Exemplo n.º 1
0
    def test_contrast_curve_fpf(self) -> None:

        with h5py.File(self.test_dir+'PynPoint_database.hdf5', 'a') as hdf_file:
            hdf_file['config'].attrs['CPU'] = 1

        module = ContrastCurveModule(name_in='contrast_fpf',
                                     image_in_tag='read',
                                     psf_in_tag='read',
                                     contrast_out_tag='limits_fpf',
                                     separation=(0.2, 0.3, 0.2),
                                     angle=(0., 360., 180.),
                                     threshold=('fpf', 1e-6),
                                     psf_scaling=1.,
                                     aperture=0.05,
                                     pca_number=2,
                                     cent_size=None,
                                     edge_size=1.,
                                     extra_rot=0.)

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

        data = self.pipeline.get_data('limits_fpf')
        assert data[0, 0] == pytest.approx(0.2, rel=self.limit, abs=0.)
        assert data[0, 1] == pytest.approx(1.797063014325614, rel=self.limit, abs=0.)
        assert data[0, 2] == pytest.approx(0.0006250749411564145, rel=self.limit, abs=0.)
        assert data[0, 3] == pytest.approx(1e-06, rel=self.limit, abs=0.)
        assert data.shape == (1, 4)
Exemplo n.º 2
0
    def test_contrast_curve(self) -> None:

        proc = ['single', 'multi']

        for item in proc:

            if item == 'multi':
                with h5py.File(self.test_dir+'PynPoint_database.hdf5', 'a') as hdf_file:
                    hdf_file['config'].attrs['CPU'] = 4

            module = ContrastCurveModule(name_in='contrast_'+item,
                                         image_in_tag='read',
                                         psf_in_tag='read',
                                         contrast_out_tag='limits_'+item,
                                         separation=(0.2, 0.3, 0.2),
                                         angle=(0., 360., 180.),
                                         threshold=('sigma', 5.),
                                         psf_scaling=1.,
                                         aperture=0.05,
                                         pca_number=2,
                                         cent_size=None,
                                         edge_size=1.,
                                         extra_rot=0.)

            self.pipeline.add_module(module)
            self.pipeline.run_module('contrast_'+item)

            data = self.pipeline.get_data('limits_'+item)
            assert data[0, 0] == pytest.approx(0.2, rel=self.limit, abs=0.)
            assert data[0, 1] == pytest.approx(2.5223717329932676, rel=self.limit, abs=0.)
            assert data[0, 2] == pytest.approx(0.0006250749411563979, rel=self.limit, abs=0.)
            assert data[0, 3] == pytest.approx(0.00026866680137822624, rel=self.limit, abs=0.)
            assert data.shape == (1, 4)
Exemplo n.º 3
0
    def test_contrast_curve_fpf(self):

        with h5py.File(self.test_dir+'PynPoint_database.hdf5', 'a') as hdf_file:
            hdf_file['config'].attrs['CPU'] = 1

        module = ContrastCurveModule(name_in='contrast_fpf',
                                     image_in_tag='read',
                                     psf_in_tag='read',
                                     contrast_out_tag='limits_fpf',
                                     separation=(0.5, 0.6, 0.1),
                                     angle=(0., 360., 180.),
                                     threshold=('fpf', 1e-6),
                                     psf_scaling=1.,
                                     aperture=0.1,
                                     pca_number=15,
                                     cent_size=None,
                                     edge_size=None,
                                     extra_rot=0.)

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

        data = self.pipeline.get_data('limits_fpf')
        assert np.allclose(data[0, 0], 5.00000000e-01, rtol=limit, atol=0.)
        assert np.allclose(data[0, 1], 0.6820548720545829, rtol=limit, atol=0.)
        assert np.allclose(data[0, 2], 0.2594381985736874, rtol=limit, atol=0.)
        assert np.allclose(data[0, 3], 1e-6, rtol=limit, atol=0.)
        assert data.shape == (1, 4)
Exemplo n.º 4
0
    def test_contrast_curve(self):

        proc = ['single', 'multi']

        for item in proc:

            if item == 'multi':
                with h5py.File(self.test_dir+'PynPoint_database.hdf5', 'a') as hdf_file:
                    hdf_file['config'].attrs['CPU'] = 4

            module = ContrastCurveModule(name_in='contrast_'+item,
                                         image_in_tag='read',
                                         psf_in_tag='read',
                                         contrast_out_tag='limits_'+item,
                                         separation=(0.5, 0.6, 0.1),
                                         angle=(0., 360., 180.),
                                         threshold=('sigma', 5.),
                                         psf_scaling=1.,
                                         aperture=0.1,
                                         pca_number=15,
                                         cent_size=None,
                                         edge_size=None,
                                         extra_rot=0.)

            self.pipeline.add_module(module)
            self.pipeline.run_module('contrast_'+item)

            data = self.pipeline.get_data('limits_'+item)
            assert np.allclose(data[0, 0], 5.00000000e-01, rtol=limit, atol=0.)
            assert np.allclose(data[0, 1], 1.2034060712266164, rtol=limit, atol=0.)
            assert np.allclose(data[0, 2], 0.2594381985736874, rtol=limit, atol=0.)
            assert np.allclose(data[0, 3], 0.00012147700290954244, rtol=limit, atol=0.)
            assert data.shape == (1, 4)
Exemplo n.º 5
0
    def test_contrast_curve(self):

        proc = ["single", "multi"]

        for item in proc:

            if item == "multi":
                database = h5py.File(self.test_dir + 'PynPoint_database.hdf5',
                                     'a')
                database['config'].attrs['CPU'] = 4

            contrast = ContrastCurveModule(name_in="contrast_" + item,
                                           image_in_tag="read",
                                           psf_in_tag="read",
                                           contrast_out_tag="limits_" + item,
                                           separation=(0.5, 0.6, 0.1),
                                           angle=(0., 360., 180.),
                                           magnitude=(7.5, 1.),
                                           threshold=("sigma", 5.),
                                           accuracy=1e-1,
                                           psf_scaling=1.,
                                           aperture=0.1,
                                           ignore=True,
                                           pca_number=15,
                                           norm=False,
                                           cent_size=None,
                                           edge_size=None,
                                           extra_rot=0.)

            self.pipeline.add_module(contrast)
            self.pipeline.run_module("contrast_" + item)

            data = self.pipeline.get_data("limits_" + item)
            assert np.allclose(data[0, 0], 5.00000000e-01, rtol=limit, atol=0.)
            assert np.allclose(data[0, 1],
                               6.647211555936695,
                               rtol=limit,
                               atol=0.)
            assert np.allclose(data[0, 2],
                               0.07837070875760642,
                               rtol=limit,
                               atol=0.)
            assert np.allclose(data[0, 3],
                               0.0002012649090622487,
                               rtol=limit,
                               atol=0.)
            assert data.shape == (1, 4)
Exemplo n.º 6
0
    def test_contrast_curve(self):

        proc = ["single", "multi"]

        for item in proc:

            if item == "multi":
                database = h5py.File(self.test_dir + 'PynPoint_database.hdf5',
                                     'a')
                database['config'].attrs['CPU'] = 4

            contrast = ContrastCurveModule(name_in="contrast_" + item,
                                           image_in_tag="read",
                                           psf_in_tag="read",
                                           contrast_out_tag="limits_" + item,
                                           separation=(0.5, 0.6, 0.1),
                                           angle=(0., 360., 180.),
                                           threshold=("sigma", 5.),
                                           psf_scaling=1.,
                                           aperture=0.1,
                                           pca_number=15,
                                           cent_size=None,
                                           edge_size=None,
                                           extra_rot=0.)

            self.pipeline.add_module(contrast)
            self.pipeline.run_module("contrast_" + item)

            data = self.pipeline.get_data("limits_" + item)
            assert np.allclose(data[0, 0], 5.00000000e-01, rtol=limit, atol=0.)
            assert np.allclose(data[0, 1],
                               2.3624384190310397,
                               rtol=limit,
                               atol=0.)
            assert np.allclose(data[0, 2],
                               0.05234065236317515,
                               rtol=limit,
                               atol=0.)
            assert np.allclose(data[0, 3],
                               0.00012147700290954244,
                               rtol=limit,
                               atol=0.)
            assert data.shape == (1, 4)