Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be a little more accurate/safe with bounding boxes #327

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions punchbowl/level2/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ def reproject_cube(input_cube: NDCube, output_wcs: WCS, output_shape: tuple[int,
# reproject, we don't want it spending time looping over all those empty pixels, calculating coordinates,
# etc. So here we find a bounding box around the input in the output frame and crop to that before reprojecting.
# To start, here we make a grid of points along the edges of the input image.
xs = np.linspace(1, input_cube.data.shape[-1], 60)
ys = np.linspace(1, input_cube.data.shape[-2], 60)
xs = np.linspace(-1, input_cube.data.shape[-1], 60)
ys = np.linspace(-1, input_cube.data.shape[-2], 60)
edgex = np.concatenate((xs, np.full(len(ys), xs[-1]), xs, np.zeros(len(ys))))
edgey = np.concatenate((np.zeros(len(xs)), ys, np.full(len(xs), ys[-1]), ys))

Expand Down
4 changes: 2 additions & 2 deletions punchbowl/level3/celestial_intermediary.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ def to_celestial_frame_cutout(data_cube: NDCube, cdelt: float = 0.02) -> NDCube:
wcs_out.wcs.crval = ((crval[0] // cdelt) * cdelt) % 360, 0

# Now find the exact bounds of the input image in this output frame, so we can set the output array size
xs = np.linspace(1, data.shape[-1], 30)
ys = np.linspace(1, data.shape[-2], 30)
xs = np.linspace(-1, data.shape[-1], 30)
ys = np.linspace(-1, data.shape[-2], 30)
edgex = np.concatenate((xs, np.full(len(ys), xs[-1]), xs, np.zeros(len(ys))))
edgey = np.concatenate((np.zeros(len(xs)), ys, np.full(len(xs), ys[-1]), ys))

Expand Down