GreenBankObservatory / dysh

https://dysh.readthedocs.io
Other
9 stars 3 forks source link

Units in sdfitsloader are not handled #295

Open teuben opened 4 months ago

teuben commented 4 months ago

Describe the bug All data loaded with SDFITSLoad() will get the unit "ct", but if BUNIT is present, it should arguably be used.

How to Reproduce Any SDFITS file, e.g from testdata

from dysh.fits.sdfitsload import SDFITSLoad
s = SDFITSLoad('TGBT21A_501_11.raw.vegas.fits')
sp = s.getspec(0)
print(sp.flux.unit)
-> ct

It's actually "solved" in PR 290, but a wider discussion on units coming from BUNIT or TTYPExx is warrented, since they could be conflicting if both are present. Also, the presence of BUNIT in the meta data would be more useful, and cut down on the code needed in PR 290.

Environment

teuben commented 4 months ago

Although the obvious issue was fixed by the recent PR (which was just merged), I'm keeping this one open to await the meta data discussion.