matrix_operations
- jwst.ami.leastsqnrm.matrix_operations(img, model, linfit=False, dqm=None)[source]
Use least squares matrix operations to solve A x = b.
A is the model, b is the data (img), and x is the coefficient vector we are solving for. In 2-D, data x = inv(At.A).(At.b).
TODO: replace linearfit with scipy fitting.
- Parameters:
- img2D float array
Input data
- model2D float array
Analytic model
- linfitbool
Whether to perform linear fit
- dqm2D bool array
Bad pixel mask slice, same shape as image.
- Returns:
- x1D float array
Solution to fit
- res2D float array
Residuals in fit
- condfloat
Condition number of the inverse of the product of model and its transpose