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

Inverse wcs bbox #314

Merged
merged 6 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dependencies = [
"numpy >=1.21.2",
"opencv-python-headless >=4.6.0.66",
"asdf >=2.15.0",
"gwcs >= 0.18.1",
"gwcs @ git+https://github.com/nden/gwcs.git@inverse-bbox",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that if you remove this change we can merge this without too much fear.

"tweakwcs >=0.8.8",
"requests >=2.22",
]
Expand Down
10 changes: 5 additions & 5 deletions src/stcal/alignment/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ def compute_scale(
msg = "If input WCS is spectral, a disp_axis must be given"
raise ValueError(msg)

crpix = np.array(wcs.invert(*fiducial))
crpix = np.array(wcs.invert(*fiducial, with_bounding_box=False))

delta = np.zeros_like(crpix)
spatial_idx = np.where(np.array(wcs.output_frame.axes_type) == "SPATIAL")[0]
Expand Down Expand Up @@ -441,7 +441,7 @@ def compute_fiducial(wcslist: list,
(low, high) values. The bounding_box is in the order of the axes, axes_order.
For two inputs and axes_order(0, 1) the bounding box can be either
((xlow, xhigh), (ylow, yhigh)) or [[xlow, xhigh], [ylow, yhigh]].

Returns
-------
fiducial : np.ndarray
Expand Down Expand Up @@ -704,7 +704,7 @@ def wcs_from_sregions(
footprints : list of np.ndarray or list of str
If list elements are numpy arrays, each should have shape (N, 2) and contain
(RA, Dec) vertices demarcating the footprint of the input WCSs.
If list elements are strings, each should be the S_REGION header keyword
If list elements are strings, each should be the S_REGION header keyword
containing (RA, Dec) vertices demarcating the footprint of the input WCSs.

ref_wcs :
Expand Down Expand Up @@ -756,8 +756,8 @@ def wcs_from_sregions(
The WCS object corresponding to the combined input footprints.

"""
footprints = [_sregion_to_footprint(s_region)
if isinstance(s_region, str) else s_region
footprints = [_sregion_to_footprint(s_region)
if isinstance(s_region, str) else s_region
for s_region in footprints]
fiducial = _calculate_fiducial(footprints, crval=crval)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_tweakreg.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def input_catalog(datamodel):
cat = amutils.get_catalog(fiducial[0], fiducial[1], search_radius=radius,
catalog=TEST_CATALOG)

x, y = w.world_to_pixel(cat["ra"], cat["dec"])
x, y = w.world_to_pixel(cat["ra"].value, cat["dec"].value)
return Table({"x": x, "y": y})


Expand Down
Loading