I keep getting this RuntimeWarning
, and I can't figure out where it's coming from, since I don't use np.nanmean
anywhere in my program. I do use np.mean
, though. Does anyone know if there's some other numpy
function (e.g., np.mean
) that calls np.nanmean
, and may be throwing this warning?
I would just go and suppress it, however, each time the warning occurs, afterward when I go to fit a polynomial to the points being processed, I get the following error:
C:\Users\M.Modeler\AppData\Local\miniconda3\envs\cloudtexture\lib\site-packages\numpy\lib\nanfunctions.py:1559: RuntimeWarning: Mean of empty slice
return np.nanmean(a, axis, out=out, keepdims=keepdims)
Intel MKL ERROR: Parameter 6 was incorrect on entry to DGELSD.
Traceback (most recent call last):
File "D:\Work_D\RD22-02_GSM\cloudTexture\cloudTexture.py", line 345, in <module>
thinned = ct.normalize(thinned,
File "D:\Work_D\RD22-02_GSM\cloudTexture\ctUtil.py", line 332, in normalize
poly = np.flip(np.polyfit(blnd[p], relrough[p], deg = polyorder))
File "<__array_function__ internals>", line 180, in polyfit
File "C:\Users\M.Modeler\AppData\Local\miniconda3\envs\cloudtexture\lib\site-packages\numpy\lib\polynomial.py", line 668, in polyfit
c, resids, rank, s = lstsq(lhs, rhs, rcond)
File "<__array_function__ internals>", line 180, in lstsq
File "C:\Users\M.Modeler\AppData\Local\miniconda3\envs\cloudtexture\lib\site-packages\numpy\linalg\linalg.py", line 2292, in lstsq
x, resids, rank, s = gufunc(a, b, rcond, signature=signature, extobj=extobj)
File "C:\Users\M.Modeler\AppData\Local\miniconda3\envs\cloudtexture\lib\site-packages\numpy\linalg\linalg.py", line 100, in _raise_linalgerror_lstsq
raise LinAlgError("SVD did not converge in Linear Least Squares")
numpy.linalg.LinAlgError: SVD did not converge in Linear Least Squares
For datasets where I don't get the mean of the empty slice warning, the polyfit
is successful. So it seems the nanmean
warning is telling me something useful, I just can't find what's causing it. Any ideas?
Additionally, any insight into the potential triggers of the above error could be helpful in tracking down the root cause of this?