fit_all_regions

jwst.adaptive_trace_model.trace_model.fit_all_regions(flux, alpha, region_map, signal_threshold, **fit_kwargs)[source]

Fit a trace model to all regions in the flux image.

Parameters:
fluxndarray

The flux image to fit.

alphandarray

Alpha coordinates for all flux values.

region_mapndarray of int

Map containing the slice or slit number for valid regions. Values are >0 for pixels in valid regions, 0 otherwise.

signal_thresholddict

Threshold values for each valid region in the region map. If the median peak value across columns in the region is below this threshold, a fit will not be attempted for that region.

**fit_kwargs

Keyword arguments to pass to the fitting routine (see fit_2d_spline_trace).

Returns:
spline_modelsdict

Keys are region numbers, values are dicts containing a spline model for each column index in the region. If a spline model could not be fit, the column index number is not present.

scalesdict

Keys are region numbers, values are dicts containing a floating point scale for each spline model, by column index number. If a spline model could not be fit, the column index number is not present.