Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update pre-commit hooks #206

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ ci:

repos:
- repo: https://github.com/psf/black-pre-commit-mirror
rev: "24.3.0"
rev: "24.8.0"
hooks:
- id: black-jupyter

- repo: https://github.com/adamchainz/blacken-docs
rev: "1.16.0"
rev: "1.18.0"
hooks:
- id: blacken-docs
additional_dependencies: [black==23.*]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.5.0"
rev: "v5.0.0"
hooks:
- id: check-added-large-files
args: ["--maxkb=10000"]
Expand Down Expand Up @@ -47,7 +47,7 @@ repos:
# args: [--prose-wrap=always]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.3.4"
rev: "v0.6.9"
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
Expand All @@ -63,7 +63,7 @@ repos:
# - pytest

- repo: https://github.com/codespell-project/codespell
rev: "v2.2.6"
rev: "v2.3.0"
hooks:
- id: codespell
types_or: [python, rst, markdown]
Expand All @@ -84,12 +84,12 @@ repos:
# exclude: .pre-commit-config.yaml

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.16
rev: v0.20.2
hooks:
- id: validate-pyproject

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.28.1
rev: 0.29.3
hooks:
- id: check-dependabot
- id: check-github-workflows
Expand Down
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
Loading
Loading