atlas-ftag-tools 0.0.8__py3-none-any.whl → 0.0.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: atlas-ftag-tools
3
- Version: 0.0.8
3
+ Version: 0.0.9
4
4
  Summary: ATLAS Flavour Tagging Tools
5
5
  Author: Sam Van Stroud, Philipp Gadow
6
6
  License: MIT
@@ -60,3 +60,27 @@ The script is `vds.py` and can be run after installing this package with
60
60
  ```
61
61
  vds <pattern> <output path>
62
62
  ```
63
+
64
+ The `<pattern>` argument should be a quotes enclosed [glob pattern](https://en.wikipedia.org/wiki/Glob_(programming)), for example `"dsid/path/*.h5"`
65
+
66
+
67
+ ## Calculate WPs
68
+
69
+ This package contains a script to calculate tagger working points (WPs).
70
+ The script is `working_points.py` and can be run after installing this package with
71
+
72
+ ```
73
+ wps \
74
+ --ttbar "path/to/ttbar/*.h5" \
75
+ --tagger GN120220509 \
76
+ --fx 0.1
77
+ ```
78
+
79
+ Both the `--tagger` and `--fx` options accept a list if you want to get the WPs for multiple taggers.
80
+
81
+ If you want to use the `ttbar` WPs get the efficiencies and rejections for the `zprime` sample, you can add `--zprime "path/to/zprime/*.h5"` to the command.
82
+ Note that a default selection of $p_T > 250 ~GeV$ to jets in the `zprime` sample.
83
+
84
+ By default the working points are printed to the terminal, but you can save the results to a YAML file with the `--outfile` option.
85
+
86
+ Use `--help` for more options and information.
@@ -1,17 +1,17 @@
1
- ftag/__init__.py,sha256=ULhLJx6S4eI6belw3lP41InlJSx_9PrYgKmuA_YVz2U,731
1
+ ftag/__init__.py,sha256=092e5JJGG0mORUgE6Si-6sMU2HxNP90t0NfWh9n3t5g,543
2
2
  ftag/cuts.py,sha256=Ge4WXLPg3WNgGxg-g7oIgCbbNFcKZonvkyskU0fDuDg,2733
3
- ftag/flavour.py,sha256=ciNtvPjcLhmf0tq2x5sOQXk2xwtLgMFS1wVlRk16VqI,2033
3
+ ftag/flavour.py,sha256=67Otbi-78vEAOagLC9mvPGwNcr_S0ljy34eoChzd_9o,2396
4
4
  ftag/flavours.yaml,sha256=S4WoB_n2uqvjo8_mlvNA1wKUwz9aFLhpyXtWsR8uR80,3121
5
5
  ftag/mock.py,sha256=3ux7kx22o94K4eCHvI3vLTElBTvlDWEHwfCwidkNCiU,3579
6
6
  ftag/region.py,sha256=Tbw7o7cqdeZcu3x49n1iXUxR0apHaUSAsSY_vTHPuGI,371
7
7
  ftag/sample.py,sha256=p7JWiBvj4tq0YcvRGi_xp_3IvBXOFvx2mUEtO05NHac,2319
8
- ftag/vds.py,sha256=3b3Hc9A9eGtftZbfenth_PDP1NoRAirKvTCqLMoU3uU,2352
8
+ ftag/vds.py,sha256=FmpP31YiSKBvh6TRIMWr-_aJHAkQs0Trhmqh2KLfT64,2402
9
9
  ftag/hdf5/__init__.py,sha256=A_a_4IUlZ2mSiDcfrZKBdja_3iTrUHvADM2lWx6g66g,325
10
10
  ftag/hdf5/h5reader.py,sha256=7FK1TfOb4tV34rlf6O3Xh918j3RwYMkm0-QLgO2NkHM,8446
11
11
  ftag/hdf5/h5utils.py,sha256=tHspHfO0lsRFcft9WQo98_ot55837nYNiTO4_0z4qwk,2376
12
12
  ftag/hdf5/h5writer.py,sha256=D4GZKWyPE-ob8anCsZ2Vw2UFwbZltl1dPn7ZlI-y1oM,3094
13
- atlas_ftag_tools-0.0.8.dist-info/METADATA,sha256=ovJP-STvMbIw42NMXMjyrH6Uq9xhiECoyjIWAXAF3Mg,2024
14
- atlas_ftag_tools-0.0.8.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
15
- atlas_ftag_tools-0.0.8.dist-info/entry_points.txt,sha256=f-2kD2GPwnJis7whmkso1bfJ64HKgzxyI1to5zCPHhw,38
16
- atlas_ftag_tools-0.0.8.dist-info/top_level.txt,sha256=qiYQuKcAvMim-31FwkT3MTQu7WQm0s58tPAia5KKWqs,5
17
- atlas_ftag_tools-0.0.8.dist-info/RECORD,,
13
+ atlas_ftag_tools-0.0.9.dist-info/METADATA,sha256=yajFDhKPhccegFIOLG49l7cuclhJiguFgF72ELrTQJA,2966
14
+ atlas_ftag_tools-0.0.9.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
15
+ atlas_ftag_tools-0.0.9.dist-info/entry_points.txt,sha256=UKbRbwA9DxfsTPRBIVVDz3u15WdzhzgRKwXXSAXuQqc,73
16
+ atlas_ftag_tools-0.0.9.dist-info/top_level.txt,sha256=qiYQuKcAvMim-31FwkT3MTQu7WQm0s58tPAia5KKWqs,5
17
+ atlas_ftag_tools-0.0.9.dist-info/RECORD,,
@@ -1,2 +1,3 @@
1
1
  [console_scripts]
2
2
  vds = ftag.vds:main
3
+ wps = ftag.wps.working_points:main
ftag/__init__.py CHANGED
@@ -1,23 +1,25 @@
1
1
  """atlas-ftag-tools - Common tools for ATLAS flavour tagging software."""
2
2
 
3
3
 
4
- __version__ = "v0.0.8"
4
+ __version__ = "v0.0.9"
5
5
 
6
- from pathlib import Path
7
-
8
- import yaml
9
6
 
10
7
  import ftag.hdf5 as hdf5
11
8
  from ftag.cuts import Cuts
12
- from ftag.flavour import Flavour, FlavourContainer
9
+ from ftag.flavour import Flavour, Flavours
13
10
  from ftag.mock import get_mock_file
14
11
  from ftag.sample import Sample
12
+ from ftag.wps.discriminant import get_discriminant
13
+ from ftag.wps.working_points import get_working_points
15
14
 
16
- # load flavours
17
- with open(Path(__file__).parent / "flavours.yaml") as f:
18
- flavours_yaml = yaml.safe_load(f)
19
- flavours_dict = {f["name"]: Flavour(cuts=Cuts.from_list(f.pop("cuts")), **f) for f in flavours_yaml}
20
- assert len(flavours_dict) == len(flavours_yaml), "Duplicate flavour names detected"
21
- Flavours = FlavourContainer(flavours_dict)
22
-
23
- __all__ = ["Cuts", "Flavours", "Sample", "hdf5", "get_mock_file", "__version__"]
15
+ __all__ = [
16
+ "Cuts",
17
+ "Flavour",
18
+ "Flavours",
19
+ "Sample",
20
+ "hdf5",
21
+ "get_mock_file",
22
+ "get_discriminant",
23
+ "get_working_points",
24
+ "__version__",
25
+ ]
ftag/flavour.py CHANGED
@@ -2,6 +2,9 @@ from __future__ import annotations
2
2
 
3
3
  from collections.abc import Generator
4
4
  from dataclasses import dataclass
5
+ from pathlib import Path
6
+
7
+ import yaml
5
8
 
6
9
  from ftag.cuts import Cuts
7
10
 
@@ -74,3 +77,10 @@ class FlavourContainer:
74
77
  if flavour.cuts == cuts:
75
78
  return flavour
76
79
  raise KeyError(f"Flavour with {cuts} not found")
80
+
81
+
82
+ with open(Path(__file__).parent / "flavours.yaml") as f:
83
+ flavours_yaml = yaml.safe_load(f)
84
+ flavours_dict = {f["name"]: Flavour(cuts=Cuts.from_list(f.pop("cuts")), **f) for f in flavours_yaml}
85
+ assert len(flavours_dict) == len(flavours_yaml), "Duplicate flavour names detected"
86
+ Flavours = FlavourContainer(flavours_dict)
ftag/vds.py CHANGED
@@ -65,9 +65,11 @@ def create_virtual_file(
65
65
  def main():
66
66
  import argparse
67
67
 
68
- parser = argparse.ArgumentParser(description="Create a virtual dataset from a glob pattern")
69
- parser.add_argument("pattern", type=Path, help="Glob pattern of files to merge")
70
- parser.add_argument("output", type=Path, help="Output file name")
68
+ parser = argparse.ArgumentParser(
69
+ description="Create a lightweight wrapper around a set of h5 files"
70
+ )
71
+ parser.add_argument("pattern", type=Path, help="quotes-enclosed glob pattern of files to merge")
72
+ parser.add_argument("output", type=Path, help="path to output virtual file")
71
73
  args = parser.parse_args()
72
74
 
73
75
  print(f"Globbing {args.pattern}...")