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-42461: Implement CloughTocher2D Interpolation #878

Merged
merged 3 commits into from Jan 19, 2024

Conversation

arunkannawadi
Copy link
Member

No description provided.

@czwa czwa self-requested a review January 16, 2024 22:39
Copy link
Contributor

@czwa czwa left a comment

Choose a reason for hiding this comment

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

A couple typos, a few questions, and one potential bug that should be easy to resolve.

)
fillValue = pexConfig.Field[float](
doc="Constant value to fill outside of the convex hull of the good "
"pixels. A long streak of bad pixels at an edge maybe set to this "
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo: "maybe" -> "may be"? That said, should this be "will be"?

Copy link
Member Author

Choose a reason for hiding this comment

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

I used "may be", because I haven't defined what long means. Perhaps I could define it in terms of buffer variable and change it to "will be".

an exhaustive search over the image.
goodpix: `dict` [`tuple` [`int`, `int`], `float`], optional
A mapping of the coordinates of the good pixels around ``badpix``
to their values that must be included when constructing the
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 mention that any values in goodpix will be overwritten with the value from the image, just so it's clear which input takes precedence.

Returns
-------
badpix: `set` [`tuple` [`int`, `int`]]
The coordinates of the bad pixels that were interpolate over.
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo: "interpolate" to "interpolated"?

elif (x, y) in badpix:
# If (x, y) is in badpix, but did not get flagged as bad,
# raise an exception.
raise ValueError(f"Pixel ({x}, {y}) is not bad as specified by maskPlanes {maskPlanes}")
Copy link
Contributor

Choose a reason for hiding this comment

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

This function ignores entries in goodpix (it silently overwrites them with the true image value), but raises if the image doesn't match the badpix. Shouldn't these cases be treated the same way?
While thinking through this case, I realized that goodpix is also susceptible to poisoning: an entry passed in goodpix will be used even if added to badpix. That definitely needs fixed, even if the rest of the existing logic stays as is (which I'm fine with).

Copy link
Member Author

Choose a reason for hiding this comment

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

The use case here is we have a collection of images that have identical mask planes, but different image planes. So we shouldn't be treating badpix (that comes from mask) in the same way as goodpix (that comes from both the mask and image planes) the same way. But yes, agree that we should check that goodpix and badpix are mutually exclusive.


# Check that the long streak of bad pixels have been replaced with the
# fillValue, but not the short streak.
np.testing.assert_array_equal(self.maskedimage.image[0:1, :50].array, config.fillValue)
Copy link
Contributor

Choose a reason for hiding this comment

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

Won't this only check half the column? Same question for the other test as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought I had a reason, but have no idea now why I did that. The test passes if I just use the full column.

@arunkannawadi arunkannawadi force-pushed the tickets/DM-42461 branch 3 times, most recently from 6201973 to 3610417 Compare January 18, 2024 22:07
@arunkannawadi arunkannawadi merged commit 45571ea into main Jan 19, 2024
2 checks passed
@arunkannawadi arunkannawadi deleted the tickets/DM-42461 branch January 19, 2024 16:15
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