MSHRINK(1)

πŸ’« mShrink β€” bestie edition πŸ’«

okay so this is a page from the Montage manual, and today we're learning about mShrink(1). she's a lil utility, she's lowkey iconic, and she's about to make your FITS files ✨smaller✨. sit down, grab a strawberry, let's go πŸ“


🌸 NAME 🌸

mShrink β€” re-size a FITS image. that's it, that's the whole vibe. resizing. slay.


✨ SYNOPSIS ✨

mShrink [-f] [-d level] [-h hdu] [-s statusfile] in.fits out.fits factor

like, that's the whole thing. flags first, then your two files, then the factor. periodt πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so basically: this is a utility for reducing the size of a FITS file, by averaging blocks of pixels. no cap. that's genuinely what she does. blocks of pixels go in, one averaged pixel comes out, the file gets smol. it's giving ✨shrink✨.


πŸŽ€ OPTIONS πŸŽ€

  • -f β€” the fixed-size flag 🫢 instead of telling her how big the blocks of pixels should be that you want averaged, you tell her the output size of the image. flip the whole thing around. main character energy.
  • -d level β€” turns on debugging to the specified level, and the levels go 1-4. so like, -d 1 is a lil peek, -d 4 is full unhinged verbose mode 😭
  • -s statusfile β€” output and errors get sent to statusfile instead of to stdout. so if you're tired of the terminal yelling at you, send it somewhere else bestie πŸ’–

🌈 ARGUMENTS 🌈

  • in.fits β€” the input FITS file. the one you're feeding her. the before picture πŸ“Έ
  • out.fits β€” the path to the output FITS file. the after picture, the glow-up, the transformation ✨
  • -h hdu β€” use the specified FITS extension. default is to use the first HDU with image data. so if you don't say anything, she just grabs the first one that has actual image data in it. no drama.
  • factor β€” this is the size of the blocks, in pixels, to average. your file size will be reduced by 1/factor squared. BUT!! if you used the -f (fixed-size) flag, then factor means something completely different: it's the desired width of the output image. same name, different job, she contains multitudes πŸ’…

πŸ‘‘ RESULT πŸ‘‘

  • [Normal mode]: you get a FITS output image, reduced in size by a factor of (1/factor)^2. math is mathing πŸ“
  • [Fixed-size mode]: you get a FITS output image of width factor. exactly that width. she said what she said.

πŸ”₯ MESSAGES πŸ”₯

here's the group chat, here's what she might say back to you:

  • OK β€” [struct stat="OK"] πŸŽ‰ we love a success story
  • ERROR β€” Cannot open status file: statusfile πŸ™ˆ couldn't open the status file you named
  • ERROR β€” Image size factor cannot be interpreted as an real number (yes that's literally how it's spelled, i don't make the rules 😭)
  • ERROR β€” Shrink factor factor cannot be interpreted as an real number
  • ERROR β€” [struct stat="ERROR", msg=
  • ERROR β€” Image file in.fits missing of inavlid FITS.
  • ERROR β€” FITS library error
ngl if you're seeing a wall of ERROR lines, that's the vibe check failing. check your file paths and your numbers fr fr πŸ’€

🧚 EXAMPLES 🧚

okay here's what it actually looks like in the wild:

$ mShrink final/out.fits final/out-lowres_5.fits 5
       [struct stat="OK"]

she ate and left no crumbs. [struct stat="OK"] is the sound of a job well done πŸ’–


πŸ’€ BUGS πŸ’€

okay this is the part where we keep it real, because besties don't lie to each other:

  • the drizzle algorithm has been implemented but has not been tested in this release. so like, she's there, she exists, nobody has taken her for a walk yet. proceed accordingly 🫣
  • 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, resulting in the error: [struct stat="ERROR", status=207, msg="illegal character in keyword"]. windows line endings strike again, we been knew 😭
  • 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 β€” that's the -l flag in mBgModel. iykyk πŸ’…

2001-2015 California Institute of Technology, Pasadena, California

if your research uses Montage, please include the following acknowledgement, and yes you have to include the whole thing, she said it with her whole chest:

"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. shoutout 🫢


and that's the whole page bestie!! go forth, average some pixel blocks, make your FITS files smol πŸ’–βœ¨ this was Montage 5, dated Dec 2016 β€” mwah, love u, bye πŸŽ€πŸ¦‹πŸŒΈ