From b99e950a8e135f8c00213d94457586daf0084698 Mon Sep 17 00:00:00 2001 From: brahim Date: Mon, 17 Mar 2025 17:25:55 +0100 Subject: [PATCH] If values of sediment attenuation parameters are infinite, a warning is added and inversion computatio is not allowed #41 --- View/acoustic_inversion_tab.py | 11 +++++++++++ View/sediment_calibration_tab.py | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/View/acoustic_inversion_tab.py b/View/acoustic_inversion_tab.py index f702ede..ec13ce3 100644 --- a/View/acoustic_inversion_tab.py +++ b/View/acoustic_inversion_tab.py @@ -23,6 +23,7 @@ import os import numpy as np import pandas as pd +from math import isinf from copy import deepcopy @@ -398,6 +399,16 @@ class AcousticInversionTab(QWidget): msgBox.setStandardButtons(QMessageBox.Ok) msgBox.exec() + elif isinf(stg.alpha_s[0]) or isinf(stg.alpha_s[1]): + + msgBox = QMessageBox() + msgBox.setWindowTitle("Alpha computation error") + msgBox.setIconPixmap( + QPixmap(self.path_icon + "no_approved.png").scaledToHeight(32, Qt.SmoothTransformation)) + msgBox.setText("Sediment sound attenuation is infinite !") + msgBox.setStandardButtons(QMessageBox.Ok) + msgBox.exec() + else: self.compute_VBI() diff --git a/View/sediment_calibration_tab.py b/View/sediment_calibration_tab.py index d1575a8..838dea4 100644 --- a/View/sediment_calibration_tab.py +++ b/View/sediment_calibration_tab.py @@ -27,6 +27,7 @@ from scipy.stats import linregress import numpy as np import pandas as pd +from math import isinf import matplotlib.pyplot as plt from matplotlib.colors import LogNorm @@ -2246,6 +2247,16 @@ class SedimentCalibrationTab(QWidget): msgBox.setStandardButtons(QMessageBox.Ok) msgBox.exec() + elif isinf(alpha_s_freq1) or isinf(alpha_s_freq2): + + msgBox = QMessageBox() + msgBox.setWindowTitle("Alpha computation error") + msgBox.setIconPixmap( + QPixmap(self._path_icon("no_approved.png")).scaledToHeight(32, Qt.SmoothTransformation)) + msgBox.setText("Sediment sound attenuation is infinite !") + msgBox.setStandardButtons(QMessageBox.Ok) + msgBox.exec() + else: msgBox = QMessageBox()