VMBoehm / MnuLFI

throwing LFI on massiveNus sims
MIT License
3 stars 4 forks source link

Running Data._make_data() #13

Closed arinavsar closed 4 years ago

arinavsar commented 4 years ago

When I try to run Data._make_data(), it is giving me this error

Traceback (most recent call last): File "", line 1, in File "/Users/arinavsar/Desktop/MnuLFI-master/mnulfi/data.py", line 130, in _make_data avg_peak = np.average(peaks, axis=1) File "<__array_function__ internals>", line 6, in average File "/Users/arinavsar/anaconda3/envs/mnulfi/lib/python3.7/site-packages/numpy/lib/function_base.py", line 390, in average avg = a.mean(axis) File "/Users/arinavsar/anaconda3/envs/mnulfi/lib/python3.7/site-packages/numpy/core/_methods.py", line 138, in _mean rcount = _count_reduce_items(arr, axis) File "/Users/arinavsar/anaconda3/envs/mnulfi/lib/python3.7/site-packages/numpy/core/_methods.py", line 57, in _count_reduce_items items *= arr.shape[ax]

EiffL commented 4 years ago

@arinavsar Thanks for reporting this! :-/ that's very weird. It looks like there error message is truncated though, can you post the end?

arinavsar commented 4 years ago

Yes, of course!


IndexError Traceback (most recent call last)

in 1 import mnulfi.data as Data ----> 2 Data._make_data() ~/Desktop/MnuLFI-master/mnulfi/data.py in _make_data() 128 129 # average peak counts at each LHC cosmology (101 x 50) --> 130 avg_peak = np.average(peaks, axis=1) 131 avg_peak.dump(os.path.join(UT.dat_dir(), 'avg_peakcnts_lhc.npy')) 132 <__array_function__ internals> in average(*args, **kwargs) ~/anaconda3/envs/mnulfi/lib/python3.7/site-packages/numpy/lib/function_base.py in average(a, axis, weights, returned) 388 389 if weights is None: --> 390 avg = a.mean(axis) 391 scl = avg.dtype.type(a.size/avg.size) 392 else: ~/anaconda3/envs/mnulfi/lib/python3.7/site-packages/numpy/core/_methods.py in _mean(a, axis, dtype, out, keepdims) 136 137 is_float16_result = False --> 138 rcount = _count_reduce_items(arr, axis) 139 # Make this warning show up first 140 if rcount == 0: ~/anaconda3/envs/mnulfi/lib/python3.7/site-packages/numpy/core/_methods.py in _count_reduce_items(arr, axis) 55 items = 1 56 for ax in axis: ---> 57 items *= arr.shape[ax] 58 return items 59 IndexError: tuple index out of range
EiffL commented 4 years ago

Ok, I found the problem. You need to define the environment variable to be the path to the data folder, see this example: https://colab.research.google.com/drive/1xm82ng1e_b7YOQeMXoOd5dtIZ2k29w_d

EiffL commented 4 years ago

This is embarrassing, sorry about that ^^' but I have opened a PR #12 @VMBoehm @changhoonhahn ;-) that should remove the need to define this variable

arinavsar commented 4 years ago

Thank you so much!