NativeAPIMixin

class gwcs.api.NativeAPIMixin[source]

Bases: ABC

A mix-in class that is intended to be inherited by the WCS class and provides the native GWCS API.

Attributes Summary

bounding_box

The input_frame's bounding box

forward_transform

The forward transformation model from the input_frame to the output_frame.

input_frame

The input coordinate frame.

output_frame

The output coordinate frame.

Methods Summary

evaluate(*args[, with_bounding_box, fill_value])

Executes the forward transform.

invert(*args[, with_bounding_box, fill_value])

Invert coordinates from output frame to input frame using analytical or user-supplied inverse.

Attributes Documentation

bounding_box

The input_frame’s bounding box

forward_transform

The forward transformation model from the input_frame to the output_frame.

input_frame

The input coordinate frame.

output_frame

The output coordinate frame.

Methods Documentation

abstractmethod evaluate(*args: ndarray[tuple[Any, ...], dtype[generic]] | Quantity, with_bounding_box: bool = True, fill_value: float | number = nan, **kwargs) tuple[ndarray[tuple[Any, ...], dtype[generic]] | Quantity, ...] | ndarray[tuple[Any, ...], dtype[generic]] | Quantity[source]

Executes the forward transform.

argsfloat or array-like

Inputs in the input coordinate system, separate inputs for each dimension.

with_bounding_boxbool, optional

If True(default) values in the result which correspond to any of the inputs being outside the bounding_box are set to fill_value.

fill_valuefloat, optional

Output value for inputs outside the bounding_box (default is np.nan).

Other Parameters:
kwargsdict

Keyword arguments to be passed to the forward_transform model.

abstractmethod invert(*args: ndarray[tuple[Any, ...], dtype[generic]] | Quantity, with_bounding_box: bool = True, fill_value: float | number = nan, **kwargs) tuple[ndarray[tuple[Any, ...], dtype[generic]] | Quantity, ...] | ndarray[tuple[Any, ...], dtype[generic]] | Quantity[source]

Invert coordinates from output frame to input frame using analytical or user-supplied inverse. When neither analytical nor user-supplied inverses are defined, a numerical solution will be attempted using a numerical inverse algorithm.

Note

Currently numerical inverse is implemented only for 2D imaging WCS.

Parameters:
argsfloat, array like

Coordinates to be inverted. The number of arguments must be equal to the number of world coordinates given by world_n_dim.

with_bounding_boxbool, optional

If True (default) values in the result which correspond to any of the inputs being outside the bounding_box are set to fill_value.

fill_valuefloat, optional

Output value for inputs outside the bounding_box (default is np.nan).

Returns:
resulttuple or value

Returns a tuple of scalar or array values for each axis. Unless input_frame.naxes == 1 when it shall return the value. The return type will be Quantity objects if the transform returns Quantity objects, else values.

Other Parameters:
kwargsdict

Keyword arguments to be passed to the backward_transform model (when defined) or to the iterative invert method.