Closed ksunden closed 6 years ago
@untzag @darienmorrow Dow we know what exception this should be catching?
(or exceptions)
I have no idea. I think the idea is to handle any wonky values in the covariance matrix (e.g. inf, -inf), but I don't have good reason to think those would pop up. I will note that the original idea/code come from this stackoverflow thread.
I think it should be probably just be a try
except
instead of using BaseException
.
Note that just try/except is functionally identical to try/except BaseException. Ideally we know what exceptions may arise from the try block, and only handle those
np.absolute and append should not throw errors, as long as we give absolute numeric data.
The other things that may cause errors have to do with indexing pcov, which is None
if a singular matrix is encountered according to scipy docs. Our code will set it to np.inf in that case, then indexing into it will generate an error.
https://github.com/wright-group/WrightTools/blob/f22920579f45632b4123661d9832ff0cc1b614c4/WrightTools/kit/_leastsq.py#L74
The exception caught should be limited to those known to be raised inside.