poisson_err

The task poisson_err calculates errors according to a Poisson confidence interval using astropy.stats.poisson_conf_interval. By default, the pipeline assumes that the errors follow a root-N Gaussian appoximation. This re-calculation can be important for datasets that have low detector counts (e.g., FUV continuum).

The input file for poisson_err is a STIS x1d file. poisson_err reads in the x1d file, calculates the correct 1-sigma upper and lower Poisson confidence interval limits, and creates new columns in the fits file.

Because we use NET_ERROR to back out the pre-dark-subtracted counts, we are assuming that err=sqrt(I), which is valid only for MAMA observations. CCD observations will also have gain, bias, and readnoise corrections.

File will be written to the filename provided by "output", creating a new file or overwriting an existing one.

Examples

poisson_err with default values:

>>> import stistools
>>> stistools.poisson_err.poisson_err("oep502040_x1d.fits",
...                                 "oep502040_poisson_x1d.fits")
stistools.poisson_err.poisson_err(x1dfile, output, verbose=True)

Adds Poisson Confidence Interval columns to extracted spectra. For use with MAMA data only. Works with echelle or first-order spectra.

Parameters:
x1dfile: str

Input MAMA x1d file from which we will calculate the poisson confidence interval.

output: str

Name of the output FITS file. Will overwrite existing file.

verbose: bool

Prints a completion message before function returns.

Returns:
Nothing is returned directly, but the file is written to output.