gwcs.wcs.Pipeline¶
- class gwcs.wcs.Pipeline(forward_transform, *, input_frame=None, output_frame=None)¶
Bases:
_BasePipelineClass to handle a sequence of WCS transformations.
This is intended to act like a list of steps, but with built in protections for things like duplicate frames. In addition, this handles all the logic for handling steps and their frames/transforms.
This class is intended to be an organizational class for the WCS which handles the sequence of steps and their transforms. It is not intended to be used directly by outside users, but rather through the
WCSclass, which subclasses this class and adds the additional evaluation functionality and user interface for the WCS.Warning
This class supports passing any
_BasePipelinesubclass as theforward_transformargument. In this case, no validation checks or copies of the steps are made. This means that when theforward_transformis a type of_BasePipeline, the user is responsible for ensuring that the pipeline is valid. Moreover, since no copies of the steps are made, any changes made to the steps contained within the resulting instance will back-propagate to the original_BasePipelinesubclass instance. This behavior is intended to allow for the efficient creation of pipelines (or WCSs) from existing pipelines (or WCSs) without the expensive overhead of validation and copies.- Parameters:
forward_transform (
ForwardTransform)input_frame (
str|CoordinateFrameProtocol|None, default:None)output_frame (
str|CoordinateFrameProtocol|None, default:None)
Attributes¶
List of all the frame names in this WCS in their order in the pipeline |
|
Return the total backward transform if available - from output to input coordinate system. |
|
Return the bounding box of the pipeline. |
|
Return the forward transform of the pipeline. |
|
Return the input frame name of the pipeline. |
|
Return the output frame name of the pipeline. |
|
Allow direct access to the raw pipeline steps. |
|
The unit of the coordinates in the output coordinate system. |
- property Pipeline.available_frames: list[str]¶
List of all the frame names in this WCS in their order in the pipeline
- property Pipeline.backward_transform: Model¶
Return the total backward transform if available - from output to input coordinate system.
- Raises:
NotImplementedError – An analytical inverse does not exist.
- property Pipeline.bounding_box: ModelBoundingBox | CompoundBoundingBox | None¶
Return the bounding box of the pipeline.
- property Pipeline.input_frame: CoordinateFrameProtocol¶
Return the input frame name of the pipeline.
- property Pipeline.output_frame: CoordinateFrameProtocol¶
Return the output frame name of the pipeline.
Methods¶
|
Attach a compound bounding box dictionary to the pipeline. |
|
Return the frame object corresponding to the given frame name. |
|
Return a transform between two coordinate frames. |
|
Insert a new frame into an existing pipeline. |
|
Insert a transform before (default) or after a coordinate frame. |
|
Return a pipeline between the two given frames. |
|
Set/replace the transform between two coordinate frames. |
- Pipeline.attach_compound_bounding_box(cbbox, selector_args)¶
Attach a compound bounding box dictionary to the pipeline.
- Pipeline.get_frame(frame)¶
Return the frame object corresponding to the given frame name.
- Parameters:
frame (
str|CoordinateFrameProtocol) – Name of the frame or the frame object.- Returns:
The frame object corresponding to the given name.
- Return type:
- Pipeline.get_transform(from_frame, to_frame)¶
Return a transform between two coordinate frames.
- Parameters:
from_frame (
str|CoordinateFrameProtocol) – Initial coordinate frame name of object.to_frame (
str|CoordinateFrameProtocol) – End coordinate frame name or object.
- Returns:
Transform between two frames.
- Return type:
- Pipeline.insert_frame(input_frame, transform, output_frame)¶
Insert a new frame into an existing pipeline. This frame must be anchored to a frame already in the pipeline by a transform. This existing frame is identified solely by its name, although an entire
CoordinateFrameProtocolcan be passed (e.g., theinput_frameoroutput_frameattribute). This frame is never modified.- Parameters:
input_frame (
str|CoordinateFrameProtocol) – Coordinate frame at start of new transformtransform (
Model) – New transform to be inserted in the pipelineoutput_frame (
str|CoordinateFrameProtocol) – Coordinate frame at end of new transform
- Return type:
- Pipeline.insert_transform(frame, transform, after=False)¶
Insert a transform before (default) or after a coordinate frame.
Append (or prepend) a transform to the transform connected to frame.
- Parameters:
frame (
str|CoordinateFrameProtocol) – Coordinate frame which sets the point of insertion.transform (
Model) – New transform to be inserted in the pipelineafter (
bool, default:False) – If True, the new transform is inserted in the pipeline immediately afterframe.
- Return type:
- Pipeline.pipeline_between(from_frame, to_frame)¶
Return a pipeline between the two given frames.
- Parameters:
from_frame (
str|CoordinateFrameProtocol) – Initial coordinate frame name of object.to_frame (
str|CoordinateFrameProtocol) – End coordinate frame name or object.
- Returns:
A
DirectionalWCS(wcs, forward) where wcs is of the type of the calling object. The forward attribute indicates if the wcs/pipeline between the two frames is forward (True, from_frame -> to_frame) or backward (False, to_frame -> from_frame). Note that if from_frame and to_frame are the same, then None is returned.- Return type:
Optional[DirectionalWCS[Self]]
- Pipeline.set_transform(from_frame, to_frame, transform)¶
Set/replace the transform between two coordinate frames.
- Parameters:
from_frame (
str|CoordinateFrameProtocol) – Initial coordinate frame.to_frame (
str|CoordinateFrameProtocol) – End coordinate frame.transform (
Model) – Transform betweenfrom_frameandto_frame.
- Return type: