gnn_tracking.analysis.efficiencies#

Attributes#

vm

Classes#

Plot

Base class for certain plots. Provides watermark and 'save' functionality.

TracksVsDBSCANPlot

Plot tracking efficiencies vs DBSCAN epsilon

PerformancePlot

Plot efficiencies vs some variable (pt, eta, etc.)

PerformanceComparisonPlot

Similar to PerforamncePlot, except that we use the same x axis for

Module Contents#

class gnn_tracking.analysis.efficiencies.Plot(*, ax: matplotlib.pyplot.Axes | None = None, watermark='', model='')#

Base class for certain plots. Provides watermark and ‘save’ functionality.

FILENAME = ''#
add_legend() None#
save(path: os.PathLike | str = '') None#
gnn_tracking.analysis.efficiencies.vm#
class gnn_tracking.analysis.efficiencies.TracksVsDBSCANPlot(mean_df: pandas.DataFrame, **kwargs)#

Bases: gnn_tracking.analysis.plotutils.Plot

Plot tracking efficiencies vs DBSCAN epsilon

tvdp = TracksVsDBSCANPlot(
    mean_df=tcmodule.cluster_scanner.get_results().df_mean,
)
secondary_k = 4
tvdp.plot_var("double_majority_pt0.9", secondary_k=secondary_k)
tvdp.plot_var("lhc_pt0.9", secondary_k=secondary_k)
tvdp.plot_var("perfect_pt0.9", secondary_k=secondary_k)
plot_var(var: str, *, secondary_k: int = 4, **kwargs)#

Plot an efficiency.

Parameters:
  • var – Name of the variable to plot

  • secondary_k – Plot a second line with this value of k

  • **kwargs – Passed to plot function

class gnn_tracking.analysis.efficiencies.PerformancePlot(xs: numpy.ndarray, df: pandas.DataFrame, *, df_ul: pandas.DataFrame | None = None, x_label: str = '$p_T$ [GeV]', y_label: str = 'Efficiency', **kwargs)#

Bases: gnn_tracking.analysis.plotutils.Plot

Plot efficiencies vs some variable (pt, eta, etc.)

Parameters:
  • xs (np.ndarray) – x values (e.g., pt or eta). Length must be one longer than the dataframe to account for bin edges.

  • df (pd.DataFrame) – Dataframe with values. Errors should be in columns named with suffix _err.

  • df_ul (_type_, optional) – Dataframe with values for upper limit. Defaults to None.

  • x_label (regexp, optional) – x label

  • y_label (str, optional) – y label

  • **kwargs – Passed to Plot

plot_var(var: str, color: str, *, label: str | None = None, plot_ul=True) None#

Plot variable

Parameters:
  • var (str) – Name of variable

  • color (str) – Color

  • label (str | None, optional) – Label for legend

  • plot_ul (bool, optional) – Plot upper limit if available

add_blocked(a: float, b: float, label='Not trained for') None#

Used to mark low pt as “not trained for”.

add_legend(**kwargs) None#
class gnn_tracking.analysis.efficiencies.PerformanceComparisonPlot(xs: numpy.ndarray, var: str, x_label: str, ylabel: str = 'Efficiency', **kwargs)#

Bases: gnn_tracking.analysis.plotutils.Plot

Similar to PerforamncePlot, except that we use the same x axis for plots of different models (and supply the dataframes directly to plot_var).

Parameters:
  • xs (np.ndarray) – x values (e.g., pt or eta). Length must be one longer than the dataframe to account for bin edges.

  • var (str) – Name of variable

  • x_label (regexp, optional) – x label

  • y_label (str, optional) – y label

  • **kwargs – Passed to Plot

plot_var(df: pandas.DataFrame, label: str, color: str) None#
add_legend(**kwargs) None#
add_blocked(a, b, label='Not trained for') None#

Used to mark low pt as “not trained for”.