-
Notifications
You must be signed in to change notification settings - Fork 14
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
stamp center filter c++ port #407
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3cdf2b2
porting over first pass
maxwest-uw 0a06fc5
merge
maxwest-uw f05944d
fix bug in array size check
maxwest-uw 82cb10b
Merge branch 'main' into stamp_center_port
maxwest-uw 80de9fb
remove commented out code
maxwest-uw b90cce1
black changes
maxwest-uw 4e0297f
fix benchmarking script
maxwest-uw 4ffd9e8
code reorganization
maxwest-uw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,7 +103,7 @@ def keep_row(self, row: ResultRow): | |
return False | ||
|
||
# Find the peak in the image. | ||
stamp = row.stamp.reshape([self.width, self.width]) | ||
stamp = row.stamp | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this change because stamp is already in the correct shape? Or is there some other reason? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yep! |
||
peak_pos = RawImage(stamp).find_peak(True) | ||
return ( | ||
abs(peak_pos.i - self.stamp_radius) < self.x_thresh | ||
|
@@ -179,7 +179,7 @@ def keep_row(self, row: ResultRow): | |
return False | ||
|
||
# Find the peack in the image. | ||
stamp = row.stamp.reshape([self.width, self.width]) | ||
stamp = row.stamp | ||
moments = RawImage(stamp).find_central_moments() | ||
return ( | ||
(abs(moments.m01) < self.m01_thresh) | ||
|
@@ -235,25 +235,5 @@ def keep_row(self, row: ResultRow): | |
bool | ||
An indicator of whether to keep the row. | ||
""" | ||
# Filter rows without a valid stamp. | ||
if not self._check_row_valid(row): | ||
return False | ||
|
||
# Find the value of the center pixel. | ||
stamp = row.stamp.flatten() | ||
center_index = self.width * self.stamp_radius + self.stamp_radius | ||
center_val = stamp[center_index] | ||
|
||
# Find the total flux in the image and check for other local_maxima | ||
flux_sum = 0.0 | ||
for i in range(self.width * self.width): | ||
pix_val = stamp[i] | ||
if pix_val != KB_NO_DATA: | ||
flux_sum += pix_val | ||
if i != center_index and self.local_max and (pix_val >= center_val): | ||
return False | ||
|
||
# Check the flux percentage. | ||
if flux_sum == 0.0: | ||
return False | ||
return center_val / flux_sum >= self.flux_thresh | ||
image = RawImage(row.stamp) | ||
return image.center_is_local_max(self.flux_thresh, self.local_max) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why this is changing. The calculation below moves the center pixel one off, but shouldn't the convolution with the PSF still cover the full PSF?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
before the range of the outer for loop would include -1 when i is 0 (due to the one pixel offset), giving an out of bound error. I just changed the range to only include dimensions that fall within the PSF.