pisa icon indicating copy to clipboard operation
pisa copied to clipboard

events_pi concat logic

Open jllanfranchi opened this issue 7 years ago • 1 comments

originally shows up here: https://github.com/jllanfranchi/pisa/blob/37f168b2d98bd51d8ab90a66c06a80e1a179ef40/pisa/core/events_pi.py#L309-L315 where the np.append was being done, but that will operate on a dict but you can't np.concat dicts. I think whoever wrote this got confused (and confused me) by iterating over keys, values and calling them subkey, subval. Should iterate over key, val and then within each val iterate over subkey, subval and then the arrays live under there and so concatenation can be done.

In the latest commit, this now shows up at https://github.com/jllanfranchi/pisa/blob/d356c92b9c96495cb3e0044ca44f277540b76697/pisa/core/events_pi.py#L413-L414 and https://github.com/jllanfranchi/pisa/blob/d356c92b9c96495cb3e0044ca44f277540b76697/pisa/core/events_pi.py#L431-L434

jllanfranchi avatar Sep 21 '18 14:09 jllanfranchi

I believe this bug currently affects

  • https://github.com/icecube/pisa/blob/dacc631a04821003aa012e74908bda689c5936c3/pisa/core/events_pi.py#L658
    • can we ever even reach this part of the code given that output_data is created as an empty dict a few lines above?
  • https://github.com/icecube/pisa/blob/dacc631a04821003aa012e74908bda689c5936c3/pisa/core/events_pi.py#L676
    • looks like we should iterate over keys in sub_data in addition (which could be something like 'true_energy' or 'weighted_aeff')
  • https://github.com/icecube/pisa/blob/dacc631a04821003aa012e74908bda689c5936c3/pisa/core/events_pi.py#L704

It doesn't seem to affect anyone in practice, though? Perhaps just assert that the output_data doesn't already contain a given key (describing (anti)neutrino flavour and interaction type) as a quick fix until someone really needs the concatenating logic?

thehrh avatar Jul 30 '24 09:07 thehrh