Skip to content

Commit

Permalink
Merge branch 'main' into init-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Saransh-cpp authored Aug 6, 2024
2 parents 14af361 + fabeebd commit e1270fb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ repos:
args: [--prose-wrap=always]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.5.4"
rev: "v0.5.6"
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
Expand Down Expand Up @@ -80,7 +80,7 @@ repos:
additional_dependencies: ["validate-pyproject-schema-store[all]"]

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: "0.29.0"
rev: "0.29.1"
hooks:
- id: check-dependabot
- id: check-github-workflows
Expand Down
26 changes: 14 additions & 12 deletions tests/test_hist_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def test_hist():

h_regular_bins = cuda_histogram.Hist(
"regular joe",
cuda_histogram.Bin("x", "x", 20, 0, 200),
cuda_histogram.Bin("y", "why", 20, -3, 3),
cuda_histogram.axis.Bin("x", "x", 20, 0, 200),
cuda_histogram.axis.Bin("y", "why", 20, -3, 3),
)
h_regular_bins.fill(x=test_pt, y=test_eta)
nentries = np.sum(counts)
Expand All @@ -62,8 +62,8 @@ def test_hist():
assert h_reduced.integrate("x", slice(20, 30)).values()[()][2] == count_some_bin + 1
assert h_reduced.integrate("y", slice(0, 0.3)).values()[()][1] == count_some_bin + 1

animal = cuda_histogram.Cat("animal", "type of animal")
vocalization = cuda_histogram.Cat(
animal = cuda_histogram.axis.Cat("animal", "type of animal")
vocalization = cuda_histogram.axis.Cat(
"vocalization", "onomatopoiea is that how you spell it?"
)
h_cat_bins = cuda_histogram.Hist("I like cats", animal, vocalization)
Expand All @@ -79,14 +79,14 @@ def test_hist():
("dog",)
] == (101.0, 10001.0)

height = cuda_histogram.Bin("height", "height [m]", 10, 0, 5)
height = cuda_histogram.axis.Bin("height", "height [m]", 10, 0, 5)
h_mascots_1 = cuda_histogram.Hist(
"fermi mascot showdown",
animal,
vocalization,
height,
# weight is a reserved keyword
cuda_histogram.Bin(
cuda_histogram.axis.Bin(
"mass", "weight (g=9.81m/s**2) [kg]", np.power(10.0, np.arange(5) - 1)
),
)
Expand All @@ -98,7 +98,7 @@ def test_hist():
vocalization,
height,
# weight is a reserved keyword
cuda_histogram.Bin(
cuda_histogram.axis.Bin(
"mass", "weight (g=9.81m/s**2) [kg]", np.power(10.0, np.arange(5) - 1)
),
),
Expand All @@ -110,7 +110,7 @@ def test_hist():
vocalization,
height,
# weight is a reserved keyword
cuda_histogram.Bin(
cuda_histogram.axis.Bin(
"mass", "weight (g=9.81m/s**2) [kg]", np.power(10.0, np.arange(5) - 1)
),
],
Expand All @@ -124,15 +124,15 @@ def test_hist():
vocalization,
height,
# weight is a reserved keyword
cuda_histogram.Bin(
cuda_histogram.axis.Bin(
"mass", "weight (g=9.81m/s**2) [kg]", np.power(10.0, np.arange(5) - 1)
),
axes=[
animal,
vocalization,
height,
# weight is a reserved keyword
cuda_histogram.Bin(
cuda_histogram.axis.Bin(
"mass",
"weight (g=9.81m/s**2) [kg]",
np.power(10.0, np.arange(5) - 1),
Expand Down Expand Up @@ -187,7 +187,7 @@ def test_hist():
== 1040.0
)

species_class = cuda_histogram.Cat(
species_class = cuda_histogram.axis.Cat(
"species_class", "where the subphylum is vertibrates"
)
classes = {
Expand Down Expand Up @@ -223,7 +223,9 @@ def test_hist():
assert h_species.axis("height") is height
assert h_species.integrate("vocalization", "h*").axis("height") is height

tall_class = cuda_histogram.Cat("tall_class", "species class (species above 1m)")
tall_class = cuda_histogram.axis.Cat(
"tall_class", "species class (species above 1m)"
)
mapping = {
"birds": (["goose", "crane"], slice(1.0, None)),
"mammals": (["bison", "fox"], slice(1.0, None)),
Expand Down

0 comments on commit e1270fb

Please sign in to comment.