Skip to content

Error when trying to get track info

I am not sure if I am doing something wrong here... I get the following:

In [2]: import km3io  
f = km3io.OfflineReader("/sps/km3net/users/guderian/track_quality_output/reconstructed/string/ARCA_42/DU1/stretching/real/stretching_new/-0.03_run8479.root.aanet.root")  

In [14]: is_reconstructed_mask = f.events.n_tracks > 0               
In [15]: tracks = f.events.tracks[is_reconstructed_mask]  
In [16]: bt = tracks[:,0]                                                                                              

In [17]: bt                                                                                                            

Out[17]: ---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/pbs/throng/km3net/software/python/3.7.5/lib/python3.7/site-packages/IPython/core/formatters.py in __call__(self, obj)
    700                 type_pprinters=self.type_printers,
    701                 deferred_pprinters=self.deferred_printers)
--> 702             printer.pretty(obj)
    703             printer.flush()
    704             return stream.getvalue()

/pbs/throng/km3net/software/python/3.7.5/lib/python3.7/site-packages/IPython/lib/pretty.py in pretty(self, obj)
    400                         if cls is not object \
    401                                 and callable(cls.__dict__.get('__repr__')):
--> 402                             return _repr_pprint(obj, self, cycle)
    403 
    404             return _default_pprint(obj, self, cycle)

/pbs/throng/km3net/software/python/3.7.5/lib/python3.7/site-packages/IPython/lib/pretty.py in _repr_pprint(obj, p, cycle)
    695     """A pprint that just redirects to the normal repr function."""
    696     # Find newlines and replace them with p.break_()
--> 697     output = repr(obj)
    698     for idx,output_line in enumerate(output.splitlines()):
    699         if idx:

/pbs/throng/km3net/software/python/3.7.5/lib/python3.7/site-packages/km3io/tools.py in __repr__(self)
    196 
    197     def __repr__(self):
--> 198         length = len(self)
    199         return "<{}[{}]: {} element{}>".format(self.__class__.__name__,
    200                                                self._mapper.name, length,

/pbs/throng/km3net/software/python/3.7.5/lib/python3.7/site-packages/km3io/tools.py in __len__(self)
    176                 _unfold_indices(
    177                     self._branch[self._keymap['id']].lazyarray(
--> 178                         basketcache=BASKET_CACHE), self._index_chain))
    179 
    180     def __iter__(self):

/pbs/throng/km3net/software/python/3.7.5/lib/python3.7/site-packages/km3io/tools.py in _unfold_indices(obj, indices)
     26     for depth, idx in enumerate(indices):
     27         try:
---> 28             obj = obj[idx]
     29         except IndexError:
     30             print(

/pbs/throng/km3net/software/python/3.7.5/lib/python3.7/site-packages/awkward/array/chunked.py in __getitem__(self, where)
    326         if isinstance(head, ChunkedArray):
    327             if not self._aligned(head):
--> 328                 raise ValueError("A ChunkedArray can only be used as a slice of a ChunkedArray if they have the same chunk sizes")
    329             chunks = []
    330             chunksizes = []

ValueError: A ChunkedArray can only be used as a slice of a ChunkedArray if they have the same chunk sizes

actually when I ask for the rec stages, it works, the lik not:

In [19]: print(bt.rec_stages)                                                                                          
[[1], [1, 2, 3], [1], [1], [1, 2, 3], ... 1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3]]

In [20]: print(bt.lik)                                                                                                 
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-20-96ed70a098d5> in <module>
----> 1 print(bt.lik)

/pbs/throng/km3net/software/python/3.7.5/lib/python3.7/site-packages/km3io/tools.py in __getattribute__(self, attr)
    144 
    145         if attr in self._keymap.keys():  # intercept branch key lookups
--> 146             return self.__getkey__(attr)
    147 
    148         return object.__getattribute__(self, attr)

/pbs/throng/km3net/software/python/3.7.5/lib/python3.7/site-packages/km3io/tools.py in __getkey__(self, key)
    154         if self._index_chain is not None and key in self._mapper.toawkward:
    155             out = ak.from_iter(out)
--> 156         return _unfold_indices(out, self._index_chain)
    157 
    158     def __getitem__(self, item):

/pbs/throng/km3net/software/python/3.7.5/lib/python3.7/site-packages/km3io/tools.py in _unfold_indices(obj, indices)
     26     for depth, idx in enumerate(indices):
     27         try:
---> 28             obj = obj[idx]
     29         except IndexError:
     30             print(

/pbs/throng/km3net/software/python/3.7.5/lib/python3.7/site-packages/awkward/array/chunked.py in __getitem__(self, where)
    326         if isinstance(head, ChunkedArray):
    327             if not self._aligned(head):
--> 328                 raise ValueError("A ChunkedArray can only be used as a slice of a ChunkedArray if they have the same chunk sizes")
    329             chunks = []
    330             chunksizes = []

ValueError: A ChunkedArray can only be used as a slice of a ChunkedArray if they have the same chunk sizes
Edited by Tamas Gal