API¶
gwcs.wcs Package¶
Classes¶
|
Basic WCS class. |
A warning class to report issues with bounding boxes in GWCS. |
|
|
An error class used to report non-convergence and/or divergence of numerical methods. |
|
Represents a |
Class Inheritance Diagram¶
digraph inheritanceff467ae7dd { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "BaseHighLevelWCS" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Abstract base class for the high-level WCS interface."]; "BaseLowLevelWCS" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Abstract base class for the low-level WCS interface."]; "GWCSAPIMixin" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="A mix-in class that is intended to be inherited by the"]; "BaseLowLevelWCS" -> "GWCSAPIMixin" [arrowsize=0.5,style="setlinewidth(0.5)"]; "HighLevelWCSMixin" -> "GWCSAPIMixin" [arrowsize=0.5,style="setlinewidth(0.5)"]; "GwcsBoundingBoxWarning" [URL="../api/gwcs.wcs.GwcsBoundingBoxWarning.html#gwcs.wcs.GwcsBoundingBoxWarning",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A warning class to report issues with bounding boxes in GWCS."]; "HighLevelWCSMixin" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Mix-in class that automatically provides the high-level WCS API for the"]; "BaseHighLevelWCS" -> "HighLevelWCSMixin" [arrowsize=0.5,style="setlinewidth(0.5)"]; "NoConvergence" [URL="../api/gwcs.wcs.NoConvergence.html#gwcs.wcs.NoConvergence",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="An error class used to report non-convergence and/or divergence"]; "Pipeline" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Class to handle a sequence of WCS transformations."]; "Step" [URL="../api/gwcs.wcs.Step.html#gwcs.wcs.Step",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Represents a ``step`` in the WCS pipeline."]; "WCS" [URL="../api/gwcs.wcs.WCS.html#gwcs.wcs.WCS",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Basic WCS class."]; "GWCSAPIMixin" -> "WCS" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Pipeline" -> "WCS" [arrowsize=0.5,style="setlinewidth(0.5)"]; }gwcs.coordinate_frames Package¶
This module defines coordinate frames for describing the inputs and/or outputs of a transform.
In the block diagram, the WCS pipeline has a two stage transformation (two astropy Model instances), with an input frame, an output frame and an intermediate frame.
┌───────────────┐
│ │
│ Input │
│ Frame │
│ │
└───────┬───────┘
│
┌─────▼─────┐
│ Transform │
└─────┬─────┘
│
┌───────▼───────┐
│ │
│ Intermediate │
│ Frame │
│ │
└───────┬───────┘
│
┌─────▼─────┐
│ Transform │
└─────┬─────┘
│
┌───────▼───────┐
│ │
│ Output │
│ Frame │
│ │
└───────────────┘
Each frame instance is both metadata for the inputs/outputs of a transform and also a converter between those inputs/outputs and richer coordinate representations of those inputs/outputs.
For example, an output frame of type SpectralFrame
provides metadata to the WCS object such as the axes_type being
"SPECTRAL" and the unit of the output etc. The output frame also provides a
converter of the numeric output of the transform to a
SpectralCoord object, by combining this metadata with the
numerical values.
axes_order and conversion between objects and arguments¶
One of the key concepts regarding coordinate frames is the axes_order argument.
This argument is used to map from the components of the frame to the inputs/outputs
of the transform. To illustrate this consider this situation where you have a
forward transform which outputs three coordinates [lat, lambda, lon]. These
would be represented as a SpectralFrame and a CelestialFrame, however, the
axes of a CelestialFrame are always [lon, lat], so by specifying two
frames as
[SpectralFrame(axes_order=(1,)), CelestialFrame(axes_order=(2, 0))]
we would map the outputs of this transform into the correct positions in the frames. As shown below, this is also used when constructing the inputs to the inverse transform.
When taking the output from the forward transform the following transformation is performed by the coordinate frames:
lat, lambda, lon
│ │ │
└──────┼─────┼────────┐
┌───────────┘ └──┐ │
│ │ │
┌─────────▼────────┐ ┌──────▼─────▼─────┐
│ │ │ │
│ SpectralFrame │ │ CelestialFrame │
│ │ │ │
│ (1,) │ │ (2, 0) │
│ │ │ │
└─────────┬────────┘ └──────────┬────┬──┘
│ │ │
│ │ │
▼ ▼ ▼
SpectralCoord(lambda) SkyCoord((lon, lat))
When considering the backward transform the following transformations take place in the coordinate frames before the transform is called:
SpectralCoord(lambda) SkyCoord((lon, lat))
│ │ │
└─────┐ ┌────────────┘ │
│ │ ┌────────────┘
▼ ▼ ▼
[lambda, lon, lat]
│ │ │
│ │ │
┌──────▼─────▼────▼────┐
│ │
│ Sort by axes_order │
│ │
└────┬──────┬─────┬────┘
│ │ │
▼ ▼ ▼
lat, lambda, lon
Functions¶
|
Return the FITS |
Classes¶
API Definition for a Coordinate frame |
|
|
Representation of a Celesital coordinate system. |
|
Represents one or more frames. |
|
Base class for Coordinate Frames. |
|
Represents a "default" detector frame. |
|
A 2D coordinate frame. |
|
Represents Spectral Frame |
|
A coordinate frame for representing Stokes polarisation states. |
|
A coordinate frame for time axes. |
Class Inheritance Diagram¶
digraph inheritance1575ec6015 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Helper class that provides a standard way to create an ABC using"]; "BaseCoordinateFrame" [URL="../api/gwcs.coordinate_frames.BaseCoordinateFrame.html#gwcs.coordinate_frames.BaseCoordinateFrame",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="API Definition for a Coordinate frame"]; "ABC" -> "BaseCoordinateFrame" [arrowsize=0.5,style="setlinewidth(0.5)"]; "CelestialFrame" [URL="../api/gwcs.coordinate_frames.CelestialFrame.html#gwcs.coordinate_frames.CelestialFrame",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Representation of a Celesital coordinate system."]; "CoordinateFrame" -> "CelestialFrame" [arrowsize=0.5,style="setlinewidth(0.5)"]; "CompositeFrame" [URL="../api/gwcs.coordinate_frames.CompositeFrame.html#gwcs.coordinate_frames.CompositeFrame",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Represents one or more frames."]; "CoordinateFrame" -> "CompositeFrame" [arrowsize=0.5,style="setlinewidth(0.5)"]; "CoordinateFrame" [URL="../api/gwcs.coordinate_frames.CoordinateFrame.html#gwcs.coordinate_frames.CoordinateFrame",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base class for Coordinate Frames."]; "BaseCoordinateFrame" -> "CoordinateFrame" [arrowsize=0.5,style="setlinewidth(0.5)"]; "EmptyFrame" [URL="../api/gwcs.coordinate_frames.EmptyFrame.html#gwcs.coordinate_frames.EmptyFrame",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Represents a \"default\" detector frame. This is for use as the default value"]; "CoordinateFrame" -> "EmptyFrame" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Frame2D" [URL="../api/gwcs.coordinate_frames.Frame2D.html#gwcs.coordinate_frames.Frame2D",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A 2D coordinate frame."]; "CoordinateFrame" -> "Frame2D" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SpectralFrame" [URL="../api/gwcs.coordinate_frames.SpectralFrame.html#gwcs.coordinate_frames.SpectralFrame",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Represents Spectral Frame"]; "CoordinateFrame" -> "SpectralFrame" [arrowsize=0.5,style="setlinewidth(0.5)"]; "StokesFrame" [URL="../api/gwcs.coordinate_frames.StokesFrame.html#gwcs.coordinate_frames.StokesFrame",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A coordinate frame for representing Stokes polarisation states."]; "CoordinateFrame" -> "StokesFrame" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TemporalFrame" [URL="../api/gwcs.coordinate_frames.TemporalFrame.html#gwcs.coordinate_frames.TemporalFrame",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A coordinate frame for time axes."]; "CoordinateFrame" -> "TemporalFrame" [arrowsize=0.5,style="setlinewidth(0.5)"]; }gwcs.wcstools Module¶
Functions¶
|
Create a grid of input points from the WCS bounding_box. |
|
Create a WCS object from a fiducial point in a coordinate frame. |
|
Given two matching sets of coordinates on detector and sky, compute the WCS. |
gwcs.selector Module¶
The classes in this module create discontinuous transforms.
The main class is RegionsSelector. It maps inputs to transforms
and evaluates the transforms on the corresponding inputs.
Regions are well defined spaces in the same frame as the inputs.
Regions are assigned unique labels (int or str). The region
labels are used as a proxy between inputs and transforms.
An example is the location of IFU slices in the detector frame.
RegionsSelectoruses two structures:A mapping of inputs to labels - “label_mapper”
A mapping of labels to transforms - “transform_selector”
A “label_mapper” is also a transform, a subclass of astropy.modeling.Model,
which returns the labels corresponding to the inputs.
An instance of a LabelMapper class is passed to RegionsSelector.
The labels are used by RegionsSelector to match inputs to transforms.
Finally, RegionsSelector evaluates the transforms on the corresponding inputs.
Label mappers and transforms take the same inputs as
RegionsSelector. The inputs should be filtered appropriately using the
inputs_mapping argument which is ian instance of
Mapping. The transforms in “transform_selector”
should have the same number of inputs and outputs.
This is illustrated below using two regions, labeled 1 and 2
+-----------+
| +-+ |
| | | +-+ |
| |1| |2| |
| | | +-+ |
| +-+ |
+-----------+
Label mapper workflow:
+--------------+
| label mapper |
+--------------+
^ |
| V
----------| +-------+
| | label |
+--------+ +-------+
---> | inputs | |
+--------+ V
| +--------------------+
| | transform_selector |
| +--------------------+
V |
+-----------+ |
| transform |<-----------
+------------+
|
V
+---------+
| outputs |
+---------+
The base class _LabelMapper can be subclassed to create other label mappers.
Classes¶
|
Maps inputs to regions. |
|
Maps array locations to labels. |
|
Maps a number to a transform, which when evaluated returns a label. |
|
The structure this class uses maps a range of values to a transform. |
|
This model defines discontinuous transforms. |
Class Inheritance Diagram¶
digraph inheritancea9670eebfb { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "LabelMapper" [URL="../api/gwcs.selector.LabelMapper.html#gwcs.selector.LabelMapper",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Maps inputs to regions. Returns the region labels corresponding to the inputs."]; "_LabelMapper" -> "LabelMapper" [arrowsize=0.5,style="setlinewidth(0.5)"]; "LabelMapperArray" [URL="../api/gwcs.selector.LabelMapperArray.html#gwcs.selector.LabelMapperArray",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Maps array locations to labels."]; "_LabelMapper" -> "LabelMapperArray" [arrowsize=0.5,style="setlinewidth(0.5)"]; "LabelMapperDict" [URL="../api/gwcs.selector.LabelMapperDict.html#gwcs.selector.LabelMapperDict",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Maps a number to a transform, which when evaluated returns a label."]; "_LabelMapper" -> "LabelMapperDict" [arrowsize=0.5,style="setlinewidth(0.5)"]; "LabelMapperRange" [URL="../api/gwcs.selector.LabelMapperRange.html#gwcs.selector.LabelMapperRange",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="The structure this class uses maps a range of values to a transform."]; "_LabelMapper" -> "LabelMapperRange" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Model" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Base class for all models."]; "RegionsSelector" [URL="../api/gwcs.selector.RegionsSelector.html#gwcs.selector.RegionsSelector",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="This model defines discontinuous transforms."]; "Model" -> "RegionsSelector" [arrowsize=0.5,style="setlinewidth(0.5)"]; "_LabelMapper" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Maps inputs to regions. Returns the region labels corresponding to the inputs."]; "Model" -> "_LabelMapper" [arrowsize=0.5,style="setlinewidth(0.5)"]; }gwcs.spectroscopy Module¶
Spectroscopy related models.
Classes¶
|
Solve the 3D Grating Dispersion Law in Direction Cosine space for the refracted angle. |
|
Sellmeier equation for glass. |
|
Sellmeier equation used by Zemax. |
|
Snell model in 3D form. |
Solve the Grating Dispersion Law for the wavelength. |
Class Inheritance Diagram¶
digraph inheritancee9acf971e3 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "AnglesFromGratingEquation3D" [URL="../api/gwcs.spectroscopy.AnglesFromGratingEquation3D.html#gwcs.spectroscopy.AnglesFromGratingEquation3D",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Solve the 3D Grating Dispersion Law in Direction Cosine"]; "Model" -> "AnglesFromGratingEquation3D" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Model" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Base class for all models."]; "SellmeierGlass" [URL="../api/gwcs.spectroscopy.SellmeierGlass.html#gwcs.spectroscopy.SellmeierGlass",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Sellmeier equation for glass."]; "Model" -> "SellmeierGlass" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SellmeierZemax" [URL="../api/gwcs.spectroscopy.SellmeierZemax.html#gwcs.spectroscopy.SellmeierZemax",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Sellmeier equation used by Zemax."]; "Model" -> "SellmeierZemax" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Snell3D" [URL="../api/gwcs.spectroscopy.Snell3D.html#gwcs.spectroscopy.Snell3D",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Snell model in 3D form."]; "Model" -> "Snell3D" [arrowsize=0.5,style="setlinewidth(0.5)"]; "WavelengthFromGratingEquation" [URL="../api/gwcs.spectroscopy.WavelengthFromGratingEquation.html#gwcs.spectroscopy.WavelengthFromGratingEquation",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Solve the Grating Dispersion Law for the wavelength."]; "Model" -> "WavelengthFromGratingEquation" [arrowsize=0.5,style="setlinewidth(0.5)"]; }gwcs.geometry Module¶
Models for general analytical geometry transformations.
Classes¶
|
Convert cartesian coordinates to spherical coordinates on a unit sphere. |
|
Transform directional cosines to vector. |
|
Convert spherical coordinates on a unit sphere to cartesian coordinates. |
|
Transform a vector to direction cosines. |