diff --git a/lumicks/pylake/population/tests/test_dwelltimes.py b/lumicks/pylake/population/tests/test_dwelltimes.py index 6e9667882..4f1576d80 100644 --- a/lumicks/pylake/population/tests/test_dwelltimes.py +++ b/lumicks/pylake/population/tests/test_dwelltimes.py @@ -41,7 +41,7 @@ def test_likelihood(exponential_data): (np.array([0.2, 0.3, 0.6, 1.2]), 0.1, np.array([0.5, 0.5, 1.3, 1.3]), 1.1932900895106002), (np.array([0.2, 0.3, 0.6, 1.2]), np.array([0.1, 0.1, 0.3, 0.3]), np.array([0.5, 0.5, 1.3, 1.3]), 1.7155483581674074), # fmt:on - ] + ], ) def test_multi_observation_limits(data, min_obs, max_obs, loglik): fit = DwelltimeModel(data, 1, min_observation_time=min_obs, max_observation_time=max_obs) @@ -54,7 +54,7 @@ def test_invalid_multi_dwelltime_parameters(): ValueError, match=re.escape( r"Size of minimum observation time array (2) must be equal to that of dwelltimes (3)" - ) + ), ): DwelltimeModel(data, min_observation_time=np.array([0.1, 0.2]), max_observation_time=10.0) @@ -62,7 +62,7 @@ def test_invalid_multi_dwelltime_parameters(): ValueError, match=re.escape( r"Size of maximum observation time array (4) must be equal to that of dwelltimes (3)" - ) + ), ): DwelltimeModel(data, min_observation_time=1.0, max_observation_time=np.array([1, 2, 3, 4])) @@ -71,7 +71,7 @@ def test_invalid_multi_dwelltime_parameters(): match=re.escape( r"When providing an array of discretization timesteps, the number of " r"discretization timesteps (2) should equal the number of dwell times provided (3)." - ) + ), ): DwelltimeModel(data, min_observation_time=10, discretization_timestep=np.array([10, 1])) @@ -80,7 +80,7 @@ def test_invalid_multi_dwelltime_parameters(): match=re.escape( r"To use a continuous model, specify a discretization timestep of None. Do not pass " r"zero as this leads to an invalid probability mass function." - ) + ), ): DwelltimeModel(data, min_observation_time=10, discretization_timestep=np.array([10, 0, 10])) @@ -136,22 +136,18 @@ def test_fit_parameters(exponential_data): np.array([0.1, 0.1, 0.3, 0.3]), np.array([0.5, 0.5, 1.3, 1.3]), None, - (0.3497069, 1.3528150) + (0.3497069, 1.3528150), ), (0.2, 1.4, 0.2, (0.247748, 1.463575)), - ( - np.array([0.2, 0.2, 0.4, 0.4]), - 1.4, - np.array([0.2, 0.2, 0.4, 0.4]), - (0.21762, 1.448516) - ), - ] + (np.array([0.2, 0.2, 0.4, 0.4]), 1.4, np.array([0.2, 0.2, 0.4, 0.4]), (0.21762, 1.448516)), + ], ) def test_bootstrap_multi(min_obs, max_obs, ref_ci, time_step): np.random.seed(123) data = np.array([0.2, 0.3, 0.6, 1.2]) fit = DwelltimeModel( - data, 1, + data, + 1, min_observation_time=min_obs, max_observation_time=max_obs, discretization_timestep=time_step, @@ -233,7 +229,7 @@ def test_dwelltime_profiles(exponential_data, exp_name, reference_bounds, reinte dataset["data"], n_components=2, **dataset["parameters"].observation_limits, - discretization_timestep=dataset["parameters"].dt + discretization_timestep=dataset["parameters"].dt, ) profiles = fit.profile_likelihood(max_chi2_step=0.25) @@ -252,7 +248,7 @@ def test_dwelltime_profiles(exponential_data, exp_name, reference_bounds, reinte match=re.escape( "Significance level (0.001) cannot be chosen lower or equal than the minimum profiled " "level (0.01)." - ) + ), ): profiles.get_interval("amplitude", 0, 0.001) @@ -267,11 +263,11 @@ def test_dwelltime_profile_plots(n_components): max_observation_time=1e4, ) profiles = fit.profile_likelihood(num_steps=2) # Keep it short - plt.close('all') + plt.close("all") profiles.plot() np.testing.assert_allclose(plt.gca().get_lines()[-1].get_data()[-1][-1], 22.415292) - plt.close('all') + plt.close("all") profiles.plot(alpha=0.5) np.testing.assert_allclose(plt.gca().get_lines()[-1].get_data()[-1][-1], 19.02877) @@ -288,7 +284,7 @@ def test_dwelltime_profiles_dunders(exponential_data): r"DwelltimeProfiles({'amplitude 0':