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-36403: Add utility function for summing footprint fluxes #21

Merged
merged 7 commits into from Jun 22, 2023

Conversation

mfisherlevine
Copy link
Contributor

No description provided.

@mfisherlevine mfisherlevine marked this pull request as draft October 4, 2022 01:12
@mfisherlevine mfisherlevine marked this pull request as ready for review October 4, 2022 01:47
Copy link

@parejkoj parejkoj left a comment

Choose a reason for hiding this comment

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

I think this could reasonably go into afw/detection/utils.py Any reason why you wouldn't want it here?


def test_fluxFromFootprint(self):
footPrintSet = detectObjectsInExp(self.exp)
allFootprints = footPrintSet.getFootprints()

Choose a reason for hiding this comment

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

This test doesn't need a butler at all, you could construct the image directly. For example, afw/tests/test_footprint[1,2].py place objects in an Image and make the footprints in place.

tests/test_utils.py Outdated Show resolved Hide resolved
tests/test_utils.py Outdated Show resolved Hide resolved
Copy link

@parejkoj parejkoj left a comment

Choose a reason for hiding this comment

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

Handful of comments, most important being that you need to change extract to compute when calling the afw function.

Returns
-------
fluxes : `list` of `float`
The fluxes for each footprint.
Copy link

Choose a reason for hiding this comment

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

Is there any value in returning a numpy array here instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm happy with a list, personally. If the user needs, it can always be cast with np.asarray as needed.

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 see the harm. I'll implement unless @mfisherlevine objects.

python/lsst/summit/utils/utils.py Outdated Show resolved Hide resolved
@@ -207,6 +213,59 @@ def test_quantiles(self):
np.testing.assert_almost_equal(edges1, edges2, decimal=decimal)


class ImageBasedTestCase(lsst.utils.tests.TestCase):
"""A test case for testing sky position offsets for exposures."""
Copy link

Choose a reason for hiding this comment

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

Are the docstring and/or class name right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree, docstring looks wrong. I'm going to leave fixing these to @fred3m though to save having too many cooks here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Unless either of you has a suggestion, I'm just going to delete the docstring. Most of the other test classes don't have docstrings, and since it currently only contains one test, I'm not sure what the long intent of this class is.

python/lsst/summit/utils/utils.py Outdated Show resolved Hide resolved
tests/test_utils.py Show resolved Hide resolved
tests/test_utils.py Outdated Show resolved Hide resolved
@fred3m fred3m merged commit 7fc05bd into main Jun 22, 2023
1 check passed
@fred3m fred3m deleted the tickets/DM-36403 branch June 22, 2023 16:56
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

3 participants