umami.input_vars_tools package#
Submodules#
umami.input_vars_tools.plotting_functions module#
Plots the given input variables of the given files and also a comparison.
- umami.input_vars_tools.plotting_functions.check_kwargs_for_ylabel_and_n_ratio_panel(kwargs: dict, fallback_ylabel: str, n_datasets: int) dict #
Helper function to check the following keyword arguments + using fallback values if they are not set - ylabel - n_ratio_panels - norm (set to “True” if not provided)
- Parameters:
kwargs (dict) – Keyword arguments handed to the plotting function
fallback_ylabel (str) – Fallback value for the ylabel
n_datasets (int) – Number of datasets that are plotted
- Returns:
Updated keyword arguments
- Return type:
kwargs
- umami.input_vars_tools.plotting_functions.get_datasets_configuration(plotting_config: dict, tracks: bool = False)#
Helper function to transform dict that stores the configuration of the different datasets into lists of certain parameters.
- Parameters:
plotting_config (dict) – Plotting configuration
tracks (bool, optional) – Bool if the function should look for the tracks_name variable in the dataset configurations.
- Returns:
filepath_list (list) – List with the filepaths of all the datasets.
labels_list (list) – List with the ‘dataset label’ of each dataset.
class_labels_list (list) – List with the class labels for each dataset. If no dataset-specific class labels are provided, the globally defined class labels are used.
tracks_name_list (list) – List with the track names of the datasets. Only returned if tracks is True.
- umami.input_vars_tools.plotting_functions.plot_input_vars_jets(datasets_filepaths: list, datasets_labels: list, datasets_class_labels: list, var_dict: dict, cut_vars_dict: dict, n_jets: int, xlabels_dict: dict | None = None, special_param_jets: dict | None = None, output_directory: str = 'input_vars_jets', plot_type: str = 'pdf', **kwargs)#
Plot the jet variable comparison for the given datasets. If multiple datasets are provided, a ratio plot comparing each flavour individually will be added below the main plot.
- Parameters:
datasets_filepaths (list) – List of filepaths to the files.
datasets_labels (list) – Label of the dataset for the legend.
datasets_class_labels (list) – List with dataset-specific class labels, e.g. [[“ujets”, “cjets”], [“cjets”]] to plot light-jets and c-jets for the first but only c-jets for the second dataset
var_dict (dict) – Dict with all the variables you want to plot inside with their binning.
cut_vars_dict (dict) – Dict with cuts on variables applied to the input datasets.
n_jets (int) – Number of jets to use for plotting.
xlabels_dict (dict, optional) – Dict that stores the xlabels of the variables that are plotted. I.e. to specify a label for “pt_btagJes”, use {“pt_btagJes”: “$p_T$ [MeV]”}. Variables that do not appear in the dict will have the variable name as xlabel. By default None
special_param_jets (dict, optional) – Dict with special x-axis cuts for the given variable.
output_directory (str, optional) – Name of the output directory. Only the dir name not path! By default “input_vars_jets”
plot_type (str, optional) – File format for the output, by default “pdf”
**kwargs (dict) – Keyword arguments passed to the plot. You can use all arguments that are supported by the HistogramPlot class in the plotting API.
- Raises:
ValueError – When operator log is chosen but more than one variable is given
- umami.input_vars_tools.plotting_functions.plot_input_vars_trks(datasets_filepaths: list, datasets_labels: list, datasets_class_labels: list, datasets_track_names: list, n_jets: int, var_dict: dict, cut_vars_dict: dict, sorting_variable: str = 'ptfrac', xlabels_dict: dict | None = None, n_leading: list | None = None, output_directory: str = 'input_vars_trks', plot_type: str = 'pdf', track_origin: str = 'All', **kwargs)#
Plot the track variable in comparison to another model with ratio plot. If multiple datasets are provided, a ratio plot comparing each flavour individually will be added below the main plot.
- Parameters:
datasets_filepaths (list) – List of filepaths to the files.
datasets_labels (list) – Label of the dataset for the legend.
datasets_class_labels (list) – List with dataset-specific class labels, e.g. [[“ujets”, “cjets”], [“cjets”]] to plot light-jets and c-jets for the first but only c-jets for the second dataset
datasets_track_names (list) – List with the track names of the files.
n_jets (int) – Number of jets to use for plotting.
var_dict (dict) – Dict with all the variables you want to plot inside with their binning.
cut_vars_dict (dict) – Dict with cuts on variables applied to the input datasets.
sorting_variable (str, optional) – Variable which is used for sorting, by default “ptfrac”
xlabels_dict (dict, optional) – Dict that stores the xlabels of the variables that are plotted. I.e. to specify a label for “pt_btagJes”, use {“pt_btagJes”: “$p_T$ [MeV]”}. Variables that do not appear in the dict will have the variable name as xlabel. By default None
n_leading (list) – n-th leading jet which is plotted. For all, = None.
output_directory (str) – Name of the output directory. Only the dir name not path!
plot_type (str, optional) – File format for the output, by default “pdf”
track_origin (str, optional) – Track set that is to be used for plotting, by default “All”
**kwargs (dict) – Keyword arguments passed to the plot. You can use all arguments that are supported by the HistogramPlot class in the plotting API.
- umami.input_vars_tools.plotting_functions.plot_n_tracks_per_jet(datasets_filepaths: list, datasets_labels: list, datasets_class_labels: list, datasets_track_names: list, n_jets: int, cut_vars_dict: dict, output_directory: str = 'input_vars_trks', plot_type: str = 'pdf', track_origin: str = 'All', **kwargs)#
Plot the number of tracks per jet as a histogram. If multiple datasets are provided, a ratio plot comparing each flavour individually will be added below the main plot.
- Parameters:
datasets_filepaths (list) – List of filepaths to the files.
datasets_labels (list) – Label of the dataset for the legend.
datasets_class_labels (list) – List with dataset-specific class labels, e.g. [[“ujets”, “cjets”], [“cjets”]] to plot light-jets and c-jets for the first but only c-jets for the second dataset
datasets_track_names (list) – List with the track names of the files.
n_jets (int) – Number of jets to use.
cut_vars_dict (dict) – Dict with cuts on variables applied to the input datasets.
output_directory (str) – Name of the output directory. Only the dir name not path!
plot_type (str, optional) – File format for the output, by default “pdf”
track_origin (str, optional) – Track set that is to be used for plotting, by default “All”
**kwargs (dict) – Keyword arguments passed to the plot. You can use all arguments that are supported by the HistogramPlot class in the plotting API.