dfreproject.sip

Functions

get_sip_coeffs(→ Tuple[torch.Tensor, torch.Tensor, ...)

Extract SIP polynomial coefficients from a WCS object.

apply_sip_distortion(u, v, sip_coeffs[, device])

Apply SIP distortion to intermediate pixel coordinates.

apply_inverse_sip_distortion(u, v, sip_coeffs[, device])

Apply inverse SIP distortion to go from distorted to intermediate coordinates.

iterative_inverse_sip(u, v, sip_coeffs[, device, ...])

Iteratively solve for undistorted coordinates when inverse SIP coefficients

Module Contents

dfreproject.sip.get_sip_coeffs(wcs: astropy.wcs.WCS) Tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor][source]

Extract SIP polynomial coefficients from a WCS object.

Parameters:

wcsastropy.wcs.WCS

WCS object potentially containing SIP distortion.

Returns:

dict:

Dictionary containing SIP coefficient matrices A, B, AP, BP and orders.

dfreproject.sip.apply_sip_distortion(u: torch.Tensor, v: torch.Tensor, sip_coeffs: Tuple, device: str = 'cpu')[source]

Apply SIP distortion to intermediate pixel coordinates.

Parameters:

u, vtorch.Tensor

Intermediate pixel coordinates (before distortion).

sip_coeffsTuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor]

SIP coefficient matrices.

devicetorch.device, optional

Device to place tensors on.

Returns:

tuple:

(u’, v’) distorted coordinates.

# Convert to tensors if needed

dfreproject.sip.apply_inverse_sip_distortion(u: torch.Tensor, v: torch.Tensor, sip_coeffs: Tuple, device: str = 'cpu')[source]

Apply inverse SIP distortion to go from distorted to intermediate coordinates.

Parameters:

u, vtorch.Tensor

Distorted coordinates.

sip_coeffsTuple

SIP coefficient matrices.

devicetorch.device, optional

Device to place tensors on.

Returns:

tuple:

(u’, v’) undistorted coordinates.

dfreproject.sip.iterative_inverse_sip(u: torch.Tensor, v: torch.Tensor, sip_coeffs: Tuple, device: str = 'cpu', max_iter: int = 20, tol: float = 1e-08)[source]

Iteratively solve for undistorted coordinates when inverse SIP coefficients are not available.

Parameters:

u, vtorch.Tensor

Distorted coordinates.

sip_coeffsTuple

SIP coefficient matrices.

devicetorch.device, optional

Device to place tensors on.

max_iterint, optional

Maximum number of iterations.

tolfloat, optional

Convergence tolerance.

Returns:

tuple:

(u’, v’) undistorted coordinates.