-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restructure I3Extractor class to make it more modular and object-oriented #30
Conversation
…tion member variables
… to module-level utility methods
…and drop 'extractor' function and eval statements in favour of explicit method calls
…ber and order of I3Extractors in DataConverter, since the internal class logic assumes it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi!
I do think removing the ability to easily adjust to the code to extract an additional item from the frames is a bad idea. I cannot count how many times I've needed the code to do just that.
I can approve this now because we want to move ahead but I do think we want to revisit this particular choice soon.
In this PR, I have proposed a restructuring of
I3Extractor
that does a few things, most notably:__call__
). This should make it more clear to the user what is unique for each call (i.e. the physics frame) and what is common across frames (e.g. GCD information, pulse map), and additionally might remove a small overhead in each call. This now means thatI3Extractor
classes are called with just a single argument,frame
.eval
functions with explicit declarations (e.g.energy = MCInIcePrimary.energy
instead ofenergy = eval("MCInIcePrimary.energy")
). This should make it easier for the python interpreter to detect any syntax errors, and it should make it easier for the reader to parse as variable references are now explicit.mode
flag with specialised classes (currentlyI3FeatureExtractor
,I3RetroExtractor
, andI3TruthExtractor
, all inheriting from the same base class,I3Extractor
). This reduces the complexity of the currentI3Extractor
class by breaking its functionality down into smaller, more coherent chunks. It also makes the use of I3Extractors more modular, such that justI3FeatureExtractor
can be used in "production" (i.e. as part of reconstruction chains) while several may be used for generating intermediate files for training GNN models.custom_truth
argument toI3Extractor
. This means that new/alternative variable configurations cannot be specified at runtime; instead, they need to be defined as separate classes. This is intentional, to reduce the complexity for ML developer users while still allowing for extensibility in the form of newI3Extractor
-inheriting classes. Let me know if you are using this features, @RasmusOrsoe, and would like to see it retained.Closes #19.