Munipack's logo

Common options

Commonly used options and switches.

Verbose output

$ munipack --verbose ... action and so on ...

This switch enables detailed reports. The additional information can be useful for exploring of processing or in doubts.

Without this switch, Munipack respects standard UNIX philosophy: Only errors are reported. A silent run means no errors. It is very usefully for processing of large datasets because only important errors should be delivered to users.

Simple Output Filenames

-o name
--output name

Specify an output file name for a single file. If the option is not presented, the output name is derived from the particular action name.

Target Directory

-t directory
--target-directory=directory

It would be useful to store output files in a specified directory. The most typical use is storing modified files in a working directory when original files are untouched.

Input filenames

All actions for files expects a list of FITS files on input. The list can be specified on a command-line or given by a file.

Filenames as arguments

The list of files to process. Usually as a names with wildcards (* or ?) equivalent to standard shell synatax. Example:

  $ munipack fits one.fits more.fits red.fits nightmare.fits
  $ munipack fits -K DATE-OBS *.fits
  $ munipack bias bias*.fits
  $ munipack fits `find dir/ -name '*.fits'`

The first example shows the FITS structre of the files gived by hand. The second one show sthe structure for all files macthing the mask. The third line prepares bias from all frames by mask bias*.fits The last one illustrates scaning of FITS files troughout sub-directories.

An input file with filenames

The input filename is powerfull alterantive to the argument lists in case of huge lists, the batch processing or arbitrary modification of output filenames.

The input filename can be given by specifing @[input] or - [< input] options:

@[input]
- < [input]

The @ (at) or - (dash) indicates to read from a standard input. (@ character has the same meaning like in classical softwares Iraf and Midas.)

The input from file is initiated with @ character followed a file-name (file.lst). The file is a plain text file with single file per line. As example, the content of the file.lst equivalent to the previous example:

one.fits
more.fits
red.fits
nightmare.fits

The file can be prepared by hand or prepared by the command with using of shell redirection and find utility:

$ ls *.fits > file.lst                  # files in current directory
$ find dir/ -name '*.fits' > file.lst   # all files in dir/, recursive
$ ls *.fits | munipack dark -           # filenames are piped from ls

An alternative form represents the input file in the form of two items per line. The items are separated by spaces, which means that spaces are not allowed in filenames.

  input1.fits output1.fits
  input2.fits output2.fits
  input3.fits output3.fits
  ...

This form can be usefull in case when a complex renaming is required. It can be very usefull for cases like

  ls 0716_*[VR].fits | awk '{a=$1; gsub(/0716/,"pks0716+71"); print a,$1;}' > input
  munipack phcorr @input

The use of two items is also allowed on command line. The items are stil separated by spaces so enclosing in apostrophes is necessory.

  munipack fits --cat 'first.fits second.fits'

There are also another a powerful way as describes Advanced Output Filenames section.

Advanced Output Filenames

-O
--pattern pattern (default: (.+)\.(.+))
--mask mask (default: empty)
--format format (default: empty)

Specify a regular expression or a format to describe of an output file name(s). The -O switch-on the advanced functionality (else the simple backup with suffix is used). The pattern is a regular expression used to matching and on will usually include bracket expression for back-references. The back-references can be used in mask with \number. To test a regular expression, use sed: sed s/pattern/mask/. --mask is used for newly created files whilst --backup for specify of backup files.

The default pattern splits filenames onto two parts name and extension separated by a dot (\.). The pattern recognizing algorithm uses Regular Expression rules syntax. The parts are accessible via \number operator. The \0 means original filename, \1 name and \2 extension.

The format is a standard format for output of sequence images. To test a format, use printf "out%d.fits",666.

When just only -O is specified, backups are disabled.

When the advanced filename processing is set, the options -t,-S,-b are ignored, because their functionality can be simply simulated.

Examples:

# store outputs in /tmp directory : -O --mask '/tmp/\0'
 barnard_0011R.fits -> /tmp/barnard_0011R.fits

# modify suffix: -O --pattern '(.+)\.fits' --mask '\1.fit'
 barnard_0011R.fits -> barnard_0011R.fit

# modify filename: -O --pattern '(.+)\.(.+)' --mask '\1_D.\2'
 barnard_0011R.fits -> barnard_0011R_D.fits

# alternate backups: -O --mask '\0.bak'
 barnard_0011R.fits -> barnard_0011R.fits.bak

# overwrite output: -O --mask '!\0'
 barnard_0011R.fits -> !barnard_0011R.fits

# list of numbered files: -O --format 'out_%02d.fits'
 barnard_0001R.fits -> out_01.fits

# disable backups: -O
 barnard_0001R.fits -> barnard_0001R.fits

See also: wxRegEx, wxString

Backup Strategy

Backup strategy for Munipack modifies both traditional Unix system as well as FITS conventions. There are general rules:

Practical implications:

The backup strategy has been changed between versions 0.5.10 and 0.5.11 (January 2018).

Numerical Data Types

-B [8|16|32|-32]
--bitpix[=8|16|32|-32]

Select bits per pixel of output images. Possible values are: 8 (0-255), 16 (0-65535), 32 (0-4294967296) for integer non-negative numbers of ℕ set and -32 (-10-38 .. 1038, 6 decimal digits) for real numbers of ℝ set, (values in braces indicates numerical ranges).

The parameter is set according to BITPIX in original frames for photometric pre-corrections or set to -32 for derived images. Defaults are usually satisfactory.

General guidelines: An optimal bitpix for raw (instrumental) data is 16 (default) which covers a full range of digital cameras. The representation occupies 2 × width × height bytes. Some out of range (rare) values will be cut-off.

The representing by real numbers (eg. -32) is recommended value for images intended for further processing because saves numerical precision and their numerical range (but occupies of twice more space with respect to 16).

8-bits reduces range (eg. suppress dynamical range) and 32 wastes a lot of storage place only.