Skip to content

Commit

Permalink
Merge branch 'master' into fix-metric-table-and-nearest
Browse files Browse the repository at this point in the history
  • Loading branch information
lgray authored Nov 30, 2023
2 parents 2d1e8de + 4080344 commit 5ce4ebd
Show file tree
Hide file tree
Showing 13 changed files with 498 additions and 295 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Set up JDK ${{ matrix.java-distribution }}/${{ matrix.java-version }}
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java-version }}
distribution: ${{ matrix.java-distribution }}
Expand Down Expand Up @@ -137,7 +137,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Conda
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
with:
Expand All @@ -160,7 +160,7 @@ jobs:
# name: test coffea-skyhook-job
#
# steps:
# - uses: actions/checkout@3.2.0
# - uses: actions/checkout@3
# - name: Test Coffea Skyhook Bindings
# shell: bash -l {0}
# run: |
Expand Down Expand Up @@ -195,7 +195,7 @@ jobs:
python -m pip install pip hatch --upgrade
python -m hatch build -t sdist -t wheel
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@v1.8.10
uses: pypa/gh-action-pypi-publish@v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ jobs:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5.4.0
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ci:

repos:
- repo: https://github.com/psf/black
rev: 23.10.1
rev: 23.11.0
hooks:
- id: black

Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ classifiers = [
"Topic :: Utilities",
]
dependencies = [
"awkward>=2.4.8",
"awkward>=2.5.0",
"uproot>=5.1.2",
"dask[array]>=2023.4.0",
"dask-awkward>=2023.11.0",
"dask-awkward>=2023.11.4",
"dask-histogram>=2023.10.0",
"correctionlib>=2.3.3",
"pyarrow>=6.0.0",
Expand Down
6 changes: 3 additions & 3 deletions src/coffea/jetmet_tools/CorrectedJetsFactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import numpy

_stack_parts = ["jec", "junc", "jer", "jersf"]
_MIN_JET_ENERGY = numpy.array(1e-2, dtype=numpy.float32)
_ONE_F32 = numpy.array(1.0, dtype=numpy.float32)
_ZERO_F32 = numpy.array(0.0, dtype=numpy.float32)
_MIN_JET_ENERGY = numpy.float32(1e-2)
_ONE_F32 = numpy.float32(1.0)
_ZERO_F32 = numpy.float32(0.0)
_JERSF_FORM = {
"class": "NumpyArray",
"inner_shape": [3],
Expand Down
11 changes: 9 additions & 2 deletions src/coffea/lumi_tools/lumi_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,16 @@ class LumiData:
brilcalc lumi -c /cvmfs/cms.cern.ch/SITECONF/local/JobConfig/site-local-config.xml \
-b "STABLE BEAMS" --normtag=/cvmfs/cms-bril.cern.ch/cms-lumi-pog/Normtags/normtag_PHYSICS.json \
-u /pb --byls --output-style csv -i Cert_294927-306462_13TeV_PromptReco_Collisions17_JSON.txt > lumi2017.csv
Note that some brilcalc files may be in different units than inverse picobarns, including possibly average instantaneous luminosity.
You should make sure that you understand the units of the LumiData file you are using before calculating luminosity with this tool.
If you are using a LumiData file containing avg. inst. luminosity, make sure to set is_inst_lumi=True in the constructor of this class.
"""

def __init__(self, lumi_csv):
seconds_per_lumi_LHC = 2**18 / (40079000 / 3564)

def __init__(self, lumi_csv, is_inst_lumi=False):
self._is_inst_lumi = is_inst_lumi
self._lumidata = np.loadtxt(
lumi_csv,
delimiter=",",
Expand Down Expand Up @@ -58,7 +65,7 @@ def get_lumi(self, runlumis):
runlumis = runlumis.array
tot_lumi = np.zeros((1,), dtype=np.dtype("float64"))
LumiData._get_lumi_kernel(runlumis[:, 0], runlumis[:, 1], self.index, tot_lumi)
return tot_lumi[0]
return tot_lumi[0] * (self.seconds_per_lumi_LHC if self._is_inst_lumi else 1.0)

@staticmethod
@numba.njit(parallel=False, fastmath=False)
Expand Down
5 changes: 2 additions & 3 deletions src/coffea/nanoevents/methods/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,11 @@ class NanoEvents(Systematic):
This mixin class is used as the top-level type for NanoEvents objects.
"""

def get_metadata(self, _dask_array_=None):
@dask_awkward.dask_property(no_dispatch=True)
def metadata(self):
"""Arbitrary metadata"""
return self.layout.purelist_parameter("metadata")

metadata = property(get_metadata)


behavior[("__typestr__", "NanoEvents")] = "event"

Expand Down
Loading

0 comments on commit 5ce4ebd

Please sign in to comment.