def analyze_polar_rotation(pole_fn, *args, **kwargs):
    """ Get celestial pole XY coordinates

    Args:
        pole_fn (str): FITS file of celestial pole

    Returns:
        tuple(int): A tuple of integers corresponding to the XY pixel position
        of celestial pole
    """
    get_solve_field(pole_fn, **kwargs)

    wcs = WCS(pole_fn)

    pole_cx, pole_cy = wcs.all_world2pix(360, 90, 1)

    return pole_cx, pole_cy
def test_get_solve_field_solved(solved_fits_file):
    orig_wcs = fits_utils.get_wcsinfo(solved_fits_file)
    assert 'crpix0' in orig_wcs

    solve_info = fits_utils.get_solve_field(solved_fits_file,
                                            skip_solved=False)
    assert isinstance(solve_info, dict)
    # 1-based numbering from WCS.
    assert 'CRPIX1' in solve_info
Esempio n. 3
0
    def solve_field(self, **kwargs):
        """ Solve field and populate WCS information.

        Args:
            **kwargs: Options to be passed to `get_solve_field`.
        """
        solve_info = fits_utils.get_solve_field(
            self.fits_file,
            ra=self.header_pointing.ra.value,
            dec=self.header_pointing.dec.value,
            **kwargs)

        self.wcs_file = solve_info['solved_fits_file']
        self.get_wcs_pointing()

        # Remove some fields
        for header in ['COMMENT', 'HISTORY']:
            with suppress(KeyError):
                del solve_info[header]

        return solve_info
def test_get_solve_field_timeout(unsolved_fits_file):
    with pytest.raises(error.Timeout):
        solve_info = fits_utils.get_solve_field(unsolved_fits_file, timeout=1)