DeepLearnPhysics / lartpc_mlreco3d

7 stars 32 forks source link

Predicted to true matching throws exception when encountering interaction with zero reconstructed particles #118

Closed justinjmueller closed 2 years ago

justinjmueller commented 2 years ago

Running on the BNB numu sample I get the following stack trace:

`~/lartpc_mlreco3d/v02_05_00/lartpc_mlreco3d/analysis/classes/ui.py in match_interactions(self, entry, mode, drop_nonprimary_particles, match_particles, return_counts, kwargs) 1104 return_counts=False, kwargs): 1105 if mode == 'pred_to_true': -> 1106 ints_from = self.get_interactions(entry, drop_nonprimary_particles=drop_nonprimary_particles) 1107 ints_to = self.get_true_interactions(entry, drop_nonprimary_particles=drop_nonprimary_particles) 1108 elif mode == 'true_to_pred':

~/lartpc_mlreco3d/v02_05_00/lartpc_mlreco3d/analysis/classes/ui.py in get_interactions(self, entry, drop_nonprimary_particles) 645 - out: List of instances (see particle.Interaction). 646 ''' --> 647 particles = self.get_particles(entry, only_primaries=drop_nonprimary_particles) 648 out = group_particles_to_interactions_fn(particles) 649 for ia in out:

~/lartpc_mlreco3d/v02_05_00/lartpc_mlreco3d/analysis/classes/ui.py in get_particles(self, entry, only_primaries, min_particle_voxel_count, attaching_threshold) 544 particles_seg = self.result['particles_seg'][entry] 545 --> 546 type_logits = self.result['node_pred_type'][entry] 547 input_node_features = [None] * type_logits.shape[0] 548 if 'particle_node_features' in self.result:

KeyError: 'node_pred_type'`

This was traced back to an event (entry==10 in the numu sample ) with 0 reconstructed particles. This can be caught explicitly downstream, but should really be handled upstream.

francois-drielsma commented 2 years ago

The above PR addresses this issue