From 118d48e4c8687b2ee413f2f0c387ff18c39d5b96 Mon Sep 17 00:00:00 2001 From: llegregam Date: Thu, 13 Jun 2024 15:35:11 +0200 Subject: [PATCH] flake8 linting --- physiofit/base/fitter.py | 8 +++++++- physiofit/models/model_3.py | 6 +++--- physiofit/tests/test_base.py | 1 + physiofit/tests/test_model_1.py | 8 ++++---- physiofit/tests/test_model_3.py | 4 ++-- tox.ini | 1 - 6 files changed, 17 insertions(+), 11 deletions(-) diff --git a/physiofit/base/fitter.py b/physiofit/base/fitter.py index 7e6b885..f461e03 100644 --- a/physiofit/base/fitter.py +++ b/physiofit/base/fitter.py @@ -413,9 +413,15 @@ def monte_carlo_analysis(self): logger.debug(f"New matrix:\n{noisy_matrix}\n") logger.debug(f"Sd matrix:\n{self.sd}\n") logger.debug(f"time vector:\n{self.model.time_vector}\n") + sim_mat = self.model.simulate( + opt_res.x, + noisy_matrix, + self.model.time_vector, + self.model.args + ) logger.debug( "simulated matrix:" - f"{self.model.simulate(opt_res.x, noisy_matrix, self.model.time_vector, self.model.args)}\n" + f"{sim_mat}\n" ) # We optimise the parameters using the noisy matrix as input diff --git a/physiofit/models/model_3.py b/physiofit/models/model_3.py index b2e9f64..7dac3cf 100644 --- a/physiofit/models/model_3.py +++ b/physiofit/models/model_3.py @@ -76,8 +76,8 @@ def simulate( m_0 = parameters[i * 2 + 1] k = fixed_params[i - 1] exp_k_t = np.exp(-k * time_vector) - simulated_matrix[:, i] = q * (x_0 / (mu + k)) \ - * (exp_mu_t - exp_k_t) \ - + m_0 * exp_k_t + simulated_matrix[:, i] = (q * (x_0 / (mu + k)) * (exp_mu_t + - exp_k_t) + + m_0 * exp_k_t) return simulated_matrix diff --git a/physiofit/tests/test_base.py b/physiofit/tests/test_base.py index 2cb756d..382f2c4 100644 --- a/physiofit/tests/test_base.py +++ b/physiofit/tests/test_base.py @@ -59,6 +59,7 @@ def test_wrong_entry_for_model_data(base_test_data): "Steady-state batch model", "Hello world this is an error" ) + return model def test_optimization_process(base_test_data): diff --git a/physiofit/tests/test_model_1.py b/physiofit/tests/test_model_1.py index eef4b7b..e6143b1 100644 --- a/physiofit/tests/test_model_1.py +++ b/physiofit/tests/test_model_1.py @@ -93,8 +93,8 @@ def test_model_1_estimation( data=model_1_data ) model.get_params() - model.args = {"Degradation constants": - {"Glucose": 0, "Acetate": 0, "Glutamine": 1} + model.args = {"Degradation constants": {"Glucose": 0, "Acetate": 0, + "Glutamine": 1} } fitter = io.initialize_fitter( data=model.data, @@ -124,8 +124,8 @@ def test_model_1_simulation( ) model.get_params() model.parameters.update(parameters) - model.args = {"Degradation constants": - {"Glucose": 0, "Acetate": 0, "Glutamine": 1} + model.args = {"Degradation constants": {"Glucose": 0, "Acetate": 0, + "Glutamine": 1} } sim_data = model.simulate( list(model.parameters.values()), diff --git a/physiofit/tests/test_model_3.py b/physiofit/tests/test_model_3.py index 1f67472..1892873 100644 --- a/physiofit/tests/test_model_3.py +++ b/physiofit/tests/test_model_3.py @@ -124,8 +124,8 @@ def test_model_3_simulation( ) model.get_params() model.parameters.update(parameters) - model.args = {"Degradation constants": - {"Glucose": 0, "Acetate": 0, "Glutamine": 1} + model.args = {"Degradation constants": {"Glucose": 0, "Acetate": 0, + "Glutamine": 1} } sim_data = model.simulate( list(model.parameters.values()), diff --git a/tox.ini b/tox.ini index 52138c5..17517ed 100644 --- a/tox.ini +++ b/tox.ini @@ -25,4 +25,3 @@ commands = flake8 deps = flake8 -