Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
frms = self._wcs.available_frames
if ref_tpwcs is None:
matrix = np.array(matrix, dtype=np.double)
shift = np.array(shift, dtype=np.double)
else:
# compute linear transformation from the tangent plane used for
# alignment to the tangent plane of this wcs:
r, t = _tp2tp(ref_tpwcs, self)
matrix = np.linalg.multi_dot([r, matrix, inv(r)]).astype(np.double)
shift = (np.dot(r, shift) - np.dot(matrix, t) + t).astype(np.double)
# if original WCS did not have tangent-plane corrections, create
# new correction and add it to the WCs pipeline:
if self._tpcorr is None:
self._tpcorr = JWSTgWCS._tpcorr_init(
v2_ref=self._wcsinfo['v2_ref'] / 3600.0,
v3_ref=self._wcsinfo['v3_ref'] / 3600.0,
roll_ref=self._wcsinfo['roll_ref']
)
JWSTgWCS._tpcorr_combine_affines(
self._tpcorr,
matrix,
_ARCSEC2RAD * np.asarray(shift)
)
self._partial_tpcorr = JWSTgWCS._v2v3_to_tpcorr_from_full(self._tpcorr)
idx_v2v3 = frms.index(self._v23name)
pipeline = deepcopy(self._wcs.pipeline)
pf, pt = pipeline[idx_v2v3]