예제 #1
0
    def test_star_align_number_ref(self) -> None:

        module = StarAlignmentModule(name_in='align4',
                                     image_in_tag='extract1',
                                     ref_image_in_tag='align2',
                                     image_out_tag='align4',
                                     accuracy=10,
                                     resize=None,
                                     num_references=20,
                                     subframe=None)

        self.pipeline.add_module(module)

        with pytest.warns(UserWarning) as warning:
            self.pipeline.run_module('align4')

        assert len(warning) == 1

        assert warning[0].message.args[0] == 'Number of available images (10) is smaller than ' \
                                             'num_references (20). Using all available images ' \
                                             'instead.'

        data = self.pipeline.get_data('align4')
        assert np.sum(data) == pytest.approx(104.46997194330757,
                                             rel=self.limit,
                                             abs=0.)
        assert data.shape == (10, 9, 9)
예제 #2
0
    def test_star_alignment(self):

        # Required for ref_image_in_tag in StarAlignmentModule, otherwise a random frame is used
        ref_extract = StarExtractionModule(name_in="star_cut_ref",
                                           image_in_tag="bp_cleaned_arr",
                                           image_out_tag="im_arr_ref",
                                           image_size=0.6,
                                           fwhm_star=0.1,
                                           position=None)

        self.pipeline.add_module(ref_extract)

        alignment = StarAlignmentModule(name_in="star_align",
                                        image_in_tag="im_arr_extract",
                                        ref_image_in_tag="im_arr_ref",
                                        image_out_tag="im_arr_aligned",
                                        accuracy=10,
                                        resize=2)

        self.pipeline.add_module(alignment)

        self.pipeline.run_module("star_cut_ref")
        self.pipeline.run_module("star_align")

        data = self.pipeline.get_data("im_arr_aligned")
        assert np.allclose(data[0, 10, 10],
                           1.1309588556526325e-05,
                           rtol=limit,
                           atol=0.)
        assert data.shape == (78, 46, 46)
예제 #3
0
    def test_star_align_number_ref(self) -> None:

        module = StarAlignmentModule(name_in='align4',
                                     image_in_tag='extract1',
                                     ref_image_in_tag='align2',
                                     image_out_tag='align4',
                                     accuracy=10,
                                     resize=None,
                                     num_references=50,
                                     subframe=None)

        self.pipeline.add_module(module)

        with pytest.warns(UserWarning) as warning:
            self.pipeline.run_module('align4')

        assert len(warning) == 1
        assert warning[0].message.args[0] == 'Number of available images (40) is smaller than ' \
                                             'num_references (50). Using all available images ' \
                                             'instead.'

        data = self.pipeline.get_data('align4')
        assert np.allclose(data[0, 19, 19], 0.09812948027289994, rtol=limit, atol=0.)
        assert np.allclose(np.mean(data), 0.0006578482216906739, rtol=limit, atol=0.)
        assert data.shape == (40, 39, 39)
예제 #4
0
    def test_star_align(self):

        align = StarAlignmentModule(name_in="align",
                                    image_in_tag="extract1",
                                    ref_image_in_tag="extract2",
                                    image_out_tag="align",
                                    accuracy=10,
                                    resize=2)

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

        data = self.pipeline.get_data("align")
        assert np.allclose(data[0, 39, 39], 0.023556628129942758, rtol=limit, atol=0.)
        assert np.allclose(np.mean(data), 0.00016446205542266837, rtol=limit, atol=0.)
        assert data.shape == (40, 78, 78)
예제 #5
0
    def test_star_align(self):

        module = StarAlignmentModule(name_in='align',
                                     image_in_tag='extract1',
                                     ref_image_in_tag=None,
                                     image_out_tag='align',
                                     accuracy=10,
                                     resize=2.)

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

        data = self.pipeline.get_data('align')
        assert np.allclose(data[0, 39, 39], 0.023556628129942758, rtol=limit, atol=0.)
        assert np.allclose(np.mean(data), 0.00016446205542266837, rtol=limit, atol=0.)
        assert data.shape == (40, 78, 78)
예제 #6
0
    def test_star_align(self) -> None:

        module = StarAlignmentModule(name_in='align1',
                                     image_in_tag='extract1',
                                     ref_image_in_tag=None,
                                     image_out_tag='align1',
                                     accuracy=10,
                                     resize=2.,
                                     num_references=10,
                                     subframe=None)

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

        data = self.pipeline.get_data('align1')
        assert np.sum(data) == pytest.approx(104.70747423205349, rel=self.limit, abs=0.)
        assert data.shape == (10, 18, 18)
예제 #7
0
    def test_star_align_ref(self) -> None:

        module = StarAlignmentModule(name_in='align3',
                                     image_in_tag='extract1',
                                     ref_image_in_tag='align2',
                                     image_out_tag='align3',
                                     accuracy=10,
                                     resize=None,
                                     num_references=10,
                                     subframe=None)

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

        data = self.pipeline.get_data('align3')
        assert np.sum(data) == pytest.approx(104.46997194330757, rel=self.limit, abs=0.)
        assert data.shape == (10, 9, 9)
예제 #8
0
    def test_star_align_ref(self) -> None:

        module = StarAlignmentModule(name_in='align3',
                                     image_in_tag='extract1',
                                     ref_image_in_tag='align2',
                                     image_out_tag='align3',
                                     accuracy=10,
                                     resize=None,
                                     num_references=10,
                                     subframe=None)

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

        data = self.pipeline.get_data('align3')
        assert np.allclose(data[0, 19, 19], 0.09812948027289994, rtol=limit, atol=0.)
        assert np.allclose(np.mean(data), 0.0006578482216906739, rtol=limit, atol=0.)
        assert data.shape == (40, 39, 39)