ijazz.plotting

Functions

ijazz_plot_results()

entry point for the ijazz_plot command

plot_results_from_json([x_unit, resp_range, ...])

Create a list of Axes to plot the results in the json file.

plot_results_from_json2G([x_unit, mu_range, ...])

Create a list of Axes to plot the results in the json file.

plot_syst_from_jsons(→ Tuple[str, List[str]])

Plot the contribution of each systematic uncertainties from the json files

plot_sas_fit_results([reso_range, add_injected, ...])

Plot the result of the scale and smearing fit

plot_mmg_injected_vs_measured(mmg[, injected_col, ...])

Plot injected vs measured response for MMG fits.

Module Contents

ijazz.plotting.ijazz_plot_results()[source]

entry point for the ijazz_plot command

ijazz.plotting.plot_results_from_json(json_file: str | pathlib.Path | Dict, dims: List = None, x_range=(), x_unit='', cat_latex: Dict = None, resp_range=(), reso_range=(), hide_legend=False, colors=None, jsons_mode='', param_to_plot=None, ylabels=['resp.', 'reso.'], **kwargs) Tuple[List[matplotlib.pyplot.Figure], matplotlib.pyplot.Axes][source]

Create a list of Axes to plot the results in the json file. the dimensions to plot can be specified, additional dimension are averaged over. Up to 3 dimensions can be plotted.

Parameters:
  • json_file (Union[str, Path, Dict]) – json file containing the results of the IJazZ SAS fit or Dict from the json file

  • dims (List, optional) – name dimensions to plot (as in the categories). Defaults to None.

  • x_range (tuple, optional) – range of the main variable (dimension 0). Defaults to ().

  • x_unit (str, optional) – usint of the main varaible. Defaults to ‘’.

  • cat_latex (Dict, optional) – dictionnary mapping var name (from categories) into a latex name. Defaults to None.

  • resp_range (tuple, optional) – y-range of the resp axis. Defaults to ().

  • reso_range (tuple, optional) – y-range if the reso axis. Defaults to ().

  • leg_ncol (int, optional) – number of columns in the legend. Defaults to 1.

  • hide_legend (bool, optional) – hide the legend. Defaults to False.

  • jsons_mode (str, optional) – select plotting mode between ‘compare’ and ‘ratio’. Defaults to ‘’.

  • param_to_plot (str, optional) – parameter to plot (resp or reso) if compare_jsons. Defaults to None.

Returns:

Figure and Axes of the plot.

Return type:

Tuple[Figure, Axes]

ijazz.plotting.plot_results_from_json2G(json_file: str | pathlib.Path | Dict, dims: List = None, x_range=(), x_unit='', cat_latex: Dict = None, mu_range=(0.78, 1.02), reso_scale_range=(0.9, 5.1), frac_range=(0.78, 1.02), **kwargs) Tuple[List[matplotlib.pyplot.Figure], matplotlib.pyplot.Axes][source]

Create a list of Axes to plot the results in the json file. the dimensions to plot can be specified, additional dimension are averaged over. Up to 3 dimensions can be plotted.

Parameters:
  • json_file (Union[str, Path, Dict]) – json file containing the results of the IJazZ SAS fit or Dict from the json file

  • dims (List, optional) – name dimensions to plot (as in the categories). Defaults to None.

  • x_range (tuple, optional) – range of the main variable (dimension 0). Defaults to ().

  • x_unit (str, optional) – usint of the main varaible. Defaults to ‘’.

  • cat_latex (Dict, optional) – dictionnary mapping var name (from categories) into a latex name. Defaults to None.

  • resp_range (tuple, optional) – y-range of the resp axis. Defaults to ().

  • reso_range (tuple, optional) – y-range if the reso axis. Defaults to ().

  • leg_ncol (int, optional) – number of columns in the legend. Defaults to 1.

Returns:

Figure and Axes of the plot.

Return type:

Tuple[Figure, Axes]

ijazz.plotting.plot_syst_from_jsons(nominal: Dict | str | pathlib.Path, syst_jsons: Dict, fit_2g: Dict | str | pathlib.Path = None, nominal_syst: Dict | str | pathlib.Path = None, scale_flat_syst: float = 0.0, smear_flat_syst: float = 0.0, **kwargs) Tuple[str, List[str]][source]

Plot the contribution of each systematic uncertainties from the json files

Parameters:
  • nominal (Union[Dict, str, Path]) – nominal json file

  • syst_jsons (Dict) – dict of json files with systematic variations

  • fit_2g (Union[Dict, str, Path], optional) – json file with the parameters of the double gaussian fit. Defaults to None.

  • nominal_syst (Union[Dict, str, Path], optional) – nominal json file with the full systematic uncertainties already computed. Used to cross-check the sum in quadrature of other syst, “total” and “check” should match. Defaults to None.

  • scale_flat_syst (float, optional) – flat scale systematic uncertainty. Defaults to 0.0.

  • smear_flat_syst (float, optional) – flat smear systematic uncertainty. Defaults to 0.0.

Returns:

ijazz.plotting.plot_sas_fit_results(sas: ijazz.ScaleAndSmearing.IJazZSAS, cat_latex={}, x_range=None, resp_range=(0.95, 1.05), reso_range=(0, 0.05), add_injected=False, use_pt_cat=False, resp_range_ratio=(0.999, 1.001), reso_range_ratio=(0.8, 1.2), pt_scale_std=1.0) Tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes][source]

Plot the result of the scale and smearing fit

Parameters:
  • sas (IJazZSAS) – object containing the fit result of the scale and smearing (as well as the data , mc samples)

  • cat_latex (dict, optional) – dict containing for each variable used for categorisation a latex plotting symbol (e.g. {‘pt’: ‘p_T’}). Defaults to {}.

  • x_range (tuple, optional) – x axis range (can be auto). Defaults to None.

  • resp_range (tuple, optional) – y axis range for response. Defaults to (0.95, 1.05).

  • reso_range (tuple, optional) – y axis range for resolution. Defaults to (0, 0.05).

  • add_injected (bool, optional) – When a resolution was injected for test, plot the value (variable sas per lepton must exist filled with the injected s&s). Defaults to False.

  • use_pt_cat (bool, optional) – Use the pt categorisation axis (when fitting with relative pt, allows to plot back w/r to pt). Defaults to False.

  • resp_range_ratio (tuple, optional) – y axis range for response ratio. Defaults to (0.999, 1.001).

  • reso_range_ratio (tuple, optional) – y axis range for resolution ratio. Defaults to (0.80, 1.20).

  • pt_scale_std (float, optional) – ?. Defaults to 1.0.

Returns:

matplotlib figure, axes with the result

Return type:

tuple[plt.Figure, plt.Axes]

ijazz.plotting.plot_mmg_injected_vs_measured(mmg, injected_col='sasg', cat_latex=None, x_range=None, resp_range=(0.98, 1.02))[source]

Plot injected vs measured response for MMG fits.

Parameters:
  • mmg (IJazZMMG) – fitted MMG object.

  • injected_col (str) – column name with injected scale per event.

  • cat_latex (dict, optional) – latex labels for categories.

  • x_range (tuple, optional) – x-axis range.

  • resp_range (tuple, optional) – y-axis range for response.