Skip to content
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

Feature/slice histograms #419

Merged
merged 6 commits into from May 17, 2024
Merged

Feature/slice histograms #419

merged 6 commits into from May 17, 2024

Conversation

mafrahm
Copy link
Contributor

@mafrahm mafrahm commented Apr 19, 2024

This PR adds the slices variable setting that allows slicing a histogram during Plotting. Example:

Exemplary task call from hh2bbww analysis:

law run cf.PlotVariables1D --variable-settings "jet1_pt,slice=5;15" --version prod1 --variables jet1_pt  --processes ggHH_kl_1_kt_1_dl_hbbhww --remove-output 0,a,y

This selects all bins from bin 5 to bin 15. You could also select bins from some x_min to x_max range by passing e.g. --variable-settings "jet1_pt,slice=50j;200j"

plot__proc_ggHH_kl_1_kt_1_dl_hbbhww__cat_incl__var_jet1_pt

This only slices the histogram itself but does not modify the x_min and x_max range of the plot since they are taken from the variable inst, but this can be modified via --variable-settings "jet1_pt,x_min=50,x_max=200". Already having this functionality makes this PR a bit pointless, but it also adds some functionality to the SettingsParameters and slicing might become useful for other use cases.

Closes #374

@mafrahm mafrahm added priority-low Low priority stuff plotting Plotting related things labels Apr 19, 2024
@mafrahm mafrahm self-assigned this Apr 19, 2024
Copy link
Member

@pkausw pkausw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks! Just one small question

columnflow/tasks/framework/parameters.py Show resolved Hide resolved
Copy link
Member

@pkausw pkausw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changing, this looks excellent now 👍

columnflow/tasks/framework/parameters.py Show resolved Hide resolved
@mafrahm mafrahm merged commit da009d3 into master May 17, 2024
8 checks passed
@mafrahm mafrahm deleted the feature/slice_histograms branch May 17, 2024 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plotting Plotting related things priority-low Low priority stuff
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support slicing of histograms during plotting tasks
2 participants