Command-line reference

The fitstoolz command groups a handful of small FITS operations. Every subcommand takes the input file as a positional argument, and every subcommand that writes takes either --outfile or --replace.

The options below are generated from each app’s typed signature — the same pydantic model that defines the step when it is called from a stimela-ninja recipe. There is one schema, so the command line and the pipeline step cannot drift apart.

fitstoolz

Command-line tools for simple operations on FITS files

Usage

fitstoolz [OPTIONS] COMMAND [ARGS]...

Options

-ll, --log-level <log_level>

Log level

Options:

INFO | WARNING | CRITICAL | ERROR

add-axis

Add an axis to a FITS image

Usage

fitstoolz add-axis [OPTIONS] FNAME

Options

--ctype <ctype>

Required Axis type; FREQ, STOKES, etc.

--index <index>

Required Add axis at this dimension index

--crpix <crpix>

Reference pixel (zero-based indexing)

--crval <crval>

Value at Reference pixel (crval)

--cdelt <cdelt>

Pixel width

--cunit <cunit>

Units (astropy naming convention)

--ra-chunks <ra_chunks>

RA chunking

--dec-chunks <dec_chunks>

Dec chunking

--spectral-chunks <spectral_chunks>

Spectral chunking

--outfile <outfile>

Path of output image

--replace, --no-replace

Overwrite output if it exists

Arguments

FNAME

Required argument

header

Show, add, edit or remove FITS header entries

Usage

fitstoolz header [OPTIONS] FNAME

Options

--show, --no-show

Show header and exit

--edit <edit>

Edit FITS header entry, as KEY=VALUE

--remove <remove>

Remove header entry

--add <add>

Add header entry, as KEY=VALUE

--outfile <outfile>

Path of output image

--replace, --no-replace

Overwrite output if it exists

Arguments

FNAME

Required argument

remove-axis

Remove an axis from a FITS image

Usage

fitstoolz remove-axis [OPTIONS] FNAME

Options

-ct, --ctype <ctype>

Required Axis type (or dimension). FREQ, STOKES, etc.

-si, --select-index <select_index>

Keep data at this index (zero-based). For example, if removing the frequency axis, this would be the channel to keep.

--ra-chunks <ra_chunks>

RA chunking

--dec-chunks <dec_chunks>

Dec chunking

--spectral-chunks <spectral_chunks>

Spectral chunking

--outfile <outfile>

Path of output image

--replace, --no-replace

Overwrite output if it exists

Arguments

FNAME

Required argument

slice

Slice a FITS image along one or more axes

Usage

fitstoolz slice [OPTIONS] FNAME

Options

--axis <axis>

Axis slicing info, as CTYPE,START,END

--memmap, --no-memmap

memmap option to pass to astropy.io.fits.open()

--ra-chunks <ra_chunks>

RA chunking

--dec-chunks <dec_chunks>

Dec chunking

--spectral-chunks <spectral_chunks>

Spectral chunking

--outfile <outfile>

Path of output image

--replace, --no-replace

Overwrite output if it exists

Arguments

FNAME

Required argument

stack

Stack FITS images along an axis

Usage

fitstoolz stack [OPTIONS] FNAME

Options

--axis <axis>

Required Stack files along this axis

--extra-files <extra_files>

Additional files to stack (use multiple times)

--stacked-fits <stacked_fits>

Required Path of stacked output image

--ra-chunks <ra_chunks>

RA chunking

--dec-chunks <dec_chunks>

Dec chunking

--spectral-chunks <spectral_chunks>

Spectral chunking

Arguments

FNAME

Required argument

stats

Get image statistics

Usage

fitstoolz stats [OPTIONS] FNAME

Options

--show, --no-show

Show min, max, mean and standard deviation

--slice <slice>

Slice data, as CTYPE,START,END

--clip-below <clip_below>

Blank pixels below this value

--clip-above <clip_above>

Blank pixels above this value

--blank-value <blank_value>

Blank value when using –clip-below/above. The values ‘inf’ and ‘nan’ are valid blank values.

Arguments

FNAME

Required argument

unstack

Unstack a FITS image along an axis

Usage

fitstoolz unstack [OPTIONS] FNAME

Options

--axis <axis>

Required Unstack the files along this axis

--ra-chunks <ra_chunks>

RA chunking

--dec-chunks <dec_chunks>

Dec chunking

--spectral-chunks <spectral_chunks>

Spectral chunking

--outfile <outfile>

Path of output image

--replace, --no-replace

Overwrite output if it exists

Arguments

FNAME

Required argument

Output paths

fitstoolz.apps.outfits_name resolves the destination for the apps that write a modified copy:

  • --outfile PATH — write there.

  • --replace — write back over the input file.

  • neither — the command raises. There is deliberately no default output name.

stack writes to its required --stacked-fits instead, and stats writes nothing at all.

The apps pass overwrite=True down to write_to_fits(), so a destination you name on the command line is a destination the app will replace. The library default is the other way round — see Security.