Closed moyuanchen closed 1 year ago
Could you please provide a representation of your azimuthal average object?
The bug was due to the presence of zeros in the _err
of the AzimuthalAverage
object.
This happens when just 1 point is present in the bin (e.g., in k=0
), so the _err
is initialized and the contribution to its value is 0.
However, the variance/standard deviation is infinite or not defined for just 1 point.
Therefore, we decide to fix it to nan
.
The check for nan
s is then performed in the noise_est
functions.
Closed by PR #163
Description Using the 'polyfit' mode in fastddm.noise_est.estimate_camera_noise for an azimuthalaverage dataclass gives the following error
To Reproduce Steps to reproduce the behavior:
estimate_camera_noise(azi_210, mode='polyfit') ~:318: RuntimeWarning: divide by zero encountered in divide ~\AppData\Local\anaconda3\envs\fastddm\lib\site-packages\numpy\lib\polynomial.py:667: RuntimeWarning: invalid value encountered in divide lhs /= scale Traceback (most recent call last):
Cell In[223], line 1 estimate_camera_noise(azimuthal_average, mode='polyfit')
File c:\users\mchen\desktop\cerbino rotation\code\fastddm\untitled2.py:775 in estimate_camera_noise
File c:\users\mchen\desktop\cerbino rotation\code\fastddm\untitled2.py:318 in _noise_polyfit_az_avg
File <__array_function__ internals>:180 in polyfit
File ~\AppData\Local\anaconda3\envs\fastddm\lib\site-packages\numpy\lib\polynomial.py:668 in polyfit c, resids, rank, s = lstsq(lhs, rhs, rcond)
File <__array_function__ internals>:180 in lstsq
File ~\AppData\Local\anaconda3\envs\fastddm\lib\site-packages\numpy\linalg\linalg.py:2300 in lstsq x, resids, rank, s = gufunc(a, b, rcond, signature=signature, extobj=extobj)
File ~\AppData\Local\anaconda3\envs\fastddm\lib\site-packages\numpy\linalg\linalg.py:101 in _raise_linalgerror_lstsq raise LinAlgError("SVD did not converge in Linear Least Squares")
LinAlgError: SVD did not converge in Linear Least Squares
Intel MKL ERROR: Parameter 4 was incorrect on entry to DGELSD.
Expected behavior Expected returning (noise, err)
Desktop (please complete the following information):
Additional context 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz 2.80 GHz 64 bit