Exemplo n.º 1
0
    def test_apply_function_to_images_same_port(self):
        dark = DarkCalibrationModule(name_in="dark1",
                                     image_in_tag="science",
                                     dark_in_tag="dark",
                                     image_out_tag="science")

        self.pipeline.add_module(dark)
        self.pipeline.run_module("dark1")

        data = self.pipeline.get_data("science")
        assert np.allclose(np.mean(data),
                           -3.190113568690675e-06,
                           rtol=limit,
                           atol=0.)
        assert data.shape == (4, 10, 10)

        self.pipeline.set_attribute("config", "MEMORY", 0, static=True)

        dark = DarkCalibrationModule(name_in="dark2",
                                     image_in_tag="science",
                                     dark_in_tag="dark",
                                     image_out_tag="science")

        self.pipeline.add_module(dark)
        self.pipeline.run_module("dark2")

        data = self.pipeline.get_data("science")
        assert np.allclose(np.mean(data),
                           -1.026073475228737e-05,
                           rtol=limit,
                           atol=0.)
        assert data.shape == (4, 10, 10)

        remove = RemoveLinesModule(lines=(1, 0, 0, 0),
                                   name_in="remove3",
                                   image_in_tag="remove_3d",
                                   image_out_tag="remove_3d")

        self.pipeline.add_module(remove)

        with pytest.raises(ValueError) as error:
            self.pipeline.run_module("remove3")

        assert str(error.value) == "Input and output port have the same tag while the input " \
                                   "function is changing the image shape. This is only " \
                                   "possible with MEMORY=None."
Exemplo n.º 2
0
    def test_apply_function_to_images_same_port(self):
        dark = DarkCalibrationModule(name_in='dark1',
                                     image_in_tag='science',
                                     dark_in_tag='dark',
                                     image_out_tag='science')

        self.pipeline.add_module(dark)
        self.pipeline.run_module('dark1')

        data = self.pipeline.get_data('science')
        assert np.allclose(np.mean(data),
                           -3.190113568690675e-06,
                           rtol=limit,
                           atol=0.)
        assert data.shape == (4, 10, 10)

        self.pipeline.set_attribute('config', 'MEMORY', 0, static=True)

        dark = DarkCalibrationModule(name_in='dark2',
                                     image_in_tag='science',
                                     dark_in_tag='dark',
                                     image_out_tag='science')

        self.pipeline.add_module(dark)
        self.pipeline.run_module('dark2')

        data = self.pipeline.get_data('science')
        assert np.allclose(np.mean(data),
                           -1.026073475228737e-05,
                           rtol=limit,
                           atol=0.)
        assert data.shape == (4, 10, 10)

        remove = RemoveLinesModule(lines=(1, 0, 0, 0),
                                   name_in='remove3',
                                   image_in_tag='remove_3d',
                                   image_out_tag='remove_3d')

        self.pipeline.add_module(remove)

        with pytest.raises(ValueError) as error:
            self.pipeline.run_module('remove3')

        assert str(error.value) == 'Input and output port have the same tag while the input ' \
                                   'function is changing the image shape. This is only ' \
                                   'possible with MEMORY=None.'
Exemplo n.º 3
0
    def test_dark_calibration(self) -> None:

        module = DarkCalibrationModule(name_in='dark',
                                       image_in_tag='images',
                                       dark_in_tag='dark',
                                       image_out_tag='dark_cal')

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

        data = self.pipeline.get_data('dark_cal')
        assert np.sum(data) == pytest.approx(0.00717386583629883,
                                             rel=self.limit,
                                             abs=0.)
        assert data.shape == (5, 11, 11)
Exemplo n.º 4
0
    def test_dark_calibration(self):

        dark_sub = DarkCalibrationModule(name_in="dark_subtraction",
                                         image_in_tag="im_arr_cut",
                                         dark_in_tag="dark_arr",
                                         image_out_tag="dark_sub_arr")

        self.pipeline.add_module(dark_sub)
        self.pipeline.run_module("dark_subtraction")

        data = self.pipeline.get_data("dark_sub_arr")
        assert np.allclose(data[0, 61, 39],
                           -0.00021601281733413911,
                           rtol=limit,
                           atol=0.)
        assert data.shape == (78, 100, 100)
Exemplo n.º 5
0
    def test_dark_calibration(self):

        dark = DarkCalibrationModule(name_in="dark",
                                     image_in_tag="images",
                                     dark_in_tag="dark",
                                     image_out_tag="dark_cal")

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

        data = self.pipeline.get_data("dark")
        assert np.allclose(data[0, 10, 10],
                           3.528694163309295e-05,
                           rtol=limit,
                           atol=0.)
        assert np.allclose(np.mean(data),
                           7.368663496379876e-07,
                           rtol=limit,
                           atol=0.)
        assert data.shape == (10, 100, 100)
Exemplo n.º 6
0
    def test_dark_calibration(self):

        module = DarkCalibrationModule(name_in='dark',
                                       image_in_tag='images',
                                       dark_in_tag='dark',
                                       image_out_tag='dark_cal')

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

        data = self.pipeline.get_data('dark_cal')
        assert np.allclose(data[0, 10, 10],
                           0.0001881700200690493,
                           rtol=limit,
                           atol=0.)
        assert np.allclose(np.mean(data),
                           3.137393482985464e-07,
                           rtol=limit,
                           atol=0.)
        assert data.shape == (10, 100, 100)