Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mhashad opened this issue Jan 22, 2021 · 2 comments
Open

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

mhashad opened this issue Jan 22, 2021 · 2 comments

Comments

@mhashad
Copy link

mhashad commented Jan 22, 2021

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
Copy link
Contributor

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
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants