try_solve_two_methods
- jwst.extract_1d.soss_extract.atoca_utils.try_solve_two_methods(matrix, result)[source]
Solve sparse matrix equation A.x=b, reverting to least-squared solver when spsolve fails.
On rare occasions spsolve’s approximation of the matrix is not appropriate and fails on good input data.
- Parameters:
- matrixarray-like
Matrix A in the system to solve
A.x = b- resultarray-like
Vector b in the system to solve
A.x = b
- Returns:
- array
Solution x of the system (1D array)