How to use the tweakwcs.tpwcs.FITSWCS function in tweakwcs

To help you get started, we’ve selected a few tweakwcs 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 spacetelescope / tweakwcs / tweakwcs / tpwcs.py View on Github external
When not provided (i.e., set to `None`), it is assumed that the
            transformations are being applied directly to *this* image WCS'
            tangent plane.

        meta: dict, None, optional
            Dictionary that will be merged to the object's ``meta`` fields.

        **kwargs: optional parameters
            Optional parameters for the WCS corrector. `FITSWCS` ignores these
            arguments (except for storing them in the ``meta`` attribute).

        """
        wcs = self._wcs
        orig_wcs = wcs.deepcopy()
        if ref_tpwcs is None:
            ref_tpwcs = FITSWCS(wcs.deepcopy())

        naxis1, naxis2 = wcs.pixel_shape

        shift = -np.dot(inv(matrix), shift)

        # estimate step for numerical differentiation. We need a step
        # large enough to avoid rounding errors and small enough to get a
        # better precision for numerical differentiation.
        # TODO: The logic below should be revised at a later time so that it
        # better takes into account the two competing requirements.
        hx = max(1.0, min(10, (wcs.wcs.crpix[0] - 1.0) / 100.0,
                          (naxis1 - wcs.wcs.crpix[0]) / 100.0))
        hy = max(1.0, min(10, (wcs.wcs.crpix[1] - 1.0) / 100.0,
                          (naxis2 - wcs.wcs.crpix[1]) / 100.0))

        # compute new CRVAL for the image WCS: