cwitools.coordinates.get_kpc_per_px¶
-
cwitools.coordinates.
get_kpc_per_px
(header, redshift=0, unit='pkpc', cosmo=FlatLambdaCDM(name="WMAP9", H0=69.3 km / (Mpc s), Om0=0.286, Tcmb0=2.725 K, Neff=3.04, m_nu=[0. 0. 0.] eV, Ob0=0.0463))¶ Return the physical size of pixels in proper kpc. Assumes 1:1 aspect ratio.
Parameters: - header (astropy.hdu.header) – Header of a 2D or 3D Astropy HDU.
- redshift (float) – Cosmological redshift of the field/target.
- unit (str) – Proper (‘pkpc’) or comoving (‘ckpc’) kiloparsecs. Default: pkpc.
- cosmo (FlatLambdaCDM) – Cosmology to use, as one of the inbuilt astropy.cosmology.FlatLambdaCDM instances (default WMAP9)
Returns: Proper or comoving kiloparsecs per pixel
Return type: float
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 cwitools.coordinates import get_kpc_per_px >>> z_target = 1.5 >>> data, header = fits.getdata("targetdata.fits", header=True) >>> px_scale_pkpc = get_kpc_per_px(header, redshift=z_target)