From 24a8ce01506304d7396f9b4185f46960380323cc Mon Sep 17 00:00:00 2001 From: Mihai Cara Date: Wed, 1 Feb 2023 00:01:47 -0500 Subject: [PATCH] Clean-up code and docs --- docs/jwst/resample/arguments.rst | 4 ---- jwst/resample/resample_step.py | 11 ++++------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/docs/jwst/resample/arguments.rst b/docs/jwst/resample/arguments.rst index 4ab85b25c9e..fb3d1777937 100644 --- a/docs/jwst/resample/arguments.rst +++ b/docs/jwst/resample/arguments.rst @@ -53,10 +53,6 @@ image. WCS object. When supplied from command line, it should be a comma-separated list of integers ``nx, ny``. - .. note:: - Argument ``output_shape``, when provided, overrides output image size - computed from the bounding box. - .. note:: Specifying ``output_shape`` *is required* when the WCS in ``output_wcs`` does not have ``bounding_box`` property set. diff --git a/jwst/resample/resample_step.py b/jwst/resample/resample_step.py index 256613757c7..158b17cf5e9 100755 --- a/jwst/resample/resample_step.py +++ b/jwst/resample/resample_step.py @@ -178,24 +178,21 @@ def _load_custom_wcs(asdf_wcs_file, output_shape): wcs = deepcopy(af.tree["wcs"]) if output_shape is not None or wcs is None: - array_shape = output_shape[::-1] - elif wcs.array_shape is not None: - array_shape = wcs.array_shape + wcs.array_shape = output_shape[::-1] elif wcs.pixel_shape is not None: - array_shape = wcs.pixel_shape[::-1] + wcs.array_shape = wcs.pixel_shape[::-1] elif wcs.bounding_box is not None: - array_shape = tuple( + wcs.array_shape = tuple( int(axs[1] - axs[0] + 0.5) for axs in wcs.bounding_box.bounding_box(order="C") ) - else: + elif wcs.array_shape is None: raise ValueError( "Step argument 'output_shape' is required when custom WCS " "does not have neither of 'array_shape', 'pixel_shape', or " "'bounding_box' attributes set." ) - wcs.array_shape = array_shape return wcs def update_phot_keywords(self, model):