def test_cutoff_mask_does_nothing_grow(): cutoff_mask, _ = util.create_cutoff_mask( dummy_image, cutoff=65500, grow=True ) healed_image = util.bfixpix(dummy_image, cutoff_mask, retdat=True) assert np.sum(healed_image) == dummy_sum
twodspec.add_arc( os.path.join(HERE, "test_data", "v_a_20180810_13_1_0_1.fits.gz[10]")) # Create some bad data some_bad_data = copy.copy(image_fits.data) len_x, len_y = image_fits.data.shape random_x = np.random.choice(np.arange(len_x), size=10, replace=False) random_y = np.random.choice(np.arange(len_y), size=10, replace=False) for i, j in zip(random_x, random_y): some_bad_data[i, j] += 1e10 # Add a bad pixel on the spectrum some_bad_data[130, 500] += 1e10 cmask, _ = util.create_cutoff_mask(image_fits.data, cutoff=1000) bmask, _ = util.create_bad_pixel_mask(image_fits.data) bad_mask = bmask & bmask def test_add_bad_pixel_mask_numpy_array(): twodspec = spectral_reduction.TwoDSpec(log_file_name=None) twodspec.add_bad_mask(bad_mask) def test_add_bad_pixel_mask_hdu(): twodspec = spectral_reduction.TwoDSpec(log_file_name=None) twodspec.add_bad_mask(fits.ImageHDU(bad_mask.astype("int"))) def test_add_bad_pixel_mask_hdu_list():
def test_cutoff_mask_list_grow(): cutoff_mask, _ = util.create_cutoff_mask( dummy_image, cutoff=[0, 1000], grow=True ) healed_image = util.bfixpix(dummy_image, cutoff_mask, retdat=True) assert np.sum(healed_image) == np.size(dummy_image)
def test_cutoff_mask_expect_fail_str(): util.create_cutoff_mask(dummy_image, cutoff="10")
def test_cutoff_mask_expect_fail_list(): util.create_cutoff_mask(dummy_image, cutoff=[0, 1000, 60000])
def test_cutoff_mask_1D_array(): util.create_cutoff_mask(np.ones(100))
def test_cutoff_mask(): cutoff_mask, _ = util.create_cutoff_mask(dummy_image, cutoff=60000) healed_image = util.bfixpix(dummy_image, cutoff_mask, retdat=True) assert np.sum(healed_image) == np.size(dummy_image)