New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added filter_non_finite flag to fit_lines #1078
base: main
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1078 +/- ##
==========================================
- Coverage 70.72% 70.71% -0.02%
==========================================
Files 64 64
Lines 4485 4490 +5
==========================================
+ Hits 3172 3175 +3
- Misses 1313 1315 +2
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@@ -377,7 +382,7 @@ def fit_lines(spectrum, model, fitter=fitting.LevMarLSQFitter(calc_uncertainties | |||
|
|||
def _fit_lines(spectrum, model, fitter=fitting.LevMarLSQFitter(calc_uncertainties=True), | |||
exclude_regions=None, weights=None, window=None, get_fit_info=False, | |||
ignore_units=False, **kwargs): | |||
ignore_units=False, filter_non_finite=False, **kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you'll need to add filter_non_finite
to the kwargs
in the LevMarLSQFitter
, looks like tests are failing because other fitters don't expect that keyword argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah good point, I thought I caught this by setting it to False when the fitter isn't LevMarLSQFitter but those fitters won't expect the flag at all
This PR adds the 'filter_non_finite' flag to specutils.fitting.fit_lines. By default, this flag is False, and it can only be True if the fitter is a
LevMarLSQFitter
. This fixes an issue when there are non-finite values in the weights array, and allows the fit to proceed with these filtered out.