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

Add pydoc comments for common.h #363

Merged
merged 4 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/kbmod/search/filtering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int> sigmaGFilteredIndices(const std::vector<float> &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);
Expand Down
2 changes: 1 addition & 1 deletion src/kbmod/search/filtering.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<int> sigmaGFilteredIndices(const std::vector<float>& values, float sgl0, float sgl1,
float sigma_g_coeff, float width);
float sigma_g_coeff, float width);

} /* namespace search */

Expand Down
69 changes: 59 additions & 10 deletions src/kbmod/search/pydocs/common_docs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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)
jeremykubica marked this conversation as resolved.
Show resolved Hide resolved

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

Expand Down
5 changes: 2 additions & 3 deletions src/kbmod/search/stack_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ namespace search {
#endif

StackSearch::StackSearch(ImageStack& imstack) : stack(imstack) {
max_result_count = 100000;
debug_info = false;
psi_phi_generated = false;

Expand Down Expand Up @@ -526,7 +525,7 @@ namespace search {

std::vector<RawImage>& StackSearch::get_psi_images() { return psi_images; }

std::vector<RawImage>& StackSearch::getPhiImages() { return phi_images; }
std::vector<RawImage>& StackSearch::get_phi_images() { return phi_images; }

void StackSearch::sort_results() {
__gnu_parallel::sort(results.begin(), results.end(),
Expand Down Expand Up @@ -615,7 +614,7 @@ namespace search {
.def("get_phi_curves", (std::vector<float>(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);
}
Expand Down
3 changes: 1 addition & 2 deletions src/kbmod/search/stack_search.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ namespace search {

// Getters for the Psi and Phi data.
std::vector<RawImage>& get_psi_images();
std::vector<RawImage>& getPhiImages();
std::vector<RawImage>& get_phi_images();
std::vector<float> get_psi_curves(Trajectory& t);
std::vector<float> get_phi_curves(Trajectory& t);

Expand Down Expand Up @@ -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;
Expand Down