Flat

Overview

This file describes the data model for the Flat. It is a series of images starting from the combination of all input pixelflat frames.

The images are written to disk as a multi-extension FITS file prefixed by Flat in the Calibrations/ folder. See Calibration Frame Naming for the naming convention.

Inspecting

PypeIt provides the pypeit_chk_flats script to inspect the key Flat outputs.

The script usage can be displayed by calling the script with the -h option:

$ pypeit_chk_flats -h
usage: pypeit_chk_flats [-h] [-v VERBOSITY] [--log_file LOG_FILE]
                        [--log_level LOG_LEVEL] [--type TYPE] [--try_old]
                        file

Display flat images in Ginga viewer

positional arguments:
  file                  PypeIt Flat file [e.g. Flat_A_1_DET01.fits]

options:
  -h, --help            show this help message and exit
  -v, --verbosity VERBOSITY
                        Verbosity level, which must be 0, 1, or 2. Level 0
                        includes warning and error messages, level 1 adds
                        informational messages, and level 2 adds debugging
                        messages and the calling sequence. (default: 2)
  --log_file LOG_FILE   Name for the log file. If set to "default", a default
                        name is used. If None, a log file is not produced.
                        (default: None)
  --log_level LOG_LEVEL
                        Verbosity level for the log file. If a log file is
                        produce and this is None, the file log will match the
                        console stream log. (default: None)
  --type TYPE           Which flats to display. Must be one of: pixel, illum,
                        all (default: all)
  --try_old             Attempt to load old datamodel versions. A crash may
                        ensue.. (default: False)

pypeit_chk_flats

This script takes a Flat as input and displays a series of images in a ginga viewer, each in a separate tab.

Here is a typical call:

pypeit_chk_flats Calibrations/Flat_A_1_DET01.fits

Below we describe the standard products. There is enough variation from spectrograph to spectrograph that we have not included example screen-shots.

Raw Flat

This is the processed and combined pixelflat image. Despite the name, it is not completely raw.

This image should look like any one of your input pixelflat images.

Pixel Flat

This is the normalized to unity image which is used to correct for pixel-to-pixel variations across the detector.

It should look mainly like a salt-and-pepper, random-noise image fluctuating very close around values of 1.

For many detectors there may be ‘pock’ marks, columns, and even funny patterns.

It is also typical for the extreme spectral portions (top/bottom) to have more structure or pattern noise. This is especially true if there is limited flux at these ends (e.g. the data goes below the atmospheric cutoff).

Illumination Flat

This image should also have most values near unity, but there will be vertical coherence. And the edges (left/right) may fall off well below unity.

Flat Model

This image should largely resemble the Raw Flat.

pypeit_show_pixflat

In addition to pypeit_chk_flats, if a custom pixel flat is provided by the user, another script pypeit_show_pixflat is available to inspect it. The script is called as follows:

pypeit_show_pixflat PYPEIT_LRISb_pixflat_B600_2x2_17sep2009_specflip.fits.gz

The script usage can be displayed by calling the script with the -h option:

$ pypeit_show_pixflat -h
usage: pypeit_show_pixflat [-h] [-v VERBOSITY] [--log_file LOG_FILE]
                           [--log_level LOG_LEVEL] [--det DET [DET ...]]
                           file

Show an archived Pixel Flat image in a ginga window.

positional arguments:
  file                  Pixel Flat filename, e.g.
                        pixelflat_keck_lris_blue.fits.gz

options:
  -h, --help            show this help message and exit
  -v, --verbosity VERBOSITY
                        Verbosity level, which must be 0, 1, or 2. Level 0
                        includes warning and error messages, level 1 adds
                        informational messages, and level 2 adds debugging
                        messages and the calling sequence. (default: 2)
  --log_file LOG_FILE   Name for the log file. If set to "default", a default
                        name is used. If None, a log file is not produced.
                        (default: None)
  --log_level LOG_LEVEL
                        Verbosity level for the log file. If a log file is
                        produce and this is None, the file log will match the
                        console stream log. (default: None)
  --det DET [DET ...]   Detector(s) to show. If more than one, list the
                        detectors as, e.g. --det 1 2 to show detectors 1 and 2.
                        If not provided, all detectors will be shown. (default:
                        None)

Troubleshooting

If one or more of your image appears to be in err, here are the things to consider:

  • Is one or more of your flat frames junk?

  • Is one or more of your input flat frames mis-labeled?

  • Did you saturate portions of the flat?

Current FlatImages Data Model

Internally, the image is held in FlatImages which subclasses from pypeit.datamodel.DataContainer.

The datamodel written to disk is:

Version 1.1.2

HDU Name

HDU Type

Data Type

Description

PRIMARY

astropy.io.fits.PrimaryHDU

Empty data HDU. Contains basic header information.

PIXELFLAT_RAW

astropy.io.fits.ImageHDU

float64

Processed, combined pixel flats

PIXELFLAT_NORM

astropy.io.fits.ImageHDU

float64

Normalized pixel flat

PIXELFLAT_MODEL

astropy.io.fits.ImageHDU

float64

Model flat

PIXELFLAT_SPAT_ID-?-BSPLINE

astropy.io.fits.BinTableHDU

bspline model of the pixelflat for spat_id=?; see bspline

PIXELFLAT_SPAT_ID-?-FINECORR

astropy.io.fits.BinTableHDU

2D polynomial fits to the fine correction of the spatial illumination profile of the pixelflat for slit_id=?; see PypeItFit

PIXELFLAT_BPM

astropy.io.fits.ImageHDU

int16

Mirrors SlitTraceSet mask for flat-specific flags

PIXELFLAT_SPEC_ILLUM

astropy.io.fits.ImageHDU

float64

Relative spectral illumination

PIXELFLAT_WAVEIMG

astropy.io.fits.ImageHDU

float64

Waveimage for pixel flat

ILLUMFLAT_RAW

astropy.io.fits.ImageHDU

float64

Processed, combined illum flats

ILLUMFLAT_SPAT_ID-?-BSPLINE

astropy.io.fits.BinTableHDU

bspline model of the illumflat for spat_id=?; see bspline

ILLUMFLAT_SPAT_ID-?-FINECORR

astropy.io.fits.BinTableHDU

2D polynomial fits to the fine correction of the spatial illumination profile of the illumflat for slit_id=?; see PypeItFit

ILLUMFLAT_BPM

astropy.io.fits.ImageHDU

int16

Mirrors SlitTraceSet mask for flat-specific flags

SPAT_ID

astropy.io.fits.ImageHDU

int64

Slit spat_id