Support #1254
St9bad_alloc errors plotting in Python
100%
Description
I'm getting the dreaded: "terminate called after throwing an instance of 'std::bad_alloc'
what(): St9bad_alloc" (memory related) errors when trying to trying to loop over my virtual planes & make plots, (the same approach given in Xboa Example 2) e.g.:
Bunch.root_graph(bunch_list, 'mean', ['z'], 'mean', ['x'], 'm', 'mm')
Bunch.root_graph(bunch_list, 'mean', ['z'], 'mean', ['pz'], 'm', 'mm')
Bunch.root_graph(bunch_list, 'mean', ['z'], 'mean', ['energy'], 'm', 'mm')
Bunch.root_graph(bunch_list, 'mean', ['z'], 'mean', ['time'], 'm', 'mm')
Bunch.root_graph(bunch_list, 'mean', ['z'], 'beta', ['x','y'], 'm', 'mm')
Bunch.root_graph(bunch_list, 'mean', ['z'], 'emittance', ['x','y'], 'm', 'mm')
etc
I get the same error if I simply fill arrays, e.g.:
for Plane in range( 0, len(bunch_list)-1 ):
my_bunch = bunch_list[Plane]
_x= round(my_bunch.get('mean', ['x'] ), 2)
_y= round(my_bunch.get('mean', ['y'] ), 2)
etc
my simulations have 10,000 muons, and >100 planes which probably isn't helping the memory side of things...I'm not well versed in Python at all, any advice on how to get round this?
Thanks,
Tim
Files