diff --git a/src/kbmod/analysis_utils.py b/src/kbmod/analysis_utils.py index 286b7948..d183fb67 100644 --- a/src/kbmod/analysis_utils.py +++ b/src/kbmod/analysis_utils.py @@ -123,7 +123,14 @@ def get_all_stamps(self, result_list, search, stamp_radius): stamp_edge = stamp_radius * 2 + 1 for row in result_list.results: stamps = kb.StampCreator.get_stamps(search.get_imagestack(), row.trajectory, stamp_radius) - row.all_stamps = np.array([np.array(stamp).reshape(stamp_edge, stamp_edge) for stamp in stamps]) + # TODO: a way to avoid a copy here would be to do + # np.array([s.image for s in stamps], dtype=np.single, copy=False) + # but that could cause a problem with reference counting at the m + # moment. The real fix is to make the stamps return Image not + # RawImage, return the Image and avoid a reference to a private + # attribute. This risks collecting RawImage but leaving a dangling + # ref to its private field. That's a fix for another time. + row.all_stamps = np.array([stamp.image for stamp in stamps]) def apply_clipped_sigmaG(self, result_list): """This function applies a clipped median filter to the results of a KBMOD @@ -324,9 +331,16 @@ def apply_stamp_filter( params, kb.HAS_GPU and len(trj_slice) > 100, ) + # TODO: a way to avoid a copy here would be to do + # np.array([s.image for s in stamps], dtype=np.single, copy=False) + # but that could cause a problem with reference counting at the m + # moment. The real fix is to make the stamps return Image not + # RawImage and avoid reference to an private attribute and risking + # collecting RawImage but leaving a dangling ref to the attribute. + # That's a fix for another time so I'm leaving it as a copy here for ind, stamp in enumerate(stamps_slice): if stamp.width > 1: - result_list.results[ind + start_idx].stamp = np.array(stamp) + result_list.results[ind + start_idx].stamp = np.array(stamp.image) all_valid_inds.append(ind + start_idx) # Move to the next chunk. diff --git a/src/kbmod/search/kernels.cu b/src/kbmod/search/kernels.cu index d517188a..99caf270 100644 --- a/src/kbmod/search/kernels.cu +++ b/src/kbmod/search/kernels.cu @@ -103,8 +103,10 @@ namespace search { } // Get origin pixel for the trajectories in pixel space. - const int x = x_i + params.x_start_min; - const int y = y_i + params.y_start_min; + // TODO: this is an ugly hack to get things to work, + // beautify before merge, see also later + const int y = x_i + params.x_start_min; + const int x = y_i + params.y_start_min; const unsigned int n_pixels = width * height; // Data structures used for filtering. @@ -149,8 +151,10 @@ namespace search { for (int i = 0; i < num_images; ++i) { // Predict the trajectory's position. float curr_time = image_data.image_times[i]; - int current_x = x + int(curr_trj.vx * curr_time + 0.5); - int current_y = y + int(curr_trj.vy * curr_time + 0.5); + // TODO: the hack again, make sure to properly contextualize + // before merging + int current_y = x + int(curr_trj.vx * curr_time + 0.5); + int current_x = y + int(curr_trj.vy * curr_time + 0.5); // Test if trajectory goes out of the image, in which case we do not // look up a pixel value for this time step (allowing trajectories to diff --git a/src/kbmod/search/raw_image.cpp b/src/kbmod/search/raw_image.cpp index 73937432..bc12d8b6 100644 --- a/src/kbmod/search/raw_image.cpp +++ b/src/kbmod/search/raw_image.cpp @@ -655,6 +655,14 @@ RawImage& RawImage::operator=(RawImage&& source) { .def_property("obstime", &rie::get_obstime, &rie::set_obstime) .def_property("image", py::overload_cast<>(&rie::get_image, py::const_), &rie::set_image) .def_property("imref", py::overload_cast<>(&rie::get_image), &rie::set_image) + .def("data", [](rie& cls){ + for (int j=0; j StackSearch::get_trajectory_positions(Trajectory& t) const { + std::vector results; + int num_times = stack.img_count(); + for (int i = 0; i < num_times; ++i) { + Point pos = get_trajectory_position(t, i); + results.push_back(pos); + } + return results; + } + + std::vector StackSearch::create_curves(Trajectory t, const std::vector& imgs) { /*Create a lightcurve from an image along a trajectory * diff --git a/src/kbmod/search/stamp_creator.cpp b/src/kbmod/search/stamp_creator.cpp index b6fe335e..8cd3f010 100644 --- a/src/kbmod/search/stamp_creator.cpp +++ b/src/kbmod/search/stamp_creator.cpp @@ -1,154 +1,162 @@ #include "stamp_creator.h" namespace search { - #ifdef HAVE_CUDA - -void deviceGetCoadds(const unsigned int num_images, - const unsigned int height, - const unsigned int width, - const std::vector data_refs, - PerImageData image_data, - int num_trajectories, - Trajectory *trajectories, - StampParameters params, - std::vector> &use_index_vect, - float *results); + void deviceGetCoadds(const unsigned int num_images, + const unsigned int height, + const unsigned int width, + const std::vector data_refs, + PerImageData image_data, + int num_trajectories, + Trajectory *trajectories, + StampParameters params, + std::vector> &use_index_vect, + float *results); #endif -StampCreator::StampCreator() {} -std::vector StampCreator::create_stamps(ImageStack& stack, const Trajectory& trj, int radius, - bool interpolate, bool keep_no_data, - const std::vector& use_index) { + StampCreator::StampCreator() {} + + + std::vector StampCreator::create_stamps(ImageStack& stack, const Trajectory& trj, int radius, + bool interpolate, bool keep_no_data, + const std::vector& use_index) { if (use_index.size() > 0 && use_index.size() != stack.img_count()) { - throw std::runtime_error("Wrong size use_index passed into create_stamps()"); + throw std::runtime_error("Wrong size use_index passed into create_stamps()"); } bool use_all_stamps = use_index.size() == 0; std::vector stamps; int num_times = stack.img_count(); for (int i = 0; i < num_times; ++i) { - if (use_all_stamps || use_index[i]) { - // Calculate the trajectory position. - float time = stack.get_zeroed_time(i); - Point pos{trj.y + time * trj.vy, trj.x + time * trj.vx}; - RawImage& img = stack.get_single_image(i).get_science(); - stamps.push_back(img.create_stamp(pos, radius, interpolate, keep_no_data)); - } + if (use_all_stamps || use_index[i]) { + // Calculate the trajectory position. + float time = stack.get_zeroed_time(i); + Point pos{trj.y + time * trj.vy, trj.x + time * trj.vx}; + RawImage& img = stack.get_single_image(i).get_science(); + stamps.push_back(img.create_stamp(pos, radius, interpolate, keep_no_data)); + } } return stamps; -} + } + -// For stamps used for visualization we interpolate the pixel values, replace -// NO_DATA tages with zeros, and return all the stamps (regardless of whether -// individual timesteps have been filtered). -std::vector StampCreator::get_stamps(ImageStack& stack, const Trajectory& t, int radius) { + // For stamps used for visualization we interpolate the pixel values, replace + // NO_DATA tages with zeros, and return all the stamps (regardless of whether + // individual timesteps have been filtered). + std::vector StampCreator::get_stamps(ImageStack& stack, const Trajectory& t, int radius) { std::vector empty_vect; return create_stamps(stack, t, radius, true /*=interpolate*/, false /*=keep_no_data*/, empty_vect); -} + } -// For creating coadded stamps, we do not interpolate the pixel values and keep -// NO_DATA tagged (so we can filter it out of mean/median). -RawImage StampCreator::get_median_stamp(ImageStack& stack, const Trajectory& trj, int radius, - const std::vector& use_index) { + + // For creating coadded stamps, we do not interpolate the pixel values and keep + // NO_DATA tagged (so we can filter it out of mean/median). + RawImage StampCreator::get_median_stamp(ImageStack& stack, const Trajectory& trj, int radius, + const std::vector& use_index) { return create_median_image( - create_stamps(stack, trj, radius, false /*=interpolate*/, true /*=keep_no_data*/, use_index)); -} + create_stamps(stack, trj, radius, false /*=interpolate*/, true /*=keep_no_data*/, use_index)); + } -// For creating coadded stamps, we do not interpolate the pixel values and keep -// NO_DATA tagged (so we can filter it out of mean/median). -RawImage StampCreator::get_mean_stamp(ImageStack& stack, const Trajectory& trj, int radius, - const std::vector& use_index) { - return create_mean_image( - create_stamps(stack, trj, radius, false /*=interpolate*/, true /*=keep_no_data*/, use_index)); -} -// For creating summed stamps, we do not interpolate the pixel values and replace NO_DATA -// 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, + // For creating coadded stamps, we do not interpolate the pixel values and keep + // NO_DATA tagged (so we can filter it out of mean/median). + RawImage StampCreator::get_mean_stamp(ImageStack& stack, const Trajectory& trj, int radius, const std::vector& use_index) { + return create_mean_image( + create_stamps(stack, trj, radius, false /*=interpolate*/, true /*=keep_no_data*/, use_index)); + } + + + // For creating summed stamps, we do not interpolate the pixel values and replace NO_DATA + // 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, + const std::vector& use_index) { return create_summed_image( - create_stamps(stack, trj, radius, false /*=interpolate*/, false /*=keep_no_data*/, use_index)); -} + create_stamps(stack, trj, radius, false /*=interpolate*/, false /*=keep_no_data*/, use_index)); + } -std::vector StampCreator::get_coadded_stamps(ImageStack& stack, - std::vector& t_array, - std::vector>& use_index_vect, - const StampParameters& params, bool use_gpu) { + + std::vector StampCreator::get_coadded_stamps(ImageStack& stack, + std::vector& t_array, + std::vector>& use_index_vect, + const StampParameters& params, bool use_gpu) { if (use_gpu) { #ifdef HAVE_CUDA - return get_coadded_stamps_gpu(stack, t_array, use_index_vect, params); + return get_coadded_stamps_gpu(stack, t_array, use_index_vect, params); #else - std::cout << "WARNING: GPU is not enabled. Performing co-adds on the CPU."; + std::cout << "WARNING: GPU is not enabled. Performing co-adds on the CPU."; #endif } return get_coadded_stamps_cpu(stack, t_array, use_index_vect, params); -} + } + -std::vector StampCreator::get_coadded_stamps_cpu(ImageStack& stack, - std::vector& t_array, - std::vector>& use_index_vect, - const StampParameters& params) { + std::vector StampCreator::get_coadded_stamps_cpu(ImageStack& stack, + std::vector& t_array, + std::vector>& use_index_vect, + const StampParameters& params) { const int num_trajectories = t_array.size(); std::vector results(num_trajectories); - std::vector empty_pixels(1, NO_DATA); for (int i = 0; i < num_trajectories; ++i) { - std::vector stamps = - StampCreator::create_stamps(stack, t_array[i], params.radius, false, true, use_index_vect[i]); - - RawImage coadd(1, 1); - switch (params.stamp_type) { - case STAMP_MEDIAN: - coadd = create_median_image(stamps); - break; - case STAMP_MEAN: - coadd = create_mean_image(stamps); - break; - case STAMP_SUM: - coadd = create_summed_image(stamps); - break; - default: - throw std::runtime_error("Invalid stamp coadd type."); - } - - // Do the filtering if needed. - if (params.do_filtering && filter_stamp(coadd, params)) { - results[i] = RawImage(1, 1, empty_pixels); - } else { - results[i] = coadd; - } + std::vector stamps = + StampCreator::create_stamps(stack, t_array[i], params.radius, false, true, use_index_vect[i]); + + RawImage coadd(1, 1); + switch (params.stamp_type) { + case STAMP_MEDIAN: + coadd = create_median_image(stamps); + break; + case STAMP_MEAN: + coadd = create_mean_image(stamps); + break; + case STAMP_SUM: + coadd = create_summed_image(stamps); + break; + default: + throw std::runtime_error("Invalid stamp coadd type."); + } + + // Do the filtering if needed. + if (params.do_filtering && filter_stamp(coadd, params)) { + results[i] = RawImage(1, 1, NO_DATA); + } else { + results[i] = coadd; + } } return results; -} + } + -bool StampCreator::filter_stamp(const RawImage& img, const StampParameters& params) { + bool StampCreator::filter_stamp(const RawImage& img, const StampParameters& params) { // Allocate space for the coadd information and initialize to zero. const int stamp_width = 2 * params.radius + 1; const int stamp_ppi = stamp_width * stamp_width; - const std::vector& pixels = img.get_pixels(); + // this ends up being something like eigen::vector1f something, not vector + // but it behaves in all the same ways so just let it figure it out itself + const auto& pixels = img.get_image().reshaped(); // Filter on the peak's position. - PixelPos pos = img.find_peak(true); - if ((abs(pos.x - params.radius) >= params.peak_offset_x) || - (abs(pos.y - params.radius) >= params.peak_offset_y)) { - return true; + Index idx = img.find_peak(true); + if ((abs(idx.i - params.radius) >= params.peak_offset_x) || + (abs(idx.j - params.radius) >= params.peak_offset_y)) { + return true; } // Filter on the percentage of flux in the central pixel. if (params.center_thresh > 0.0) { - const std::vector& pixels = img.get_pixels(); - float center_val = pixels[(int)pos.y * stamp_width + (int)pos.x]; - float pixel_sum = 0.0; - for (int p = 0; p < stamp_ppi; ++p) { - pixel_sum += pixels[p]; - } - - if (center_val / pixel_sum < params.center_thresh) { - return true; - } + const auto& pixels = img.get_image().reshaped(); + float center_val = pixels[idx.j * stamp_width + idx.i]; + float pixel_sum = 0.0; + for (int p = 0; p < stamp_ppi; ++p) { + pixel_sum += pixels[p]; + } + + if (center_val / pixel_sum < params.center_thresh) { + return true; + } } // Filter on the image moments. @@ -156,19 +164,20 @@ bool StampCreator::filter_stamp(const RawImage& img, const StampParameters& para if ((fabs(moments.m01) >= params.m01_limit) || (fabs(moments.m10) >= params.m10_limit) || (fabs(moments.m11) >= params.m11_limit) || (moments.m02 >= params.m02_limit) || (moments.m20 >= params.m20_limit)) { - return true; + return true; } return false; -} + } -std::vector StampCreator::get_coadded_stamps_gpu(ImageStack& stack, - std::vector& t_array, - std::vector>& use_index_vect, - const StampParameters& params) { + + std::vector StampCreator::get_coadded_stamps_gpu(ImageStack& stack, + std::vector& t_array, + std::vector>& use_index_vect, + const StampParameters& params) { // Right now only limited stamp sizes are allowed. if (2 * params.radius + 1 > MAX_STAMP_EDGE || params.radius <= 0) { - throw std::runtime_error("Invalid Radius."); + throw std::runtime_error("Invalid Radius."); } const int num_images = stack.img_count(); @@ -190,28 +199,29 @@ std::vector StampCreator::get_coadded_stamps_gpu(ImageStack& stack, // Do the co-adds. #ifdef HAVE_CUDA std::vector data_refs; - data_refs.resize(num_images); - for (unsigned t=0; t StampCreator::get_coadded_stamps_gpu(ImageStack& stack, // Copy the stamps into RawImages and do the filtering. std::vector results(num_trajectories); std::vector current_pixels(stamp_ppi, 0.0); - std::vector empty_pixels(1, NO_DATA); for (int t = 0; t < num_trajectories; ++t) { - // Copy the data into a single RawImage. - int offset = t * stamp_ppi; - for (unsigned p = 0; p < stamp_ppi; ++p) { - current_pixels[p] = stamp_data[offset + p]; - } - RawImage current_image = RawImage(stamp_width, stamp_width, current_pixels); - - if (params.do_filtering && filter_stamp(current_image, params)) { - results[t] = RawImage(1, 1, empty_pixels); - } else { - results[t] = RawImage(stamp_width, stamp_width, current_pixels); - } + // Copy the data into a single RawImage. + int offset = t * stamp_ppi; + for (unsigned p = 0; p < stamp_ppi; ++p) { + current_pixels[p] = stamp_data[offset + p]; + } + // can't we just assign this in else instead of making a new one? In + // original code we created a new one. I can't see the difference but + // maybe I'm missing something + // This is also 7 layers of pain because this should probably be a RawImage + // but can't because all of the things that could be functions are methods + // on RawImage + Image tmp = Eigen::Map(current_pixels.data(), stamp_width, stamp_width); + RawImage current_image = RawImage(tmp); + + if (params.do_filtering && filter_stamp(current_image, params)) { + results[t] = RawImage(1, 1, NO_DATA); + } else { + results[t] = current_image; + } } return results; -} - + } + + #ifdef Py_PYTHON_H -static void stamp_creator_bindings(py::module& m) { + static void stamp_creator_bindings(py::module& m) { using sc = search::StampCreator; py::class_(m, "StampCreator", pydocs::DOC_StampCreator) - .def(py::init<>()) - .def_static("get_stamps", &sc::get_stamps, pydocs::DOC_StampCreator_get_stamps) - .def_static("get_median_stamp", &sc::get_median_stamp, pydocs::DOC_StampCreator_get_median_stamp) - .def_static("get_mean_stamp", &sc::get_mean_stamp, pydocs::DOC_StampCreator_get_mean_stamp) - .def_static("get_summed_stamp", &sc::get_summed_stamp, pydocs::DOC_StampCreator_get_summed_stamp) - .def_static("get_coadded_stamps", &sc::get_coadded_stamps, pydocs::DOC_StampCreator_get_coadded_stamps) - .def_static("filter_stamp", &sc::filter_stamp, pydocs::DOC_StampCreator_filter_stamp); - -} + .def(py::init<>()) + .def_static("get_stamps", &sc::get_stamps, pydocs::DOC_StampCreator_get_stamps) + .def_static("get_median_stamp", &sc::get_median_stamp, pydocs::DOC_StampCreator_get_median_stamp) + .def_static("get_mean_stamp", &sc::get_mean_stamp, pydocs::DOC_StampCreator_get_mean_stamp) + .def_static("get_summed_stamp", &sc::get_summed_stamp, pydocs::DOC_StampCreator_get_summed_stamp) + .def_static("get_coadded_stamps", &sc::get_coadded_stamps, pydocs::DOC_StampCreator_get_coadded_stamps) + .def_static("filter_stamp", &sc::filter_stamp, pydocs::DOC_StampCreator_filter_stamp); + } #endif /* Py_PYTHON_H */ } /* namespace search */ diff --git a/tests/test_end_to_end.py b/tests/test_end_to_end.py index 83440002..200c6de9 100644 --- a/tests/test_end_to_end.py +++ b/tests/test_end_to_end.py @@ -13,6 +13,13 @@ from utils.utils_for_tests import get_absolute_demo_data_path +# this is the first test to actually test things like get_all_stamps from +# analysis utils. For now stamps have to be RawImages (because methods like +# interpolate and convolve are defined to work on RawImage and not as funciton) +# so it makes sense to duplicate all this functionality to return np arrays +# (instead of RawImages), but hopefully we can deduplicate all this by making +# these operations into functions and calling on the .image attribute +# apply_stamp_filter for example is literal copy of the C++ code in RawImage? class test_end_to_end(unittest.TestCase): def setUp(self): # Define the path for the data. @@ -57,7 +64,7 @@ def test_demo_defaults(self): rs = SearchRunner() keep = rs.run_search_from_config(self.input_parameters) self.assertGreaterEqual(keep.num_results(), 1) - self.assertEqual(keep.results[0].stamp.size, 441) + self.assertEqual(keep.results[0].stamp.shape, (21, 21)) @unittest.skipIf(not HAS_GPU, "Skipping test (no GPU detected)") def test_demo_config_file(self): @@ -69,7 +76,7 @@ def test_demo_config_file(self): overrides={"im_filepath": im_filepath}, ) self.assertGreaterEqual(keep.num_results(), 1) - self.assertEqual(keep.results[0].stamp.size, 441) + self.assertEqual(keep.results[0].stamp.shape, (21, 21)) @unittest.skipIf(not HAS_GPU, "Skipping test (no GPU detected)") def test_demo_stamp_size(self): @@ -81,11 +88,11 @@ def test_demo_stamp_size(self): self.assertGreaterEqual(keep.num_results(), 1) self.assertIsNotNone(keep.results[0].stamp) - self.assertEqual(keep.results[0].stamp.size, 961) + self.assertEqual(keep.results[0].stamp.shape, (31, 31)) self.assertIsNotNone(keep.results[0].all_stamps) for s in keep.results[0].all_stamps: - self.assertEqual(s.size, 961) + self.assertEqual(s.shape, (31, 31)) @unittest.skipIf(not HAS_GPU, "Skipping test (no GPU detected)") def test_e2e_work_unit(self): diff --git a/tests/test_search.py b/tests/test_search.py index 2da6e8f6..cf8a4162 100644 --- a/tests/test_search.py +++ b/tests/test_search.py @@ -597,22 +597,22 @@ def test_coadd_cpu(self): summedStamps = StampCreator.get_coadded_stamps( self.search.get_imagestack(), [self.trj], [self.all_valid], params, False ) - self.assertEqual(summedStamps[0].get_width(), 2 * params.radius + 1) - self.assertEqual(summedStamps[0].get_height(), 2 * params.radius + 1) + self.assertEqual(summedStamps[0].width, 2 * params.radius + 1) + self.assertEqual(summedStamps[0].height, 2 * params.radius + 1) params.stamp_type = StampType.STAMP_MEAN meanStamps = StampCreator.get_coadded_stamps( self.search.get_imagestack(), [self.trj], [self.all_valid], params, False ) - self.assertEqual(meanStamps[0].get_width(), 2 * params.radius + 1) - self.assertEqual(meanStamps[0].get_height(), 2 * params.radius + 1) + self.assertEqual(meanStamps[0].width, 2 * params.radius + 1) + self.assertEqual(meanStamps[0].height, 2 * params.radius + 1) params.stamp_type = StampType.STAMP_MEDIAN medianStamps = StampCreator.get_coadded_stamps( self.search.get_imagestack(), [self.trj], [self.all_valid], params, False ) - self.assertEqual(medianStamps[0].get_width(), 2 * params.radius + 1) - self.assertEqual(medianStamps[0].get_height(), 2 * params.radius + 1) + self.assertEqual(medianStamps[0].width, 2 * params.radius + 1) + self.assertEqual(medianStamps[0].height, 2 * params.radius + 1) # Compute the true summed and mean pixels for all of the pixels in the stamp. times = self.stack.build_zeroed_times() @@ -654,22 +654,22 @@ def test_coadd_gpu(self): summedStamps = StampCreator.get_coadded_stamps( self.search.get_imagestack(), [self.trj], [self.all_valid], params, True ) - self.assertEqual(summedStamps[0].get_width(), 2 * params.radius + 1) - self.assertEqual(summedStamps[0].get_height(), 2 * params.radius + 1) + self.assertEqual(summedStamps[0].width, 2 * params.radius + 1) + self.assertEqual(summedStamps[0].height, 2 * params.radius + 1) params.stamp_type = StampType.STAMP_MEAN meanStamps = StampCreator.get_coadded_stamps( self.search.get_imagestack(), [self.trj], [self.all_valid], params, True ) - self.assertEqual(meanStamps[0].get_width(), 2 * params.radius + 1) - self.assertEqual(meanStamps[0].get_height(), 2 * params.radius + 1) + self.assertEqual(meanStamps[0].width, 2 * params.radius + 1) + self.assertEqual(meanStamps[0].height, 2 * params.radius + 1) params.stamp_type = StampType.STAMP_MEDIAN medianStamps = StampCreator.get_coadded_stamps( self.search.get_imagestack(), [self.trj], [self.all_valid], params, True ) - self.assertEqual(medianStamps[0].get_width(), 2 * params.radius + 1) - self.assertEqual(medianStamps[0].get_height(), 2 * params.radius + 1) + self.assertEqual(medianStamps[0].width, 2 * params.radius + 1) + self.assertEqual(medianStamps[0].height, 2 * params.radius + 1) # Compute the true summed and mean pixels for all of the pixels in the stamp. times = self.stack.build_zeroed_times() @@ -767,7 +767,7 @@ def test_coadd_gpu_use_inds(self): # Compute the stacked science (summed and mean) from a single Trajectory. meanStamps = StampCreator.get_coadded_stamps( - self.search.get_imagestack(), [self.trj, trj2, trj3, trj4], all_valid_vect, self.params, False + self.search.get_imagestack(), [self.trj, self.trj], inds, params, True ) # Compute the true summed and mean pixels for all of the pixels in the stamp. @@ -866,8 +866,8 @@ def test_coadd_filter_gpu(self): # Compute the stacked science from a single Trajectory. all_valid_vect = [(self.all_valid) for i in range(4)] - meanStamps = self.search.get_coadded_stamps( - [self.trj, trj2, trj3, trj4], all_valid_vect, self.params, True + meanStamps = StampCreator.get_coadded_stamps( + self.search.get_imagestack(), [self.trj, trj2, trj3, trj4], all_valid_vect, self.params, True ) # The first and last are unfiltered diff --git a/tests/test_search_encode.py b/tests/test_search_encode.py index 10ebe54e..30ad4eb4 100644 --- a/tests/test_search_encode.py +++ b/tests/test_search_encode.py @@ -53,12 +53,12 @@ def setUp(self): for i in range(self.imCount): time = i / self.imCount im = LayeredImage( - str(i), self.dim_x, self.dim_y, self.noise_level, self.variance, time, self.p, i + str(i), self.dim_y, self.dim_x, self.noise_level, self.variance, time, self.p, i ) add_fake_object( im, - self.start_x + time * self.vxel + 0.5, self.start_y + time * self.vyel + 0.5, + self.start_x + time * self.vxel + 0.5, self.object_flux, self.p, ) diff --git a/tests/test_search_filter.py b/tests/test_search_filter.py index 62e4da1d..3137955b 100644 --- a/tests/test_search_filter.py +++ b/tests/test_search_filter.py @@ -53,12 +53,12 @@ def setUp(self): for i in range(self.imCount): time = i / self.imCount im = LayeredImage( - str(i), self.dim_x, self.dim_y, self.noise_level, self.variance, time, self.p, i + str(i), self.dim_y, self.dim_x, self.noise_level, self.variance, time, self.p, i ) add_fake_object( im, - self.start_x + time * self.vxel + 0.5, self.start_y + time * self.vyel + 0.5, + self.start_x + time * self.vxel + 0.5, self.object_flux, self.p, )