Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
astrofrog committed Sep 11, 2023
1 parent dd766a0 commit 5add81d
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions reproject/mosaicking/coadd.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import dask.array as da
import numpy as np
from astropy.wcs import WCS
from astropy.wcs.utils import pixel_to_pixel
from astropy.wcs.wcsapi import SlicedLowLevelWCS

from ..utils import parse_input_data, parse_input_weights, parse_output_projection
Expand Down Expand Up @@ -215,12 +216,12 @@ def reproject_and_coadd(
pixel_in = xs, ys
else:
# We use only the corners of cubes and higher dimension datasets
pixel_in = list(
pixel_in = next(

Check warning on line 219 in reproject/mosaicking/coadd.py

View check run for this annotation

Codecov / codecov/patch

reproject/mosaicking/coadd.py#L219

Added line #L219 was not covered by tests
zip(*product([(-0.5, shape_out[::-1][i] - 0.5) for i in range(len(shape_out))]))
)
pixel_in = pixel_in[0] # FIXME
pixel_in = [np.array(p) for p in pixel_in]

Check warning on line 222 in reproject/mosaicking/coadd.py

View check run for this annotation

Codecov / codecov/patch

reproject/mosaicking/coadd.py#L222

Added line #L222 was not covered by tests

pixel_out = wcs_out.world_to_pixel(*wcs_in.pixel_to_world(*pixel_in))
pixel_out = pixel_to_pixel(wcs_in, wcs_out, *pixel_in)

# Determine the cutout parameters

Expand All @@ -231,7 +232,7 @@ def reproject_and_coadd(
if any([np.any(np.isnan(c_out)) for c_out in pixel_out]):
wcs_out_indiv = wcs_out
shape_out_indiv = shape_out

slices_out = [slice(0, shape_out[i]) for i in range(len(shape_out))]
else:
# Determine indices - note the reverse order compared to pixel

Expand Down Expand Up @@ -263,10 +264,10 @@ def reproject_and_coadd(

shape_out_indiv = tuple(shape_out_indiv)

if isinstance(wcs_out, WCS):
wcs_out_indiv = wcs_out[slices_out]
else:
wcs_out_indiv = SlicedLowLevelWCS(wcs_out.low_level_wcs, slices_out)
if isinstance(wcs_out, WCS):
wcs_out_indiv = wcs_out[slices_out]
else:
wcs_out_indiv = SlicedLowLevelWCS(wcs_out.low_level_wcs, slices_out)

Check warning on line 270 in reproject/mosaicking/coadd.py

View check run for this annotation

Codecov / codecov/patch

reproject/mosaicking/coadd.py#L270

Added line #L270 was not covered by tests

# TODO: optimize handling of weights by making reprojection functions
# able to handle weights, and make the footprint become the combined
Expand Down

0 comments on commit 5add81d

Please sign in to comment.