Skip to content

Commit a1e1479

Browse files
committed
drop finite checks in curve_fit, since we already do this
1 parent 2bfb140 commit a1e1479

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

fooof/objs/fit.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,8 @@ def _simple_ap_fit(self, freqs, power_spectrum):
946946
warnings.simplefilter("ignore")
947947
aperiodic_params, _ = curve_fit(get_ap_func(self.aperiodic_mode),
948948
freqs, power_spectrum, p0=guess,
949-
maxfev=self._maxfev, bounds=ap_bounds)
949+
maxfev=self._maxfev, bounds=ap_bounds,
950+
check_finite=False)
950951
except RuntimeError as excp:
951952
error_msg = ("Model fitting failed due to not finding parameters in "
952953
"the simple aperiodic component fit.")
@@ -1003,7 +1004,8 @@ def _robust_ap_fit(self, freqs, power_spectrum):
10031004
warnings.simplefilter("ignore")
10041005
aperiodic_params, _ = curve_fit(get_ap_func(self.aperiodic_mode),
10051006
freqs_ignore, spectrum_ignore, p0=popt,
1006-
maxfev=self._maxfev, bounds=ap_bounds)
1007+
maxfev=self._maxfev, bounds=ap_bounds,
1008+
check_finite=False)
10071009
except RuntimeError as excp:
10081010
error_msg = ("Model fitting failed due to not finding "
10091011
"parameters in the robust aperiodic fit.")
@@ -1149,7 +1151,8 @@ def _fit_peak_guess(self, guess):
11491151
# Fit the peaks
11501152
try:
11511153
gaussian_params, _ = curve_fit(gaussian_function, self.freqs, self._spectrum_flat,
1152-
p0=guess, maxfev=self._maxfev, bounds=gaus_param_bounds)
1154+
p0=guess, maxfev=self._maxfev, bounds=gaus_param_bounds,
1155+
check_finite=False)
11531156
except RuntimeError as excp:
11541157
error_msg = ("Model fitting failed due to not finding "
11551158
"parameters in the peak component fit.")

0 commit comments

Comments
 (0)