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-19802: Fix jointcal ra/dec bounding box calculations #142

Merged
merged 4 commits into from May 23, 2019

Conversation

parejkoj
Copy link
Collaborator

This should fix the problem, and includes a test that demonstrates the fix.

In addition to being useful for this test, this is a function we may
want in a future "parallelize data reads" approach.
This lets us specify new on-sky positions for the fake catalogs.
Copy link
Contributor

@erykoff erykoff left a comment

Choose a reason for hiding this comment

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

I can't really comment on the idiomaticness of the c++ code, though nothing looks crazy. See my suggestions below.

AstrometryTransformLinear identity;
TanPixelToRaDec commonTangentPlaneToRaDec(identity, _commonTangentPoint);
Frame raDecFrame = commonTangentPlaneToRaDec.apply(tangentPlaneFrame, false);

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll have to trust based on the tests that this works, because I have no experience with the wcs Frames.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The Frame in this case, is actually a jointcal object. I want to replace it with lsst.geom.Box2D at some point (DM-4044).

points.emplace_back(sphgeom::LonLat::fromDegrees(raDecFrame.xMax, raDecFrame.yMin));
points.emplace_back(sphgeom::LonLat::fromDegrees(raDecFrame.xMin, raDecFrame.yMax));
points.emplace_back(sphgeom::LonLat::fromDegrees(raDecFrame.xMax, raDecFrame.yMax));

Copy link
Contributor

Choose a reason for hiding this comment

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

What confused me here is that I guess x and y in the raDecFrame are in sky coordinates? It is not apparent from the x and y terminology (outside the scope of this ticket!) but maybe it's worth adding a comment to this effect? (Or it might be well-known to those more familiar with how the wcs Frames work.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, this is confusing because jointcal's internal objects (Frame and Point) are used in both on-sky, and on-sensor cases, with x and y having different meanings in those cases. This is unfortunate, but I haven't had time to do the plumbing work to fix it (again, DM-4044).

I've added a comment that may clarify things?

import lsst.geom
from lsst.meas.algorithms import getRefFluxField, LoadIndexedReferenceObjectsTask, DatasetConfig
import lsst.pipe.base
import lsst.jointcal
from lsst.jointcal import MinimizeResult
# from lsst.jointcal.jointcal import computeBoundingCircle
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be removed.

for x in bbox.getCorners()]
points.extend([lsst.geom.SpherePoint(wcs2.pixelToSky(lsst.geom.Point2D(x)))
for x in bbox.getCorners()])
self._checkPointsInCircle(points, center, radius)
Copy link
Contributor

Choose a reason for hiding this comment

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

I can't help but notice that lines 327-341 are identical to 290-304, as best as I can tell. Is there a way to consolidate this?

@parejkoj
Copy link
Collaborator Author

I've pushed an update that responds to your comments. Is the new docstring better?

Use sphgeom and SpherePoint to correctly compute the "bounding circle"
of all ccdImages. The old code was wildly wrong near RA=0, and also
sometimes had the wrong radius.
Now that the center and radius math is fixed, some of  the numbers of
loaded reference sources are slightly different (and more correct!).
@parejkoj parejkoj merged commit 24f8ad2 into master May 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants