Skip to content

Commit

Permalink
Flatten arrays in ravel evaluation (#309)
Browse files Browse the repository at this point in the history
* Flatten arrays in ravel evaluation

Otherwise it breaks real hard when you try to pass multiple points
into pixel_to_world, because of array broadcasting

* Only flatten items if they're actually arrays (just in case they aren't)

* Add changelog
  • Loading branch information
SolarDrew authored Mar 25, 2024
1 parent c4a9cc2 commit d03ea50
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog/309.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix broadcasting issues during pixel -> world conversion for models with a Ravel component.
1 change: 1 addition & 0 deletions dkist/wcs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ def evaluate(self, *inputs_):
else:
has_units = False
input_values = inputs_
input_values = [item.flatten() if isinstance(item, np.ndarray) else item for item in input_values]
# round the index values, but clip them if they exceed the array bounds
# the bounds are one less than the shape dimension value
array_bounds = np.array(self.array_shape) - 1
Expand Down

0 comments on commit d03ea50

Please sign in to comment.