ftag#

atlas-ftag-tools - Common tools for ATLAS flavour tagging software.

Submodules#

Attributes#

Classes#

Functions#

get_mock_file(→ tuple[str, h5py.File])

get_working_points(→ dict | None)

Calculate the working points.

Package Contents#

ftag.__version__ = 'v0.2.13'#
class ftag.Cuts#
cuts: tuple[Cut, Ellipsis]#
classmethod from_list(cuts: list) Cuts#
classmethod empty() Cuts#
__post_init__()#
property variables: list[str]#
ignore(variables: list[str])#
__call__(array: numpy.ndarray) CutsResult#
__add__(other: Cuts)#
__len__() int#
__iter__() collections.abc.Iterator#
__getitem__(variable)#
__repr__() str#
ftag.Flavours#
class ftag.Label#
name: str#
label: str#
cuts: ftag.cuts.Cuts#
colour: str#
category: str#
_px: str | None = None#
property px: str#
property eff_str: str#
property rej_str: str#
property frac_str: str#
__str__() str#
__lt__(other) bool#
class ftag.LabelContainer#
labels: dict[str, Label]#
__iter__() collections.abc.Iterator#
__getitem__(key) Label#
__len__() int#
__getattr__(name) Label#
__contains__(label: str | Label) bool#
__eq__(other) bool#
__repr__() str#
property categories: list[str]#
by_category(category: str) LabelContainer#
from_cuts(cuts: list | ftag.cuts.Cuts) Label#
classmethod from_yaml(yaml_path: pathlib.Path | None = None) LabelContainer#
classmethod from_list(labels: list[Label]) LabelContainer#
backgrounds(signal: Label, only_signals: bool = True) LabelContainer#
ftag.get_mock_file(num_jets=1000, fname: str | None = None, tracks_name: str = 'tracks', num_tracks: int = 40) tuple[str, h5py.File]#
class ftag.Sample#
pattern: pathlib.Path | str | tuple[pathlib.Path | str, Ellipsis]#
ntuple_dir: pathlib.Path | str | None = None#
name: str | None = None#
weights: list[float] | None = None#
__post_init__() None#
property path: tuple[pathlib.Path, Ellipsis]#
property files: list[str]#
property num_files: int#
property dsid: list[str]#
property sample_id: list[str]#
property tags: list[str]#
property ptag: list[str]#
property rtag: list[str]#
property dumper_tag: list[str]#
virtual_file(**kwargs) list[pathlib.Path | str]#
__str__()#
__lt__(other)#
__eq__(other)#
class ftag.Transform#
variable_map: dict[str, dict[str, str]] | None = None#
ints_map: dict[str, dict[str, dict[int, int]]] | None = None#
floats_map: dict[str, dict[str, str | Callable]] | None = None#
__post_init__()#
__call__(batch: Batch) Batch#
map_variables(batch: Batch) Batch#

Rename variables in a batch of data.

Parameters:

batch (Batch) – Dict of structured numpy arrays.

Returns:

Dict of structured numpy arrays with renamed variables.

Return type:

Batch

map_ints(batch: Batch) Batch#

Map integer values to new values.

Parameters:

batch (Batch) – Dict of structured numpy arrays.

Returns:

Dict of structured numpy arrays with mapped integer values.

Return type:

Batch

map_floats(batch: Batch) Batch#

Transform float values.

Parameters:

batch (Batch) – Dict of structured numpy arrays.

Returns:

Dict of structured numpy arrays with transformed float values.

Return type:

Batch

map_dtype(name: str, dtype: numpy.dtype) numpy.dtype#
map_variable_names(name: str, variables: list[str], inverse=False) list[str]#
ftag.get_working_points(args: argparse.Namespace) dict | None#

Calculate the working points.

Parameters:

args (argparse.Namespace) – Input arguments from the argparser

Returns:

Dict with the working points. If args.outfile is given, the function returns None and stored the resulting dict in a yaml file in args.outfile.

Return type:

dict | None