def test_fit_center_full(self) -> None: module = FitCenterModule(name_in='fit1', image_in_tag='shift', fit_out_tag='fit_full', mask_out_tag='mask', method='full', mask_radii=(None, 0.1), sign='positive', model='gaussian', guess=(1., 2., 3., 3., 0.01, 0., 0.)) self.pipeline.add_module(module) self.pipeline.run_module('fit1') data = self.pipeline.get_data('fit_full') assert np.mean(data[:, 0]) == pytest.approx(0.94, rel=0., abs=0.01) assert np.mean(data[:, 2]) == pytest.approx(2.07, rel=0., abs=0.01) assert np.mean(data[:, 4]) == pytest.approx(0.08, rel=0., abs=0.01) assert np.mean(data[:, 6]) == pytest.approx(0.08, rel=0., abs=0.01) assert np.mean(data[:, 8]) == pytest.approx(0.24, rel=0., abs=0.01) assert data.shape == (10, 14) data = self.pipeline.get_data('mask') assert np.sum(data) == pytest.approx(103.45599730750453, rel=self.limit, abs=0.) assert data.shape == (10, 18, 18)
def test_fit_center_full(self) -> None: module = FitCenterModule(name_in='fit1', image_in_tag='shift', fit_out_tag='fit_full', mask_out_tag='mask', method='full', radius=0.05, sign='positive', model='gaussian', guess=(6., 4., 3., 3., 0.01, 0., 0.)) self.pipeline.add_module(module) self.pipeline.run_module('fit1') data = self.pipeline.get_data('fit_full') assert np.allclose(np.mean(data[:, 0]), 5.999068486622676, rtol=1e-3, atol=0.) assert np.allclose(np.mean(data[:, 2]), 4.000055166165185, rtol=1e-3, atol=0.) assert np.allclose(np.mean(data[:, 4]), 0.08106141046470318, rtol=1e-3, atol=0.) assert np.allclose(np.mean(data[:, 6]), 0.0810026137349896, rtol=1e-3, atol=0.) assert np.allclose(np.mean(data[:, 8]), 0.024462594420743763, rtol=1e-3, atol=0.) assert np.allclose(np.mean(data[:, 12]), 3.0281141786814477e-05, rtol=1e-3, atol=0.) assert data.shape == (40, 14) data = self.pipeline.get_data('mask') assert np.allclose(data[0, 43, 45], 0.023556628129942764, rtol=limit, atol=0.) assert np.allclose(data[0, 43, 55], 0.0, rtol=limit, atol=0.) assert np.allclose(np.mean(data), 0.00010827527282995305, rtol=limit, atol=0.) assert data.shape == (40, 78, 78)
def test_fit_center_full(self): module = FitCenterModule(name_in='fit1', image_in_tag='shift', fit_out_tag='fit_full', mask_out_tag='mask', method='full', radius=0.05, sign='positive', model='gaussian', guess=(6., 4., 3., 3., 0.01, 0., 0.)) self.pipeline.add_module(module) self.pipeline.run_module('fit1') data = self.pipeline.get_data('fit_full') assert np.allclose(data[0, 0], 5.997834332959175, rtol=limit, atol=0.) assert np.allclose(np.mean(data), 13.202402625344051, rtol=1e-4, atol=0.) assert data.shape == (40, 14) data = self.pipeline.get_data('mask') assert np.allclose(data[0, 43, 45], 0.023556628129942764, rtol=limit, atol=0.) assert np.allclose(data[0, 43, 55], 0.0, rtol=limit, atol=0.) assert np.allclose(np.mean(data), 0.00010827527282995305, rtol=limit, atol=0.) assert data.shape == (40, 78, 78)
def test_fit_center_mean(self): module = FitCenterModule(name_in='fit2', image_in_tag='shift', fit_out_tag='fit_mean', mask_out_tag=None, method='mean', radius=0.05, sign='positive', model='moffat', guess=(6., 4., 3., 3., 0.01, 0., 0., 1.)) self.pipeline.add_module(module) self.pipeline.run_module('fit2') data = self.pipeline.get_data('fit_mean') assert np.allclose(np.mean(data[:, 0]), 5.999072568941366, rtol=1e-3, atol=0.) assert np.allclose(np.mean(data[:, 2]), 4.000051869708742, rtol=1e-3, atol=0.) assert np.allclose(np.mean(data[:, 4]), 0.08384036587023312, rtol=1e-3, atol=0.) assert np.allclose(np.mean(data[:, 6]), 0.08379313488754872, rtol=1e-3, atol=0.) assert np.allclose(np.mean(data[:, 8]), 0.025631328037795074, rtol=1e-3, atol=0.) assert np.allclose(np.mean(data[:, 12]), -0.0011275279023032867, rtol=1e-3, atol=0.) assert data.shape == (40, 16)
def test_fit_center_mean(self) -> None: module = FitCenterModule(name_in='fit2', image_in_tag='shift', fit_out_tag='fit_mean', mask_out_tag=None, method='mean', mask_radii=(None, 0.1), sign='positive', model='moffat', guess=(1., 2., 3., 3., 0.01, 0., 0., 1.)) self.pipeline.add_module(module) self.pipeline.run_module('fit2') data = self.pipeline.get_data('fit_mean') assert np.mean(data[:, 0]) == pytest.approx(0.94, rel=0., abs=0.01) assert np.mean(data[:, 2]) == pytest.approx(2.06, rel=0., abs=0.01) assert np.mean(data[:, 4]) == pytest.approx(0.08, rel=0., abs=0.01) assert np.mean(data[:, 6]) == pytest.approx(0.08, rel=0., abs=0.01) assert np.mean(data[:, 8]) == pytest.approx(0.24, rel=0., abs=0.01) assert data.shape == (10, 16)
def test_fit_center_mean(self): module = FitCenterModule(name_in='fit2', image_in_tag='shift', fit_out_tag='fit_mean', mask_out_tag=None, method='mean', radius=0.05, sign='positive', model='moffat', guess=(6., 4., 3., 3., 0.01, 0., 0., 1.)) self.pipeline.add_module(module) self.pipeline.run_module('fit2') data = self.pipeline.get_data('fit_mean') assert np.allclose(data[0, 0], 5.999072568941366, rtol=limit, atol=0.) assert np.allclose(np.mean(data), 14.525054620661948, rtol=1e-4, atol=0.) assert data.shape == (40, 16)