Bug #1184
Example3 fails - IndexError
100%
Description
@ python Example_3.py
========= XBOA example 3 =========
This example shows how to make cuts
Loading file...
Loaded
Traceback (most recent call last):
File "Example_3.py", line 51, in <module>
bunch_list0.cut({'amplitude x y':30.}, operator.ge, global_cut=True)
File "/home/carlisle/maus2/devel_2/third_party/install/lib/python2.7/site-packages/xboa/Bunch.py", line 741, in cut
if type(Hit()[variable]) != type(0.):
File "/home/carlisle/maus2/devel_2/third_party/install/lib/python2.7/site-packages/xboa/Hit.py", line 88, in getitem
return self.get(variable)
File "/home/carlisle/maus2/devel_2/third_party/install/lib/python2.7/site-packages/xboa/Hit.py", line 298, in get
raise IndexError('Key \''+str(key)+'\' could not be found for Hit.get() - should be one of '+str(Hit.get_variables()))
IndexError: Key 'amplitude x y' could not be found for Hit.get() - should be one of ['x', 'y', 'z', 't', 'px', 'py', 'pz', 'energy', 'mass', 'local_weight', 'global_weight', 'weight', 'bx', 'by', 'bz', 'ex', 'ey', 'ez', 'sx', 'sy', 'sz', 'path_length', 'proper_time', 'e_dep', 'charge', 'event_number', 'station', 'pid', 'status', 'particle_number', 'eventNumber', 'particleNumber', '', 'phi', 'weight', "ct'", 'pt', "z'", "x'", "y'", 'r_squared', 'p', 'r', 'pphi', "r'", "t'", 'kinetic_energy', 'spin', 'l_kin', 'ct']@
Was the amplitude calc. never implemented? Or taken out? Running the Example scripts in addition to the Tests automatically upon installation would ensure the Examples are kept maintained...does this sound sensible? They're very useful...
Thanks,
Tim
Updated by Carlisle, Timothy almost 11 years ago
- Description updated (diff)
Note: I'm using the development version (incl. Issue 89) of the latest release.
Updated by Rogers, Chris almost 11 years ago
It's probably a bug introduced by the recent change. I only run the examples before making a release, so I wouldn't have noticed this... apologies.
Updated by Carlisle, Timothy almost 11 years ago
ah, ok. It'll sort itself out by the next full release then.
Updated by Rogers, Chris almost 11 years ago
I made the SystemTest handle examples more robustly in r90 - now running e.g.
python xboa/test/SystemTest.py
will run all 4 examples properly, plus xboa9f script. I note that there are some test failures here...
Updated by Rogers, Chris almost 11 years ago
So I added an index by spill as well as event number and particle number; and made the global_weights index into a dict that hashes (spill, event, particle) to (weight). I now need to update the MAUS IO routines to use spill instead of event_number; event_number instead of particle_number; and use particle_number properly.
Updated by Rogers, Chris almost 11 years ago
Fixed in r92 - updated cut routine couldn't handle bunch type variables (in this case amplitude). Expanded tests to include this test case.
Updated by Rogers, Chris almost 11 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100