Skip to content

Commit

Permalink
calibration: don't allow zero diffusion constant
Browse files Browse the repository at this point in the history
  • Loading branch information
JoepVanlier committed Aug 22, 2024
1 parent 2928a4b commit bbcd8d9
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,11 @@ def fit_power_spectrum(
power_spectrum.power,
power_spectrum.num_points_per_block,
initial_params=np.array([anl_fit_res.fc, anl_fit_res.D, *model._filter.initial_values]),
lower_bounds=np.array([0.0, 0.0, *model._filter.lower_bounds()]),
# The lower bound on the diffusion constant is needed to ensure that the robust
# fitter does not encounter a singularity when the diffusion constant goes to zero.
# Sometimes this can momentarily occur during the fitting procedure (during numerical
# differentiation).
lower_bounds=np.array([0.0, 1e-100, *model._filter.lower_bounds()]),
upper_bounds=np.array(
[np.inf, np.inf, *model._filter.upper_bounds(power_spectrum.sample_rate)]
),
Expand Down

0 comments on commit bbcd8d9

Please sign in to comment.