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

stamp center filter c++ port #407

Merged
merged 8 commits into from
Dec 20, 2023
Merged

stamp center filter c++ port #407

merged 8 commits into from
Dec 20, 2023

Conversation

maxwest-uw
Copy link
Collaborator

ports the code for the stamp center filter into c++.

@maxwest-uw
Copy link
Collaborator Author

Previous Benchmarks

(recorded 10/12/2023)

Rad |       Method       |    Time
----------------------------------------
   2 | C++ (all)          |  0.0000209
   2 | StampPeakFilter    |  0.0001952
   2 | StampMomentsFilter |  0.0001926
 **2 | StampCenterFilter  |  0.0001895**
----------------------------------------
   5 | C++ (all)          |  0.0000437
   5 | StampPeakFilter    |  0.0001974
   5 | StampMomentsFilter |  0.0002416
 **5 | StampCenterFilter  |  0.0007824**
----------------------------------------
  10 | C++ (all)          |  0.0000420
  10 | StampPeakFilter    |  0.0002211
  10 | StampMomentsFilter |  0.0003056
**10 | StampCenterFilter  |  0.0028199**
----------------------------------------
  20 | C++ (all)          |  0.0001171
  20 | StampPeakFilter    |  0.0002759
  20 | StampMomentsFilter |  0.0005156
**20 | StampCenterFilter  |  0.0106616**
----------------------------------------

New Benchmark

(recorded 12/19/2023)

 Rad |       Method       |    Time
----------------------------------------
   2 | C++ (all)          |  0.0000218
   2 | StampPeakFilter    |  0.0001257
   2 | StampMomentsFilter |  0.0001295
 **2 | StampCenterFilter  |  0.0000831**
----------------------------------------
   5 | C++ (all)          |  0.0000669
   5 | StampPeakFilter    |  0.0001272
   5 | StampMomentsFilter |  0.0001889
 **5 | StampCenterFilter  |  0.0000933**
----------------------------------------
  10 | C++ (all)          |  0.0000737
  10 | StampPeakFilter    |  0.0001497
  10 | StampMomentsFilter |  0.0003031
**10 | StampCenterFilter  |  0.0001373**
----------------------------------------
  20 | C++ (all)          |  0.0002598
  20 | StampPeakFilter    |  0.0001967
  20 | StampMomentsFilter |  0.0007231
**20 | StampCenterFilter  |  0.0002791**
----------------------------------------

Copy link
Contributor

@jeremykubica jeremykubica left a comment

Choose a reason for hiding this comment

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

A few clarification questions

@@ -30,7 +39,7 @@ def setup_coadd_stamp(params):
p = PSF(1.0)
psf_dim = p.get_dim()
psf_rad = p.get_radius()
for i in range(psf_dim):
for i in range(1, psf_dim):
Copy link
Contributor

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?

Copy link
Collaborator Author

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.

@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The 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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yep!

src/kbmod/search/raw_image.cpp Show resolved Hide resolved
Copy link
Contributor

@jeremykubica jeremykubica left a comment

Choose a reason for hiding this comment

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

Thanks for making this change.

@maxwest-uw maxwest-uw merged commit 5ba2324 into main Dec 20, 2023
2 checks passed
@maxwest-uw maxwest-uw deleted the stamp_center_port branch December 20, 2023 22:33
DinoBektesevic pushed a commit that referenced this pull request Jan 10, 2024
* porting over first pass

* merge

* fix bug in array size check

* remove commented out code

* black changes

* fix benchmarking script

* code reorganization
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.

2 participants