Open Tobychev opened 1 year ago
Do we really want a FlagEnum
that is using binary operations to store the values instead of just a tuple of the enum like we e.g. do for DataLevel
?
What is the advantage of using FlagEnum
?
I didn't think of using a tuple of enums, compared with that case I'm not sure there is any benefit. I can change it.
Check out this pull request on
See visual diffs & provide feedback on Jupyter Notebooks.
Powered by ReviewNB
@maxnoe You can't properly do it with an tuple, because the StereoCombiner takes the properties via traitlets and traitlets only support type checking fixed length tuples. But traitlets can typecheck variable size sets, so I used that instead.
However, I realised that the assumption that a reconstructor only does one thing seems to be pretty deeply encoded in the predict_table
functions via assumptions about the prefix
used to name columns, and I don't have a good idea for how to resolve that.
A first start at addressing the need in #2291 of a reconstructor indicating it reconstructs many properties.
I changed
ReconstructionProperties
into a enum ofFlag
type, meaning a reconstructor can say it provides both geometry and particle type by settingself.property = ReconstructionProperty.ENERGY | ReconstructionProperty.PARTICLE_TYPE
It is also possible to pick out a list of properties a reconstructor supports given a flag combination in
self.property
using this (slightly unreadable) list comprehension