Visualization

sp3d_with_ds9

This script opens a 3D FITS image in the ds9 image browser and allows interactive selection of object and sky spaxels. Simultaneously, the corresponding spectra and their subtraction are displayed. This interaction is similar to what is done with the program qfitsview. The reason for developing this code has been the more comfortable interaction with the Matplotlib window displaying the spectra, along with the ability to leverage the full functionality of the ds9 program. The ds9 session is launched automatically when running this script and must be closed manually upon completion.

(venv_numina) $ numina-sp3d_with_ds9 --help
Usage: numina-sp3d_with_ds9 [-h] [-e EXTNUM] [--extname EXTNAME] [--i1 I1] [--i2 I2] [--footprint]
                            [--wave-unit WAVE_UNIT] [--ds9exec DS9EXEC]
                            [--plot_render {matplotlib,ds9,both}] [--input-masks INPUT_MASKS]
                            [--output-masks OUTPUT_MASKS] [--version] [--output-dir OUTPUT_DIR]
                            [--no-color] [--record] [--echo]
                            [--log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}]
                            datacube

Interactive examination of 3D data cubes with ds9.

Positional Arguments:
  datacube              Input 3D FITS data cube

Options:
  -h, --help            show this help message and exit
  -e, --extnum EXTNUM   Extension number for image in input files.
  --extname EXTNAME     Extension name for image in input files.
  --i1 I1               First pixel along NAXIS3 (default 1)
  --i2 I2               Last pixel along NAXIS3 (default NAXIS3)
  --footprint           Plot footprint along NAXIS3 (default False)
  --wave-unit WAVE_UNIT
                        Unit of the wavelength axis (default Angstrom)
  --ds9exec DS9EXEC     Command line to launch ds9 (default 'ds9')
  --plot_render {matplotlib,ds9,both}
                        Display to display spectra (default=matplotlib)
  --input-masks INPUT_MASKS
                        Path to a FITS file with source and continuum masks
  --output-masks OUTPUT_MASKS
                        Path to the output FITS file with source and continuum masks
  --version             Display version information and exit
  --output-dir OUTPUT_DIR
                        Output directory (default: .)
  --no-color            Disable color output
  --record              Record terminal output
  --echo                Display full command line
  --log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}
                        Set the logging level

ximshow

This is a tool for visualizing 2D FITS images using Matplotlib, which can be convenient when displaying multiple images consecutively and quickly saving the result to a PNG or PDF file.

(venv_numina) $ numina-ximshow --help
Usage: numina-ximshow [-h] [--extnum EXTNUM] [--extname EXTNAME] [--z1z2 Z1Z2] [--bbox BBOX]
                      [--firstpix FIRSTPIX] [--aspect {equal,auto}] [--xlabel XLABEL]
                      [--ylabel YLABEL] [--cmap CMAP] [--cbar-label CBAR_LABEL]
                      [--cbar_orientation {horizontal,vertical,None}] [--keystitle KEYSTITLE]
                      [--ds9reg DS9REG] [--geometry GEOMETRY] [--factor_macosx FACTOR_MACOSX]
                      [--pdffile PDFFILE] [--pngfile PNGFILE] [--figuredict FIGUREDICT]
                      [--debugplot {0,1,2,10,11,12,21,22}]
                      filename [filename ...]

description: display FITS images

Positional Arguments:
  filename              FITS file (wildcards allowed) or txt file with list of FITS files

Options:
  -h, --help            show this help message and exit
  --extnum EXTNUM       Extension number in input files (note that primary extension is 1 =
                        default value)
  --extname EXTNAME     Extension name in input file. Only works for a single file, not for a list
                        of files (use --extnum instead)
  --z1z2 Z1Z2           tuple '[+/-z1, +/-z2]', minmax, zscale or None (=zscale)
  --bbox BBOX           bounding box tuple: nc1,nc2,ns1,ns2
  --firstpix FIRSTPIX   coordinates of lower left pixel: nc0, ns0
  --aspect {equal,auto}
                        aspect ratio (equal or auto)
  --xlabel XLABEL       X-axis label
  --ylabel YLABEL       Y-axis label
  --cmap CMAP           color map
  --cbar-label CBAR_LABEL
                        color bar label
  --cbar_orientation {horizontal,vertical,None}
                        color bar orientation
  --keystitle KEYSTITLE
                        tuple of FITS keywords.format: key1,key2,...keyn.'format'
  --ds9reg DS9REG       ds9 region file to be overplotted
  --geometry GEOMETRY   string "xwidth,ywidth,xorigin,yorigin"
  --factor_macosx FACTOR_MACOSX
                        Factor to control the size of the plot on macOS (default=1.5)
  --pdffile PDFFILE     ouput PDF file name
  --pngfile PNGFILE     ouput PNG file name
  --figuredict FIGUREDICT
                        string with dictionary of parameters for plt.figure()
  --debugplot {0,1,2,10,11,12,21,22}
                        Integer indicating plotting/debugging (default=12)