From 674ba43bc7c8557c96bc41bfb9bc34cd68a730ff Mon Sep 17 00:00:00 2001 From: Drew Leonard Date: Fri, 3 Nov 2023 14:26:13 +0000 Subject: [PATCH 1/3] 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 --- dkist/wcs/models.py | 1 + 1 file changed, 1 insertion(+) diff --git a/dkist/wcs/models.py b/dkist/wcs/models.py index c684f419..8033a378 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() 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 From 398f7b21142115e61f818ae4924076ef5d9f959b Mon Sep 17 00:00:00 2001 From: Drew Leonard Date: Mon, 6 Nov 2023 14:15:33 +0000 Subject: [PATCH 2/3] Only flatten items if they're actually arrays (just in case they aren't) --- dkist/wcs/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dkist/wcs/models.py b/dkist/wcs/models.py index 8033a378..97d08cc9 100755 --- a/dkist/wcs/models.py +++ b/dkist/wcs/models.py @@ -635,7 +635,7 @@ def evaluate(self, *inputs_): else: has_units = False input_values = inputs_ - input_values = [item.flatten() for item in input_values] + 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 From 5d6b2522e7b7d82ee4d4285e28ba6cd433990d6d Mon Sep 17 00:00:00 2001 From: Drew Leonard Date: Mon, 6 Nov 2023 14:21:23 +0000 Subject: [PATCH 3/3] Add changelog --- changelog/309.bugfix.rst | 1 + 1 file changed, 1 insertion(+) 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.