MBACKGROUND(1)

✨ MBACKGROUND β€” remove a background plane from a FITS image, bestie ✨

okay so this is mBackground, part of the Montage toolset. She's giving "delete the background plane from your FITS image" and honestly? iconic. πŸ’…


🌸 SYNOPSIS 🌸

mBackground [-d level] [-n(o-areas)] [-s statusfile] in.fits out.fits A
B C

mBackground [-t] [-d level] [-n(o-areas)] [-s statusfile] in.fits
out.fits images.tbl corrfile.tbl

Two whole moods, pick your fighter. 🫢


πŸ’– DESCRIPTION πŸ’–

So what she does is remove a background plane from a FITS image. Periodt.

The background correction that gets applied to your image is written as Ax+By+C, where (x,y) is the pixel coordinate β€” and bestie, listen, the image center is the origin, not the corner. And (A,B,C)? Those are the background plane parameters, specified as linear coefficients. That's the whole vibe. πŸ¦‹


✨ OPTIONS ✨

  • -d level β€” turns on debugging up to the specified level. She's chatty, your call how chatty. πŸ”₯
  • -n β€” says that no area images are present (it assumes equal weighting for each data pixel). Lowkey the chill option.
  • -s statusfile β€” mBackground's output and errors get written to statusfile instead of stdout. Fancy.
  • -t β€” run in table mode. This starts a whole group of mBackground runs in parallel, reading off the same pair of tables to figure out which files and background corrections to work with. Recommended for running only on grids or parallel processors, no cap.

πŸŽ€ ARGUMENTS πŸŽ€

  • in.fits β€” input FITS file. The one you're fixing.
  • out.fits β€” output FITS file. The glow-up result.
  • A B C β€” corrections (as given by mFitplane or mFitExec). Just three little numbers, three little numbers. πŸ’œ
  • images.tbl β€” when run as part of a GRID processing job, mBackground requires the image metadata table to retrieve the filenames of images.
  • corrections.tbl β€” when run as part of a GRID processing job, mBackground requires a table of corrections (from mFitplane and mFitExec) to apply to the corresponding image (from images.tbl).

🌈 RESULT 🌈

Output FITS image with background subtraction applied. That's it. That's the prize. πŸ‘‘


πŸ’… MESSAGES πŸ’…

Here's the whole group chat of things she might say to you. Not me listing every single one, but like... yes actually, every single one:

  • OK β€” [struct stat = "OK"]
  • ERROR β€” No status file name given
  • ERROR β€” Cannot open status file: statusfile
  • ERROR β€” No debug level given
  • ERROR β€” Debug level string is invalid: string
  • ERROR β€” Debug level value cannot be negative
  • ERROR β€” Invalid input file filename
  • ERROR β€” Invalid output file filename
  • ERROR β€” A coefficient string is not a number
  • ERROR β€” B coefficient string is not a number
  • ERROR β€” C coefficient string is not a number
  • ERROR β€” Invalid image metadata file: images.tbl
  • ERROR β€” Image table needs columns cntr and fname
  • ERROR β€” Hit end of image table without finding file name
  • ERROR β€” Need columns: id,a,b,c in corrections file
  • ERROR β€” Hit end of corrections table without finding data
  • ERROR β€” FITS library error message
  • ERROR β€” general error message

πŸ“ EXAMPLES πŸ“

The following is sample output from mFitplane for a FITS image, in.fits:

[struct stat="OK", a=-0.000144415, b=-0.000133642, c=-31.8984,
crpix1=758.5, crpix2=-1032, xmin=-758.5, xmax=-349.5, ymin=1032,
ymax=1498, xcenter=-555.007, ycenter=1265.26, rms=0.576727]

Then we use the plane coefficients calculated by mFitplane to subtract the background from the image, like so:

$ mBackground projdir/in.fits bg_removed/in.fits -0.000144415
-0.000133642 -31.8984
       [struct stat="OK"]

Obsessed. It just works. 🧚


πŸ’€ BUGS πŸ’€

okay bestie, this is the part where we're real with each other:

  • The drizzle algorithm has been implemented but has not been tested in this release. So like. It exists. We don't know her yet. πŸ™ˆ
  • If a header template contains carriage returns (i.e., created/modified on a Windows machine), the cfitsio library 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 is safer to turn on the "level only" background matching (the -l flag in mBgModel).

2001-2015 California Institute of Technology, Pasadena, California

If your research uses Montage, please include the following acknowledgement: "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."

The Montage distribution includes an adaptation of the MOPEX algorithm developed at the Spitzer Science Center.


and that's the whole page, babe πŸŽ€ this was Montage 5, dated Dec 2016, and it's the mBackground(1) manual β€” go subtract a plane, you absolute main character πŸ’–βœ¨