diff --git a/lib/libcfitsio.a b/lib/libcfitsio.a deleted file mode 100644 index 6d79f323..00000000 Binary files a/lib/libcfitsio.a and /dev/null differ diff --git a/src/kbmod/search/image_stack.cpp b/src/kbmod/search/image_stack.cpp index ea64ce36..c8e13b5b 100644 --- a/src/kbmod/search/image_stack.cpp +++ b/src/kbmod/search/image_stack.cpp @@ -144,33 +144,6 @@ void ImageStack::clear_from_gpu() { data_on_gpu = false; } -RawImage ImageStack::make_global_mask(int flags, int threshold) { - uint64_t npixels = get_npixels(); - - // Start with an empty global mask. - RawImage global_mask = RawImage(width, height); - global_mask.set_all(0.0); - - // For each pixel count the number of images where it is masked. - std::vector counts(npixels, 0); - for (unsigned int img = 0; img < images.size(); ++img) { - auto imgMask = images[img].get_mask().get_image().reshaped(); - - // Count the number of times a pixel has any of the given flags - for (uint64_t pixel = 0; pixel < npixels; ++pixel) { - if ((flags & static_cast(imgMask[pixel])) != 0) counts[pixel]++; - } - } - - // Set all pixels below threshold to 0 and all above to 1 - auto global_m = global_mask.get_image().reshaped(); - for (uint64_t p = 0; p < npixels; ++p) { - global_m[p] = counts[p] < threshold ? 0.0 : 1.0; - } - - return global_mask; -} - #ifdef Py_PYTHON_H static void image_stack_bindings(py::module& m) { using is = search::ImageStack; @@ -194,7 +167,6 @@ static void image_stack_bindings(py::module& m) { .def("build_zeroed_times", &is::build_zeroed_times, pydocs::DOC_ImageStack_build_zeroed_times) .def("sort_by_time", &is::sort_by_time, pydocs::DOC_ImageStack_sort_by_time) .def("img_count", &is::img_count, pydocs::DOC_ImageStack_img_count) - .def("make_global_mask", &is::make_global_mask, pydocs::DOC_ImageStack_make_global_mask) .def("convolve_psf", &is::convolve_psf, pydocs::DOC_ImageStack_convolve_psf) .def("get_width", &is::get_width, pydocs::DOC_ImageStack_get_width) .def("get_height", &is::get_height, pydocs::DOC_ImageStack_get_height) diff --git a/src/kbmod/search/image_stack.h b/src/kbmod/search/image_stack.h index 20c59abc..0eb5310d 100644 --- a/src/kbmod/search/image_stack.h +++ b/src/kbmod/search/image_stack.h @@ -47,9 +47,6 @@ class ImageStack { void convolve_psf(); - // Make and return a global mask. - RawImage make_global_mask(int flags, int threshold); - virtual ~ImageStack(); // Functions to handle transfering data to/from GPU. diff --git a/src/kbmod/search/pydocs/image_stack_docs.h b/src/kbmod/search/pydocs/image_stack_docs.h index b6f8344e..a500175c 100644 --- a/src/kbmod/search/pydocs/image_stack_docs.h +++ b/src/kbmod/search/pydocs/image_stack_docs.h @@ -130,27 +130,6 @@ static const auto DOC_ImageStack_sort_by_time = R"doc( Raises a ``RuntimeError`` if the input image is the data is currently on GPU. )doc"; -static const auto DOC_ImageStack_make_global_mask = R"doc( - Create a new global mask from a set of flags and a threshold. - The global mask marks a pixel as masked if and only if it is masked - by one of the given flags in at least ``threshold`` individual images. - The returned mask is binary. - - Parameters - ---------- - flags : `int` - A bit mask of mask flags to use when counting. - threshold : `int` - The minimum number of images in which a pixel must be masked to be - part of the global mask. - - Returns - ------- - global_mask : `RawImage` - A RawImage containing the global mask with 1 for masked pixels - and 0 for unmasked pixels. - )doc"; - static const auto DOC_ImageStack_convolve_psf = R"doc( Convolves each image (science and variance layers) with the PSF stored in the LayeredImage object. diff --git a/tests/test_image_stack.py b/tests/test_image_stack.py index a3eb346d..6ccade16 100644 --- a/tests/test_image_stack.py +++ b/tests/test_image_stack.py @@ -98,23 +98,6 @@ def test_times(self): for i in range(self.num_images): self.assertEqual(times[i], 2.0 * i) - def test_make_global_mask(self): - # Mask a single point in each image with flag=2. - for i in range(self.num_images): - self.images[i].get_mask().set_pixel(5, 5, 2) - - # Apply the global mask for flag=1 and a threshold of the bit set - # in at least one mask. Note this ignores flag=2 for the count. - mask = self.im_stack.make_global_mask(1, 1) - - # Check that the correct pixels are masked - for y in range(self.im_stack.get_height()): - for x in range(self.im_stack.get_width()): - if y == 10 and x >= 10 and x <= 10 + (self.num_images - 1): - self.assertEqual(mask.get_pixel(y, x), 1) - else: - self.assertEqual(mask.get_pixel(y, x), 0) - # WOW, this is the first test that caught the fact that interpolated_add # called add, and that add had flipped i and j by accident. The first one. # TODO: more clean understandable tests for basic functionality, these big