Skip to content

Commit

Permalink
Merge pull request #240 from lpsinger/astropy-modeling-units
Browse files Browse the repository at this point in the history
Move input unit conversion and bounds checking to base class
  • Loading branch information
karllark authored Sep 16, 2024
2 parents d2e54ba + 4b977da commit f4cc6cd
Show file tree
Hide file tree
Showing 15 changed files with 152 additions and 340 deletions.
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

0 comments on commit f4cc6cd

Please sign in to comment.