# GAIN reference file¶

REFTYPE

GAIN

Data model

GainModel

The GAIN reference file contains a pixel-by-pixel gain map, which can be used to convert pixel values from units of DN to electrons. The gain values are assumed to be in units of e/DN.

## Reference Selection Keywords for GAIN¶

CRDS selects appropriate GAIN references based on the following keywords. GAIN is not applicable for instruments not in the table. All keywords used for file selection are required.

Instrument

Keywords

FGS

INSTRUME, DETECTOR, SUBARRAY, DATE-OBS, TIME-OBS

MIRI

INSTRUME, DETECTOR, SUBARRAY, DATE-OBS, TIME-OBS

NIRCam

INSTRUME, DETECTOR, SUBARRAY, DATE-OBS, TIME-OBS

NIRISS

INSTRUME, DETECTOR, SUBARRAY, DATE-OBS, TIME-OBS

NIRSpec

INSTRUME, DETECTOR, SUBARRAY, DATE-OBS, TIME-OBS

## Standard Keywords¶

The following table lists the keywords that are required to be present in all reference files. The first column gives the FITS keyword names. The second column gives the jwst data model name for each keyword, which is useful when using data models in creating and populating a new reference file. The third column gives the equivalent meta tag in ASDF reference file headers, which is the same as the name within the data model meta tree (second column).

FITS Keyword

Data Model Name

ASDF meta tag

AUTHOR

model.meta.author

author

DATAMODL

model.meta.model_type

model_type

DATE

model.meta.date

date

DESCRIP

model.meta.description

description

FILENAME

model.meta.filename

N/A

INSTRUME

model.meta.instrument.name

instrument: {name}

PEDIGREE

model.meta.pedigree

pedigree

REFTYPE

model.meta.reftype

reftype

TELESCOP

model.meta.telescope

telescope

USEAFTER

model.meta.useafter

useafter

NOTE: More information on standard required keywords can be found here: Standard Required Keywords

## Type Specific Keywords for GAIN¶

In addition to the standard reference file keywords listed above, the following keywords are required in GAIN reference files, because they are used as CRDS selectors (see Reference Selection Keywords for GAIN):

Keyword

Data Model Name

DETECTOR

model.meta.instrument.detector

SUBARRAY

model.meta.subarray.name

BUNIT1

model.meta.bunit_data

1 BUNIT is not used as a CRDS selector, but is required in the “SCI” extension header of GAIN reference files to document the units of the data. The expected value is “ELECTRONS/DN”.

## Reference File Format¶

GAIN reference files are FITS files with a single IMAGE extension. The FITS primary data array is assumed to be empty. The characteristics of the FITS extensions are as follows:

EXTNAME

XTENSION

NAXIS

Dimensions

Data type

SCI

IMAGE

2

ncols x nrows

float