mSubCube

Description:
Creates a subimage (or "cutout") of a FITS file. Note that in "normal" mode, all the parameters (location and size) are in degrees; in pixel (-p) mode, all of them are in pixels.
Syntax:
mSubCube [-d] [-D3 index-selection-string] [-D4 index-selection-string] [-a] [-h hdu] [-s statusfile] in.fits out.fits ra dec xsize [ysize]
mSubCube -p [-d] [-D3 index-selection-string] [-D4 index-selection-string] [-h hdu] [-s statusfile] in.fits out.fits xstartpix ystartpix xpixsize [ypixsize]

Switches:

-d
Turns on debugging.
-D3
This argument is a string (quoted if it contain spaces) defining the subset of indices desired. The string has the form of an ordered set of comma-separated values, which each value is either an index or a range of indices. For instance, "2, 4:46, 58, 101:120" would copy dimension three planes 2, 4 through 46, 58 and 101 through 120 to the output cube. Note that these numbers refer to indices in a FITS cube, so are one-offset, not zero. Attempts to go outside the available data result in an error.
-D4
The same sort of thing as -D3, but for the fourth dimension.
-a
All pixels - Force retrieval of whole image (useful to extract an entire HDU)
-h hdu
Operate on the specified FITS header extension (HDU)
-s statusfile
Output and errors are sent to statusfile instead of to stdout
-p
Pixel mode - create subimage using pixel locations, instead of a location on the sky

Arguments:

in.fits
Input FITS file.
out.fits
Path to output FITS file.
ra
In normal mode, RA of center of output image.
dec
In normal mode, declination of center of output image.
xstartpix
In pixel mode, pixel along the x-axis where the cutout image will begin
ystartpix
In pixel mode, pixel along the y-axis where the cutout image will begin
xsize
In normal mode, width of output image in degrees.
ysize
In normal mode, height of output image in degrees (default is equal to xsize.
xpixsize
In pixel mode, width of output image in pixels
ypixsize
In pixel mode, height of output image in pixels (default is equal to xpixsize
Results:
[struct stat="OK", content="blank, flat or normal"]
The content keyword indicates whether all pixels where NaN (blank), all pixels were the same value (flat), or the image appears to be normal.

Examples

$ mSubCube image1.fits subimage.fits 307.9 37.29 .01 .01
[struct stat="OK", content="normal"]

Return Codes:

  • [struct stat="OK", content="blank, flat or normal"]
  • [struct stat="ERROR", msg="Usage: mSubCube [-d][-a(ll-pixels)] [-h hdu] [-s statusfile] in.fit out.fit ra dec xsize [ysize] | mSubCube -p [-d] [-h hdu] [-s statusfile] in.fits out.fit xstartpix ystartpix xpixsize [ypixsize]"]
  • [struct stat="ERROR", msg="HDU value (hdu) must be a non-negative integer"]
  • [struct stat="ERROR", msg="Cannot open status file: statusfile"]
  • [struct stat="ERROR", msg="Center RA string (string) cannot be interpreted as a real number"]
  • [struct stat="ERROR", msg="Center Dec string (string) cannot be interpreted as a real number"]
  • [struct stat="ERROR", msg="X size string (string) cannot be interpreted as a real number"]
  • [struct stat="ERROR", msg="Y size string (string) cannot be interpreted as a real number"]
  • [struct stat="ERROR", msg="Invalid 'x' size"]
  • [struct stat="ERROR", msg="Invalid 'y' size"]
  • [struct stat="ERROR", msg="Image file filename missing or invalid FITS"]
  • [struct stat="ERROR", msg="Cannot find HDU hdu"]
  • [struct stat="ERROR", msg="Output wcsinit() failed."]
  • [struct stat="ERROR", msg="Location is off image"]
  • [struct stat="ERROR", msg="Region outside image"]
  • [struct stat="ERROR", msg="No pixels match area."]
  • [struct stat="ERROR", msg="Can't create output file: out.fits"]
  • [struct stat="ERROR", flag=n, msg="FITS library error"]