pycut #43
Merged
sophiemiddleton merged 3 commits intoMu2e:mainfrom Aug 21, 2025
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added the
pycutmodule and companion demo notebookA comprehensive framework for managing complex analysis cut flows.
Features
Cut definition and management
add_cut(name, description, mask, active=True, group=None)- Define analysis cuts with boolean maskstoggle_cut(cut_dict)- Enable/disable individual cuts using dictionary mappingtoggle_group(group_dict)- Enable/disable entire groups of cutsCut flow generation
create_cut_flow(data)- Generate detailed cut flow showing progressive event retentionformat_cut_flow(cut_flow)- Format cut flow aspandasDataFramecombine_cut_flows(cut_flow_list)- Combine multiple cut flows (useful for multiprocessing)Selection application
combine_cuts(cut_names=None, active_only=True)- Generate combined boolean mask from selected cutsget_active_cuts()- Retrieve currently active cuts for inspectionState management
save_state(state_name)- Save current cut configuration for later restorationrestore_state(state_name)- Restore previously saved cut configurationrestore_original_state()- Reset all cuts to their initial active stateslist_saved_states()- Display all available saved configurationsOrganisation and inspection
get_groups()- Retrieve cuts organised by group membershiplist_groups()- Display summary of all groups and their cut contentsTypical workflow
add_cut()with appropriate groupscreate_cut_flow()save_state()toggle_cut()ortoggle_group()combine_cuts()for analysisrestore_state()The module integrates well with the broader pyutils ecosystem, working with data processed by
pyprocessand selections created bypyselect.