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

DM-43416: Fix warning in bbox_contains_sky_coords #732

Merged
merged 3 commits into from
Apr 30, 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
2 changes: 1 addition & 1 deletion doc/lsst.afw.cameraGeom/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Contributing
============

``lsst.afw.cameraGeom`` is developed at https://github.com/lsst/afw.
You can find Jira issues for this module under the `afw <https://jira.lsstcorp.org/issues/?jql=project%20%3D%20DM%20AND%20component%20%3D%20afw>`_ component.
You can find Jira issues for this module under the `afw <https://rubinobs.atlassian.net/issues/?jql=project%20%3D%20DM%20AND%20component%20%3D%20afw>`_ component.

.. _lsst.afw.cameraGeom-pyapi:

Expand Down
2 changes: 1 addition & 1 deletion doc/lsst.afw.coord/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Contributing
============

``lsst.afw.coord`` is developed at https://github.com/lsst/afw.
You can find Jira issues for this module under the `afw <https://jira.lsstcorp.org/issues/?jql=project%20%3D%20DM%20AND%20component%20%3D%20afw>`_ component.
You can find Jira issues for this module under the `afw <https://rubinobs.atlassian.net/issues/?jql=project%20%3D%20DM%20AND%20component%20%3D%20afw>`_ component.

Python API reference
====================
Expand Down
2 changes: 1 addition & 1 deletion doc/lsst.afw.detection/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Contributing
============

``lsst.afw.detection`` is developed at https://github.com/lsst/afw.
You can find Jira issues for this module under the `afw <https://jira.lsstcorp.org/issues/?jql=project%20%3D%20DM%20AND%20component%20%3D%20afw>`_ component.
You can find Jira issues for this module under the `afw <https://rubinobs.atlassian.net/issues/?jql=project%20%3D%20DM%20AND%20component%20%3D%20afw>`_ component.

.. _lsst.afw.detection-pyapi:

Expand Down
2 changes: 1 addition & 1 deletion doc/lsst.afw.display/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Contributing
============

``lsst.afw.display`` is developed at https://github.com/lsst/afw.
You can find Jira issues for this module under the `afw <https://jira.lsstcorp.org/issues/?jql=project%20%3D%20DM%20AND%20component%20%3D%20afw>`_ component.
You can find Jira issues for this module under the `afw <https://rubinobs.atlassian.net/issues/?jql=project%20%3D%20DM%20AND%20component%20%3D%20afw>`_ component.

.. _lsst.afw.display-pyapi:

Expand Down
2 changes: 1 addition & 1 deletion doc/lsst.afw.fits/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Contributing
============

``lsst.afw.fits`` is developed at https://github.com/lsst/afw.
You can find Jira issues for this module under the `afw <https://jira.lsstcorp.org/issues/?jql=project%20%3D%20DM%20AND%20component%20%3D%20afw>`_ component.
You can find Jira issues for this module under the `afw <https://rubinobs.atlassian.net/issues/?jql=project%20%3D%20DM%20AND%20component%20%3D%20afw>`_ component.

.. _lsst.afw.fits-pyapi:

Expand Down
2 changes: 1 addition & 1 deletion doc/lsst.afw.formatters/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Contributing
============

``lsst.afw.formatters`` is developed at https://github.com/lsst/afw.
You can find Jira issues for this module under the `afw <https://jira.lsstcorp.org/issues/?jql=project%20%3D%20DM%20AND%20component%20%3D%20afw>`_ component.
You can find Jira issues for this module under the `afw <https://rubinobs.atlassian.net/issues/?jql=project%20%3D%20DM%20AND%20component%20%3D%20afw>`_ component.

.. _lsst.afw.formatters-pyapi:

Expand Down
2 changes: 1 addition & 1 deletion doc/lsst.afw.geom/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Contributing
============

``lsst.afw.geom`` is developed at https://github.com/lsst/afw.
You can find Jira issues for this module under the `afw <https://jira.lsstcorp.org/issues/?jql=project%20%3D%20DM%20AND%20component%20%3D%20afw>`_ component.
You can find Jira issues for this module under the `afw <https://rubinobs.atlassian.net/issues/?jql=project%20%3D%20DM%20AND%20component%20%3D%20afw>`_ component.

.. _lsst.afw.geom-pyapi:

Expand Down
2 changes: 1 addition & 1 deletion doc/lsst.afw.image/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ Contributing
============

``lsst.afw.image`` is developed at https://github.com/lsst/afw.
You can find Jira issues for this module under the `afw <https://jira.lsstcorp.org/issues/?jql=project%20%3D%20DM%20AND%20component%20%3D%20afw>`_ component.
You can find Jira issues for this module under the `afw <https://rubinobs.atlassian.net/issues/?jql=project%20%3D%20DM%20AND%20component%20%3D%20afw>`_ component.
2 changes: 1 addition & 1 deletion doc/lsst.afw.math/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Contributing
============

``lsst.afw.math`` is developed at https://github.com/lsst/afw.
You can find Jira issues for this module under the `afw <https://jira.lsstcorp.org/issues/?jql=project%20%3D%20DM%20AND%20component%20%3D%20afw>`_ component.
You can find Jira issues for this module under the `afw <https://rubinobs.atlassian.net/issues/?jql=project%20%3D%20DM%20AND%20component%20%3D%20afw>`_ component.

.. If there are topics related to developing this module (rather than using it), link to this from a toctree placed here.

Expand Down
2 changes: 1 addition & 1 deletion doc/lsst.afw.multiband/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ Contributing
============

``lsst.afw.multiband`` is developed at https://github.com/lsst/afw.
You can find Jira issues for this module under the `afw <https://jira.lsstcorp.org/issues/?jql=project%20%3D%20DM%20AND%20component%20%3D%20afw>`_ component.
You can find Jira issues for this module under the `afw <https://rubinobs.atlassian.net/issues/?jql=project%20%3D%20DM%20AND%20component%20%3D%20afw>`_ component.
2 changes: 1 addition & 1 deletion doc/lsst.afw.table/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Contributing
============

``lsst.afw.table`` is developed at https://github.com/lsst/afw.
You can find Jira issues for this module under the `afw <https://jira.lsstcorp.org/issues/?jql=project%20%3D%20DM%20AND%20component%20%3D%20afw>`_ component.
You can find Jira issues for this module under the `afw <https://rubinobs.atlassian.net/issues/?jql=project%20%3D%20DM%20AND%20component%20%3D%20afw>`_ component.

.. _lsst.afw.table-pyapi:

Expand Down
2 changes: 1 addition & 1 deletion doc/lsst.afw.typehandling/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Contributing
============

``lsst.afw.typehandling`` is developed at https://github.com/lsst/afw.
You can find Jira issues for this module under the `afw <https://jira.lsstcorp.org/issues/?jql=project%20%3D%20DM%20AND%20component%20%3D%20afw>`_ component.
You can find Jira issues for this module under the `afw <https://rubinobs.atlassian.net/issues/?jql=project%20%3D%20DM%20AND%20component%20%3D%20afw>`_ component.

.. If there are topics related to developing this module (rather than using it), link to this from a toctree placed here.

Expand Down
7 changes: 5 additions & 2 deletions python/lsst/afw/image/exposure/exposureUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,11 @@ def bbox_contains_sky_coords(bbox, wcs, ra, dec, padding=10):

radec_contained = poly.contains(_ra, _dec)

x_in, y_in = wcs.skyToPixelArray(_ra, _dec, degrees=False)
contained = np.zeros_like(radec_contained, dtype=bool)

x_in, y_in = wcs.skyToPixelArray(_ra[radec_contained], _dec[radec_contained], degrees=False)
xy_contained = bbox.contains(x_in, y_in)
kfindeisen marked this conversation as resolved.
Show resolved Hide resolved

return radec_contained & xy_contained
# contained[not radec_contained] is already false
contained[radec_contained] = xy_contained
return contained
7 changes: 5 additions & 2 deletions tests/test_exposure.py
Original file line number Diff line number Diff line change
Expand Up @@ -866,8 +866,11 @@ def testContainsSkyCoords(self):
ra = np.concatenate(([300.0], ra, [180.]))
dec = np.concatenate(([50.0], dec, [50.0]))

contains = self.exposureMiWcs.containsSkyCoords(ra*units.degree,
dec*units.degree)
# Bad NaN handling appears as a warning, not an error
with warnings.catch_warnings():
warnings.simplefilter("error", category=RuntimeWarning)
contains = self.exposureMiWcs.containsSkyCoords(ra*units.degree,
dec*units.degree)
compare = np.ones(len(contains), dtype=bool)
compare[0] = False
compare[-1] = False
Expand Down
Loading