gammapy / enrico

Enrico helps you with your Fermi data analysis
http://enrico.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
22 stars 26 forks source link

LC issue - cannot do a non-empty take from an empty axes #156

Open mhashad opened 3 years ago

mhashad commented 3 years ago

I got this error while running the LC command for energy range from 100MeV to 10000MeV however it works well for energy range from 100MeV to 500000MeV and it gives the result.dat file and the plots. Could you help me fix this problem.

/home/hep/enrico/enrico/plotting.py:344: RuntimeWarning: divide by zero encountered in log10 optimal_markersize = (0.5+4./(1.+np.log10(len(y)))) /home/hep/enrico/enrico/plotting.py:345: RuntimeWarning: divide by zero encountered in log10 optimal_errorlinewidth = (0.2+2./(1.+4.np.log10(len(y)))) Traceback (most recent call last): File "/home/hep/enrico/bin/enrico_plot_lc", line 30, in lcobject.PlotLC() File "/home/hep/enrico/enrico/lightcurve.py", line 223, in PlotLC self._PlotLC() File "/home/hep/enrico/enrico/lightcurve.py", line 469, in _PlotLC plt.ylim(ymin=max(plt.ylim()[0],np.percentile(Index[~uplimIndex],1)0.1), File "/home/hep/anaconda2/envs/fermi/lib/python2.7/site-packages/numpy/lib/function_base.py", line 3699, in percentile interpolation=interpolation) File "/home/hep/anaconda2/envs/fermi/lib/python2.7/site-packages/numpy/lib/function_base.py", line 3425, in _ureduce r = func(a, *kwargs) File "/home/hep/anaconda2/envs/fermi/lib/python2.7/site-packages/numpy/lib/function_base.py", line 3816, in _percentile x1 = take(ap, indices_below, axis=axis) weights_below File "/home/hep/anaconda2/envs/fermi/lib/python2.7/site-packages/numpy/core/fromnumeric.py", line 123, in take return take(indices, axis, out, mode) IndexError: cannot do a non-empty take from an empty axes.

mireianievas commented 3 years ago

Maybe there are no detections in that energy range so y is empty abd then the log fails, but it shouldn't spit that error. Let me have a look and maybe get a workaround ...

mireianievas commented 3 years ago

Ok, that is actually a strange error indeed. Can you provide a minimal example that produces it? I would like to do some tests.