Skip to content

Commit b49a826

Browse files
authored
Keep nentries of first histogram after division (#154)
* Keep nentries of first histogram after division * bump version
1 parent e3758e6 commit b49a826

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "FHist"
22
uuid = "68837c9b-b678-4cd5-9925-8a54edc8f695"
33
authors = ["Moelf <proton[at]jling.dev>", "Nick Amin <amin.nj[at]gmail.com>"]
4-
version = "0.11.12"
4+
version = "0.11.13"
55

66
[deps]
77
BayesHistogram = "000d9b38-65fe-4c81-bdb9-69f01f102479"

src/arithmatics.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ for T in (:Hist1D,:Hist2D,:Hist3D)
3434
_sumw2 = sumw2(h1) ./ (counts2 .^ 2) .+
3535
(sqrt.(sumw2(h2)) .* counts1 ./ (counts2 .^ 2)) .^ 2
3636

37-
($T)(bincounts = newcounts, binedges = edge1, sumw2 = _sumw2, nentries = nentries(h1) ÷ nentries(h2); overflow=h1.overflow)
37+
($T)(bincounts = newcounts, binedges = edge1, sumw2 = _sumw2, nentries = nentries(h1); overflow=h1.overflow)
3838
end
3939

4040
@eval function merge!(h1::$T, h2::$T)

test/runtests.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,10 +364,12 @@ end
364364
h = h1 / h2
365365
@test bincounts(h) == [1.0, 2.0, 0.5]
366366
@test sumw2(h) == [2.0, 6.0, 0.375]
367+
@test nentries(h) == nentries(h1)
367368

368369
h = h1 * 2
369370
@test bincounts(h) == [2.0, 4.0, 2.0]
370371
@test sumw2(h) == [4.0, 8.0, 4.0]
372+
@test nentries(h) == nentries(h1)
371373

372374
h = h1/(h1+h2*2)
373375
@test bincounts(h) [0.333333, 0.5, 0.2] atol=1e-6

0 commit comments

Comments
 (0)