Exemple #1
0
    def test_remove_last_frame(self):

        last = RemoveLastFrameModule(name_in="last",
                                     image_in_tag="read",
                                     image_out_tag="last")

        self.pipeline.add_module(last)
        self.pipeline.run_module("last")

        data = self.pipeline.get_data("last")
        assert np.allclose(data[0, 50, 50], 0.09798413502193704, rtol=limit, atol=0.)
        assert np.allclose(np.mean(data), 0.00010020258903646778, rtol=limit, atol=0.)
        assert data.shape == (40, 100, 100)

        self.pipeline.set_attribute("last", "PARANG", np.arange(0., 40., 1.), static=False)

        star = np.zeros((40, 2))
        star[:, 0] = np.arange(40., 80., 1.)
        star[:, 1] = np.arange(40., 80., 1.)

        self.pipeline.set_attribute("last", "STAR_POSITION", star, static=False)

        attribute = self.pipeline.get_attribute("last", "PARANG", static=False)
        assert np.allclose(np.mean(attribute), 19.5, rtol=limit, atol=0.)
        assert attribute.shape == (40, )

        attribute = self.pipeline.get_attribute("last", "STAR_POSITION", static=False)
        assert np.allclose(np.mean(attribute), 59.5, rtol=limit, atol=0.)
        assert attribute.shape == (40, 2)
    def test_remove_last_frame(self) -> None:

        module = RemoveLastFrameModule(name_in='last',
                                       image_in_tag='read',
                                       image_out_tag='last')

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

        data = self.pipeline.get_data('last')
        assert np.sum(data) == pytest.approx(84.68885503527224,
                                             rel=self.limit,
                                             abs=0.)
        assert data.shape == (8, 11, 11)

        self.pipeline.set_attribute('last',
                                    'PARANG',
                                    np.arange(8.),
                                    static=False)
        self.pipeline.set_attribute('last',
                                    'STAR_POSITION',
                                    np.full((8, 2), 5.),
                                    static=False)

        attr = self.pipeline.get_attribute('last', 'PARANG', static=False)
        assert np.sum(attr) == pytest.approx(28., rel=self.limit, abs=0.)
        assert attr.shape == (8, )

        attr = self.pipeline.get_attribute('last',
                                           'STAR_POSITION',
                                           static=False)
        assert np.sum(attr) == pytest.approx(80., rel=self.limit, abs=0.)
        assert attr.shape == (8, 2)
Exemple #3
0
    def test_remove_last(self):

        remove_last = RemoveLastFrameModule(name_in="last_frame",
                                            image_in_tag="im_arr",
                                            image_out_tag="im_arr_last")

        self.pipeline.add_module(remove_last)
        self.pipeline.run_module("last_frame")

        data = self.pipeline.get_data("im_arr_last")
        assert np.allclose(data[0, 61, 39],
                           -0.00022889163546536875,
                           rtol=limit,
                           atol=0.)
        assert data.shape == (78, 102, 100)