Hi! I have been updating my library to use astropy units on the spectra declaration and I wonder if anyone could please help me to use the proper declaration and identification for these variables. This question has two parts:
There are issues on the github which discuss the spectral flux declaration. And they seem to be included on the astropy.units.spectral() function. However, I cannot find the keywords for the FLAM, FNU, wavenumber etc:
> import astropy
> from astropy import units as au
> from astropy.units.core import CompositeUnit, IrreducibleUnit, PrefixUnit, Unit
>
> flux_keyword_lists = ['F_lam', 'f_la', 'flam', 'Flam', 'f_lam', 'FLAM', 'F_LAM']
> for keyword in flux_keyword_lists:
> try:
> unit_variable = au.Unit(keyword)
> print(f'{keyword} is a VALID unit')
> except ValueError:
> print(f'{keyword} is NOT a valid unit')
F_lam is NOT a valid unit
f_la is NOT a valid unit
flam is NOT a valid unit
Flam is NOT a valid unit
f_lam is NOT a valid unit
FLAM is NOT a valid unit
F_LAM is NOT a valid unit
Are they actually included in the units database?
So far I have been adding them as aliases:
au.add_enabled_aliases({'F_lam': au.erg/au.s/au.cm**2/au.AA, 'F_nu': au.erg/au.s/au.cm**2/au.Hz,
'f_E': au.photon/au.s/au.cm**2/au.keV, 'f_lam': au.photon/au.s/au.cm**2/au.AA,
'WN': 1/au.cm})
I would also like to give the user the option to include their own astropy units in the spectra declaration. However, to confirm if the user input is an astropy unit I have found upto 4 different types:
isinstance(input_variable, (CompositeUnit, IrreducibleUnit, PrefixUnit, Unit))
Is there a unique identifier for astropy unit classes?
Thanks for any advice.