Package pywcs :: Module pywcs :: Class WCS
[frames] | no frames]

Class WCS

source code

object --+    
         |    
   WCSBase --+
             |
            WCS
Known Subclasses:

Instance Methods
 
__copy__()
Creates a deep copy of the WCS object. (Inherited from pywcs.WCSBase)
source code
 
__init__(self, header, key=' ', relax=False)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
a new object with type S, a subtype of T
__new__(T, S, ...) (Inherited from pywcs.WCSBase) source code
int
celfix()
Translates AIPS-convention celestial projection types, -NCP and -GLS. (Inherited from pywcs.WCSBase)
source code
 
copy()
Creates a deep copy of the WCS object. (Inherited from pywcs.WCSBase)
source code
int
cylfix()
Fixes WCS keyvalues for malformed cylindrical projections. (Inherited from pywcs.WCSBase)
source code
int
datfix()
Translates the old DATE-OBS date format to year-2000 standard form (yyyy-mm-ddThh:mm:ss) and derives MJD-OBS from it if not already set. (Inherited from pywcs.WCSBase)
source code
dict
fix(translate_units='', naxis=0)
Applies all of the corrections handled separately by datfix, unitfix, celfix, spcfix and cylfix. (Inherited from pywcs.WCSBase)
source code
bool
has_cdi_ja()
Returns True if CDi_ja is present. (Inherited from pywcs.WCSBase)
source code
bool
has_crotaia()
Returns True if CROTAia is present. (Inherited from pywcs.WCSBase)
source code
bool
has_pci_ja()
Returns True if PCi_ja is present. (Inherited from pywcs.WCSBase)
source code
dict
mix(mixpix, mixcel, vspan, vstep, viter, world, pixcrd)
Given either the celestial longitude or latitude plus an element of the pixel coordinate, solves for the remaining elements by iterating on the unknown celestial coordinate element using s2p. (Inherited from pywcs.WCSBase)
source code
dict
p2s(pixcrd)
Converts pixel to world coordinates. (Inherited from pywcs.WCSBase)
source code
world
pixel2world(x, y=None)
Transforms world coordinates to pixel coordinates.
source code
 
print_contents()
Print the contents of the WCS object to stdout. (Inherited from pywcs.WCSBase)
source code
dict
s2p(world)
Transforms world coordinates to pixel coordinates. (Inherited from pywcs.WCSBase)
source code
 
set()
Sets up a WCS object for use according to information supplied within it. (Inherited from pywcs.WCSBase)
source code
int
spcfix()
Translates AIPS-convention spectral coordinate types. (Inherited from pywcs.WCSBase)
source code
 
sptr(ctype, i=-1)
Translates the spectral axis in a WCS object. (Inherited from pywcs.WCSBase)
source code
int
unitfix(translate_units='')
Translates non-standard CUNITia keyvalues. (Inherited from pywcs.WCSBase)
source code
pixel
world2pixel(ra, dec=None)
Transforms world coordinates to pixel coordinates.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties
string alt
Character code for alternate coordinate descriptions. (Inherited from pywcs.WCSBase)
array[2][2] of double cd
CDi_ja linear transformation matrix. (Inherited from pywcs.WCSBase)
array[naxis] of double cdelt
Coordinate increments (CDELTia) for each coord axis. (Inherited from pywcs.WCSBase)
list of strings cname
A list of the coordinate axis names, CNAMEia. (Inherited from pywcs.WCSBase)
array[naxis] of int colax
An array recording the column numbers for each axis in a pixel list. (Inherited from pywcs.WCSBase)
  colnum
Where the coordinate representation is associated with an image-array column in a FITS binary table, this variable may be used to record the relevant column number. (Inherited from pywcs.WCSBase)
array[naxis] of double crder
The random error in each coordinate axis, CRDERia. (Inherited from pywcs.WCSBase)
array[2][2] of double crota
CROTAia keyvalues for each coordinate axis. (Inherited from pywcs.WCSBase)
array[naxis] of double crpix
Coordinate reference pixels (CRPIXja) for each pixel axis. (Inherited from pywcs.WCSBase)
array[naxis] of double crval
Coordinate reference values (CRVALia) for each coordinate axis. (Inherited from pywcs.WCSBase)
array[naxis] of double csyer
The systematic error in the coordinate value axes, CSYERia. (Inherited from pywcs.WCSBase)
list of strings ctype
List of CTYPEia keyvalues. (Inherited from pywcs.WCSBase)
int cubeface
Index into the pixcrd (pixel coordinate) array for the CUBEFACE axis. (Inherited from pywcs.WCSBase)
list of strings cunit
List of CUNITia keyvalues which define the units of measurement of the CRVALia, CDELTia and CDi_ja keywords. (Inherited from pywcs.WCSBase)
string dateavg
Representative mid-point of the date of observation in ISO format, yyyy-mm-ddThh:mm:ss. (Inherited from pywcs.WCSBase)
string dateobs
Start of the date of observation in ISO format, yyyy-mm-ddThh:mm:ss. (Inherited from pywcs.WCSBase)
float equinox
The equinox associated with dynamical equatorial or ecliptic coordinate systems, EQUINOXa (or EPOCH in older headers). (Inherited from pywcs.WCSBase)
int lat
The index into the world coordinate array containing latitude values. (Inherited from pywcs.WCSBase)
float latpole
The native latitude of the celestial pole, LATPOLEa (deg). (Inherited from pywcs.WCSBase)
int lng
The index into the world coordinate array containing longitude values. (Inherited from pywcs.WCSBase)
float lonpole
The native longitude of the celestial pole, LONPOLEa (deg). (Inherited from pywcs.WCSBase)
float mjdavg
Modified Julian Date (MJD = JD - 2400000.5), MJD-AVG, corresponding to DATE-AVG. (Inherited from pywcs.WCSBase)
float mjdobs
Modified Julian Date (MJD = JD - 2400000.5), MJD-OBS, corresponding to DATE-OBS. (Inherited from pywcs.WCSBase)
string name
The name given to the coordinate representation WCSNAMEa. (Inherited from pywcs.WCSBase)
int naxis
The number of axes (pixel and coordinate), given by the NAXIS or WCSAXESa keyvalues. (Inherited from pywcs.WCSBase)
array[3] of double obsgeo
Location of the observer in a standard terrestrial reference frame, OBSGEO-X, OBSGEO-Y, OBSGEO-Z (in metres). (Inherited from pywcs.WCSBase)
array[2][2] of double pc
The PCi_ja (pixel coordinate) transformation matrix. (Inherited from pywcs.WCSBase)
list of tuples ps
PSi_ma keywords for each i and m. (Inherited from pywcs.WCSBase)
list of tuples pv
PVi_ma keywords for each i and m. (Inherited from pywcs.WCSBase)
string radesys
The equatorial or ecliptic coordinate system type, RADESYSa. (Inherited from pywcs.WCSBase)
float restfrq
Rest frequency (Hz) from RESTFRQa. (Inherited from pywcs.WCSBase)
float restwav
Rest wavelength (m) from RESTWAVa. (Inherited from pywcs.WCSBase)
int spec
The index containing the spectral axis values. (Inherited from pywcs.WCSBase)
string specsys
Spectral reference frame (standard of rest), SPECSYSa (Inherited from pywcs.WCSBase)
string ssysobs
The actual spectral reference frame in which there is no differential variation in the spectral coordinate across the field-of-view, SSYSOBSa. (Inherited from pywcs.WCSBase)
string ssyssrc
The spectral reference frame (standard of rest) in which the redshift was measured, SSYSSRCa. (Inherited from pywcs.WCSBase)
float velangl
The angle in degrees that should be used to decompose an observed velocity into radial and transverse components. (Inherited from pywcs.WCSBase)
float velosys
The relative radial velocity (m/s) between the observer and the selected standard of rest in the direction of the celestial reference coordinate, VELOSYSa. (Inherited from pywcs.WCSBase)
float zsource
The redshift, ZSOURCEa, of the source. (Inherited from pywcs.WCSBase)

Inherited from object: __class__

Method Details

__init__(self, header, key=' ', relax=False)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • header - A PyFITS header object or a string containing the raw FITS header data.
  • key - The key referring to a particular WCS transform in the header. This may be either ' ' or 'A'-'Z' and corresponds to the "a" part of "CTYPEia".
  • relax - Degree of permissiveness:
    • False: Recognize only FITS keywords defined by the published WCS standard.
    • True: Admit all recognized informal extensions of the WCS standard.
Raises:
  • MemoryError - Memory allocation failed.
  • ValueError - Invalid key.
  • KeyError - Key not found in FITS header.
Overrides: object.__init__
(inherited documentation)

pixel2world(x, y=None)

source code 

Transforms world coordinates to pixel coordinates. pixel2world is a convenience wrapper around p2s. If intermediate values from the transform are needed, use the more complex p2s directly.

Parameters:
  • x (array of double) - Array of x pixel coordinates, or if y is not provided, a 2-dimensional array of both x- and y-coordinates. Pixel coordinates are zero based.
  • y (array of double or None) - Array of y pixel coordinates. If provided, x must be 1-dimensional and the same length as y.
Returns: world
If both x and y were provided, a 2-tuple of arrays, where the first element is latitude coordinates and the second element is longitude coordinates. Otherwise, a single 2D array containing both latitude and longitude.

world2pixel(ra, dec=None)

source code 

Transforms world coordinates to pixel coordinates. world2pixel is a convenience wrapper around s2p. If intermediate values from the transform are needed, use the more complex s2p directly.

Parameters:
  • ra (array of double) - Array of ra world coordinates, or if dec is not provided, a 2-dimensional array of both ra- and dec-coordinates. World coordinates are in decimal degrees.
  • dec (array of double or None) - Array of dec world coordinates. If provided, ra must be 1-dimensional and the same length as dec.
Returns: pixel
If both ra and dec were provided, a 2-tuple of arrays, where the first element is x coordinates and the second element is y coordinates. Otherwise, a single 2D array containing both x and y. Pixel coordinates are zero-based.