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

Mechanical application of clang-format #788

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion src/kbmod/search/psi_phi_array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ std::array<float, 3> compute_scale_params_from_image_vect(const std::vector<RawI
// Check if we have hit a case where the image is effectively empty (all zero).
if ((bnds[0] == 0.0) && (bnds[1] == 0.0)) {
logging::getLogger("kbmod.search.psi_phi_array")
->debug("Image " + std::to_string(i) + " has no data.\n");
->debug("Image " + std::to_string(i) + " has no data.\n");
}

if (bnds[0] < min_val) min_val = bnds[0];
Expand Down
2 changes: 1 addition & 1 deletion src/kbmod/search/raw_image.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class RawImage {
RawImage create_stamp(const Point& p, const int radius, const bool keep_no_data) const;

// Compute the min and max bounds of values in the image.
std::array<float, 2> compute_bounds(bool strict_checks=true) const;
std::array<float, 2> compute_bounds(bool strict_checks = true) const;

// Convolve the image with a point spread function.
void convolve(PSF& psf);
Expand Down
3 changes: 1 addition & 2 deletions src/kbmod/search/stack_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ StackSearch::StackSearch(ImageStack& imstack) : stack(imstack), results(0), gpu_
// --------------------------------------------

void StackSearch::set_min_obs(int new_value) {
if (new_value < 0)
throw std::runtime_error("min_obs must be >= 0.");
if (new_value < 0) throw std::runtime_error("min_obs must be >= 0.");
if (new_value > stack.img_count())
throw std::runtime_error("min_obs cannot be greater than the number of images.");

Expand Down
21 changes: 9 additions & 12 deletions src/kbmod/search/stamp_creator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ void deviceGetCoadds(const uint64_t num_images, const uint64_t width, const uint
GPUArray<int>& use_index_vect, GPUArray<float>& results);
#endif

std::vector<RawImage> create_stamps(ImageStack& stack, const Trajectory& trj, int radius,
bool keep_no_data, const std::vector<bool>& use_index) {
std::vector<RawImage> create_stamps(ImageStack& stack, const Trajectory& trj, int radius, bool keep_no_data,
const std::vector<bool>& use_index) {
if (use_index.size() > 0)
assert_sizes_equal(use_index.size(), stack.img_count(), "create_stamps() use_index");
bool use_all_stamps = (use_index.size() == 0);
Expand Down Expand Up @@ -76,8 +76,7 @@ std::vector<RawImage> get_coadded_stamps(ImageStack& stack, std::vector<Trajecto
return get_coadded_stamps_cpu(stack, t_array, use_index_vect, params);
}

std::vector<RawImage> get_coadded_stamps_cpu(ImageStack& stack,
std::vector<Trajectory>& t_array,
std::vector<RawImage> get_coadded_stamps_cpu(ImageStack& stack, std::vector<Trajectory>& t_array,
std::vector<std::vector<bool>>& use_index_vect,
const StampParameters& params) {
const uint64_t num_trajectories = t_array.size();
Expand Down Expand Up @@ -155,8 +154,7 @@ bool filter_stamp(const RawImage& img, const StampParameters& params) {
return false;
}

std::vector<RawImage> get_coadded_stamps_gpu(ImageStack& stack,
std::vector<Trajectory>& t_array,
std::vector<RawImage> get_coadded_stamps_gpu(ImageStack& stack, std::vector<Trajectory>& t_array,
std::vector<std::vector<bool>>& use_index_vect,
const StampParameters& params) {
logging::Logger* rs_logger = logging::getLogger("kbmod.search.stamp_creator");
Expand Down Expand Up @@ -269,8 +267,8 @@ std::vector<RawImage> get_coadded_stamps_gpu(ImageStack& stack,
return results;
}

std::vector<RawImage> create_variance_stamps(ImageStack& stack, const Trajectory& trj,
int radius, const std::vector<bool>& use_index) {
std::vector<RawImage> create_variance_stamps(ImageStack& stack, const Trajectory& trj, int radius,
const std::vector<bool>& use_index) {
if (use_index.size() > 0)
assert_sizes_equal(use_index.size(), stack.img_count(), "create_stamps() use_index");
bool use_all_stamps = (use_index.size() == 0);
Expand Down Expand Up @@ -337,13 +335,12 @@ static void stamp_creator_bindings(py::module& m) {
m.def("get_median_stamp", &search::get_median_stamp, pydocs::DOC_StampCreator_get_median_stamp);
m.def("get_mean_stamp", &search::get_mean_stamp, pydocs::DOC_StampCreator_get_mean_stamp);
m.def("get_summed_stamp", &search::get_summed_stamp, pydocs::DOC_StampCreator_get_summed_stamp);
m.def("get_coadded_stamps", &search::get_coadded_stamps,
pydocs::DOC_StampCreator_get_coadded_stamps);
m.def("get_coadded_stamps", &search::get_coadded_stamps, pydocs::DOC_StampCreator_get_coadded_stamps);
m.def("get_variance_weighted_stamp", &search::get_variance_weighted_stamp,
pydocs::DOC_StampCreator_get_variance_weighted_stamp);
pydocs::DOC_StampCreator_get_variance_weighted_stamp);
m.def("create_stamps", &search::create_stamps, pydocs::DOC_StampCreator_create_stamps);
m.def("create_variance_stamps", &search::create_variance_stamps,
pydocs::DOC_StampCreator_create_variance_stamps);
pydocs::DOC_StampCreator_create_variance_stamps);
m.def("filter_stamp", &search::filter_stamp, pydocs::DOC_StampCreator_filter_stamp);
}
#endif /* Py_PYTHON_H */
Expand Down
8 changes: 4 additions & 4 deletions src/kbmod/search/stamp_creator.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ namespace search {
// The indices to use are indicated by use_index: a vector<bool> indicating whether to use
// each time step. An empty (size=0) vector will use all time steps.
static std::vector<RawImage> create_stamps(ImageStack& stack, const Trajectory& trj, int radius,
bool keep_no_data, const std::vector<bool>& use_index);
bool keep_no_data, const std::vector<bool>& use_index);

static std::vector<RawImage> get_stamps(ImageStack& stack, const Trajectory& t, int radius);

static RawImage get_median_stamp(ImageStack& stack, const Trajectory& trj, int radius,
const std::vector<bool>& use_index);
const std::vector<bool>& use_index);

static RawImage get_mean_stamp(ImageStack& stack, const Trajectory& trj, int radius,
const std::vector<bool>& use_index);
const std::vector<bool>& use_index);

static RawImage get_summed_stamp(ImageStack& stack, const Trajectory& trj, int radius,
const std::vector<bool>& use_index);
const std::vector<bool>& use_index);

// Compute a mean or summed stamp for each trajectory on the GPU or CPU.
// The GPU implementation is slower for small numbers of trajectories (< 500), but performs
Expand Down