Acoustic data: Minor refacto.

dev
Pierre-Antoine 2025-04-28 09:47:41 +02:00
parent f23dceb42b
commit ff39ad0536
1 changed files with 27 additions and 69 deletions

View File

@ -2314,83 +2314,41 @@ class AcousticDataTab(QWidget):
''' rmin and rmax are updated with double slider of depth ''' ''' rmin and rmax are updated with double slider of depth '''
data_id = self.fileListWidget.currentRow() data_id = self.fileListWidget.currentRow()
stg.rmin[data_id] = (( round_depth = np.round(stg.depth[data_id][0, :], 2)
np.where( depth_max = float(
np.abs( "".join(
np.round( findall(
stg.depth[data_id][0, :], 2 "[.0-9]",
) - float( self.lineEdit_depth_max_limits.text()
"".join(
findall(
"[.0-9]",
self.lineEdit_depth_max_limits.text()
)
)
)
) == np.nanmin(
np.abs(
np.round(stg.depth[data_id][0, :], 2)
- float(
"".join(
findall(
"[.0-9]",
self.lineEdit_depth_max_limits.text()
)
)
)
)
)
)[0][0]+1,
float(
"".join(
findall(
"[.0-9]",
self.lineEdit_depth_max_limits.text()
)
) )
) )
)
depth_min = float(
"".join(
findall(
"[.0-9]",
self.lineEdit_depth_min_limits.text()
)
)
)
diff_max = np.abs(round_depth - depth_max)
diff_min = np.abs(round_depth - depth_min)
stg.rmin[data_id] = ((
np.where(diff_max == np.nanmin(diff_max))[0][0]+1,
depth_max
)) ))
stg.rmax[data_id] = (( stg.rmax[data_id] = ((
np.where( np.where(diff_min == np.nanmin(diff_min))[0][0],
np.abs( depth_min
np.round(
stg.depth[data_id][0, :], 2
) - float(
"".join(
findall(
"[.0-9]",
self.lineEdit_depth_min_limits.text()
)
)
)
) == np.nanmin(
np.abs(
np.round(stg.depth[data_id][0, :], 2)
- float(
"".join(
findall(
"[.0-9]",
self.lineEdit_depth_min_limits.text()
)
)
)
)
)
)[0][0],
float(
"".join(
findall(
"[.0-9]",
self.lineEdit_depth_min_limits.text()
)
)
)
)) ))
stg.depth_cross_section[data_id] = ( stg.depth_cross_section[data_id] = (
stg.depth[data_id][:, stg.depth[data_id][
stg.rmin[data_id][0]:stg.rmax[data_id][0]] :, stg.rmin[data_id][0]:stg.rmax[data_id][0]
]
) )
def compute_BS_cross_section(self): def compute_BS_cross_section(self):