Exemple #1
0
    def test_nodding_background(self) -> None:

        module = StackCubesModule(name_in='mean',
                                  image_in_tag='sky',
                                  image_out_tag='mean',
                                  combine='mean')

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

        data = self.pipeline.get_data('mean')
        assert np.sum(data) == pytest.approx(21.108557759610548, rel=self.limit, abs=0.)
        assert data.shape == (2, 11, 11)

        attr = self.pipeline.get_attribute('mean', 'INDEX', static=False)
        assert np.sum(attr) == pytest.approx(1, rel=self.limit, abs=0.)
        assert attr.shape == (2, )

        attr = self.pipeline.get_attribute('mean', 'NFRAMES', static=False)
        assert np.sum(attr) == pytest.approx(2, rel=self.limit, abs=0.)
        assert attr.shape == (2, )

        module = NoddingBackgroundModule(name_in='nodding',
                                         sky_in_tag='mean',
                                         science_in_tag='science',
                                         image_out_tag='nodding',
                                         mode='both')

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

        data = self.pipeline.get_data('nodding')
        assert np.sum(data) == pytest.approx(1.793466459074705, rel=self.limit, abs=0.)
        assert data.shape == (10, 11, 11)
Exemple #2
0
    def test_stack_cube(self):

        module = StackCubesModule(name_in='stackcube',
                                  image_in_tag='images',
                                  image_out_tag='mean',
                                  combine='mean')

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

        data = self.pipeline.get_data('mean')
        assert np.allclose(data[0, 50, 50],
                           0.09805840100024205,
                           rtol=limit,
                           atol=0.)
        assert np.allclose(np.mean(data),
                           0.00010029494781738069,
                           rtol=limit,
                           atol=0.)
        assert data.shape == (4, 100, 100)

        attribute = self.pipeline.get_attribute('mean', 'INDEX', static=False)
        assert np.allclose(np.mean(attribute), 1.5, rtol=limit, atol=0.)
        assert attribute.shape == (4, )

        attribute = self.pipeline.get_attribute('mean',
                                                'NFRAMES',
                                                static=False)
        assert np.allclose(np.mean(attribute), 1, rtol=limit, atol=0.)
        assert attribute.shape == (4, )
Exemple #3
0
    def test_stack_cube(self) -> None:

        module = StackCubesModule(name_in='stackcube',
                                  image_in_tag='images',
                                  image_out_tag='mean',
                                  combine='mean')

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

        data = self.pipeline.get_data('mean')
        assert np.mean(data) == pytest.approx(0.08722544528764689,
                                              rel=self.limit,
                                              abs=0.)
        assert data.shape == (2, 11, 11)

        attribute = self.pipeline.get_attribute('mean', 'INDEX', static=False)
        assert np.mean(attribute) == pytest.approx(0.5, rel=self.limit, abs=0.)
        assert attribute.shape == (2, )

        attribute = self.pipeline.get_attribute('mean',
                                                'NFRAMES',
                                                static=False)
        assert np.mean(attribute) == pytest.approx(1, rel=self.limit, abs=0.)
        assert attribute.shape == (2, )
Exemple #4
0
    def test_nodding_background(self):

        mean = StackCubesModule(name_in='mean',
                                image_in_tag='sky',
                                image_out_tag='mean',
                                combine='mean')

        self.pipeline.add_module(mean)
        self.pipeline.run_module('mean')

        data = self.pipeline.get_data('mean')
        assert np.allclose(data[0, 50, 50],
                           1.270877476321969e-05,
                           rtol=limit,
                           atol=0.)
        assert np.allclose(np.mean(data),
                           8.937360237872607e-07,
                           rtol=limit,
                           atol=0.)
        assert data.shape == (4, 100, 100)

        attribute = self.pipeline.get_attribute('mean', 'INDEX', static=False)
        assert np.allclose(np.mean(attribute), 1.5, rtol=limit, atol=0.)
        assert attribute.shape == (4, )

        attribute = self.pipeline.get_attribute('mean',
                                                'NFRAMES',
                                                static=False)
        assert np.allclose(np.mean(attribute), 1, rtol=limit, atol=0.)
        assert attribute.shape == (4, )

        nodding = NoddingBackgroundModule(name_in='nodding',
                                          sky_in_tag='mean',
                                          science_in_tag='star',
                                          image_out_tag='nodding',
                                          mode='both')

        self.pipeline.add_module(nodding)
        self.pipeline.run_module('nodding')

        data = self.pipeline.get_data('nodding')
        assert np.allclose(data[0, 50, 50],
                           0.09797142624717381,
                           rtol=limit,
                           atol=0.)
        assert np.allclose(np.mean(data),
                           9.945087327935862e-05,
                           rtol=limit,
                           atol=0.)
        assert data.shape == (40, 100, 100)