Skip to content
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

Hotfix: use mask in specutils loader #1715

Merged
merged 2 commits into from
Nov 1, 2023
Merged

Hotfix: use mask in specutils loader #1715

merged 2 commits into from
Nov 1, 2023

Conversation

kbwestfall
Copy link
Collaborator

As titled. The new check on a monotonically increasing wavelength vector caused problems for some spectrographs that have wavelengths set to 0. This is avoided by using the mask.

@kbwestfall kbwestfall requested a review from tbowers7 October 30, 2023 16:05
Comment on lines +200 to +201
_wave, _flux, _ivar = _enforce_monotonic_wavelengths(_wave[_gpm], _flux[_gpm], _ivar[_gpm],
strict=strict)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if there are no good pixels (i.e., all are zero for some reason)? Will _enforce_monotonic_wavelengths() as written choke on empty input arrays? Maybe add an edge-case check to bypass the enforcement in this case?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! What do you think of my fix:

if not np.any(_gpm):
    msgs.warn(f'Spectrum {sobj.NAME} is fully masked and will be ignored!')
    continue

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks good.

Copy link
Collaborator

@tbowers7 tbowers7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix. Approving.

Comment on lines +200 to +201
_wave, _flux, _ivar = _enforce_monotonic_wavelengths(_wave[_gpm], _flux[_gpm], _ivar[_gpm],
strict=strict)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks good.

Copy link
Collaborator

@rcooke-ast rcooke-ast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@kbwestfall kbwestfall merged commit f0ec8e0 into develop Nov 1, 2023
23 checks passed
@kbwestfall kbwestfall deleted the specutil_hotfix branch November 1, 2023 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants