def test_psf_preparation(self) -> None: module = PSFpreparationModule(name_in='prep1', image_in_tag='science', image_out_tag='science_prep', mask_out_tag=None, norm=False, resize=None, cent_size=0.2, edge_size=1.0) self.pipeline.add_module(module) self.pipeline.run_module('prep1') data = self.pipeline.get_data('science_prep') assert np.allclose(data[0, 0, 0], 0.0, rtol=limit, atol=0.) assert np.allclose(data[0, 25, 25], 2.0926464668090656e-05, rtol=limit, atol=0.) assert np.allclose(data[0, 99, 99], 0.0, rtol=limit, atol=0.) assert np.allclose(np.mean(data), 4.534001223501053e-07, rtol=limit, atol=0.) assert data.shape == (80, 100, 100) module = PSFpreparationModule(name_in='prep2', image_in_tag='reference', image_out_tag='reference_prep', mask_out_tag=None, norm=False, resize=None, cent_size=0.2, edge_size=1.0) self.pipeline.add_module(module) self.pipeline.run_module('prep2') data = self.pipeline.get_data('reference_prep') assert np.allclose(data[0, 0, 0], 0.0, rtol=limit, atol=0.) assert np.allclose(data[0, 25, 25], 2.0926464668090656e-05, rtol=limit, atol=0.) assert np.allclose(data[0, 99, 99], 0.0, rtol=limit, atol=0.) assert np.allclose(np.mean(data), 1.227592050148539e-07, rtol=limit, atol=0.) assert data.shape == (40, 100, 100)
def test_psf_preparation(self): prep = PSFpreparationModule(name_in="prep1", image_in_tag="science", image_out_tag="science_prep", mask_out_tag=None, norm=False, resize=None, cent_size=0.2, edge_size=1.0) self.pipeline.add_module(prep) self.pipeline.run_module("prep1") data = self.pipeline.get_data("science_prep") assert np.allclose(data[0, 0, 0], 0.0, rtol=limit, atol=0.) assert np.allclose(data[0, 25, 25], 2.0926464668090656e-05, rtol=limit, atol=0.) assert np.allclose(data[0, 99, 99], 0.0, rtol=limit, atol=0.) assert np.allclose(np.mean(data), 4.534001223501053e-07, rtol=limit, atol=0.) assert data.shape == (80, 100, 100) prep = PSFpreparationModule(name_in="prep2", image_in_tag="reference", image_out_tag="reference_prep", mask_out_tag=None, norm=False, resize=None, cent_size=0.2, edge_size=1.0) self.pipeline.add_module(prep) self.pipeline.run_module("prep2") data = self.pipeline.get_data("reference_prep") assert np.allclose(data[0, 0, 0], 0.0, rtol=limit, atol=0.) assert np.allclose(data[0, 25, 25], 2.0926464668090656e-05, rtol=limit, atol=0.) assert np.allclose(data[0, 99, 99], 0.0, rtol=limit, atol=0.) assert np.allclose(np.mean(data), 1.227592050148539e-07, rtol=limit, atol=0.) assert data.shape == (40, 100, 100)
def test_psf_preparation_no_mask_out(self): prep = PSFpreparationModule(name_in="prep3", image_in_tag="read", image_out_tag="prep3", mask_out_tag=None, norm=False, cent_size=None, edge_size=None) self.pipeline.add_module(prep) self.pipeline.run_module("prep3") data = self.pipeline.get_data("prep3") assert np.allclose(data[0, 0, 0], 0.00032486907273264834, rtol=limit, atol=0.) assert np.allclose(data[0, 25, 25], 2.0926464668090656e-05, rtol=limit, atol=0.) assert np.allclose(data[0, 99, 99], -0.000287573978535779, rtol=limit, atol=0.) assert np.allclose(np.mean(data), 0.00010029494781738066, rtol=limit, atol=0.) assert data.shape == (40, 100, 100)
def test_psf_preparation_norm_mask(self): prep = PSFpreparationModule(name_in="prep1", image_in_tag="read", image_out_tag="prep1", mask_out_tag="mask1", norm=True, cent_size=0.1, edge_size=1.0) self.pipeline.add_module(prep) self.pipeline.run_module("prep1") data = self.pipeline.get_data("prep1") assert np.allclose(data[0, 0, 0], 0., rtol=limit, atol=0.) assert np.allclose(data[0, 99, 99], 0., rtol=limit, atol=0.) assert np.allclose(np.mean(data), 0.0001690382058762809, rtol=limit, atol=0.) assert data.shape == (40, 100, 100) data = self.pipeline.get_data("mask1") assert np.allclose(data[0, 0], 0., rtol=limit, atol=0.) assert np.allclose(data[99, 99], 0., rtol=limit, atol=0.) assert np.allclose(np.mean(data), 0.4268, rtol=limit, atol=0.) assert data.shape == (100, 100)
def test_psf_preparation_norm_mask(self) -> None: module = PSFpreparationModule(name_in='prep1', image_in_tag='read', image_out_tag='prep1', mask_out_tag='mask1', norm=True, cent_size=0.1, edge_size=1.0) self.pipeline.add_module(module) self.pipeline.run_module('prep1') data = self.pipeline.get_data('prep1') assert np.allclose(data[0, 0, 0], 0., rtol=limit, atol=0.) assert np.allclose(data[0, 99, 99], 0., rtol=limit, atol=0.) assert np.allclose(np.mean(data), 0.0001690382058762809, rtol=limit, atol=0.) assert data.shape == (40, 100, 100) data = self.pipeline.get_data('mask1') assert np.allclose(data[0, 0], 0., rtol=limit, atol=0.) assert np.allclose(data[99, 99], 0., rtol=limit, atol=0.) assert np.allclose(np.mean(data), 0.4268, rtol=limit, atol=0.) assert data.shape == (100, 100)
def test_psf_preparation_norm_resize_mask(self): prep = PSFpreparationModule(name_in="prep1", image_in_tag="read", image_out_tag="prep1", mask_out_tag="mask1", norm=True, resize=2., cent_size=0.1, edge_size=1.0) self.pipeline.add_module(prep) self.pipeline.run_module("prep1") data = self.pipeline.get_data("prep1") assert np.allclose(data[0, 0, 0], 0., rtol=limit, atol=0.) assert np.allclose(data[0, 25, 25], 0., rtol=limit, atol=0.) assert np.allclose(data[0, 99, 99], 0., rtol=limit, atol=0.) assert np.allclose(np.mean(data), 0.0001818623671899089, rtol=limit, atol=0.) assert data.shape == (40, 200, 200) data = self.pipeline.get_data("mask1") assert np.allclose(data[0, 0], 0., rtol=limit, atol=0.) assert np.allclose(data[120, 120], 1., rtol=limit, atol=0.) assert np.allclose(data[100, 100], 0., rtol=limit, atol=0.) assert np.allclose(np.mean(data), 0.1067, rtol=limit, atol=0.) assert data.shape == (200, 200)
def test_psf_preparation(self) -> None: module = PSFpreparationModule(name_in='prep1', image_in_tag='science', image_out_tag='science_prep', mask_out_tag=None, norm=False, resize=None, cent_size=0.05, edge_size=1.) self.pipeline.add_module(module) self.pipeline.run_module('prep1') data = self.pipeline.get_data('science_prep') assert np.sum(data) == pytest.approx(5.029285028467547, rel=self.limit, abs=0.) assert data.shape == (10, 21, 21) module = PSFpreparationModule(name_in='prep2', image_in_tag='reference', image_out_tag='reference_prep', mask_out_tag=None, norm=False, resize=None, cent_size=0.05, edge_size=1.) self.pipeline.add_module(module) self.pipeline.run_module('prep2') data = self.pipeline.get_data('reference_prep') assert np.sum(data) == pytest.approx(5.029285028467547, rel=self.limit, abs=0.) assert data.shape == (10, 21, 21)
def test_psf_preparation_sdi(self) -> None: module = PSFpreparationModule(name_in='prep4', image_in_tag='read_ifs', image_out_tag='prep4', mask_out_tag=None, norm=False, cent_size=None, edge_size=None) self.pipeline.add_module(module) self.pipeline.run_module('prep4') data = self.pipeline.get_data('prep4') assert np.sum(data) == pytest.approx(749.8396528807369, rel=self.limit, abs=0.) assert data.shape == (3, 10, 21, 21)
def test_psf_preparation_no_mask_out(self) -> None: module = PSFpreparationModule(name_in='prep3', image_in_tag='read', image_out_tag='prep3', mask_out_tag=None, norm=False, cent_size=None, edge_size=None) self.pipeline.add_module(module) self.pipeline.run_module('prep3') data = self.pipeline.get_data('prep3') assert np.sum(data) == pytest.approx(105.54278879805277, rel=self.limit, abs=0.) assert data.shape == (10, 11, 11)
def test_psf_preparation_norm_mask(self) -> None: module = PSFpreparationModule(name_in='prep1', image_in_tag='read', image_out_tag='prep1', mask_out_tag='mask1', norm=True, cent_size=0.1, edge_size=1.0) self.pipeline.add_module(module) self.pipeline.run_module('prep1') data = self.pipeline.get_data('prep1') assert np.sum(data) == pytest.approx(-1.5844830188044685, rel=self.limit, abs=0.) assert data.shape == (10, 11, 11) data = self.pipeline.get_data('mask1') assert np.sum(data) == pytest.approx(52, rel=self.limit, abs=0.) assert data.shape == (11, 11)