dr-rodriguez / SEDkitSIMPLE

Utilities and examples for using SEDkit with SIMPLE
0 stars 0 forks source link

Load spectrum using units column #2

Open kelle opened 2 years ago

kelle commented 2 years ago

Try getting units from units column in the spectrum table if specutils reader doesn't work.

dr-rodriguez commented 2 years ago

This is really hard because the specutils reader generally works. When it fails, it's not due to the units- it's due to the file itself.

We can however, consider something: do we force the units of a Spectrum1D object? That is, after specutils work, do we overwrite something like wave.unit to be whatever the database says? I'm not sure if it's possible, but we could consider it. Note, that it doesn't guarantee that we'll get anything better; I'm seeing flux units of erg s-1 cm-2 A-1 in the database which are likely to be interpreted as ampere rather than Ansgtroms...

I will point out that I added https://github.com/dr-rodriguez/SEDkitSIMPLE/blob/main/sedsimple.py#L162 to do a check for ampere and convert it if present. Not an elegant fix, but something to quickly address that issue.