Skip to content
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

Move input unit conversion and bounds checking to base class #240

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
1.6.dev (unreleased)
================

- none yet
- Refactor model input unit conversion and wavenumber bounds checking:

- The models' evaluate methods are no longer meant to be called directly.

- The BaseExtModel class now overrides the prepare_inputs method so that
unit conversion and bounds checking is done prior to calling the subclass'
evaluate method. Subclasses are no longer responsible for doing the unit
conversion and bounds checking themselves.

- Use Astropy's built-in input model units handling.

1.5 (2024-08-16)
================
Expand Down
2 changes: 1 addition & 1 deletion docs/dust_extinction/dev_model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ All
All dust extinction models have at least the following:

* A member variable `x_range` that that define the valid range of wavelengths. These are defined in inverse microns as is common for extinction curve research.
* A member function `evaluate` that computes the extinction at a given `x` and any model parameter values. The `x` values are checked to be within the valid `x_range`. The `x` values should have astropy.units. If they do not, then they are assumed to be in inverse microns and a warning is issued stating such.
* A member function `evaluate` that computes the extinction at a given `x` and any model parameter values. The `x` values are checked to be within the valid `x_range`. The `x` values passed to the `evaluate` method have no units; the base class `BaseExtModel` will automatically convert whatever units the user provided to inverse microns prior to calling the `evaulate` method. The `evaluate` method should not be called directly.

All of these classes used in ``dust_extinction`` are based on the
`Model <https://docs.astropy.org/en/stable/modeling/>`_ astropy.modeling class.
Expand Down
Loading
Loading