Prjprm¶

class
astropy.wcs.
Prjprm
¶ Bases:
object
Class 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.
Readonly. Projection category matching the value of the relevant
wcs
module constants:Threeletter projection code defined by the FITS standard.
Readonly. True if the projection is conformal.
Readonly. True if the projection diverges in latitude.
Readonly. True if the projection is equal area.
Readonly. True if the projection can represent the whole sphere in a finite, nonoverlapped mapping.
Readonly. Intermediate integer value (used only for the
ZPN
andHPX
projections).Readonly. Intermediate integer value (used only for the
ZPN
andHPX
projections).Readonly. 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.
Readonly. Range of projection parameter indices: 100 times the first allowed index plus the number of parameters, e.g.
The radius of the generating sphere for the projection, a linear scaling parameter.
Readonly. True if the projection is a radiallysymmetric zenithal projection.
the native latitude, \(\theta_0\) (in degrees) of the reference point, i.e. the point
(x,y) = (0,0)
.Readonly. Intermediate floatingpoint values derived from the projection parameters, cached here to save recomputation.
Readonly. The offset in
x
used to force \((x,y) = (0,0)\) at \((\phi_0, \theta_0)\).Readonly. The offset in
y
used 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)\).This method sets up a
Prjprm
object according to information supplied within it.Set/Get projection parameters for specific index.
Attributes Documentation

bounds
¶ Controls bounds checking. If
bounds&1
then enable strict bounds checking for the sphericaltoCartesian (s2x
) transformation for theAZP
,SZP
,TAN
,SIN
,ZPN
, andCOP
projections. Ifbounds&2
then enable strict bounds checking for the Cartesiantospherical transformation (x2s
) for theHPX
andXPH
projections. Ifbounds&4
then the Cartesian tospherical 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
Prjprm
struct (viaPrjprm.set()
) whenbounds
is changed.

category
¶ Readonly. Projection category matching the value of the relevant
wcs
module constants:PRJ_ZENITHAL, PRJ_CYLINDRICAL, PRJ_PSEUDOCYLINDRICAL, PRJ_CONVENTIONAL, PRJ_CONIC, PRJ_POLYCONIC, PRJ_QUADCUBE, and PRJ_HEALPIX.

code
¶ Threeletter projection code defined by the FITS standard.

conformal
¶ Readonly. True if the projection is conformal.

divergent
¶ Readonly. True if the projection diverges in latitude.

equiareal
¶ Readonly. True if the projection is equal area.

global_projection
¶ Readonly. True if the projection can represent the whole sphere in a finite, nonoverlapped mapping.

m
¶ Readonly. Intermediate integer value (used only for the
ZPN
andHPX
projections).

n
¶ Readonly. Intermediate integer value (used only for the
ZPN
andHPX
projections).

name
¶ Readonly. 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 projectionspecific default.

pv
¶ Projection parameters. These correspond to the
PVi_ma
keywords in FITS, sopv[0]
isPVi_0a
,pv[1]
isPVi_1a
, etc., wherei
denotes the latitudelike axis. Many projections usepv[1]
(PVi_1a
), some also usepv[2]
(PVi_2a
) andSZP
usespv[3]
(PVi_3a
).ZPN
is currently the only projection that uses any of the others.When setting
pv
values using lists ornumpy.ndarray
, elements set toNone
will be left unchanged while those set tonumpy.nan
will be set toWCSLIB
’sUNDEFINED
special value. For efficiency purposes, if supplied list ornumpy.ndarray
is shorter than the length of thepv
member, then remaining values inpv
will be left unchanged.Note
When retrieving
pv
, a copy of theprjprm.pv
array is returned. Modifying this array values will not modify underlyingWCSLIB
’sprjprm.pv
data.

pvrange
¶ Readonly. Range of projection parameter indices: 100 times the first allowed index plus the number of parameters, e.g.
TAN
is 0 (no parameters),SZP
is 103 (1 to 3), andZPN
is 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
¶ Readonly. True if the projection is a radiallysymmetric 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 projectionspecific default.

w
¶ Readonly. Intermediate floatingpoint values derived from the projection parameters, cached here to save recomputation.
Note
When retrieving
w
, a copy of theprjprm.w
array is returned. Modifying this array values will not modify underlyingWCSLIB
’sprjprm.w
data.

x0
¶ Readonly. The offset in
x
used to force \((x,y) = (0,0)\) at \((\phi_0, \theta_0)\).

y0
¶ Readonly. The offset in
y
used 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_ma
keywords in FITS, sopv[0]
isPVi_0a
,pv[1]
isPVi_1a
, etc., wherei
denotes the latitudelike axis. Many projections usepv[1]
(PVi_1a
), some also usepv[2]
(PVi_2a
) andSZP
usespv[3]
(PVi_3a
).ZPN
is currently the only projection that uses any of the others.Setting a
pvi
value toNone
will reset the correspondingWCSLIB
’sprjprm.pv
element to the default value as set byWCSLIB
’sprjini()
.Setting a
pvi
value tonumpy.nan
will set the correspondingWCSLIB
’sprjprm.pv
element toWCSLIB
’sUNDEFINED
special 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 coordinatess (in degrees). Values corresponding to invalid \((\phi, \theta)\) coordinates are set to
numpy.nan
.
 phi
 Returns
 x, y
tuple
ofnumpy.ndarray
Projected coordinates.
 x, y
 Raises
MemoryError
Null
prjprm
pointer passed to WCSLIB routines.InvalidPrjParametersError
Invalid 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
tuple
ofnumpy.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
MemoryError
Null
prjprm
pointer passed to WCSLIB routines.InvalidPrjParametersError
Invalid projection parameters.

set
()¶ This method sets up a
Prjprm
object according to information supplied within it.Note that this routine need not be called directly; it will be invoked by
prjx2s
andprjs2x
ifPrjprm.flag
is anything other than a predefined magic value.The one important property of
set()
is that the projection code must be defined in thePrjprm
in order forset()
to identify the required projection. Raises
MemoryError
Null
prjprm
pointer passed to WCSLIB routines.InvalidPrjParametersError
Invalid projection parameters.
InvalidCoordinateError
One 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_ma
keywords in FITS, sopv[0]
isPVi_0a
,pv[1]
isPVi_1a
, etc., wherei
denotes the latitudelike axis. Many projections usepv[1]
(PVi_1a
), some also usepv[2]
(PVi_2a
) andSZP
usespv[3]
(PVi_3a
).ZPN
is currently the only projection that uses any of the others.Setting a
pvi
value toNone
will reset the correspondingWCSLIB
’sprjprm.pv
element to the default value as set byWCSLIB
’sprjini()
.Setting a
pvi
value tonumpy.nan
will set the correspondingWCSLIB
’sprjprm.pv
element toWCSLIB
’sUNDEFINED
special value.
