keflavich / cube-line-extractor

4 stars 1 forks source link

Use of std on masked noisecubebright cube produces warning #37

Closed jmangum closed 2 years ago

jmangum commented 2 years ago

The following line:

noisemapbright = noisecubebright.with_mask(mask[:,None,None]).std(axis=0)

...produces the following warning...

/Users/jmangum/anaconda3/envs/python39/lib/python3.9/site-packages/numpy/lib/nanfunctions.py:1878: RuntimeWarning: Degrees of freedom <= 0 for slice.
  var = nanvar(a, axis=axis, dtype=dtype, out=out, ddof=ddof,

Probably innocuous, but would like to fix if I knew what was causing this warning.

keflavich commented 2 years ago

That implies that there is at least one spectrum that consists of only 1 pixel, so the standard deviation can't be computed. i.e., noisemask.with_mask(mask[:,None,None]).include().sum(axis=0) will have at least one pixel with value 1

jmangum commented 2 years ago

ok. Looks innocuous. Should we just educate users about this warning in the documentation?

keflavich commented 2 years ago

yeah. We can also probably find a way to silence it... though I'm not immediately sure how as this isn't one of the seterr-ignorable warnings.