diff --git a/src/Meshing/Mage.py b/src/Meshing/Mage.py index 90f44d569886709fe59faf9f60afa25f4eff3e71..1e8f4c2d32f8d6f7a014d484219041881a93b1ea 100644 --- a/src/Meshing/Mage.py +++ b/src/Meshing/Mage.py @@ -298,7 +298,7 @@ class MeshingWithMageMailleurTT(AMeshingTool): lplan: bool = False, lm: int = 3, linear: bool = False, - origin_value = 0.0): + origin_value=0.0): if reach is None or len(reach.profiles) == 0: return reach @@ -371,7 +371,7 @@ class MeshingWithMageMailleurTT(AMeshingTool): lplan: bool = False, lm: int = 3, linear: bool = False, - origin_value = 0.0): + origin_value=0.0): if reach is None or len(reach.profiles) == 0: return reach diff --git a/src/Model/Geometry/ProfileXYZ.py b/src/Model/Geometry/ProfileXYZ.py index 0bd8d83db408da1b44f9c78e9063e4099a964f55..ff5ae5995f7337140e324903477166220ffc08fb 100644 --- a/src/Model/Geometry/ProfileXYZ.py +++ b/src/Model/Geometry/ProfileXYZ.py @@ -583,27 +583,44 @@ class ProfileXYZ(Profile, SQLSubModel): """ Remove points to keep at most np_purge points. """ + if (self.nb_points <= np_purge): + return - if (self.nb_points <= np_purge): return - - nb_named = 2 # we consider the first and last point as named + nb_named = 2 # we consider the first and last point as named area = [0.0] + for i in range(1, self.nb_points-1): if self.point(i).point_is_named(): area.append(9999999.999) nb_named += 1 else: - area.append(PointXYZ.areatriangle3d(self.point(i-1),self.point(i),self.point(i+1))) + area.append( + PointXYZ.areatriangle3d( + self.point(i-1), + self.point(i), + self.point(i+1)) + ) + area.append(0.0) - while (self.nb_points > max(np_purge, nb_named)): - to_rm = np.argmin(area[1:self.nb_points-1])+1 + while self.nb_points > max(np_purge, nb_named): + to_rm = np.argmin(area[1:self.nb_points - 1]) + 1 + self.delete_i([to_rm]) area.pop(to_rm) + for i in [to_rm-1, to_rm]: - if (i == 0): continue - if (i == self.nb_points - 1): continue + if (i == 0): + continue + + if (i == self.nb_points - 1): + continue + if self.point(i).point_is_named(): area[i] = 9999999.999 else: - area[i] = PointXYZ.areatriangle3d(self.point(i-1),self.point(i),self.point(i+1)) + area[i] = PointXYZ.areatriangle3d( + self.point(i-1), + self.point(i), + self.point(i+1) + ) diff --git a/src/View/Geometry/UpdateKPDialog.py b/src/View/Geometry/UpdateKPDialog.py index 08abf1f45d8dcd5583110080958754b29195d5fe..87afc9778247286063719fff7974cf7f8724a572 100644 --- a/src/View/Geometry/UpdateKPDialog.py +++ b/src/View/Geometry/UpdateKPDialog.py @@ -74,8 +74,10 @@ class UpdateKPDialog(PamhyrDialog): def changed_profile(self): origin = self.get_combobox_text("comboBox_origin") - self.set_double_spin_box("doubleSpinBox_origin", - self._reach.profile(self.profiles.index(origin)).kp) + self.set_double_spin_box( + "doubleSpinBox_origin", + self._reach.profile(self.profiles.index(origin)).kp + ) @property def profiles(self): diff --git a/src/View/InitialConditions/Window.py b/src/View/InitialConditions/Window.py index 5dfb4cfae563fe8c9392ace024acd2c25af5a569..82946e84d2bb6c0b48fe16a8742c77039709742b 100644 --- a/src/View/InitialConditions/Window.py +++ b/src/View/InitialConditions/Window.py @@ -170,7 +170,8 @@ class InitialConditionsWindow(PamhyrWindow): self.find(QAction, "action_add").triggered.connect(self.add) self.find(QAction, "action_del").triggered.connect(self.delete) self.find(QAction, "action_sort").triggered.connect(self.sort) - self.find(QAction, "action_import").triggered.connect(self.import_from_file) + self.find(QAction, "action_import").triggered\ + .connect(self.import_from_file) self.find(QPushButton, "pushButton_generate_1").clicked.connect( self.generate_growing_constante_height @@ -192,7 +193,6 @@ class InitialConditionsWindow(PamhyrWindow): return rows[0].row() - def update(self): self._update_plot() self._propagate_update(key=Modules.INITIAL_CONDITION) diff --git a/src/View/Results/PlotKPC.py b/src/View/Results/PlotKPC.py index d6f5feae45aeea9dce7ae681d1aafa841f03324a..01bf7a6aac2f772a9612e3b821992cc5c4e664fb 100644 --- a/src/View/Results/PlotKPC.py +++ b/src/View/Results/PlotKPC.py @@ -115,8 +115,8 @@ class PlotKPC(PamhyrPlot): lambda z, h: z - h[0], sl, z ), - z_min, # Original geometry - sl # Original sediment layers + z_min, # Original geometry + sl # Original sediment layers ) ) @@ -132,8 +132,8 @@ class PlotKPC(PamhyrPlot): lambda z, h: z + h[0], sl, z ), - z_br, # Bedrock elevation - sl # Current sediment layers + z_br, # Bedrock elevation + sl # Current sediment layers ) ) diff --git a/src/View/Tools/Plot/PamhyrToolbar.py b/src/View/Tools/Plot/PamhyrToolbar.py index 0d060ec43fbf200ecce8a5997959eaf871fc9512..2a851c924f4f9653d3f6ab2ccf6cd63ec1abbaf1 100644 --- a/src/View/Tools/Plot/PamhyrToolbar.py +++ b/src/View/Tools/Plot/PamhyrToolbar.py @@ -200,7 +200,6 @@ class PamhyrPlotToolbar(NavigationToolbar2QT): self.icons.append(("save_figure", icon_save)) - def save_figure(self, *args): file_types = self.canvas.get_supported_filetypes_grouped() default_file_type = self.canvas.get_default_filetype()