Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes some issues with FitTrace when bins are fully masked:
If
peak_method=gaussian
, the fit will fail if even one column/bin is fully masked, with the error being raised by the fitter. This PR fixes that issue by setting the fit trace value to nan for that column, so it can proceed and fit the next bin. For the final fit to all bin peaks for the trace, these nans bins/columns will then be filtered.If peak_method=max or centroid, a warning when a fully masked bin is encountered claiming that it is 'Falling back on trace value from all-bin fit.'. This is not accurate to what is happening
2a. for
max
, the argmax of that bin will be returned which is always 0 for a fully masked bin. To avoid skewing the final fit to all bins when 0, i think a more appropriate value for this is 'nan' which can then be filtered from the final fit. theres nothing to really 'fall back' to in this case. This will require fixing almost all of the tests, so for now in this PR i just modify the warning message and retain the current behavior. See ISSUE.2b. for
centroid
, when there is a fully masked bin it is also not 'falling back to the all bin fit'. to find the centroid of a fully masked bin, it attempts to interpolate between nans and will always return the maximum index in the bin. Likemax
, i am not changing the current behavior in this PR, that can be done as a follow up to resolve the corresponding ISSUE, but I change the warning message to reflect what is actually happening at the moment.I also reorganized some stuff out of post_init into its own method, but this change is inconsequential.