fit_and_oversample

jwst.adaptive_trace_model.trace_model.fit_and_oversample(model, fit_threshold=10.0, slope_limit=0.1, psf_optimal=False, oversample_factor=1.0, return_intermediate_models=False)[source]

Fit a trace model and optionally oversample an IFU datamodel.

Parameters:
modelIFUImageModel

The input datamodel, updated in place.

fit_thresholdfloat, optional

The signal threshold sigma for attempting spline fits within a slice region. Lower values will create spline traces for more slices. If less than or equal to 0, all slices will be fit.

slope_limitfloat, optional

The normalized slope threshold for using the spline model in oversampled data. Lower values will use the spline model for fainter sources. If less than or equal to 0, the spline model will always be used.

psf_optimalbool, optional

If True, residual corrections to the spline model are not included in the oversampled flux. This option is generally appropriate for simple isolated point sources only. If set, slope_limit and fit_threshold values are ignored and spline fits are attempted and used for all data.

oversample_factorfloat, optional

If not 1.0, then the data will be oversampled by this factor.

return_intermediate_modelsbool, optional

If True, additional image models will be returned, containing the full spline model, the spline model as used for compact sources, the residual model, and the linearly interpolated data.

Returns:
modelIFUImageModel

The datamodel, updated with a trace image and optionally oversampled arrays.

full_spline_modelIFUImageModel, optional

The spline model evaluated at all pixels. Returned only if return_intermediate_models is True.

source_spline_modelIFUImageModel, optional

The spline model evaluated at compact source locations only. Returned only if return_intermediate_models is True.

linear_modelIFUImageModel or None, optional

All data linearly interpolated onto the oversampled grid Returned only if return_intermediate_models is True. Will be None if oversample_factor is 1.0.

residual_modelIFUImageModel or None, optional

Residuals from the spline fit, linearly interpolated onto the oversampled grid Returned only if return_intermediate_models is True. Will be None if oversample_factor is 1.0.