Miscellaneous 3D data scripts

measure_slice_xy_offsets_in_3d_cube

This script calculates the spatial offset in the sky plane between a particular spatial slice and all the spatial slices of a given 3D cube. It does so using a cross-correlation method.

(venv_numina) $ numina-measure_slice_xy_offsets_in_3d_cube --help
Usage: numina-measure_slice_xy_offsets_in_3d_cube [-h] [--extname EXTNAME] [--polydeg POLYDEG]
                                                  [--times-sigma-reject TIMES_SIGMA_REJECT]
                                                  [--islice-reference ISLICE_REFERENCE]
                                                  [--iterate] [--method {1,2}] [--plots]
                                                  [--version] [--output-dir OUTPUT_DIR]
                                                  [--no-color] [--record] [--echo]
                                                  [--log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}]
                                                  filename npoints

Determine (X,Y) offsets between slices along NAXIS3

Positional Arguments:
  filename              Input 3D FITS file
  npoints               Number of points along NAXIS3

Options:
  -h, --help            show this help message and exit
  --extname EXTNAME     Output extension name to store result (default None)
  --polydeg POLYDEG     Polynomial degree to fit distortion
  --times-sigma-reject TIMES_SIGMA_REJECT
                        Times sigma to reject fitted offsets (default 3.0)
  --islice-reference ISLICE_REFERENCE
                        Initial pixel corresponding to the reference slice (from 1 to NAXIS3)
  --iterate             Force one iteration
  --method {1,2}        Method (1: skimage, 2: scipy)
  --plots               Plot intermediate results
  --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

resample_wave_3d_cube

This script resamples a 3D data cube by specifying the output values for CRVAL3, CDELT3 and NAXIS3. The celestial WCS is preserved, and the spectral WCS is modified in order to make use of the new wavelength sampling. This code does not use the functionality of the reproject package and instead performs a simple linear redistribution of the signal in the newly sampled wavelength grid. In this sense, it produces the same result as the numina-generate_mosaic_of_3d_images script when employed with a single input 3D FITS file and the reprojection method is interp.

(venv_numina) $ numina-resample_wave_3d_cube --help
Usage: numina-resample_wave_3d_cube [-h] [--extname EXTNAME] [--crval3out CRVAL3OUT]
                                    [--cdelt3out CDELT3OUT] [--naxis3out NAXIS3OUT]
                                    [--slice_ini SLICE_INI] [--slice_end SLICE_END]
                                    [--wcskey WCSKEY] [--connected_zeros_to_nan] [--version]
                                    [--output-dir OUTPUT_DIR] [--no-color] [--record] [--echo]
                                    [--log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}]
                                    input output

Resample a 3D cube in the wavelength axis (NAXIS3).

Positional Arguments:
  input                 Input FITS file with the 3D cube.
  output                Output FITS file with the resampled 3D cube.

Options:
  -h, --help            show this help message and exit
  --extname EXTNAME     Extension name of the input HDU (default: 'PRIMARY').
  --crval3out CRVAL3OUT
                        Minimum wavelength for the output image (in meters).
  --cdelt3out CDELT3OUT
                        Wavelength step for the output image (in meters).
  --naxis3out NAXIS3OUT
                        Number of slices in the output image.
  --slice_ini SLICE_INI
                        Initial slice index to be resampled (1-based).
  --slice_end SLICE_END
                        Final slice index to be resampled (1-based).
  --wcskey WCSKEY       WCS key to use when multiple WCS are present in the FITS header.
  --connected_zeros_to_nan
                        Convert connected zeros to NaN before resampling.
  --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