Prjprm#
- class astropy.wcs.Prjprm#
 Bases:
objectClass that contains information needed to project or deproject native spherical coordinates. It consists of certain members that must be set by the user (given) and others that are set by the WCSLIB routines (returned). Some of the latter are supplied for informational purposes and others are for internal use only.
Attributes Summary
Controls bounds checking.
Read-only. Projection category matching the value of the relevant
wcsmodule constants:Three-letter projection code defined by the FITS standard.
Read-only. True if the projection is conformal.
Read-only. True if the projection diverges in latitude.
Read-only. True if the projection is equal area.
Read-only. True if the projection can represent the whole sphere in a finite, non-overlapped mapping.
Read-only. Intermediate integer value (used only for the
ZPNandHPXprojections).Read-only. Intermediate integer value (used only for the
ZPNandHPXprojections).Read-only. Long name of the projection.
The native longitude, \(\phi_0\) (in degrees) of the reference point, i.e. the point
(x,y) = (0,0).Projection parameters.
Read-only. Range of projection parameter indices: 100 times the first allowed index plus the number of parameters, e.g.
TANis 0 (no parameters),SZPis 103 (1 to 3), andZPNis 30 (0 to 29).The radius of the generating sphere for the projection, a linear scaling parameter.
Read-only. True if the projection is a radially-symmetric zenithal projection.
the native latitude, \(\theta_0\) (in degrees) of the reference point, i.e. the point
(x,y) = (0,0).Read-only. Intermediate floating-point values derived from the projection parameters, cached here to save recomputation.
Read-only. The offset in
xused to force \((x,y) = (0,0)\) at \((\phi_0, \theta_0)\).Read-only. The offset in
yused to force \((x,y) = (0,0)\) at \((\phi_0, \theta_0)\).Methods Summary
Set/Get projection parameters for specific index.
Project native spherical coordinates \((\phi,\theta)\) to Cartesian
(x,y)coordinates in the plane of projection.Deproject Cartesian
(x,y)coordinates in the plane of projection to native spherical coordinates \((\phi,\theta)\).set(/)This method sets up a
Prjprmobject according to information supplied within it.Set/Get projection parameters for specific index.
Attributes Documentation
- bounds#
 Controls bounds checking. If
bounds&1then enable strict bounds checking for the spherical-to-Cartesian (s2x) transformation for theAZP,SZP,TAN,SIN,ZPN, andCOPprojections. Ifbounds&2then enable strict bounds checking for the Cartesian-to-spherical transformation (x2s) for theHPXandXPHprojections. Ifbounds&4then the Cartesian- to-spherical transformations (x2s) will invoke WCSLIB’sprjbchk()to perform bounds checking on the computed native coordinates, with a tolerance set to suit each projection. bounds is set to 7 during initialization by default which enables all checks. Zero it to disable all checking.It is not necessary to reset the
Prjprmstruct (viaPrjprm.set()) whenboundsis changed.
- category#
 Read-only. Projection category matching the value of the relevant
wcsmodule constants:PRJ_ZENITHAL, PRJ_CYLINDRICAL, PRJ_PSEUDOCYLINDRICAL, PRJ_CONVENTIONAL, PRJ_CONIC, PRJ_POLYCONIC, PRJ_QUADCUBE, and PRJ_HEALPIX.
- code#
 Three-letter projection code defined by the FITS standard.
- conformal#
 Read-only. True if the projection is conformal.
- divergent#
 Read-only. True if the projection diverges in latitude.
- equiareal#
 Read-only. True if the projection is equal area.
- global_projection#
 Read-only. True if the projection can represent the whole sphere in a finite, non-overlapped mapping.
- m#
 Read-only. Intermediate integer value (used only for the
ZPNandHPXprojections).
- n#
 Read-only. Intermediate integer value (used only for the
ZPNandHPXprojections).
- name#
 Read-only. Long name of the projection.
- phi0#
 The native longitude, \(\phi_0\) (in degrees) of the reference point, i.e. the point
(x,y) = (0,0). If undefined the initialization routine will set this to a projection-specific default.
- pv#
 Projection parameters. These correspond to the
PVi_makeywords in FITS, sopv[0]isPVi_0a,pv[1]isPVi_1a, etc., whereidenotes the latitude-like axis. Many projections usepv[1](PVi_1a), some also usepv[2](PVi_2a) andSZPusespv[3](PVi_3a).ZPNis currently the only projection that uses any of the others.When setting
pvvalues using lists ornumpy.ndarray, elements set toNonewill be left unchanged while those set tonumpy.nanwill be set toWCSLIB’sUNDEFINEDspecial value. For efficiency purposes, if supplied list ornumpy.ndarrayis shorter than the length of thepvmember, then remaining values inpvwill be left unchanged.Note
When retrieving
pv, a copy of theprjprm.pvarray is returned. Modifying this array values will not modify underlyingWCSLIB’sprjprm.pvdata.
- pvrange#
 Read-only. Range of projection parameter indices: 100 times the first allowed index plus the number of parameters, e.g.
TANis 0 (no parameters),SZPis 103 (1 to 3), andZPNis 30 (0 to 29).
- r0#
 The radius of the generating sphere for the projection, a linear scaling parameter. If this is zero, it will be reset to its default value of \(180^\circ/\pi\) (the value for FITS WCS).
- simplezen#
 Read-only. True if the projection is a radially-symmetric zenithal projection.
- theta0#
 the native latitude, \(\theta_0\) (in degrees) of the reference point, i.e. the point
(x,y) = (0,0). If undefined the initialization routine will set this to a projection-specific default.
- w#
 Read-only. Intermediate floating-point values derived from the projection parameters, cached here to save recomputation.
Note
When retrieving
w, a copy of theprjprm.warray is returned. Modifying this array values will not modify underlyingWCSLIB’sprjprm.wdata.
- x0#
 Read-only. The offset in
xused to force \((x,y) = (0,0)\) at \((\phi_0, \theta_0)\).
- y0#
 Read-only. The offset in
yused to force \((x,y) = (0,0)\) at \((\phi_0, \theta_0)\).
Methods Documentation
- get_pvi()#
 Set/Get projection parameters for specific index. These correspond to the
PVi_makeywords in FITS, sopv[0]isPVi_0a,pv[1]isPVi_1a, etc., whereidenotes the latitude-like axis. Many projections usepv[1](PVi_1a), some also usepv[2](PVi_2a) andSZPusespv[3](PVi_3a).ZPNis currently the only projection that uses any of the others.Setting a
pvivalue toNonewill reset the correspondingWCSLIB’sprjprm.pvelement to the default value as set byWCSLIB’sprjini().Setting a
pvivalue tonumpy.nanwill set the correspondingWCSLIB’sprjprm.pvelement toWCSLIB’sUNDEFINEDspecial value.
- prjs2x()#
 Project native spherical coordinates \((\phi,\theta)\) to Cartesian
(x,y)coordinates in the plane of projection.The projection is that specified by
Prjprm.code.- Parameters:
 - phi
numpy.ndarray Array corresponding to the longitude \(\phi\) of the projected point in native spherical coordinates (in degrees).
- theta
numpy.ndarray Array corresponding to the longitude \(\theta\) of the projected point in native spherical coordinates (in degrees). Values corresponding to invalid \((\phi, \theta)\) coordinates are set to
numpy.nan.
- phi
 - Returns:
 - x, y
python:tupleofnumpy.ndarray Projected coordinates.
- x, y
 - Raises:
 MemoryErrorNull
prjprmpointer passed to WCSLIB routines.InvalidPrjParametersErrorInvalid projection parameters.
- prjx2s()#
 Deproject Cartesian
(x,y)coordinates in the plane of projection to native spherical coordinates \((\phi,\theta)\).The projection is that specified by
Prjprm.code.- Parameters:
 - x, y
numpy.ndarray Arrays corresponding to the first (
x) and second (y) projected coordinates.
- x, y
 - Returns:
 - phi, theta
python:tupleofnumpy.ndarray Longitude and latitude \((\phi,\theta)\) of the projected point in native spherical coordinates (in degrees). Values corresponding to invalid
(x,y)coordinates are set tonumpy.nan.
- phi, theta
 - Raises:
 MemoryErrorNull
prjprmpointer passed to WCSLIB routines.InvalidPrjParametersErrorInvalid projection parameters.
- set(/)#
 This method sets up a
Prjprmobject according to information supplied within it.Note that this routine need not be called directly; it will be invoked by
prjx2sandprjs2xifPrjprm.flagis anything other than a predefined magic value.The one important property of
set()is that the projection code must be defined in thePrjprmin order forset()to identify the required projection.- Raises:
 MemoryErrorNull
prjprmpointer passed to WCSLIB routines.InvalidPrjParametersErrorInvalid projection parameters.
InvalidCoordinateErrorOne or more of the
(x,y)or(lon,lat)coordinates were invalid.
- set_pvi()#
 Set/Get projection parameters for specific index. These correspond to the
PVi_makeywords in FITS, sopv[0]isPVi_0a,pv[1]isPVi_1a, etc., whereidenotes the latitude-like axis. Many projections usepv[1](PVi_1a), some also usepv[2](PVi_2a) andSZPusespv[3](PVi_3a).ZPNis currently the only projection that uses any of the others.Setting a
pvivalue toNonewill reset the correspondingWCSLIB’sprjprm.pvelement to the default value as set byWCSLIB’sprjini().Setting a
pvivalue tonumpy.nanwill set the correspondingWCSLIB’sprjprm.pvelement toWCSLIB’sUNDEFINEDspecial value.