WCSGeometry¶
-
class
hips.WCSGeometry(wcs: astropy.wcs.wcs.WCS, width: int, height: int)[source]¶ Bases:
objectSky image geometry: WCS and image shape.
Parameters: wcs :
WCSWCS projection object
width, height : int
Width and height of the image in pixels
Examples
To create a
WCSGeometry, you can create anyWCSand choose an image shape (number of pixels):from astropy.wcs import WCS from hips import WCSGeometry wcs = WCS(naxis=2) wcs.wcs.ctype[0] = 'GLON-AIT' wcs.wcs.ctype[1] = 'GLAT-AIT' wcs.wcs.crval[0] = 0 wcs.wcs.crval[1] = 0 wcs.wcs.crpix[0] = 1000 wcs.wcs.crpix[1] = 500 wcs.wcs.cdelt[0] = -0.01 wcs.wcs.cdelt[1] = 0.01 geometry = WCSGeometry(wcs, width=2000, height=1000)
See also
WCSGeometry.createas a simpler (but also not quite as flexible) way to generateWCSandWCSGeometryobjects.Attributes Summary
WCS_ORIGIN_DEFAULTDefault WCS transform origin, to be used in all WCS pix <-> world calls. celestial_frameCelestial frame for the given WCS (str). center_pixImage center in pixel coordinates (tuple of x, y). center_skycoordImage center in sky coordinates ( SkyCoord).fits_headerFITS header for the given WCS ( Header).pixel_skycoordsGrid of sky coordinates of the image pixels ( SkyCoord).Methods Summary
create(skydir, width, height, fov, …)Create WCS object for given sky image parameters ( WCSGeometry).create_from_dict(params)Create WCS object from a dictionary ( WCSGeometry).make(geometry, _ForwardRef()])Convenience constructor for create_from_dict classmethod or existing object ( WCSGeometry).pix_to_sky(x, y)Helper function to convert pix to sky coordinates. Attributes Documentation
-
WCS_ORIGIN_DEFAULT= 0¶ Default WCS transform origin, to be used in all WCS pix <-> world calls.
-
celestial_frame¶ Celestial frame for the given WCS (str).
Calls
wcs_to_celestial_frame.
-
center_pix¶ Image center in pixel coordinates (tuple of x, y).
Methods Documentation
-
classmethod
create(skydir: astropy.coordinates.sky_coordinate.SkyCoord, width: int, height: int, fov: Union[str, astropy.coordinates.angles.Angle], coordsys: str = 'icrs', projection: str = 'AIT') → hips.utils.wcs.WCSGeometry[source]¶ Create WCS object for given sky image parameters (
WCSGeometry).Parameters: skydir :
SkyCoordSky coordinate of the WCS reference point
width, height : int
Width and height of the image in pixels
fov : str or
AngleField of view
coordsys : {‘icrs’, ‘galactic’}
Coordinate system
projection : str
Projection of the WCS object. To see list of supported projections visit: http://docs.astropy.org/en/stable/wcs/#supported-projections
Examples
>>> from astropy.coordinates import SkyCoord >>> from hips import WCSGeometry >>> skycoord = SkyCoord(10, 20, unit='deg') >>> geometry = WCSGeometry.create( ... skydir=SkyCoord(0, 0, unit='deg', frame='galactic'), ... width=2000, height=1000, fov='3 deg', ... coordsys='galactic', projection='AIT', ... ) >>> geometry.wcs Number of WCS axes: 2 CTYPE : 'GLON-AIT' 'GLAT-AIT' CRVAL : 0.0 0.0 CRPIX : 500.0 1000.0 PC1_1 PC1_2 : 1.0 0.0 PC2_1 PC2_2 : 0.0 1.0 CDELT : -0.0015 0.0015 NAXIS : 0 0 >>> geometry.shape Shape(width=2000, height=1000)
-
classmethod
create_from_dict(params: dict) → hips.utils.wcs.WCSGeometry[source]¶ Create WCS object from a dictionary (
WCSGeometry).The extra options are passed to the
createclass method, it can take the following parameters:- target
- width
- height
- fov
- coordsys
- projection
For detailed description, see the
createclass method’s docstring.
-
classmethod
make(geometry: Union[dict, _ForwardRef('WCSGeometry')]) → hips.utils.wcs.WCSGeometry[source]¶ Convenience constructor for create_from_dict classmethod or existing object (
WCSGeometry).
-