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-35530: Fix typo in persisted scarlet model data #57

Merged
merged 2 commits into from
Jul 12, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions python/lsst/meas/extensions/scarlet/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ class ScarletFactorizedComponentData:
extent : `tuple` of `int`
The `(width, height)` of the component array.
center : `tuple` of `int`
The center of the component.
The ``(x, y)`` center of the component.
Note: once this is converted into a scarlet `LiteBlend` the source has
the traditional c++ `(y, x)` ordering.
sed : `numpy.ndarray`
The SED of the component.
morph : `numpy.ndarray`
Expand All @@ -130,7 +132,7 @@ def asDict(self) -> dict:
return {
"xy0": self.xy0,
"extent": self.extent,
"center": self.extent,
"center": self.center,
Copy link
Contributor

Choose a reason for hiding this comment

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

Because of the mix-n’-match of conventions, it wouldn’t hurt to be explicit about (y, x) vs. (x, y) in the variable doc strings (in addition to your comment in the class description above). I got nervous looking at your test…!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, I'll make it clear in the docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's actually more confusing than you think. To be consistent with xy0 and the rest of the stack, the center in the persistence model is in (x, y) format, it's just scarlet that uses the C++ (y, x) format. But I am clarifying in the docs.

Copy link
Contributor

Choose a reason for hiding this comment

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

🤪

"sed": tuple(self.sed.astype(float)),
"morph": tuple(self.morph.flatten().astype(float))
}
Expand Down
3 changes: 3 additions & 0 deletions tests/test_deblend.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ def test_deblend_task(self):

# Get the scarlet model for the source
source = [src for src in blend.sources if src.recordId == child.getId()][0]
parentBox = catalog.find(child["parent"]).getFootprint().getBBox()
self.assertEqual(source.center[1], px - parentBox.getMinX())
self.assertEqual(source.center[0], py - parentBox.getMinY())

if useFlux:
# Get the flux re-weighted model and test against
Expand Down