cwitools.coordinates.get_pkpc_per_px¶
-
cwitools.coordinates.get_pkpc_per_px(wcs, redshift=0)¶ Return the physical size of pixels in proper kpc. Assumes 1:1 aspect ratio.
- Args:
- wcs (astropy.wcs.WCS): A 2D or 3D astropy WCS object. redshift (float): Cosmological redshift of the field/target.
- Returns:
- float: Proper kiloparsecs per pixel
Examples:
Note that this method assumes the spatial axes are equal in scale and that the WCS is either (deg, deg, wavelength) or (deg, deg).
>>> from astropy.io import fits >>> from astropy.wcs import WCS >>> from cwitools.coordinates import get_pkpc_px >>> z_target = 1.5 >>> data, header = fits.getdata("targetdata.fits", header=True) >>> wcs = WCS(header) >>> px_scale_pkpc = pkpc_per_px(wcs, redshift=z_target)