Open lpsinger opened 2 months ago
I would definitely entertain such a PR.
One question, would this allow for no units to be passed and interpreted as wavenumbers (1/micron)? Not allowing this is not a show-shopper, I've thought about removing this option. It would potentially mean new versions are not compatible with existing code, but that can be ok/allowed.
One question, would this allow for no units to be passed and interpreted as wavenumbers (1/micron)?
There is the astropy.modeling.Model.input_units_allow_dimensionless
attribute that you can set on model classes, but I tried it out and I personally don't like it. It seems like it turns off the automatic unit conversion so that either the units you declared or dimensionless quantities make it to your evaluate method.
If you set the
input_units
,return_units
,input_units_equivalencies
, andbounding_box
properties, then when you call a model, theastropy.modeling.Model
base class will automatically convert the users' arguments to your desired units and do bounds checking. Note that thespectral()
equivalency will do automatic conversion between wavelength and wavenumber. This builtin functionality could essentially replace_get_x_in_wavenumbers
and_test_valid_x_range
. Would you entertain a patch to do this? I'm working on a project where it would be nice to have the bounds and units of these models exposed in the conventional way.