## Background


How much background (in counts/sec) to subtract before calibration.


Usage

``` python
Background(
    mode="none",
    rtg_value=0.0004,
    spatial_bin=1,
    spectral_bin=1,
    wavelength_range=None
)
```


Models the two IDL background modes as data instead of flags:

- `"none"` -- subtract nothing (default).
- `"rtg"` -- subtract a constant dark rate `rtg_value` (the radioisotope-thermoelectric-generator background, IDL `pass.rtg`).
- `"spectral_average"` -- estimate the background from a featureless wavelength band (`wavelength_range`) by averaging counts/sec over the spectral axis, then subtract that per-(slit, readout) average from every spectral sample.

`spatial_bin`/`spectral_bin` are carried for parity with the IDL spec but are not yet used by the stand-in spectral-average estimator.


## Parameter Attributes


`mode: str = ``"none"`  

`rtg_value: float = ``0.0004`  

`spatial_bin: int = ``1`  

`spectral_bin: int = ``1`  

`wavelength_range: tuple[float, float] | None = None`  


## Methods

| Name | Description |
|----|----|
| [offset()](#offset) | Return the amount to subtract from `counts_per_sec`. |

------------------------------------------------------------------------


#### offset()


Return the amount to subtract from `counts_per_sec`.


Usage

``` python
offset(counts_per_sec, wavelength)
```


`counts_per_sec` is the `(NX, NY, NZ)` cube already divided by the integration time; `wavelength` is the `(NX,)` centre-wavelength axis. The return value is a scalar (`none`/`rtg`) or a `(1, NY, NZ)` array (`spectral_average`) -- both broadcast cleanly against the cube.
