Skip to content

Commit

Permalink
Merge pull request #1241 from scikit-hep/fix_1238_backport
Browse files Browse the repository at this point in the history
fix(backport): allow JetResolution to handle additional filename metadata
  • Loading branch information
lgray authored Jan 8, 2025
2 parents 1f69f3a + 64f0c10 commit d784451
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 13 deletions.
9 changes: 5 additions & 4 deletions coffea/jetmet_tools/JetResolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,16 @@ def __init__(self, **kwargs):
)
)
info = name.split("_")
if len(info) != 5:
if len(info) > 6 or len(info) < 5:
raise Exception("Corrector name is not properly formatted!")
offset = len(info) - 5

campaign = _checkConsistency(campaign, info[0])
dataera = _checkConsistency(dataera, info[1])
datatype = _checkConsistency(datatype, info[2])
levels.append(info[3])
datatype = _checkConsistency(datatype, info[2 + offset])
levels.append(info[3 + offset])
funcs.append(func)
jettype = _checkConsistency(jettype, info[4])
jettype = _checkConsistency(jettype, info[4 + offset])

if campaign is None:
raise Exception("Unable to determine production campaign of JECs!")
Expand Down
1 change: 1 addition & 0 deletions coffea/lookup_tools/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"jec": convert_jec_txt_file,
"jersf": convert_jersf_txt_file,
"jr": convert_jr_txt_file,
"jer": convert_jr_txt_file,
"junc": convert_junc_txt_file,
"ea": convert_effective_area_file,
"pileup": convert_pileup_json_file,
Expand Down
2 changes: 0 additions & 2 deletions coffea/processor/parsl/condor_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import parsl
from parsl.providers import CondorProvider
from parsl.channels import LocalChannel
from parsl.config import Config
from parsl.executors import HighThroughputExecutor

Expand Down Expand Up @@ -68,7 +67,6 @@ def condor_config(
cores_per_worker=1,
worker_logdir_root="./",
provider=CondorProvider(
channel=LocalChannel(),
init_blocks=total_workers,
max_blocks=max_workers,
nodes_per_block=1,
Expand Down
2 changes: 0 additions & 2 deletions coffea/processor/parsl/detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from parsl.app.app import python_app

from parsl.providers import LocalProvider
from parsl.channels import LocalChannel
from parsl.config import Config
from parsl.executors import HighThroughputExecutor

Expand All @@ -17,7 +16,6 @@
label="coffea_parsl_default",
cores_per_worker=1,
provider=LocalProvider(
channel=LocalChannel(),
init_blocks=1,
max_blocks=1,
),
Expand Down
2 changes: 0 additions & 2 deletions coffea/processor/parsl/slurm_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import parsl
from parsl.providers import SlurmProvider
from parsl.channels import LocalChannel
from parsl.launchers import SrunLauncher
from parsl.config import Config
from parsl.executors import HighThroughputExecutor
Expand Down Expand Up @@ -56,7 +55,6 @@ def slurm_config(
address=address_by_hostname(),
prefetch_capacity=0,
provider=SlurmProvider(
channel=LocalChannel(),
launcher=SrunLauncher(),
init_blocks=initial_workers,
max_blocks=max_workers,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ python-requires = ">=3.8,<3.12"

[project.optional-dependencies]
spark = ["ipywidgets", "pyspark>=2.4.1,<3.0.0", "jinja2"]
parsl = ["parsl>=1.1"]
parsl = ["parsl>=2024.12.09"]
dask = [
"dask[dataframe]>=2.6.0",
"distributed>=2.6.0",
Expand Down
Binary file not shown.
4 changes: 4 additions & 0 deletions tests/test_jetmet_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def jetmet_evaluator():
"* * tests/samples/RegroupedV2_Fall17_17Nov2017_V32_MC_UncertaintySources_AK4PFchs.junc.txt.gz",
"* * tests/samples/Regrouped_Fall17_17Nov2017_V32_MC_UncertaintySources_AK4PFchs.junc.txt",
"* * tests/samples/Spring16_25nsV10_MC_PtResolution_AK4PFPuppi.jr.txt.gz",
"* * tests/samples/Summer23Prompt23_RunCv1234_JRV1_MC_PtResolution_AK4PFPuppi.jr.txt.gz",
"* * tests/samples/Spring16_25nsV10_MC_SF_AK4PFPuppi.jersf.txt.gz",
"* * tests/samples/Autumn18_V7_MC_SF_AK4PFchs.jersf.txt.gz",
]
Expand Down Expand Up @@ -206,6 +207,9 @@ def test_jet_resolution():
jer_names = ["Spring16_25nsV10_MC_PtResolution_AK4PFPuppi"]
reso = JetResolution(**{name: evaluator[name] for name in jer_names})

check2023_names = ["Summer23Prompt23_RunCv1234_JRV1_MC_PtResolution_AK4PFPuppi"]
_ = JetResolution(**{name: evaluator[name] for name in check2023_names})

print(reso)

resos = reso.getResolution(JetEta=test_eta, Rho=test_Rho, JetPt=test_pt)
Expand Down
2 changes: 0 additions & 2 deletions tests/test_parsl.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def test_parsl_htex_executor():

import parsl
from parsl.providers import LocalProvider
from parsl.channels import LocalChannel
from parsl.executors import HighThroughputExecutor
from parsl.config import Config

Expand All @@ -68,7 +67,6 @@ def test_parsl_htex_executor():
address="127.0.0.1",
cores_per_worker=max(multiprocessing.cpu_count() // 2, 1),
provider=LocalProvider(
channel=LocalChannel(),
init_blocks=1,
max_blocks=1,
nodes_per_block=1,
Expand Down

0 comments on commit d784451

Please sign in to comment.