The `reproject` package is a Python library designed for re-gridding astronomical images from one World Coordinate System (WCS) to another. It provides a uniform interface for various reprojection techniques, including interpolation-based methods, the adaptive and anti-aliased algorithm by DeForest (2004), and flux-conserving spherical polygon intersection. The library also supports reprojection to and from HEALPIX projections through integration with `astropy-healpix`. It is currently at version 0.19.0 and is actively maintained as part of the Astropy project, with a regular release cadence aligned with Astropy's development cycle.
pip install reprojectVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to reproject a simple 2D NumPy array from one Astropy WCS object to another using the `reproject_interp` function. It creates dummy input data and WCS, defines a target WCS with a different scale and rotation, performs the reprojection, and then visualizes both the original and reprojected images. For real-world applications, input data often comes from FITS files.
Ensure your input data has correct and well-defined WCS information before using `reproject`. If alignment is needed, perform image registration with other tools first.
For flux-conserving reprojection, use `reproject_exact` or `reproject_adaptive` with the `conserve_flux=True` parameter. Be aware that these methods are computationally more intensive.
For large arrays, consider setting `block_size='auto'` or a specific tuple, and `parallel=True` (which requires `dask` to be installed) to enable chunked processing and reduce memory footprint.
Verify that your `WCS` object is correctly initialized with `naxis=2` (or the appropriate number of celestial axes) and that the celestial projection axes align with the dimensions of your input data array. When passing `(data, wcs)`, ensure `wcs` corresponds to the celestial dimensions of `data`.
Carefully inspect both the input and output `astropy.wcs.WCS` objects. Check all relevant FITS keywords (`CRVAL`, `CRPIX`, `CDELT`, `CTYPE`, `PC`, `CUNIT`, `RADECSYS`, `EQUINOX`) for correctness. Ensure consistent coordinate frames. If dealing with different datums, confirm that `astropy` is configured to handle the transformations correctly. Small errors in the WCS can lead to significant shifts.