smash-transport / sparkx

SPARKX - Software Package for Analyzing Relativistic Kinematics in Collision eXperiments
https://smash-transport.github.io/sparkx/
GNU General Public License v3.0
5 stars 0 forks source link

update_num_output_per_event_after_filter does not work for multiplicity_cuts. #294

Closed LucasConstantin closed 1 week ago

LucasConstantin commented 1 month ago

When calling Oscar.multiplicity_cut() the num_output_per_event is not updated correctly. This is because the particle_list_ is reduced in size, but the update_num_output_per_event_after_filter() function only updates the entries in range(len(self.particle_list_)) without removing the remaining entries. This also causes problems with the print_particle_lists_to_file() function.

This code produces the errors: path = '..' + os.sep + 'data' +os.sep+ 'SMASH_min_bias_alpha_clustering.oscar' oscar = sparkx.Oscar(path, events=(0,200)).participants() mult_cut = oscar.multiplicity_cut(1) #keep events with N >= 1 print(oscar.num_output_per_event()) mult_cut.print_particle_lists_to_file('test.oscar')

Traceback (most recent call last): File "/mnt/c/Users/lucas/Desktop/Masterarbeit_project/sparkx_flow_checks/multiplicity_folders.py", line 11, in mult_cut.print_particle_lists_to_file('test.oscar') File "/usr/local/lib/python3.9/dist-packages/sparkx/Oscar.py", line 1078, in print_particle_lists_to_file particle_output = np.asarray(self.particle_list()[i]) File "/usr/local/lib/python3.9/dist-packages/sparkx/Oscar.py", line 634, in particle_list particle = self.particlelist[i_ev][i_part] IndexError: list index out of range

NGoetz commented 1 week ago

Closed by #296