Closed scfleming closed 7 years ago
I fixed the warning generated by the first gAperture example in code that was just pushed to v1.28.6.
I'm unable to reproduce the "divide by zero encountered in log10" warning with the second gAperture command. And code diving suggests that this warning has already been suppressed by using np.errstate()
so I'm not sure how it's being raised.
Run of M dwarfs have several targets with following errors, probably all triggered from the same thing (a dvide by zero, or a NaN somewhere, or something). At least 185 / 526 targets had these warnings. Most, but not all, were in the FUV band.
While these are just warnings, this ticket is to: 1.) Confirm that the result of these warning-induced calculations do not have adverse effects later in the pipeline. 2.) If possible, treat such cases in a way that would not involve a RuntimeWarning and (potentially) better handle situations where a calucation is being requested with a missing or bad value.
/data2/fleming/anaconda3/lib/python3.6/site-packages/numpy/core/_methods.py:59: RuntimeWarning: Mean of empty slice. warnings.warn("Mean of empty slice.", RuntimeWarning) /data2/fleming/anaconda3/lib/python3.6/site-packages/numpy/core/_methods.py:70: RuntimeWarning: invalid value encountered in double_scalars ret = ret.dtype.type(ret / rcount) /data2/fleming/anaconda3/lib/python3.6/site-packages/numpy/core/_methods.py:70: RuntimeWarning: invalid value encountered in true_divide ret = ret.dtype.type(ret / rcount) /data2/fleming/gPhoton/gPhoton/galextools.py:262: RuntimeWarning: divide by zero encountered in log10 mag = -2.5 * np.log10(cps) + scale /data2/fleming/gPhoton/gPhoton/curvetools.py:1002: RuntimeWarning: invalid value encountered in subtract band)) /data2/fleming/gPhoton/gPhoton/curvetools.py:1005: RuntimeWarning: invalid value encountered in subtract lcurve['mag'])
One example to recreate is this command: gAperture(band="FUV", skypos=[213.884612, 4.6578871], stepsz=30.0, csvfile="2429412860515851942_FUV.csv", overwrite=True, radius=0.0035555555555555557, annulus=[0.014222222222222223, 0.035555555555555556], verbose=3, maxgap=50, photoncsvfile="2429412860515851942_FUV_photons.csv")
A few other files have additional RuntimeWarnings: /data2/fleming/gPhoton/gPhoton/galextools.py:262: RuntimeWarning: divide by zero encountered in log10 mag = -2.5 * np.log10(cps) + scale
gAperture(band="FUV", skypos=[353.5128222, 0.1783158], stepsz=30.0, csvfile="6453519865059739235_FUV.csv", overwrite=True, radius=0.0035555555555555557, annulus=[0.014222222222222223, 0.035555555555555556], verbose=3, maxgap=50, photoncsvfile="6453519865059739235/6453519865059739235_FUV_photons.csv")