MPAD(1)

πŸ¦‹ MPAD(1) β€” aka mPad, bestie edition πŸ¦‹

okay so first things first: this page is from the Montage manual set, and the star of the show is a lil tool called mPad πŸ’… (you'll see MPAD(1) floating around too β€” same girl, different outfit).


✨ NAME ✨

mPad β€” and the official one-word description is... None. 😭

fr fr, that's it. that's the whole NAME section. the mystery is the brand.


✨ SYNOPSIS ✨

mPad [-nowcs][-d level][-val NaN-value][-bar xmin xmax ymin ymax
histfile] in.fits out.fits left right top bottom

✨ DESCRIPTION ✨

so every once in a while you want to pad the border of an image β€” like, give it some breathing room 🫢. maybe you need space for annotation, maybe you're adding a color bar, maybe you just want it to look cute for the visual effect. whatever the reason, mPad does exactly that. and if a color bar is what you're after, it adds one too β€” wherever you tell it to, which might be out in the pad or might be sitting right on top of the image. your call, main character πŸ’…

the pad around the edges gets filled with NULLS (these render the same as the minimum in the color table, except in mJPEG/mViewer πŸ‘€). but you can optionally have those NULLs translated to some other value using the -val argument. slay.


✨ OPTIONS ✨

  • -nowcs β€” if your image has WCS values chillin' in the header, those need to be adjusted to compensate for the padding. this flag is you telling the software "bestie, there are no WCS keywords in here, don't even try" πŸ™ˆ
  • -d level β€” set the debugging level (default is none)
  • -val NaN-value β€” the value you want NULL pixels converted to πŸŽ€
  • -bar xmin xmax β€” [see below, the args spill down the page like a group chat]

ymin ymax

histfile

okay so adding a color bar as part of the image? it's a little trickier than it first seems. lowkey deceptive ✨

a color bar is a rectangular region of pixels whose data values are set so it gives the impression of the lookup-table used to render the image. to pull that off, we need the image histogram that mViewer (or whatever renderer you're running) would use when displaying the data.

the easiest way to do this is:

  1. use mHistogram to generate the stretchl
  2. use mPad to add the pixel array (usually in a pad added around the outside of the image(;
  3. use mViewer with the same pre-build histogram to render the image

✨ ARGUMENTS ✨

  • in.fits β€” the original FITS image 🌸
  • out.fits β€” the padded FITS image πŸ’–
  • left right top bottom β€” how many pixels to pad on each of the four sides of the image. all four, in that order, no skipping πŸ‘‘

✨ RESULT ✨

if everything goes right, you get a brand-new image that's almost identical to the original β€” just padded around the edges, and possibly carrying an embedded color bar πŸŽ€. and when you send it over to mViewer, that tool can optionally add annotation to the bar. teamwork, periodt.


✨ MESSAGES ✨

here's every message this thing can throw at you, verbatim, no cap:

  • ERROR No debug level given
  • ERROR Debug level string is invalid: 'badstring'
  • ERROR Debug level value cannot be negative
  • ERROR Not enough information given to draw color bar
  • ERROR Bar X min string is invalid: 'badstring'
  • ERROR Bar X max string is invalid: 'badstring'
  • ERROR Bar Y min string is invalid: 'badstring'
  • ERROR Bar Y max string is invalid: 'badstring'
  • ERROR Cannot open histogram file badfile
  • ERROR No value given for NaN conversion
  • ERROR NaN conversion value string is invalid: 'badstring'
  • ERROR FITS library error
  • ERROR general error message

✨ EXAMPLES ✨

the moment you've been waiting for, bestie:

(mHistogram -file SDSS_r.fits -2s max gaussian-log -out SDSS_r.hist)

mPad -bar -100 -50 50 -50 SDSS_r.hist SDSS_r.fits sdss.fits 50
250 50 50 [struct stat="OK"]

ate. πŸ”₯


✨ BUGS ✨

🚨 okay bestie, pay attention, this part is not a vibe:

the drizzle algorithm has been implemented but has not been tested in this release. πŸ‘€

if a header template contains carriage returns (i.e., it was created/modified on a Windows machine), the cfitsio library will be unable to read it properly, and you'll get this:

[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, then return to the originally desired header size for the final coaddition. the default background matching assumes there are no non-linear background variations in the individual images (and therefore in the overlap differences). if there's any uncertainty in this regard, it's safer to turn on the "level only" background matching β€” that's 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, bestie 🫢 this was Montage 5, dated Dec 2016 β€” go pad something iconic ✨πŸ’