MPROJECT(1)
β¨ MPROJECT β¨ β a.k.a. the mProject manual page, bestie edition π
okay so first things first: this is the manual for mProject, part of Montage, and it lives in section 1 of the manual. Buckle up, we're reprojecting FITS images and it's gonna be iconic π¦
πΈ NAME πΈ
mProject β re-project FITS images π
π SYNOPSIS π
mProject [-z factor] [-d level] [-s statusfile] [-h hdu] [-x scale] [-w
weightfile] [-W fixed-weight] [-t threshold] [-X] [-b border-string]
[-e(nergy-mode)] [-f] in.fits out.fits hdr.template
β¨ DESCRIPTION β¨
So, what does mProject actually do? It takes one single image and reprojects it onto the scale defined in a FITS header template file (there's a whole explainer about header templates if you go read up on it, iykyk).
And it doesn't just hand you one file, it hands you a pair:
- the reprojected image itself, and
- an "area" image β that's the fraction of input pixel sky area that landed in each output pixel π«Ά
The "drizzle" algorithm is what's implemented here. How does it work? Basically:
- It maps pixel corners (as adjusted by drizzle, if drizzle got called) from the input pixel space to the output pixel space.
- It calculates the overlap area with each output pixel.
- It accumulates the appropriate fraction of the input flux into the output image pixels.
And on top of that, the appropriate fraction of the input pixel area gets accumulated into the area image pixels too. No pixel gets left out π
Projecting points from input pixel space to output pixel space happens in two steps:
- First, map from input pixel space to sky coordinates.
- Second, map from sky coordinates to output pixel space.
π¨ SPECIAL NOTE TIME, this one has happened enough times that it earned its own paragraph π¨
It is genuinely possible to define a FITS header with the reference location off the image. And people do it a LOT β like, folks will often reference cylindrical projections (e.g., CAR, CEA) to location (0.,0.) (e.g., the Galactic center). That's not wrong in itself, bestie, but it does lead to extremely large pixel offsets (e.g., in the hundreds of thousands π).
And related to that: 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. So like... be careful, okay? π
π OPTIONS π
-z factorβ processing is done utilizing the drizzle algorithm.factoris a floating point number; the recommended drizzle factors are from0.5to1. Slay.-d levelβ causes additional debugging information to be printed to stdout. Valid levels are1-5. (For higher debugging levels, it's recommended that you redirect the output to a file, because it gets chatty.)-s statusfileβ output and errors are written tostatusfileinstead of being written to stdout. Quiet girl era π€«-h hduβ use the specified FITS extension (default is to use the first HDU with image data).-x scaleβ apply a correction factor ofscaleto each pixel.-w weightfileβ path to a weight map to be used when reading values from the input image.-W fixed-weightβ use a constant weight value for the whole image.-t thresholdβ pixels with weights belowthresholdwill be treated as blank. Gone. Ghosted. π-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 toNaN.-eβ process the data as total energy rather than the default energy density (scale values by relative pixel areas).-fβ output the full region requested even if there is a border ofNULLvalues (default is to shrinkwrap to just the pixels with values).
π§ ARGUMENTS π§
in.fitsβ input FITS file to be reprojected.out.fitsβ path of output FITS file to be created.hdr.templateβ FITS header template to be used in generation of output image.
π RESULT π
Two files are created as output, and yes that's the whole point:
- the reprojected FITS file (
out.fits), and - an "area" image (
out_area.fits) which records the amount of coverage (in output pixel space) provided by the input images. π
π MESSAGES π
Here's the whole menu of things this program might say to you:
OKβ[struct stat="OK", time=seconds]βERRORβ Drizzle factor string (string) cannot be interpreted as a real numberERRORβ Weight threshold string (string) cannot be interpreted as a real numberERRORβ Flux scale string (string) cannot be interpreted as a real numberERRORβ Cannot open status file:statusfileERRORβ HDU value (hdu) must be a non-negative integerERRORβ No overlapERRORβ Not enough memory for output data image arrayERRORβ Not enough memory for output area image arrayERRORβ Outputwcsinit()failed.ERRORβ Inputwcsinit()failed.ERRORβ FITS library errorERRORβ All pixels are blankERRORβ Template file not foundERRORβ Image filein.fitsmissing or invalid FITSERRORβ Weight fileweightfilemissing or invalid FITS
π EXAMPLES π
Look at her go:
$ mProject rawdir/real_orig.fits projdir/base_unity.fits
templates/galactic_orig.txt
[struct stat="OK", time=143]
ate. no crumbs. π₯
π BUGS π
okay so the not-so-cute part, but we gotta be honest:
- The drizzle algorithm has been implemented but has not been tested in this release. (Yeah. We said what we said.)
- If a header template contains carriage returns (i.e., created/modified on a Windows machine), the
cfitsiolibrary will be unable to read it properly, resulting in the error:[struct stat="ERROR", status=207, msg="illegal character in keyword"] - It is best for the background correction algorithms if the area described in the header template completely encloses all of the input images in their entirety. If parts of input images are "chopped off" by the header template, the background correction will be affected. We recommend you use an expanded header for the reprojection and background modeling steps, returning to the originally desired header size for the final coaddition. The default background matching assumes that there are no non-linear background variations in the individual images (and therefore in the overlap differences). If there is any uncertainty in this regard, it's safer to turn on the "level only" background matching (the
-lflag inmBgModel).
π«Ά COPYRIGHT π«Ά
2001-2015 California Institute of Technology, Pasadena, California
If your research uses Montage, please include the following acknowledgement β fr fr, this is the polite thing to do:
"This research made use of Montage. It is funded by the National Science Foundation under Grant Number ACI-1440620, and was previously funded by the National Aeronautics and Space Administration's Earth Science Technology Office, Computation Technologies Project, under Cooperative Agreement Number NCC5-626 between NASA and the California Institute of Technology."
Also! The Montage distribution includes an adaptation of the MOPEX algorithm developed at the Spitzer Science Center. π
and that's the whole page, bestie π this was Montage 5, dated Dec 2016, and you've been reading the MPROJECT(1) manual β go forth and reproject, main character π
β¨π¦
π¦ where this page comes from
- debian bookworm: montage 6.0+dfsg-7+b8 Β· BSD-3-Clause
- debian trixie: montage 6.1+dfsg-1+b1 Β· BSD-3-Clause
- ubuntu jammy: montage 6.0+dfsg-7build5 Β· BSD-3-Clause
- ubuntu noble: montage 6.0+dfsg-9 Β· BSD-3-Clause
- ubuntu questing: montage 6.1+dfsg-2
- ubuntu resolute: montage 6.1+dfsg-2build2 Β· BSD-3-Clause
- ubuntu stonking: montage 6.1+dfsg-2build2 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms