Skip to content

Commit

Permalink
Clean-up code and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mcara committed Feb 8, 2023
1 parent b75e173 commit 24a8ce0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
4 changes: 0 additions & 4 deletions docs/jwst/resample/arguments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 4 additions & 7 deletions jwst/resample/resample_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 24a8ce0

Please sign in to comment.