WCS
- class sherpa.astro.io.wcs.WCS(name: str, type: str, crval: Sequence[float] | ndarray, crpix: Sequence[float] | ndarray, cdelt: Sequence[float] | ndarray, crota: float = 0.0, epoch: float = 2000.0, equinox: float = 2000.0)[source] [edit on github]
Bases:
NoNewAttributesAfterInitRepresent a World Coordinate System transformation.
This does not support all possible astronomical transforms.
- Parameters:
name – The name of the transformation (expected to be “world” or “physical”).
type – The transform type (expected to be one of “LINEAR”, “WCS”, or “TAN-P”).
crval – The reference point in the output coordinate system (a two-element sequence).
crpix – The reference point in the input coordinate system (a two-element sequence).
cdelt – The width and height of a pixel in the output coordinate system (a two-element sequence).
crota – The rotation of the transformation.
epoch – The epoch of the transformation (not always used).
equinox – The equinox of the transformation (not always used).
Methods Summary
apply(-> tuple[~numpy.float64, ~numpy.float64])Convert the input coordinates to the output system.
invert(-> tuple[~numpy.float64, ~numpy.float64])Convert the output coordinates to the input system.
Methods Documentation
- apply(x0: float, x1: float) tuple[float64, float64][source] [edit on github]
- apply(x0: Sequence[float] | ndarray, x1: Sequence[float] | ndarray) tuple[ndarray, ndarray]
Convert the input coordinates to the output system.
- Parameters:
x0 – Coordinate or coordinates of the first axis.
x1 – Coordinate or coordinates of the second axis (must match the size of x0).
- Returns:
The coordinate (or coordinates) of the points in the output system as the two-element tuple (c0, c1). If x0 and x1 are scalars then c0 and c1 will be scalars otherwise they will be arrays.
- Return type:
retval
Examples
>>> crval = [200, -100] >>> crpix = [5, 10] >>> cdelt = [2, 4] >>> c1 = WCS("physical", "LINEAR", crval, crpix, cdelt) >>> x, y = c1.apply(5, 10) >>> float(x), float(y) (200.0, -100.0) >>> c1.apply([5, 10], [10, 2]) (array([200., 210.]), array([-100., -132.]))
- invert(x0: float, x1: float) tuple[float64, float64][source] [edit on github]
- invert(x0: Sequence[float] | ndarray, x1: Sequence[float] | ndarray) tuple[ndarray, ndarray]
Convert the output coordinates to the input system.
- Parameters:
x0 – Coordinate or coordinates of the first axis.
x1 – Coordinate or coordinates of the second axis (must match the size of x0).
- Returns:
The coordinate (or coordinates) of the points in the input system as the two-element tuple (c0, c1). If x0 and x1 are scalars then c0 and c1 will be scalars otherwise they will be arrays.
- Return type:
retval
Examples
>>> crval = [200, -100] >>> crpix = [5, 10] >>> cdelt = [2, 4] >>> c1 = WCS("physical", "LINEAR", crval, crpix, cdelt) >>> x, y = c1.invert(200, -100) >>> float(x), float(y) (5.0, 10.0) >>> c1.invert([200, 210], [-100, -132]) (array([ 5., 10.]), array([10., 2.]))