# Reference Files¶

The `rscd`

correction step uses an RSCD reference file.

## RSCD Reference File¶

- REFTYPE
RSCD

- Data model

The RSCD reference file contains coefficients used to compute the correction.

### Reference Selection Keywords for RSCD¶

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

Instrument |
Keywords |
---|---|

MIRI |
INSTRUME, DETECTOR, 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 RSCD¶

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

Keyword |
Data Model Name |
---|---|

DETECTOR |
model.meta.instrument.detector |

### Reference File Format¶

RSCD reference files are FITS format, with 1 BINTABLE extension. The FITS primary HDU does not contain a data array. The BINTABLE extension uses the identifier EXTNAME = “RSCD” and the characteristics of the table columns are as follows:

Column name |
Data type |
Notes |
---|---|---|

subarray |
char*13 |
FULL or subarray name |

readpatt |
char*4 |
SLOW or FAST |

rows |
char*4 |
EVEN or ODD |

tau |
float32 |
e-folding time scale, in units of frames |

ascale |
float32 |
\(b{1}\) in equation 2 |

pow |
float32 |
\(b{2}\) in equation 2 |

illum_zp |
float32 |
\(illum_{zpt}\) in equation 2.1 |

illum_slope |
float32 |
\(illum_{slope}\) in equation 2.1 |

illum2 |
float32 |
\(illum2\) in equation 2.1 |

param3 |
float32 |
\(b{3}\) in equation 2 |

crossopt |
float32 |
\(Crossover Point\) in equation 2.2 |

sat_zp |
float32 |
\(sat_\text{zp}\) in equation 3.1 |

sat_slope |
float32 |
\(sat_\text{slope}\) in equation 3.1 |

sat_2 |
float32 |
\(sat_2\) in equation 3.1 |

sat_mzp |
float32 |
\(sat_\text{mzp}\) in equation 3 |

sat_rowterm |
float32 |
\(evenrow_{corrections}\) in equation 3.1 |

sat_scale |
float32 |
\(scale_\text{sat}\) in equation 3 |

The entries in the first 3 columns of the table are used as row selection criteria, matching the exposure properties and row type of the data. The remaining 14 columns contain the parameter values for the double-exponential correction function.

The general form of the correction to be added to the input data is:

```
corrected data = input data + dn_accumulated * scale * exp(-T / tau) (Equation 1)
```

where:

T is the time since the last group in the previous integration

tau is the exponential time constant found in the RSCD table

dn_accumulated is the DN level that was accumulated for the pixel from the previous integration.

In cases where the last integration does not saturate, the \(scale\) term in equation 1 is determined according to:

\(scale = b{1}* [Counts{2}^{b{2}} * [1/exp(Counts{2}/b{3}) -1 ]\; \; (Equation \; 2)\)

The following two additional equations are used in Equation 2:

\(b{1} = ascale * (illum_{zpt} + illum_{slope}*N + illum2* N^2) \; \; (Equation \; 2.1)\)

\(Counts{2} = Final \, DN \, in \, the \, last \, group \, in \; the \, previous \, integration \, - Crossover \, Point \; \; (Equation \; 2.2)\)

where:

N in equation 2.1 is the number of groups per integration

Crossover Point in equation 2.2 is column CROSSOPT in the RSCD table.

If the previous integration saturates, \(scale\) is no longer calculated using equations 2 - 2.2. Instead it is calculated using equations 3 and 3.1:

\(scale_\text{sat} = slope * Counts{3} + sat_\text{mzp} \; \; (Equation \; 3)\)

\(slope = sat_{zp} + sat_{slope} * N + sat_2*N^2 + evenrow_{corrections} \; \; (Equation \; 3.1)\)

where:

\(Counts{3}\) is an estimate of what the last group in the previous integration would have been if saturation did not exist

\(scale_\text{sat}\) is sat_scale in the RSCD table

\(sat_\text{mzp}\) is sat_mzp in the RSCD table

\(sat_\text{zp}\) is sat_zp in the RSCD table

\(sat_\text{slope}\) is sat_slope in the RSCD table

\(sat_2\) is sat2 in the RSCD table

\(evenrow_{corrections}\) is sat_rowterm in the RSCD table

N is the number of groups per integration