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

Minor changes to DC loaders for future surveys #1122

Merged
merged 3 commits into from Apr 30, 2024

Conversation

aragilar
Copy link
Contributor

@aragilar aragilar commented Feb 6, 2024

This makes it easier to use a fallback header and access the last spectra from a wrapper loader. These changes are to support loading some of the IFS surveys (such as SAMI) that Data Central hosts.

Copy link

codecov bot commented Feb 6, 2024

Codecov Report

Attention: Patch coverage is 91.42857% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 86.77%. Comparing base (5ec4931) to head (ef70cdb).
Report is 3 commits behind head on main.

Files Patch % Lines
specutils/io/default_loaders/dc_common.py 42.85% 4 Missing ⚠️
specutils/io/default_loaders/sami.py 96.82% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1122       +/-   ##
===========================================
+ Coverage   72.22%   86.77%   +14.55%     
===========================================
  Files          62       63        +1     
  Lines        4432     4500       +68     
===========================================
+ Hits         3201     3905      +704     
+ Misses       1231      595      -636     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

# We never actually want to return something, this just flags it to pylint
# that we know we're breaking out of the function when skip is selected
return None
return spectrum
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the change here? It looks like this function acts on an existing spectra_map object and thus, as the comment says, shouldn't return anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The original idea (based on what spectra I had access to at the time) was that files were either a single extension (with data represented as a 2d array, which is what most of the GAMA spectra were) or were across multiple extensions. We've got (legacy, so cannot change the format the files were written in) files that instead require more manipulation (e.g. the WCS was only in the first extension), so we want to be able to keep a reference around to the 1d spectrum independent of the mapping.

There are at least 3 surveys where we're going to use this (MGC, SAMI, S7), so rather than hacking this into each of their loaders, I figured I'd do the change in the place where it needs to be.

Copy link
Contributor

Choose a reason for hiding this comment

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

Gotcha, seems reasonable enough. Any chance you could add a test for the new fallback header code?

@aragilar
Copy link
Contributor Author

Sorry, this dropped down my todo list, as a test of the changes, I've added the first pass of the SAMI loaders we're working on to the PR, which use the changed functionality.

@aragilar aragilar force-pushed the support-fallback-more-modifications branch from 9418b23 to ed78b82 Compare April 5, 2024 04:47
@rosteen
Copy link
Contributor

rosteen commented Apr 16, 2024

Sorry, this dropped down my todo list, as a test of the changes, I've added the first pass of the SAMI loaders we're working on to the PR, which use the changed functionality.

Looking at the code coverage, it seems like the SAMI loaders are never getting called during testing, so I suspect that the identifier for the new loader isn't positively identifying the files you uploaded.

@aragilar aragilar force-pushed the support-fallback-more-modifications branch from ed78b82 to 80c2b70 Compare April 19, 2024 08:32
@aragilar
Copy link
Contributor Author

I've modified the tests slightly, that should directly flag whether the SAMI loaders are being used or not (which is weird because it works locally).

@aragilar
Copy link
Contributor Author

Oh, it looks like the tests are being skipped, if you look at test_loaders in the coverage run, there's a whole bunch of tests marked as skip. I guess they should be not skipped, which will likely improve coverage all round.

aragilar added a commit to aragilar/specutils that referenced this pull request Apr 19, 2024
This should reduce the number of tests skipped, and resolve some of the
weirdness with coverage seen in astropy#1122.
This should reduce the number of tests skipped, and resolve some of the
weirdness with coverage seen in astropy#1122.
@aragilar aragilar force-pushed the support-fallback-more-modifications branch from 80c2b70 to bb6da5d Compare April 26, 2024 05:57
This makes it easier to use a fallback header and access the last
spectra from a wrapper loader. These changes are to support loading some
of the IFS surveys (such as SAMI) that Data Central hosts.
This adds an initial version of the future SAMI loaders, in order to
test the changes to the lower level DC loaders.
@aragilar aragilar force-pushed the support-fallback-more-modifications branch from bb6da5d to ef70cdb Compare April 26, 2024 06:01
@aragilar
Copy link
Contributor Author

I've rebased this on top of #1132 to see if this actually shows the right coverage now.

@aragilar
Copy link
Contributor Author

The SAMI file coverage is as expected now.

rosteen pushed a commit that referenced this pull request Apr 30, 2024
This should reduce the number of tests skipped, and resolve some of the
weirdness with coverage seen in #1122.
@rosteen
Copy link
Contributor

rosteen commented Apr 30, 2024

LGTM now that coverage is reporting properly.

@rosteen rosteen merged commit bf2355b into astropy:main Apr 30, 2024
12 checks passed
@aragilar aragilar deleted the support-fallback-more-modifications branch May 1, 2024 03:05
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.

None yet

2 participants