cwitools.coordinates.scale_hdu

cwitools.coordinates.scale_hdu(hdu, upscale, header_only=False, reproject_mode='interp-bicubic')

Scale the data and/or header in an HDU up by a factor.

Note: this is just a convenience wrapper of tools from the Reproject package.

Parameters:
  • hdu (HDU) – The HDU to be scaled up.
  • upscale (float) – The factor to scale the data/WCS up by.
  • header_only (bool) – Set to only scale the Header (i.e. WCS)
  • reproject_mode (str) – Method to use from ‘Reproject’ package. “interp-nearest-neighbor” “interp-bilinear” “interp-bicubic” (Default) “exact”
Returns:

The scaled HDU

Return type:

astropy.fits.HDU

Example

To zoom in by a factor of 2:

>>> hdu_new = scale_hdu(hdu_old, 2)

To zoom out by a factor of 2:

>>> hdu_new = scale_hdu(hdu_old, 0.5)

If you only need the header without actually projecting the data,

>>> hdu_new = scale_hdu(hdu_old, factor)
>>> header_new = hdu_new.header