apply_background_2d¶
- jwst.mrs_imatch.mrs_imatch_step.apply_background_2d(model2d, channel=None, subtract=True)[source]¶
Apply (subtract or add back) background values computed from
meta.background
polynomials to 2D image data.This function modifies the input
model2d
’s data.Warning
This function does not check whether background was previously applied to image data (through
meta.background.subtracted
).Warning
This function does not modify input model’s
meta.background.subtracted
attribute to indicate that background has been applied to model’s data. User is responsible for settingmeta.background.subtracted
after background was applied to all channels. Partial application of background (i.e., to only some channels as opposite to all channels) is not recommended.- Parameters:
model2d (
jwst.datamodels.image.ImageModel
) – Ajwst.datamodels.image.ImageModel
from whose data background needs to be subtracted (or added back).channel (str, int, list, None, optional) – This parameter indicates for which channel background values should be applied. An integer value is automatically converted to a string type. A string type input value indicates a single channel to which background should be applied.
channel
can also be a list of several string or integer single channel values. The default value ofNone
indicates that background should be applied to all channels.subtract (bool, optional) – Indicates whether to subtract or add back background values to input model data. By default background is subtracted from data.