Skip to content

Commit

Permalink
Merge branch 'test/scorpio4d' into dev/scorpio_3.2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
jehturner committed Oct 24, 2024
2 parents 270adfb + 5bea5bb commit 307038f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion astrodata/tests/test_wcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def test_remove_unused_world_axis(F2_IMAGE):
assert_allclose(new_result, result)
adwcs.remove_unused_world_axis(ad[0])
new_result = ad[0].wcs(900, 800)
assert_allclose(new_result, result[:2])
assert_allclose(new_result, result[-2:])
for frame in ad[0].wcs.available_frames:
assert getattr(ad[0].wcs, frame).naxes == 2

Expand Down
8 changes: 6 additions & 2 deletions astrodata/wcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,11 @@ def make_fitswcs_transform(input):
other_models = fitswcs_other(wcs_info, other=other)
all_models = other_models
if sky_model:
i = -1
for i, m in enumerate(all_models):
m.meta['output_axes'] = [i]
all_models.append(sky_model)
sky_model.meta['output_axes'] = [i+1, i+2]

# Now arrange the models so the inputs and outputs are in the right places
all_models.sort(key=lambda m: m.meta['output_axes'][0])
Expand Down Expand Up @@ -959,11 +963,11 @@ def remove_unused_world_axis(ext):
new_pipeline = []
for step in reversed(ext.wcs.pipeline):
frame, transform = step.frame, step.transform
if axis < frame.naxes:
frame = remove_axis_from_frame(frame, axis)
if transform is not None:
if axis < transform.n_outputs:
transform, axis = remove_axis_from_model(transform, axis)
if axis is not None and axis < frame.naxes:
frame = remove_axis_from_frame(frame, axis)
new_pipeline = [(frame, transform)] + new_pipeline

if axis not in (ndim, None):
Expand Down

0 comments on commit 307038f

Please sign in to comment.