fit_2d_spline_trace
- jwst.adaptive_trace_model.trace_model.fit_2d_spline_trace(flux, alpha, fit_scale=None, lrange=50, col_index=None, require_ngood=10, spline_bkpt=50, space_ratio=1.2)[source]
Create a trace model from spline fits to a single slit/slice image.
Image must be oriented so that wavelengths are along x-axis. Each column is fit separately, with a window to include nearby data.
- Parameters:
- fluxndarray
Input 2D flux image to fit.
- alphandarray
Alpha coordinates for input flux.
- fit_scalendarray, optional
Array of scale values to apply to the input flux before fitting.
- lrangeint, optional
Local column range for data to include in the fit, to the left and right of each input column.
- col_indexiterable or None, optional
Iterable or generator that produces column index values to fit. If provided, columns will be fit in the order specified. If not provided, columns will be fit left to right.
- require_ngoodint, optional
Minimum number of data points required to attempt a fit in a column.
- spline_bkptint, optional
Number of spline breakpoints (knots).
- space_ratiofloat, optional
Maximum spacing ratio to allow fitting to continue. If the tenth-largest spacing in the input
xvecis larger than the knot spacing by this ratio, then return None instead of attempting to fit the data.
- Returns:
- splinesdict
Keys are column index numbers, values are
BSpline. If a spline model could not be fit, the column index number is not present.- scalesdict
Keys are column index numbers, values are floating point scales, to pair with the returned models. If a spline model could not be fit, the column index number is not present.