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-22777: Prune diaForcedSources in DiaForcedSourceTask #71

Merged
merged 1 commit into from Jan 9, 2020

Conversation

morriscb
Copy link
Contributor

@morriscb morriscb commented Jan 8, 2020

No description provided.

Copy link
Member

@kfindeisen kfindeisen left a comment

Choose a reason for hiding this comment

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

Looks good, couple of minor comments.

@@ -264,3 +266,31 @@ def _calibrate_and_merge(self,
output_catalog.drop(columns=self.config.dropColumns, inplace=True)

return output_catalog

def _trim_to_bbox(self, catalog, exposure):
Copy link
Member

Choose a reason for hiding this comment

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

It seems a bit odd to have a trim_to_bbox method that takes an exposure. Why not let it take a Box2I (more reusable) or call it trim_to_exposure (more robust to changes in algorithm, pixel vs. celestial coordinates, etc)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to trim_to_exposure

Comment on lines 295 to 296
return catalog[np.logical_and(np.logical_and(minX < xS, maxX > xS),
np.logical_and(minY < yS, maxY > yS))]
Copy link
Member

Choose a reason for hiding this comment

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

Box2D has a vector contains method, so I think you can simplify this to something like:

return catalog[bbox.contains(xS, yS)]

The loop over xS and yS is done in C++, so this should also be faster than the current code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, didn't see the vectorized bbox.contains.

src = objects.addNew()
src['id'] = 10000000
src.setCoord(wcs.pixelToSky(-100000,
-100000))
Copy link
Member

Choose a reason for hiding this comment

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

Actually, one more suggestion: consider testing points that are out-of-bounds in only X or only Y, or some that are just out-of-bounds (especially points that would be treated differently by Box2I vs. Box2D).

Rename trim_to_bbox to trim_to_exposure.

Directly use Box2D.contains

Add two more test points outside of ccd.
@morriscb morriscb merged commit 68d9fe3 into master Jan 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants