-
Notifications
You must be signed in to change notification settings - Fork 25
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
BUG/API: read_fits_spec now more flexible but at a cost #384
Conversation
Thank you for your contribution! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #384 +/- ##
==========================================
+ Coverage 96.80% 96.83% +0.03%
==========================================
Files 17 17
Lines 2034 2056 +22
==========================================
+ Hits 1969 1991 +22
Misses 65 65 ☔ View full report in Codecov by Sentry. |
but at a cost.
def teardown_class(self): | ||
shutil.rmtree(self.outdir) | ||
|
||
def test_read_nonstandard_fits_cols_01(tmp_path): |
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.
This is the example given by @ariedel .
assert_quantity_allclose(tr(wav), trace, atol=1e-7) | ||
|
||
|
||
def test_read_nonstandard_fits_cols_02(tmp_path): |
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.
This is the example given by @talister .
@@ -295,6 +295,18 @@ def validate_unit(input_unit): | |||
output_unit = THROUGHPUT | |||
elif input_unit_lowcase == 'jy': | |||
output_unit = u.Jy | |||
elif input_unit_lowcase == "flam": |
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.
If there are anymore weird units that STScI uses in any table column synphot
needs to parse, we have to hardcode the exception rule here, or fix the data.
Now that we go though astropy.table.QTable
, it parses all the columns. AFAIK, there is no way to skip. This is the price we pay for a more flexible table format.
simply because we have no such files in ASCII format. TST: Improve coverage, use tmp_path instead of tempfile or tmpdir
I have tried this branch, and I am concerned about the removal of the case insensitivity. The ETC web interface uses synphot to read in user-uploaded spectra; I worry that this would lead to rejection of a large number of spectra and a worse user experience. Part of the reason the original issue appeared is that the ETC is now trying to expand our use of Synphot to reading in files that aren't actually spectra or spectral elements (quantum yield curves, dispersion files) in a unit-aware way. If you have an hour or half hour of time to chat with us about the best ways to accomplish this, it would be much appreciated. |
This is a side effect of using Unified I/O in
If you have no plans to use these objects within |
p.s. I opened astropy/astropy#16221 but now that I have thought about it as I typed it up, maybe I can force the case-insensitivity here. Will report back. |
@ariedel , I managed to make it case insensitive again. Is this good enough for you? |
This is much better. It's potentially revealed more problems in STScI's TRDS dataset, but I don't think Synphot should be responsible for them @rizeladiaz
|
Ah, yes, I didn't test this in stsynphot. Maybe I should. |
I'm pretty sure it's because the flux unit in those bz77 files is "STMAG". |
with remote data
If it is just a matter of weird unit strings, we can add exception rules here if they are not too weird. |
p.s. Did not seem to trip up stsynphot, at least for the stuff that I test for. |
Actually, I take it back. I found |
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 have now tested this, and approve.
FWIW I restarted the devdeps job at https://github.com/spacetelescope/stsynphot_refactor/actions/runs/8338326996 and it still passed. But if you find anything amiss, please open new issue(s). Thanks for the review! |
Description
This pull request is to address the problem of
read_fits_spec
unnecessarily hardcodingTUNIT1
andTUNIT2
. However, in making it more flexible, some breaking changes are unavoidable. See change log added here.Fixes #372
After merge
stsynphot
downstream.