-
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
functionalize and remove the StampCreator class #761
base: main
Are you sure you want to change the base?
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
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.
One blocking change to make (the benchmark) and a bunch of small stylistic fixes to make before merging.
@@ -55,7 +54,6 @@ def run_search_benchmark(params): | |||
|
|||
# Create an empty search stack. | |||
# im_stack = ImageStack([]) | |||
sc = StampCreator() | |||
|
|||
# Do the timing runs. | |||
tmr = timeit.Timer(stmt="sc.filter_stamp(stamp, params)", globals=locals()) |
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.
This will need to be changed because sc
no longer exists.
StampCreator::StampCreator() {} | ||
|
||
std::vector<RawImage> StampCreator::create_stamps(ImageStack& stack, const Trajectory& trj, int radius, | ||
std::vector<RawImage> create_stamps(ImageStack& stack, const Trajectory& trj, int radius, | ||
bool keep_no_data, const std::vector<bool>& use_index) { |
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.
This line should moved left to align with the line above.
std::vector<bool> empty_vect; | ||
return create_stamps(stack, t, radius, false /*=keep_no_data*/, empty_vect); | ||
} | ||
|
||
// For creating coadded stamps, we do not interpolate the pixel values and keep | ||
// invalid pixels tagged (so we can filter it out of mean/median). | ||
RawImage StampCreator::get_median_stamp(ImageStack& stack, const Trajectory& trj, int radius, | ||
RawImage get_median_stamp(ImageStack& stack, const Trajectory& trj, int radius, | ||
const std::vector<bool>& use_index) { |
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.
This line should be moved left to align with the line above.
const std::vector<bool>& use_index) { | ||
return create_median_image(create_stamps(stack, trj, radius, true /*=keep_no_data*/, use_index)); | ||
} | ||
|
||
// For creating coadded stamps, we do not interpolate the pixel values and keep | ||
// invalid pixels tagged (so we can filter it out of mean/median). | ||
RawImage StampCreator::get_mean_stamp(ImageStack& stack, const Trajectory& trj, int radius, | ||
RawImage get_mean_stamp(ImageStack& stack, const Trajectory& trj, int radius, | ||
const std::vector<bool>& use_index) { |
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.
This line should be moved left to align with the line above.
const std::vector<bool>& use_index) { | ||
return create_mean_image(create_stamps(stack, trj, radius, true /*=keep_no_data*/, use_index)); | ||
} | ||
|
||
// For creating summed stamps, we do not interpolate the pixel values and replace | ||
// invalid pixels with zero (which is the same as filtering it out for the sum). | ||
RawImage StampCreator::get_summed_stamp(ImageStack& stack, const Trajectory& trj, int radius, | ||
RawImage get_summed_stamp(ImageStack& stack, const Trajectory& trj, int radius, | ||
const std::vector<bool>& use_index) { |
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.
This line should be moved left to align with the line above.
const std::vector<bool>& use_index) { | ||
return create_summed_image(create_stamps(stack, trj, radius, false /*=keep_no_data*/, use_index)); | ||
} | ||
|
||
std::vector<RawImage> StampCreator::get_coadded_stamps(ImageStack& stack, std::vector<Trajectory>& t_array, | ||
std::vector<RawImage> get_coadded_stamps(ImageStack& stack, std::vector<Trajectory>& t_array, | ||
std::vector<std::vector<bool>>& use_index_vect, |
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.
These two lines should be moved left to align with the line above.
@@ -80,7 +78,7 @@ std::vector<RawImage> StampCreator::get_coadded_stamps(ImageStack& stack, std::v | |||
return get_coadded_stamps_cpu(stack, t_array, use_index_vect, params); | |||
} | |||
|
|||
std::vector<RawImage> StampCreator::get_coadded_stamps_cpu(ImageStack& stack, | |||
std::vector<RawImage> get_coadded_stamps_cpu(ImageStack& stack, |
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.
The lines below should be moved left to align with this line.
@@ -159,7 +157,7 @@ bool StampCreator::filter_stamp(const RawImage& img, const StampParameters& para | |||
return false; | |||
} | |||
|
|||
std::vector<RawImage> StampCreator::get_coadded_stamps_gpu(ImageStack& stack, | |||
std::vector<RawImage> get_coadded_stamps_gpu(ImageStack& stack, |
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.
The lines below should be moved left to align with this line.
@@ -273,7 +271,7 @@ std::vector<RawImage> StampCreator::get_coadded_stamps_gpu(ImageStack& stack, | |||
return results; | |||
} | |||
|
|||
std::vector<RawImage> StampCreator::create_variance_stamps(ImageStack& stack, const Trajectory& trj, | |||
std::vector<RawImage> create_variance_stamps(ImageStack& stack, const Trajectory& trj, |
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.
The lines below should be moved left to align with this line.
@@ -295,7 +293,7 @@ std::vector<RawImage> StampCreator::create_variance_stamps(ImageStack& stack, co | |||
return stamps; | |||
} | |||
|
|||
RawImage StampCreator::get_variance_weighted_stamp(ImageStack& stack, const Trajectory& trj, int radius, | |||
RawImage get_variance_weighted_stamp(ImageStack& stack, const Trajectory& trj, int radius, |
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.
The line below should be moved left to align with this line.
Removes the
StampCreator
and leaves all of its methods as functionsresolves #714
(was going through the backlog looking for something to do and couldn't resist the urge to make something more functional)