mProjectPP

Description:
mProjectPP reprojects a single image to the scale defined in an alternate FITS header template generated (usually) by mTANhdr. The program produces a pair of images: the reprojected image and an "area" image consisting of the fraction input pixel sky area that went into each output pixel. This area image goes through all the subsequent processing that the reprojected image does, allowing it to be properly coadded at the end.

mProjectPP performs a plane-to-plane transform on the input image, and is an adaptation of the Mopex algorithm and developed in collaboration with the Spitzer Space Telescope. It provides a speed increase of approximately a factor of 30 over the general-purpose mProject. However, mProjectPP is only suitable for projections which can be approximated by tangent-plane projections (TAN, SIN, ZEA, STG, ARC), and is therefore not suited for images covering large portions of the sky. Also note that it does not directly support changes in coordinate system (i.e. equatorial to galactic coordinates), though these changes can be facilitated by the use of an alternate header.

One situation that has happened often enough to warrant special note: It is possible to define a FITS header with the reference location off the image. In particular, people often reference cylindrical projections (e.g., CAR, CEA) to location (0.,0.) (e.g., the Galactic center). This is not wrong in itself but does lead to extremely large pixel offsets (e.g., in the hundreds of thousands). Related to this, if you extract a header from an image with large offsets of this type, it is unlikely that you can simply change projection types without also adjusting the reference location/offsets. Most likely, you will end up with the reproject data all being off-scale.

Syntax:
mProjectPP [-z factor] [-d level] [-b border] [-s statusfile] [-o altout.hdr] [-i altin.hdr] [-h hdu] [-x scale] [-w weightfile] [-W fixed-weight] [-t threshold] [-X] [-b border-string] in.fits out.fits template.hdr

Switches:

-z factor
Processing is done utilizing the drizzle algorithm. factor is a floating point number; recommended drizzle factors are from 0.5 to 1.
-d level
Causes additional debugging information to be printed to stdout. Valid levels are 1-5; for levels greater than 1, it's recommended to redirect the output into a text file.
-b border
Ignores border pixels around the image edge when performing calculations.
-s statusfile
Output and errors are written to statusfile instead of being written to stdout.
-[i|o] alternate.hdr
Specifies an alternate FITS header for use in mProjectPP calculations, allows substitution of psuedo-TAN headers created by mTANHdr.
-h hdu
Specify the FITS extension to re-project if the FITS image is multi-extension.
-x scale
Multiple the pixel values by scale when reprojecting. For instance, each 2MASS image has a different scale factor (very near 1.0) to correct for varying magnitude-zero points.
-w weightfile
Path to a weight map to be used when reading values from the input image.
-W fixed-weight
Use constant weight value for the whole image.
-t threshold
Pixels with weights below threshold will be treated as blank.
-X
Makes the output region (originally defined in the header template) big enough to include all of the input images
-b border-string
Define a border width or border pixel corners outside of which all pixels are set to NaN.

Arguments:

in.fits
Input FITS file to be reprojected.
out.fits
Path to output FITS file to be created.
template.hdr
FITS header template to be used in generation of output FITS
Results:
Two files are created as output: the reprojected FITS file (out.fits), and an "area" image (out_area.fits). See the image reprojection algorithm for more information.

Examples:

$ mProjectPP rawdir/real_orig.fits projdir/base_unity.fits templates/galactic_orig.txt
[struct stat="OK", time=14]

Return Codes:

  • [struct stat="OK", time=seconds]
  • [struct stat="ERROR", msg="Usage: %s [-z factor] [-d level] [-b border] [-s statusfile] [-o altout.hdr] [-i altin.hdr] [-h hdu] [-x scale] [-w weightfile] [-t threshold] [-X(expand)] in.fits out.fits template.hdr"]
  • [struct stat="ERROR", msg="Drizzle factor string (string) cannot be interpreted as a real number"]
  • [struct stat="ERROR", msg="Cannot open status file: statusfile"]
  • [struct stat="ERROR", msg="Weight threshold string (threshold) cannot be interpreted as a real number"]
  • [struct stat="ERROR", msg="Flux scale string (scale) cannot be interpreted as a real number"]
  • [struct stat="ERROR", msg="Border value string (string) cannot be interprted as an integer or a set of polygon vertices"]
  • [struct stat="ERROR", msg="Border value (value) must be greater than or equal to zero"]
  • [struct stat="ERROR", msg="HDU value (hdu) must be a non-negative integer"]
  • [struct stat="ERROR", msg="Could not set up plane-to-plane transform. Check for compliant headers."]
  • [struct stat="ERROR", msg="No overlap"] (indicates that none of the output pixels are contained in the area defined by the header template)
  • [struct stat="ERROR", msg="Not enough memory for output data image array"]
  • [struct stat="ERROR", msg="Not enough memory for output area image array"]
  • [struct stat="ERROR", msg="Output wcsinit() failed."]
  • [struct stat="ERROR", msg="Input wcsinit() failed."]
  • [struct stat="ERROR", msg="Input and output must be in the same coordinate system for fast reprojection"]
  • [struct stat="ERROR", msg="All pixels are blank"]
  • [struct stat="ERROR", msg="Input image projection (projection) must be TAN, SIN, ZEA, STG or ARC for fast reprojection"]
  • [struct stat="ERROR", msg="Output image projection (projection) must be TAN, SIN, ZEA, STG or ARC for fast reprojection"]
  • [struct stat="ERROR", msg="Template file [template.hdr] not found"]
  • [struct stat="ERROR", msg="Image file in.fits is missing or invalid FITS"]
  • [struct stat="ERROR", msg="Weight file weightfile is missing or invalid FITS"]
  • [struct stat="ERROR", status=n, msg="FITS library error"]