Ejemplo n.º 1
0
    def test_waffle_center_even(self) -> None:

        module = WaffleCenteringModule(size=2.,
                                       center=(50, 50),
                                       name_in='waffle_even',
                                       image_in_tag='star_even',
                                       center_in_tag='waffle_even',
                                       image_out_tag='center_even',
                                       radius=42.5,
                                       pattern='x',
                                       sigma=0.135)

        self.pipeline.add_module(module)
        self.pipeline.run_module('waffle_even')

        data = self.pipeline.get_data('star_even')
        assert np.allclose(data[0, 49, 49], 0.08406157361512759, rtol=limit, atol=0.)
        assert np.allclose(data[0, 49, 50], 0.08406157361512759, rtol=limit, atol=0.)
        assert np.allclose(data[0, 50, 49], 0.08406157361512759, rtol=limit, atol=0.)
        assert np.allclose(data[0, 50, 50], 0.08406157361512759, rtol=limit, atol=0.)

        data = self.pipeline.get_data('center_even')
        assert np.allclose(data[0, 37, 37], 0.09778822940550569, rtol=limit, atol=0.)
        assert np.allclose(np.mean(data), 0.00017777777777778643, rtol=limit, atol=0.)
        assert data.shape == (10, 75, 75)

        attribute = self.pipeline.get_attribute('center_even', 'History: WaffleCenteringModule')
        assert attribute == '[x, y] = [49.5, 49.5]'
Ejemplo n.º 2
0
    def test_waffle_center_odd(self) -> None:

        module = WaffleCenteringModule(size=2.,
                                       center=(50, 50),
                                       name_in='waffle_odd',
                                       image_in_tag='star_odd',
                                       center_in_tag='waffle_odd',
                                       image_out_tag='center_odd',
                                       radius=42.5,
                                       pattern='x',
                                       sigma=0.135)

        self.pipeline.add_module(module)
        self.pipeline.run_module('waffle_odd')

        data = self.pipeline.get_data('star_odd')
        assert np.allclose(data[0, 50, 50], 0.09806026673451182, rtol=limit, atol=0.)

        data = self.pipeline.get_data('center_odd')
        assert np.allclose(data[0, 37, 37], 0.0980602667345118, rtol=limit, atol=0.)
        assert np.allclose(np.mean(data), 0.00017777777777778643, rtol=limit, atol=0.)
        assert data.shape == (10, 75, 75)

        attribute = self.pipeline.get_attribute('center_odd', 'History: WaffleCenteringModule')
        assert attribute == '[x, y] = [50.0, 50.0]'
Ejemplo n.º 3
0
    def test_waffle_center_even(self):

        waffle = WaffleCenteringModule(size=2.,
                                       center=(50, 50),
                                       name_in="waffle_even",
                                       image_in_tag="star_even",
                                       center_in_tag="waffle_even",
                                       image_out_tag="center_even",
                                       radius=42.5,
                                       pattern="x",
                                       sigma=0.135)

        self.pipeline.add_module(waffle)
        self.pipeline.run_module("waffle_even")

        data = self.pipeline.get_data("star_even")
        assert np.allclose(data[0, 49, 49], 0.08406157361512759, rtol=limit, atol=0.)
        assert np.allclose(data[0, 49, 50], 0.08406157361512759, rtol=limit, atol=0.)
        assert np.allclose(data[0, 50, 49], 0.08406157361512759, rtol=limit, atol=0.)
        assert np.allclose(data[0, 50, 50], 0.08406157361512759, rtol=limit, atol=0.)

        data = self.pipeline.get_data("center_even")
        assert np.allclose(data[0, 37, 37], 0.09778822940550569, rtol=limit, atol=0.)
        assert np.allclose(np.mean(data), 0.00017777777777778643, rtol=limit, atol=0.)
        assert data.shape == (10, 75, 75)

        attribute = self.pipeline.get_attribute("center_even", "History: Waffle centering")
        assert attribute == "position [x, y] = [49.5, 49.5]"
Ejemplo n.º 4
0
    def test_waffle_center_odd(self):

        waffle = WaffleCenteringModule(size=2.,
                                       center=(50, 50),
                                       name_in="waffle_odd",
                                       image_in_tag="star_odd",
                                       center_in_tag="waffle_odd",
                                       image_out_tag="center_odd",
                                       radius=42.5,
                                       pattern="x",
                                       sigma=0.135)

        self.pipeline.add_module(waffle)
        self.pipeline.run_module("waffle_odd")

        data = self.pipeline.get_data("star_odd")
        assert np.allclose(data[0, 50, 50], 0.09806026673451182, rtol=limit, atol=0.)

        data = self.pipeline.get_data("center_odd")
        assert np.allclose(data[0, 37, 37], 0.0980602667345118, rtol=limit, atol=0.)
        assert np.allclose(np.mean(data), 0.00017777777777778643, rtol=limit, atol=0.)
        assert data.shape == (10, 75, 75)

        attribute = self.pipeline.get_attribute("center_odd", "History: Waffle centering")
        assert attribute == "position [x, y] = [50.0, 50.0]"
Ejemplo n.º 5
0
    def test_waffle_center_odd(self) -> None:

        module = AddLinesModule(name_in='add',
                                image_in_tag='star',
                                image_out_tag='star_add',
                                lines=(45, 45, 45, 45))

        self.pipeline.add_module(module)
        self.pipeline.run_module('add')

        data = self.pipeline.get_data('star_add')
        assert np.sum(data) == pytest.approx(105.54278879805278,
                                             rel=self.limit,
                                             abs=0.)
        assert data.shape == (10, 101, 101)

        module = WaffleCenteringModule(size=0.2,
                                       center=(50, 50),
                                       name_in='waffle',
                                       image_in_tag='star_add',
                                       center_in_tag='waffle',
                                       image_out_tag='center',
                                       radius=35.,
                                       pattern='x',
                                       sigma=0.05)

        self.pipeline.add_module(module)

        with pytest.warns(DeprecationWarning) as warning:
            self.pipeline.run_module('waffle')

        assert len(warning) == 1

        assert warning[0].message.args[0] == 'The \'pattern\' parameter will be deprecated in a ' \
                                             'future release. Please Use the \'angle\' ' \
                                             'parameter instead and set it to 45.0 degrees.'

        data = self.pipeline.get_data('center')
        assert np.sum(data) == pytest.approx(104.93318507061295,
                                             rel=self.limit,
                                             abs=0.)
        assert data.shape == (10, 9, 9)

        attr = self.pipeline.get_attribute('center',
                                           'History: WaffleCenteringModule')
        assert attr == '[x, y] = [50.0, 50.0]'
Ejemplo n.º 6
0
    def test_waffle_center_even(self) -> None:

        module = AddLinesModule(name_in='add1',
                                image_in_tag='star_add',
                                image_out_tag='star_even',
                                lines=(0, 1, 0, 1))

        self.pipeline.add_module(module)
        self.pipeline.run_module('add1')

        data = self.pipeline.get_data('star_even')
        assert np.sum(data) == pytest.approx(105.54278879805275,
                                             rel=self.limit,
                                             abs=0.)
        assert data.shape == (10, 102, 102)

        module = AddLinesModule(name_in='add2',
                                image_in_tag='waffle',
                                image_out_tag='waffle_even',
                                lines=(0, 1, 0, 1))

        self.pipeline.add_module(module)
        self.pipeline.run_module('add2')

        data = self.pipeline.get_data('waffle_even')
        assert np.sum(data) == pytest.approx(4.000000000000195,
                                             rel=self.limit,
                                             abs=0.)
        assert data.shape == (1, 102, 102)

        module = ShiftImagesModule(shift_xy=(0.5, 0.5),
                                   interpolation='spline',
                                   name_in='shift3',
                                   image_in_tag='star_even',
                                   image_out_tag='star_shift')

        self.pipeline.add_module(module)
        self.pipeline.run_module('shift3')

        data = self.pipeline.get_data('star_shift')
        assert np.sum(data) == pytest.approx(105.54278879805274,
                                             rel=self.limit,
                                             abs=0.)
        assert data.shape == (10, 102, 102)

        module = ShiftImagesModule(shift_xy=(0.5, 0.5),
                                   interpolation='spline',
                                   name_in='shift4',
                                   image_in_tag='waffle_even',
                                   image_out_tag='waffle_shift')

        self.pipeline.add_module(module)
        self.pipeline.run_module('shift4')

        data = self.pipeline.get_data('waffle_shift')
        assert np.sum(data) == pytest.approx(4.000000000000194,
                                             rel=self.limit,
                                             abs=0.)
        assert data.shape == (1, 102, 102)

        module = WaffleCenteringModule(size=0.2,
                                       center=(50, 50),
                                       name_in='waffle_even',
                                       image_in_tag='star_shift',
                                       center_in_tag='waffle_shift',
                                       image_out_tag='center_even',
                                       radius=35.,
                                       pattern='x',
                                       sigma=0.05)

        self.pipeline.add_module(module)

        with pytest.warns(DeprecationWarning) as warning:
            self.pipeline.run_module('waffle_even')

        assert len(warning) == 1

        assert warning[0].message.args[0] == 'The \'pattern\' parameter will be deprecated in a ' \
                                             'future release. Please Use the \'angle\' ' \
                                             'parameter instead and set it to 45.0 degrees.'

        data = self.pipeline.get_data('center_even')
        assert np.sum(data) == pytest.approx(105.22695036281449,
                                             rel=self.limit,
                                             abs=0.)
        assert data.shape == (10, 9, 9)

        attr = self.pipeline.get_attribute('center_even',
                                           'History: WaffleCenteringModule')
        assert attr == '[x, y] = [50.5, 50.5]'