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] [--i1 I1] [--i2 I2] [--ds9exec DS9EXEC]
                            [--plot_render {matplotlib,ds9,both}]
                            [--input_masks INPUT_MASKS]
                            [--output_masks OUTPUT_MASKS] [--verbose] [--echo]
                            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
  --i1 I1               First pixel along NAXIS3 (default 1)
  --i2 I2               Last pixel along NAXIS3 (default NAXIS3)
  --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
  --verbose             Display intermediate information
  --echo                Display full command line

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] [--z1z2 Z1Z2] [--bbox BBOX]
                      [--firstpix FIRSTPIX] [--aspect {equal,auto}]
                      [--cmap CMAP] [--cbar_label CBAR_LABEL]
                      [--cbar_orientation {horizontal,vertical,None}]
                      [--keystitle KEYSTITLE] [--ds9reg DS9REG]
                      [--geometry GEOMETRY] [--pdffile PDFFILE]
                      [--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 first
                        extension is 1 = default value)
  --z1z2 Z1Z2           tuple , 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)
  --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"
  --pdffile PDFFILE     ouput PDF 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)