How to use pynpoint - 10 common examples

To help you get started, we’ve selected a few pynpoint examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PynPoint / PynPoint / pynpoint / util / star.py View on Github external
width : int, None
        The width (pix) of the subframe. The full image is used if set to None.
    fwhm : int, None
        Full width at half maximum (pix) of the Gaussian kernel. Not used if set to None.

    Returns
    -------
    numpy.ndarray
        Position (y, x) of the brightest pixel.
    """

    if width is not None:
        if center is None:
            center = center_pixel(image)

        image = crop_image(image, center, width)

    if fwhm is None:
        smooth = np.copy(image)

    else:
        sigma = fwhm / math.sqrt(8. * math.log(2.))
        kernel = (fwhm * 2 + 1, fwhm * 2 + 1)
        smooth = cv2.GaussianBlur(image, kernel, sigma)

    # argmax[0] is the y position and argmax[1] is the y position
    argmax = np.asarray(np.unravel_index(smooth.argmax(), smooth.shape))

    if center is not None and width is not None:
        argmax[0] += center[0] - (image.shape[0] - 1) // 2  # y
        argmax[1] += center[1] - (image.shape[1] - 1) // 2  # x
github PynPoint / PynPoint / tests / test_core / test_pypeline.py View on Github external
def test_add_wrong_module(self) -> None:

        pipeline = Pypeline(self.test_dir, self.test_dir, self.test_dir)

        with pytest.raises(TypeError) as error:
            pipeline.add_module(None)

        assert str(error.value) == 'type of argument "module" must be ' \
                                   'pynpoint.core.processing.PypelineModule; got NoneType instead'

        os.remove(self.test_dir+'PynPoint_database.hdf5')
github PynPoint / PynPoint / tests / test_processing / test_timedenoising.py View on Github external
def setup_class(self) -> None:

        self.limit = 1e-10
        self.test_dir = os.path.dirname(__file__) + '/'

        create_star_data(self.test_dir+'images')
        create_config(self.test_dir+'PynPoint_config.ini')

        self.pipeline = Pypeline(self.test_dir, self.test_dir, self.test_dir)
github PynPoint / PynPoint / tests / test_processing / test_basic.py View on Github external
def setup_class(self) -> None:

        self.limit = 1e-10
        self.test_dir = os.path.dirname(__file__) + '/'

        create_star_data(self.test_dir+'data1')
        create_star_data(self.test_dir+'data2')
        create_star_data(self.test_dir+'data3')

        create_config(self.test_dir+'PynPoint_config.ini')

        self.pipeline = Pypeline(self.test_dir, self.test_dir, self.test_dir)
github PynPoint / PynPoint / tests / test_processing / test_filter.py View on Github external
def setup_class(self) -> None:

        self.limit = 1e-10
        self.test_dir = os.path.dirname(__file__) + '/'

        create_star_data(self.test_dir+'data')
        create_config(self.test_dir+'PynPoint_config.ini')

        self.pipeline = Pypeline(self.test_dir, self.test_dir, self.test_dir)
github PynPoint / PynPoint / tests / test_core / test_pypeline.py View on Github external
def test_create_pipeline_path_missing(self) -> None:

        dir_non_exists = self.test_dir + 'none/'
        dir_exists = self.test_dir

        with pytest.raises(AssertionError) as error:
            Pypeline(dir_non_exists, dir_exists, dir_exists)

        assert str(error.value) == 'Input directory for _m_working_place does not exist ' \
                                   '- input requested: '+self.test_dir+'none/.'

        with pytest.raises(AssertionError) as error:
            Pypeline(dir_exists, dir_non_exists, dir_exists)

        assert str(error.value) == 'Input directory for _m_input_place does not exist ' \
                                   '- input requested: '+self.test_dir+'none/.'

        with pytest.raises(AssertionError) as error:
            Pypeline(dir_exists, dir_exists, dir_non_exists)

        assert str(error.value) == 'Input directory for _m_output_place does not exist ' \
                                   '- input requested: '+self.test_dir+'none/.'

        with pytest.raises(AssertionError) as error:
            Pypeline()

        assert str(error.value) == 'Input directory for _m_working_place does not exist ' \
                                   '- input requested: None.'
github PynPoint / PynPoint / tests / test_core / test_pypeline.py View on Github external
def test_get_tags(self) -> None:

        pipeline = Pypeline(self.test_dir, self.test_dir, self.test_dir)

        assert pipeline.get_tags() == 'images'
github PynPoint / PynPoint / tests / test_core / test_pypeline.py View on Github external
dir_exists = self.test_dir

        with pytest.raises(AssertionError) as error:
            Pypeline(dir_non_exists, dir_exists, dir_exists)

        assert str(error.value) == 'Input directory for _m_working_place does not exist ' \
                                   '- input requested: '+self.test_dir+'none/.'

        with pytest.raises(AssertionError) as error:
            Pypeline(dir_exists, dir_non_exists, dir_exists)

        assert str(error.value) == 'Input directory for _m_input_place does not exist ' \
                                   '- input requested: '+self.test_dir+'none/.'

        with pytest.raises(AssertionError) as error:
            Pypeline(dir_exists, dir_exists, dir_non_exists)

        assert str(error.value) == 'Input directory for _m_output_place does not exist ' \
                                   '- input requested: '+self.test_dir+'none/.'

        with pytest.raises(AssertionError) as error:
            Pypeline()

        assert str(error.value) == 'Input directory for _m_working_place does not exist ' \
                                   '- input requested: None.'
github PynPoint / PynPoint / tests / test_core / test_pypeline.py View on Github external
def test_run_module_wrong_tag(self) -> None:

        pipeline = Pypeline(self.test_dir, self.test_dir, self.test_dir)

        module = FitsReadingModule(name_in='read')

        pipeline.add_module(module)

        module = FitsWritingModule(name_in='write',
                                   file_name='result.fits',
                                   data_tag='im_list')

        pipeline.add_module(module)

        module = BadPixelSigmaFilterModule(name_in='badpixel',
                                           image_in_tag='im_list',
                                           image_out_tag='im_out')

        pipeline.add_module(module)
github PynPoint / PynPoint / tests / test_processing / test_limits.py View on Github external
def setup_class(self) -> None:

        self.limit = 1e-10
        self.test_dir = os.path.dirname(__file__) + '/'

        create_star_data(self.test_dir+'self.limits', npix=21, pos_star=10.)
        create_config(self.test_dir+'PynPoint_config.ini')

        self.pipeline = Pypeline(self.test_dir, self.test_dir, self.test_dir)