From d03ea50638df51e0c4968ce71f8adce7ab5f180b Mon Sep 17 00:00:00 2001 From: Drew Leonard Date: Mon, 25 Mar 2024 14:54:07 +0000 Subject: [PATCH] Flatten arrays in ravel evaluation (#309) * 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 --- changelog/309.bugfix.rst | 1 + dkist/wcs/models.py | 1 + 2 files changed, 2 insertions(+) create mode 100644 changelog/309.bugfix.rst diff --git a/changelog/309.bugfix.rst b/changelog/309.bugfix.rst new file mode 100644 index 00000000..0372e13c --- /dev/null +++ b/changelog/309.bugfix.rst @@ -0,0 +1 @@ +Fix broadcasting issues during pixel -> world conversion for models with a Ravel component. diff --git a/dkist/wcs/models.py b/dkist/wcs/models.py index c684f419..97d08cc9 100755 --- a/dkist/wcs/models.py +++ b/dkist/wcs/models.py @@ -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