From fb280b93ec1c41a3428e566f39e8b2110d261c7d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2025 12:18:44 +0000 Subject: [PATCH] style: pre-commit fixes --- tests/unit/test_likelihoods.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tests/unit/test_likelihoods.py b/tests/unit/test_likelihoods.py index 12af5a74..8aa9e66c 100644 --- a/tests/unit/test_likelihoods.py +++ b/tests/unit/test_likelihoods.py @@ -215,25 +215,27 @@ def test_scaled_log_likelihood(self, one_signal_problem): @pytest.mark.unit def test_observed_fisher(self, one_signal_problem): - likelihood = pybop.GaussianLogLikelihoodKnownSigma(one_signal_problem, sigma0=0.1) - + likelihood = pybop.GaussianLogLikelihoodKnownSigma( + one_signal_problem, sigma0=0.1 + ) + # Create mock data and sensitivities y = {"Voltage [V]": np.array([3.7, 3.6, 3.5])} dy = np.array([[0.1, 0.2, 0.3]]) - + # Compute observed Fisher Information Matrix fim = likelihood.observed_fisher(y, dy) - + # Check that FIM is a 1x1 array (since we have one parameter) assert fim.shape == (1, 1) - + # Check that FIM is positive (for a single parameter, it should be) assert fim[0, 0] > 0 - + # Check that FIM is computed correctly expected_fim = np.sum(np.square(dy)) / likelihood.n_data np.testing.assert_allclose(fim, expected_fim, rtol=1e-7) - + # Test without providing dy fim_without_dy = likelihood.observed_fisher(y) assert fim_without_dy.shape == (1, 1)