Skip to content

Commit

Permalink
style: pre-commit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Oct 7, 2024
1 parent 0b12df4 commit 3786868
Show file tree
Hide file tree
Showing 59 changed files with 532 additions and 642 deletions.
5 changes: 4 additions & 1 deletion data/xhy/check_pfnanos.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
"metadata": {},
"outputs": [],
"source": [
"from __future__ import annotations\n",
"\n",
"import os\n",
"\n",
"import yaml"
]
},
Expand Down Expand Up @@ -37,7 +40,7 @@
" for sample in os.listdir(f\"/eos/uscms/store/group/lpcpfnano/{user}/v2_3/{year}/XHY\")\n",
" ]\n",
"\n",
" with open(f\"parsed_miniaod_{year}.yaml\", \"r\") as f:\n",
" with open(f\"parsed_miniaod_{year}.yaml\") as f:\n",
" mini_samples = list(yaml.safe_load(f)[\"samples\"][\"XHY\"][\"datasets\"].keys())\n",
"\n",
" for sample in mini_samples:\n",
Expand Down
9 changes: 6 additions & 3 deletions data/xhy/filter_samples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
"metadata": {},
"outputs": [],
"source": [
"import yaml\n",
"import os"
"from __future__ import annotations\n",
"\n",
"import os\n",
"\n",
"import yaml"
]
},
{
Expand All @@ -16,7 +19,7 @@
"metadata": {},
"outputs": [],
"source": [
"with open(\"parsed_miniaod_2017.yaml\", \"r\") as f:\n",
"with open(\"parsed_miniaod_2017.yaml\") as f:\n",
" files = yaml.safe_load(f)"
]
},
Expand Down
4 changes: 3 additions & 1 deletion data/xhy/parse_das.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"metadata": {},
"outputs": [],
"source": [
"with open(\"./miniaod.txt\", \"r\") as f:\n",
"from __future__ import annotations\n",
"\n",
"with open(\"./miniaod.txt\") as f:\n",
" samples = f.readlines()"
]
},
Expand Down
2 changes: 1 addition & 1 deletion inference_scans/run_law.sh
Original file line number Diff line number Diff line change
Expand Up @@ -218,4 +218,4 @@ if [ $impacts = 1 ]; then
--page -1 \
--pull-range 3 \
--Snapshot-custom-args="$custom_args"
fi
fi
25 changes: 14 additions & 11 deletions paper/latex_tables.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
"metadata": {},
"outputs": [],
"source": [
"import yaml\n",
"from __future__ import annotations\n",
"\n",
"import json\n",
"from copy import deepcopy\n",
"from pathlib import Path\n",
"\n",
"import numpy as np\n",
"import pandas as pd\n",
"from copy import deepcopy\n",
"from pathlib import Path"
"import yaml"
]
},
{
Expand Down Expand Up @@ -45,7 +48,7 @@
"metadata": {},
"outputs": [],
"source": [
"with open(\"samples/JetHT.yaml\", \"r\") as f:\n",
"with open(\"samples/JetHT.yaml\") as f:\n",
" samples = yaml.safe_load(f)[\"samples\"]\n",
"\n",
"lines = []\n",
Expand Down Expand Up @@ -77,7 +80,7 @@
"metadata": {},
"outputs": [],
"source": [
"with open(\"samples/SingleMuon.yaml\", \"r\") as f:\n",
"with open(\"samples/SingleMuon.yaml\") as f:\n",
" samples = yaml.safe_load(f)[\"samples\"]\n",
"\n",
"lines = []\n",
Expand Down Expand Up @@ -164,10 +167,10 @@
"metadata": {},
"outputs": [],
"source": [
"with open(\"samples/MC_bg.yaml\", \"r\") as f:\n",
"with open(\"samples/MC_bg.yaml\") as f:\n",
" samples = yaml.safe_load(f)[\"samples\"]\n",
"\n",
"with open(\"../data/xsecs.json\", \"r\") as f:\n",
"with open(\"../data/xsecs.json\") as f:\n",
" xsecs = json.load(f)\n",
"\n",
"lines = []\n",
Expand All @@ -179,7 +182,7 @@
"\n",
" for key, dataset in samples[sample][\"datasets\"].items():\n",
" dname = dataset.split(\"/\")[1].replace(\"_\", \"\\_\")\n",
" citation = \"\" if not key in refs else rf\"~\\cite{{{refs[key]}}}\"\n",
" citation = \"\" if key not in refs else rf\"~\\cite{{{refs[key]}}}\"\n",
" lines.append(rf\" & {dname} & {process_xsec(xsecs[key])}{citation} \\\\\" + \"\\n\")\n",
"\n",
" lend = len(samples[sample][\"datasets\"])\n",
Expand All @@ -200,10 +203,10 @@
"metadata": {},
"outputs": [],
"source": [
"with open(\"samples/MC_sig.yaml\", \"r\") as f:\n",
"with open(\"samples/MC_sig.yaml\") as f:\n",
" samples = yaml.safe_load(f)[\"samples\"]\n",
"\n",
"with open(\"../data/xsecs.json\", \"r\") as f:\n",
"with open(\"../data/xsecs.json\") as f:\n",
" xsecs = json.load(f)\n",
"\n",
"lines = []\n",
Expand Down Expand Up @@ -247,7 +250,7 @@
" return (mX, mY)\n",
"\n",
"\n",
"with open(\"../data/xhy/parsed_miniaod_2017.yaml\", \"r\") as f:\n",
"with open(\"../data/xhy/parsed_miniaod_2017.yaml\") as f:\n",
" samples = yaml.safe_load(f)[\"samples\"][\"XHY\"][\"datasets\"]\n",
"\n",
"mps = [[*mxmy(sample)] for sample in samples]\n",
Expand Down
5 changes: 3 additions & 2 deletions paper/limit_plots.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
"metadata": {},
"outputs": [],
"source": [
"import matplotlib as mpl\n",
"import matplotlib.pyplot as plt\n",
"from __future__ import annotations\n",
"\n",
"import matplotlib.patches as patches\n",
"import matplotlib.pyplot as plt\n",
"import matplotlib.ticker as mticker\n",
"import mplhep as hep\n",
"import numpy as np\n",
Expand Down
21 changes: 7 additions & 14 deletions src/HHbbVV/VBF_binder/VBFKinematicsStudy.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,15 @@
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"from __future__ import annotations\n",
"\n",
"import awkward as ak\n",
"import matplotlib.pyplot as plt\n",
"import mplhep as hep\n",
"import matplotlib.ticker as mticker\n",
"import mplhep as hep\n",
"import numpy as np\n",
"\n",
"import uproot\n",
"import awkward as ak\n",
"from coffea import nanoevents\n",
"\n",
"from coffea.nanoevents.methods.base import NanoEventsArray\n",
"from coffea.analysis_tools import Weights, PackedSelection\n",
"from coffea.nanoevents.methods import nanoaod\n",
"from coffea.nanoevents.methods import vector\n",
"from coffea.lookup_tools.dense_lookup import dense_lookup\n",
"\n",
"from HHbbVV.processors.utils import pad_val\n",
"\n",
"plt.style.use(hep.style.CMS)\n",
Expand Down Expand Up @@ -77,7 +70,7 @@
" (abs(events.GenPart.pdgId) == HIGGS_PDGID) * events.GenPart.hasFlags(GEN_FLAGS)\n",
"]\n",
"\n",
"vs = events.GenPart[((abs(events.GenPart.pdgId) == 24)) * events.GenPart.hasFlags(GEN_FLAGS)]"
"vs = events.GenPart[(abs(events.GenPart.pdgId) == 24) * events.GenPart.hasFlags(GEN_FLAGS)]"
]
},
{
Expand All @@ -95,7 +88,7 @@
"metadata": {},
"outputs": [],
"source": [
"ak4_jet_selection = { # noqa: RUF012\n",
"ak4_jet_selection = {\n",
" \"pt\": 25,\n",
" \"eta\": 2.7,\n",
" \"jetId\": \"tight\",\n",
Expand All @@ -105,7 +98,7 @@
"}\n",
"\n",
"# ak8 jet preselection\n",
"preselection = { # noqa: RUF012\n",
"preselection = {\n",
" \"pt\": 300.0,\n",
" \"eta\": 2.4,\n",
" \"VVmsd\": 50,\n",
Expand Down
21 changes: 7 additions & 14 deletions src/HHbbVV/VBF_binder/VBFKinematicsStudyRK.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,14 @@
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"from __future__ import annotations\n",
"\n",
"import awkward as ak\n",
"import matplotlib.pyplot as plt\n",
"import mplhep as hep\n",
"import matplotlib.ticker as mticker\n",
"import mplhep as hep\n",
"import numpy as np\n",
"\n",
"import uproot\n",
"import awkward as ak\n",
"from coffea import nanoevents\n",
"\n",
"from coffea.nanoevents.methods.base import NanoEventsArray\n",
"from coffea.analysis_tools import Weights, PackedSelection\n",
"from coffea.nanoevents.methods import nanoaod\n",
"from coffea.nanoevents.methods import vector\n",
"from coffea.lookup_tools.dense_lookup import dense_lookup\n",
"from tqdm import tqdm\n",
"\n",
"from HHbbVV.processors.utils import pad_val\n",
Expand Down Expand Up @@ -145,7 +138,7 @@
"Hbb = ak.pad_none(Hbb, 1, axis=1)[:, 0]\n",
"HVV = ak.pad_none(HVV, 1, axis=1)[:, 0]\n",
"\n",
"vs = events.GenPart[((abs(events.GenPart.pdgId) == 24)) * events.GenPart.hasFlags(GEN_FLAGS)]\n",
"vs = events.GenPart[(abs(events.GenPart.pdgId) == 24) * events.GenPart.hasFlags(GEN_FLAGS)]\n",
"\n",
"# vbf output quarks are always at index 4, 5\n",
"gen_quarks = events.GenPart[events.GenPart.hasFlags([\"isHardProcess\"])][:, 4:6]"
Expand Down Expand Up @@ -275,7 +268,7 @@
"outputs": [],
"source": [
"# ak8 jet preselection\n",
"preselection = { # noqa: RUF012\n",
"preselection = {\n",
" \"pt\": 300.0,\n",
" \"eta\": 2.4,\n",
" \"VVmsd\": 50,\n",
Expand Down Expand Up @@ -479,7 +472,7 @@
"metadata": {},
"outputs": [],
"source": [
"ak4_jet_selection = { # noqa: RUF012\n",
"ak4_jet_selection = {\n",
" \"pt\": 15,\n",
" \"eta_min\": 1,\n",
" \"eta_max\": 5.1,\n",
Expand Down
16 changes: 9 additions & 7 deletions src/HHbbVV/VBF_binder/VBFVectorTesting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@
"metadata": {},
"outputs": [],
"source": [
"import vector\n",
"import numpy as np\n",
"from __future__ import annotations\n",
"\n",
"import time\n",
"\n",
"import numpy as np\n",
"import vector\n",
"\n",
"start_time = time.time()\n",
"\n",
"# Generating dummy data for vbf1\n",
Expand Down Expand Up @@ -124,8 +127,8 @@
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"\n",
"def to_four_momentum(pt, phi, eta, m):\n",
Expand Down Expand Up @@ -209,7 +212,6 @@
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"\n",
"def to_four_momentum(pt, phi, eta, m):\n",
Expand Down Expand Up @@ -339,7 +341,6 @@
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import vector\n",
"\n",
"\n",
Expand Down Expand Up @@ -506,9 +507,10 @@
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import time\n",
"\n",
"import numpy as np\n",
"\n",
"\n",
"def to_four_momentum(pt, phi, eta, m):\n",
" px = pt * np.cos(phi)\n",
Expand Down Expand Up @@ -590,8 +592,8 @@
"metadata": {},
"outputs": [],
"source": [
"import vector\n",
"import numpy as np\n",
"import vector\n",
"\n",
"\n",
"# Define a function to convert pt, eta, phi, mass to a vector object\n",
Expand Down
Loading

0 comments on commit 3786868

Please sign in to comment.