make_median_image
- jwst.clean_flicker_noise.tso_median_image.make_median_image(input_model, rateints_model, soss_refmodel=None)[source]
Make a scaled median image across integrations to subtract before cleaning.
The procedure is:
Subtract a reference background from the input ramp and rate data (NIRISS SOSS only).
Compute a representative flux for scaling for each integration from the rate data.
For TSO spectral modes, extract a spectrum from a simple box and compute the whitelight flux for each integration.
For TSO imaging modes, sum the flux over an aperture at the expected source location for each integration.
For any other mode, take the median of the flux in each integration.
Median combine all data across integrations to make a median ramp or image.
Scale the median image by the representative flux for each integration.
Add the subtracted background level to the median image (NIRISS SOSS only).
- Parameters:
- input_model
RampModelorCubeModel Ramp or rateints model to be cleaned.
- rateints_model
CubeModel Draft rateints model corresponding to the input model. May be the same as
input_model.- soss_refmodel
PastasossModel, optional Used to identify NIRISS SOSS traces for box extraction. If not provided, a default model will be retrieved.
- input_model
- Returns:
- scaled_medianndarray
The scaled median image to subtract, matching the dimensions of the input model.
- Raises:
- ValueError
If the input does not have multiple integrations or extracted fluxes are all invalid.