Pamhyr: Fix Pep8.

setup.py
Pierre-Antoine Rouby 2024-05-15 11:29:39 +02:00
parent 9d343a42ce
commit 4be43528e3
6 changed files with 38 additions and 20 deletions

View File

@ -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

View File

@ -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)
)

View File

@ -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):

View File

@ -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)

View File

@ -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
)
)

View File

@ -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()