Skip to content
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
4 changes: 2 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ New Features
is controlled by a new optional boolean keyword ``with_bounding_box``. [#6081]

- Added infrastructure support for units on parameters and during
model evaluation and fitting, added support for units on Gaussian1D
and added a new Blackbody1D model. [#4855]
model evaluation and fitting, added support for units on most
functional models and added a new BlackBody1D model. [#4855, #6183]

- ``astropy.nddata``

Expand Down
13 changes: 4 additions & 9 deletions astropy/modeling/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1475,22 +1475,17 @@ def prepare_inputs(self, *inputs, **kwargs):
for i in range(len(inputs)):

input_name = self.inputs[i]
input_unit = self.input_units.get(input_name, None)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change assumes self.input_units is now always a dictionary. The deleted code allowed for None type and a dictionary. Is this intentional?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point it's always a dict. The check for None is done earlier.


if self.input_units is not None:
input_unit = self.input_units.get(input_name, None)
if input_unit is None:
continue

if isinstance(inputs[i], Quantity):

# We check for consistency of the units with input_units,
# taking into account any equivalencies

if input_unit is None:

# We dont need to do anything since no restrictions were
# placed on input_units for this parameter.
pass

elif inputs[i].unit.is_equivalent(input_unit, equivalencies=input_units_equivalencies[input_name]):
if inputs[i].unit.is_equivalent(input_unit, equivalencies=input_units_equivalencies[input_name]):

# If equivalencies have been specified, we need to
# convert the input to the input units - this is because
Expand Down
Loading