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 15, 2024
1 parent 980794d commit fb48c1e
Show file tree
Hide file tree
Showing 80 changed files with 740 additions and 828 deletions.
2 changes: 2 additions & 0 deletions CheckOutputs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"metadata": {},
"outputs": [],
"source": [
"from __future__ import annotations\n",
"\n",
"import pandas as pd"
]
},
Expand Down
18 changes: 9 additions & 9 deletions src/HH4b/BDT/BDTSemiBoosted.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"from __future__ import annotations\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import pandas as pd\n",
"import vector\n",
"from sklearn.metrics import auc, roc_curve\n",
"from sklearn.model_selection import train_test_split\n",
"from xgboost import XGBClassifier\n",
"from sklearn.metrics import accuracy_score, roc_auc_score\n",
"import HH4b.utils as utils\n",
"import HH4b.plotting as plotting\n",
"from sklearn.metrics import roc_curve, auc\n",
"import matplotlib.pyplot as plt\n",
"import mplhep as hep\n",
"import vector"
"\n",
"import HH4b.utils as utils"
]
},
{
Expand Down Expand Up @@ -563,7 +563,7 @@
"\n",
"samples_loaded = list(events_dict.keys())\n",
"keys_loaded = list(events_dict[samples_loaded[0]].keys())\n",
"print(f\"Keys in events_dict\")\n",
"print(\"Keys in events_dict\")\n",
"for i in keys_loaded:\n",
" print(i)"
]
Expand Down
18 changes: 9 additions & 9 deletions src/HH4b/BDT/BDT_HH4b.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"from __future__ import annotations\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import pandas as pd\n",
"import vector\n",
"from sklearn.metrics import auc, roc_curve\n",
"from sklearn.model_selection import train_test_split\n",
"from xgboost import XGBClassifier\n",
"from sklearn.metrics import accuracy_score, roc_auc_score\n",
"import HH4b.utils as utils\n",
"import HH4b.plotting as plotting\n",
"from sklearn.metrics import roc_curve, auc\n",
"import matplotlib.pyplot as plt\n",
"import mplhep as hep\n",
"import vector"
"\n",
"import HH4b.utils as utils"
]
},
{
Expand Down Expand Up @@ -136,7 +136,7 @@
"\n",
"samples_loaded = list(events_dict.keys())\n",
"keys_loaded = list(events_dict[samples_loaded[0]].keys())\n",
"print(f\"Keys in events_dict\")\n",
"print(\"Keys in events_dict\")\n",
"for i in keys_loaded:\n",
" print(i)"
]
Expand Down
18 changes: 9 additions & 9 deletions src/HH4b/BDT/BDT_HH4b_Collin_Soper_Angle.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"from __future__ import annotations\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import pandas as pd\n",
"import vector\n",
"from sklearn.metrics import auc, roc_curve\n",
"from sklearn.model_selection import train_test_split\n",
"from xgboost import XGBClassifier\n",
"from sklearn.metrics import accuracy_score, roc_auc_score\n",
"import HH4b.utils as utils\n",
"import HH4b.plotting as plotting\n",
"from sklearn.metrics import roc_curve, auc\n",
"import matplotlib.pyplot as plt\n",
"import mplhep as hep\n",
"import vector"
"\n",
"import HH4b.utils as utils"
]
},
{
Expand Down Expand Up @@ -563,7 +563,7 @@
"\n",
"samples_loaded = list(events_dict.keys())\n",
"keys_loaded = list(events_dict[samples_loaded[0]].keys())\n",
"print(f\"Keys in events_dict\")\n",
"print(\"Keys in events_dict\")\n",
"for i in keys_loaded:\n",
" print(i)"
]
Expand Down
12 changes: 7 additions & 5 deletions src/HH4b/boosted/BDTRun2Check.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@
"metadata": {},
"outputs": [],
"source": [
"from __future__ import annotations\n",
"\n",
"import os\n",
"import pickle\n",
"\n",
"import numpy as np\n",
"import pandas as pd\n",
"import uproot\n",
"import numpy as np\n",
"import pickle\n",
"import vector\n",
"\n",
"from HH4b.postprocessing import bb_assignment\n",
"from HH4b.utils import ShapeVar, CUT_MAX_VAL, load_samples\n",
"from HH4b.utils import get_feat, make_vector"
"from HH4b.utils import get_feat, load_samples, make_vector"
]
},
{
Expand Down Expand Up @@ -766,8 +768,8 @@
"source": [
"import hist\n",
"import matplotlib.pyplot as plt\n",
"import mplhep as hep\n",
"import matplotlib.ticker as mticker\n",
"import mplhep as hep\n",
"\n",
"hep.style.use([\"CMS\", \"firamath\"])\n",
"\n",
Expand Down
23 changes: 8 additions & 15 deletions src/HH4b/boosted/BDT_boosted.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,20 @@
}
],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"from __future__ import annotations\n",
"\n",
"import hist\n",
"import pickle\n",
"\n",
"from sklearn.model_selection import train_test_split\n",
"from xgboost import XGBClassifier\n",
"from sklearn.metrics import accuracy_score, roc_auc_score\n",
"from sklearn.metrics import roc_curve, auc\n",
"\n",
"import HH4b.utils as utils\n",
"import HH4b.plotting as plotting\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import matplotlib.ticker as mticker\n",
"import mplhep as hep\n",
"import numpy as np\n",
"import pandas as pd\n",
"import vector\n",
"from sklearn.metrics import accuracy_score, auc, roc_auc_score, roc_curve\n",
"from sklearn.model_selection import train_test_split\n",
"from xgboost import XGBClassifier\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import mplhep as hep\n",
"import matplotlib.ticker as mticker\n",
"import HH4b.utils as utils\n",
"\n",
"hep.style.use([\"CMS\", \"firamath\"])\n",
"\n",
Expand Down
9 changes: 5 additions & 4 deletions src/HH4b/boosted/DataMCPlots2018.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@
"outputs": [],
"source": [
"# import utilities for post-process\n",
"import utils\n",
"from __future__ import annotations\n",
"\n",
"import vector\n",
"import numpy as np\n",
"import pandas as pd\n",
"import numpy as np"
"import utils\n",
"import vector"
]
},
{
Expand Down Expand Up @@ -278,7 +279,7 @@
"source": [
"samples_loaded = list(events_dict.keys())\n",
"keys_loaded = list(events_dict[samples_loaded[0]].keys())\n",
"print(f\"Keys in events_dict\")\n",
"print(\"Keys in events_dict\")\n",
"print(keys_loaded)"
]
},
Expand Down
31 changes: 10 additions & 21 deletions src/HH4b/boosted/FitB_0.95.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,17 @@
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"import vector\n",
"import os\n",
"from xgboost import XGBClassifier\n",
"from pathlib import Path\n",
"from __future__ import annotations\n",
"\n",
"import HH4b.utils as utils\n",
"from HH4b.utils import ShapeVar\n",
"import HH4b.plotting as plotting\n",
"from HH4b.postprocessing import PostProcess, Region\n",
"import HH4b.postprocessing as postprocessing\n",
"from HH4b.hh_vars import samples, years, samples_run3\n",
"from pathlib import Path\n",
"\n",
"import hist\n",
"import matplotlib.pyplot as plt\n",
"import mplhep as hep\n",
"import matplotlib.ticker as mticker\n",
"import importlib\n",
"import numpy as np\n",
"import pandas as pd\n",
"\n",
"import HH4b.plotting as plotting\n",
"from HH4b.hh_vars import samples\n",
"\n",
"formatter = mticker.ScalarFormatter(useMathText=True)\n",
"formatter.set_powerlimits((-3, 3))"
Expand Down Expand Up @@ -281,10 +273,7 @@
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"from matplotlib import cm\n",
"from matplotlib.ticker import LinearLocator"
"import numpy as np"
]
},
{
Expand Down Expand Up @@ -317,7 +306,7 @@
"\n",
"# select data in the plotting region\n",
"Txbb_cond = Txbb >= txbb_low\n",
"BDT_cond = BDT >= bdt_low\n",
"BDT_cond = bdt_low <= BDT\n",
"cond = Txbb_cond & BDT_cond\n",
"\n",
"Txbb = Txbb[cond]\n",
Expand Down Expand Up @@ -1464,7 +1453,7 @@
"\n",
"# select data in the plotting region\n",
"Txbb_cond = Txbb >= txbb_low\n",
"BDT_cond = BDT >= bdt_low\n",
"BDT_cond = bdt_low <= BDT\n",
"cond = Txbb_cond & BDT_cond\n",
"\n",
"Txbb = Txbb[cond]\n",
Expand Down
33 changes: 9 additions & 24 deletions src/HH4b/boosted/FitB_0.95_PoissonCDF_separate.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
"metadata": {},
"outputs": [],
"source": [
"from __future__ import annotations\n",
"\n",
"B_max = 150435.0 # obtained from nevents_regionB at (0,0)"
]
},
Expand All @@ -29,25 +31,11 @@
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"import vector\n",
"import os\n",
"from xgboost import XGBClassifier\n",
"from pathlib import Path\n",
"\n",
"import HH4b.utils as utils\n",
"from HH4b.utils import ShapeVar\n",
"import HH4b.plotting as plotting\n",
"from HH4b.postprocessing import PostProcess, Region\n",
"import HH4b.postprocessing as postprocessing\n",
"from HH4b.hh_vars import samples, years, samples_run3\n",
"\n",
"import hist\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import mplhep as hep\n",
"import matplotlib.ticker as mticker\n",
"import importlib\n",
"import numpy as np\n",
"import pandas as pd\n",
"\n",
"formatter = mticker.ScalarFormatter(useMathText=True)\n",
"formatter.set_powerlimits((-3, 3))"
Expand Down Expand Up @@ -85,10 +73,7 @@
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"from matplotlib import cm\n",
"from matplotlib.ticker import LinearLocator"
"import numpy as np"
]
},
{
Expand Down Expand Up @@ -121,7 +106,7 @@
"\n",
"# select data in the plotting region\n",
"Txbb_cond = Txbb >= txbb_low\n",
"BDT_cond = BDT >= bdt_low\n",
"BDT_cond = bdt_low <= BDT\n",
"cond = Txbb_cond & BDT_cond\n",
"\n",
"Txbb = Txbb[cond]\n",
Expand Down Expand Up @@ -243,8 +228,8 @@
"metadata": {},
"outputs": [],
"source": [
"from scipy.special import gammainc, gamma\n",
"from scipy.optimize import curve_fit"
"from scipy.optimize import curve_fit\n",
"from scipy.special import gamma, gammainc"
]
},
{
Expand Down
9 changes: 6 additions & 3 deletions src/HH4b/boosted/FitToys.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
"metadata": {},
"outputs": [],
"source": [
"from __future__ import annotations\n",
"\n",
"import os\n",
"import uproot\n",
"\n",
"import numpy as np\n",
"import uproot\n",
"\n",
"\n",
"def run_command(command, dry_run=False):\n",
Expand Down Expand Up @@ -2054,7 +2057,7 @@
"r_dict = {}\n",
"biases = [0]\n",
"for bias in biases:\n",
" file_names = f\"/home/users/woodson/HH4b/src/HH4b/boosted/cards/toy_*/higgsCombineTest.FitDiagnostics.mH125.root\"\n",
" file_names = \"/home/users/woodson/HH4b/src/HH4b/boosted/cards/toy_*/higgsCombineTest.FitDiagnostics.mH125.root\"\n",
" file = uproot.concatenate(file_names)\n",
"\n",
" r = np.array(file.limit)[::4]\n",
Expand Down Expand Up @@ -2092,9 +2095,9 @@
}
],
"source": [
"from scipy import stats\n",
"import matplotlib.pyplot as plt\n",
"import mplhep as hep\n",
"from scipy import stats\n",
"\n",
"xrange = 4\n",
"bins = 21\n",
Expand Down
Loading

0 comments on commit fb48c1e

Please sign in to comment.