keflavich / cube-line-extractor

4 stars 1 forks source link

Nan values in gauss_mask_cube calculation produces warning #36

Closed jmangum closed 2 years ago

jmangum commented 2 years ago

I don't think that this is a bug, but does produce a distressing warning when there are NaN values in the width_map cube, which is produced using:

width_map = brightest_cube.linewidth_sigma()

The line that produces the warning is:

gauss_mask_cube = np.exp(-(np.array(centroid_map)[None,:,:] -
                                   np.array(subcube.spectral_axis)[:,None,None])**2 /
                                   (2*np.array(width_map*width_map_scaling)[None,:,:]**2))

I believe that the input cubes use NaN as a blanking value. Is there a better way to handle these (probably innocuous) issues/warnings?

keflavich commented 2 years ago

what's the warning?

jmangum commented 2 years ago
/Users/jmangum/Python/mangum_galaxies-master/CubeLineMoment.py:426: RuntimeWarning: divide by zero encountered in divide
  gauss_mask_cube = np.exp(-(np.array(centroid_map)[None,:,:] -
keflavich commented 2 years ago

eh, if you want to silence them, use np.seterr(divide='ignore'). I wouldn't worry otherwise

jmangum commented 2 years ago

ok. Will just explain better in documentation.