From f039d06a9a5c9ff56a2af10015418ea59cf9e244 Mon Sep 17 00:00:00 2001 From: Jeremy Kubica <104161096+jeremykubica@users.noreply.github.com> Date: Mon, 2 Oct 2023 10:05:19 -0400 Subject: [PATCH 1/4] Add some pybind comments --- src/kbmod/search/pydocs/common_docs.h | 69 +++++++++++++++++++++++---- src/kbmod/search/stack_search.cpp | 4 +- src/kbmod/search/stack_search.h | 2 +- 3 files changed, 62 insertions(+), 13 deletions(-) diff --git a/src/kbmod/search/pydocs/common_docs.h b/src/kbmod/search/pydocs/common_docs.h index ae76909b..516cf2c0 100644 --- a/src/kbmod/search/pydocs/common_docs.h +++ b/src/kbmod/search/pydocs/common_docs.h @@ -8,13 +8,15 @@ namespace pydocs { Attributes ---------- x : `float` - x coordinate of the origin (what?) + x coordinate of the trajectory at first timestep (in pixels) y : `float` - y coordinate of the origin (what?) + y coordinate of the trajectory at first timestep (in pixels) vx : `float` x component of the velocity, as projected on the image + (in pixels per day) vy : `float` y component of the velocity, as projected on the image + (in pixels per day) lh : `float` Likelihood (accumulated?) flux : `float` @@ -24,20 +26,67 @@ namespace pydocs { )doc"; static const auto DOC_PixelPos = R"doc( - todo + A coordinate pair to store a location on an image. + + Attributes + ---------- + x : `float` + An x position on an image (in fractional pixels). + y : `float` + An x position on an image (in fractional pixels). )doc"; static const auto DOC_ImageMoments = R"doc( - todo + The central moments of an image (capture how Gaussian-like an image it) + + Attributes + ---------- + m00 : `float` + The m00 central moment. + m01 : `float` + The m01 central moment. + m10 : `float` + The m10 central moment. + m11 : `float` + The m11 central moment. + m02 : `float` + The m02 central moment. + m20 : `float` + The m20 central moment. )doc"; static const auto DOC_StampParameters = R"doc( - todo - ")doc"; - - static const auto DOC_BaryCorrection = R"doc( - todo - ")doc"; + Parameters for stamp generation and filtering. + + Attributes + ---------- + radius : `int` + The stamp radius (in pixels) + stamp_type : `StampType` + The co-add method to use for co-added stamps. Must be one of + STAMP_SUM, STAMP_MEAN, or STAMP_MEDIAN. + do_filtering : `bool` + Indicates whether to do stamp-based filtering. + center_thresh : `float` + The minimum percentage of total flux at the central pixels + for a valid coadded stamp. + peak_offset_x : `float` + The minimum x offset (in pixels) of the brightest location in the + coadded stamp to filter. + peak_offset_y : `float` + The minimum y offset (in pixels) of the brightest location in the + coadded stamp to filter. + m01_limit : `float` + The minimum m01 central moment to filter a coadded stamp. + m10_limit : `float` + The minimum m10 central moment to filter a coadded stamp. + m11_limit : `float` + The minimum m11 central moment to filter a coadded stamp. + m02_limit : `float` + The minimum m02 central moment to filter a coadded stamp. + m20_limit : `float` + The minimum m20 central moment to filter a coadded stamp. + )doc"; } // namespace pydocs diff --git a/src/kbmod/search/stack_search.cpp b/src/kbmod/search/stack_search.cpp index db6d1288..a882a34b 100644 --- a/src/kbmod/search/stack_search.cpp +++ b/src/kbmod/search/stack_search.cpp @@ -526,7 +526,7 @@ namespace search { std::vector& StackSearch::get_psi_images() { return psi_images; } - std::vector& StackSearch::getPhiImages() { return phi_images; } + std::vector& StackSearch::get_phi_images() { return phi_images; } void StackSearch::sort_results() { __gnu_parallel::sort(results.begin(), results.end(), @@ -615,7 +615,7 @@ namespace search { .def("get_phi_curves", (std::vector(ks::*)(tj &)) & ks::get_phi_curves, pydocs::DOC_StackSearch_get_phi_curves) .def("prepare_psi_phi", &ks::prepare_psi_phi, pydocs::DOC_StackSearch_prepare_psi_phi) .def("get_psi_images", &ks::get_psi_images, pydocs::DOC_StackSearch_get_psi_images) - .def("get_phi_images", &ks::getPhiImages, pydocs::DOC_StackSearch_get_phi_images) + .def("get_phi_images", &ks::get_phi_images, pydocs::DOC_StackSearch_get_phi_images) .def("get_results", &ks::get_results, pydocs::DOC_StackSearch_get_results) .def("set_results", &ks::set_results, pydocs::DOC_StackSearch_set_results); } diff --git a/src/kbmod/search/stack_search.h b/src/kbmod/search/stack_search.h index 99fc3010..5953e6dd 100644 --- a/src/kbmod/search/stack_search.h +++ b/src/kbmod/search/stack_search.h @@ -75,7 +75,7 @@ namespace search { // Getters for the Psi and Phi data. std::vector& get_psi_images(); - std::vector& getPhiImages(); + std::vector& get_phi_images(); std::vector get_psi_curves(Trajectory& t); std::vector get_phi_curves(Trajectory& t); From d1096a6c6e40337bcb9750790c2bf2e3235e5785 Mon Sep 17 00:00:00 2001 From: Jeremy Kubica <104161096+jeremykubica@users.noreply.github.com> Date: Mon, 2 Oct 2023 10:14:24 -0400 Subject: [PATCH 2/4] Remove unused variable --- src/kbmod/search/stack_search.cpp | 1 - src/kbmod/search/stack_search.h | 1 - 2 files changed, 2 deletions(-) diff --git a/src/kbmod/search/stack_search.cpp b/src/kbmod/search/stack_search.cpp index a882a34b..6a8e9168 100644 --- a/src/kbmod/search/stack_search.cpp +++ b/src/kbmod/search/stack_search.cpp @@ -13,7 +13,6 @@ namespace search { #endif StackSearch::StackSearch(ImageStack& imstack) : stack(imstack) { - max_result_count = 100000; debug_info = false; psi_phi_generated = false; diff --git a/src/kbmod/search/stack_search.h b/src/kbmod/search/stack_search.h index 5953e6dd..e58ac5de 100644 --- a/src/kbmod/search/stack_search.h +++ b/src/kbmod/search/stack_search.h @@ -124,7 +124,6 @@ namespace search { void start_timer(const std::string& message); void end_timer(); - unsigned max_result_count; bool psi_phi_generated; bool debug_info; ImageStack stack; From 5fe08131aa222e69dd5511e9e3b64a3a67091640 Mon Sep 17 00:00:00 2001 From: Jeremy Kubica <104161096+jeremykubica@users.noreply.github.com> Date: Mon, 2 Oct 2023 10:26:59 -0400 Subject: [PATCH 3/4] Remove tabs --- src/kbmod/search/filtering.cpp | 4 ++-- src/kbmod/search/filtering.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/kbmod/search/filtering.cpp b/src/kbmod/search/filtering.cpp index 0bc8f4f3..7727cfa6 100644 --- a/src/kbmod/search/filtering.cpp +++ b/src/kbmod/search/filtering.cpp @@ -6,14 +6,14 @@ namespace search { #ifdef HAVE_CUDA /* The filter_kenerls.cu functions. */ extern "C" void SigmaGFilteredIndicesCU(float *values, int num_values, float sgl0, float sgl1, float sg_coeff, - float width, int *idx_array, int *min_keep_idx, int *max_keep_idx); + float width, int *idx_array, int *min_keep_idx, int *max_keep_idx); #endif /* Return the list of indices from the values array such that those elements pass the sigmaG filtering defined by percentiles [sgl0, sgl1] with coefficient sigma_g_coeff and a multiplicative factor of width. */ std::vector sigmaGFilteredIndices(const std::vector &values, float sgl0, float sgl1, - float sigma_g_coeff, float width) { + float sigma_g_coeff, float width) { // Bounds check the percentile values. assert(sgl0 > 0.0); assert(sgl1 < 1.0); diff --git a/src/kbmod/search/filtering.h b/src/kbmod/search/filtering.h index 3f424374..bcb19f4c 100644 --- a/src/kbmod/search/filtering.h +++ b/src/kbmod/search/filtering.h @@ -9,7 +9,7 @@ namespace search { pass the sigmaG filtering defined by percentiles [sGL0, sGL1] with coefficient sigmag_coeff and a multiplicative factor of width. */ std::vector sigmaGFilteredIndices(const std::vector& values, float sgl0, float sgl1, - float sigma_g_coeff, float width); + float sigma_g_coeff, float width); } /* namespace search */ From ef2e79386d55a7e139a8d4e2595807a3af1c86f3 Mon Sep 17 00:00:00 2001 From: Jeremy Kubica <104161096+jeremykubica@users.noreply.github.com> Date: Mon, 2 Oct 2023 11:03:18 -0400 Subject: [PATCH 4/4] Update src/kbmod/search/pydocs/common_docs.h Co-authored-by: Melissa DeLucchi <113376043+delucchi-cmu@users.noreply.github.com> --- src/kbmod/search/pydocs/common_docs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kbmod/search/pydocs/common_docs.h b/src/kbmod/search/pydocs/common_docs.h index 516cf2c0..ef0e3cf3 100644 --- a/src/kbmod/search/pydocs/common_docs.h +++ b/src/kbmod/search/pydocs/common_docs.h @@ -37,7 +37,7 @@ namespace pydocs { )doc"; static const auto DOC_ImageMoments = R"doc( - The central moments of an image (capture how Gaussian-like an image it) + The central moments of an image (capture how Gaussian-like an image is) Attributes ----------