FHist

A pure Julia 1/2/3D histogram package that focus on speed and is thread-safe.

https://github.com/moelf/fhist.jl

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (9.9%) to scientific vocabulary

Keywords

hep histogram julia julialang

Keywords from Contributors

particle high-energy-physics particle-physics hack standardization interpretability meshing root-cern root cern
Last synced: 6 months ago · JSON representation ·

Repository

A pure Julia 1/2/3D histogram package that focus on speed and is thread-safe.

Basic Info
Statistics
  • Stars: 55
  • Watchers: 4
  • Forks: 12
  • Open Issues: 10
  • Releases: 52
Topics
hep histogram julia julialang
Created about 5 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog License Citation

README.md

FHist.jl

Dev CICodecov

Fast, error-aware, and thread-safe 1D/2D/3D histograms that are also compatible with StatsBase.Histogram

Changelog

  • 0.11
    • Breaking change to the main constructor API, now the API is sanely divided into "constructor for empty histogram" and "make histogram given data". See documentation.
  • 0.10
    • due to huge latency issue, UnicodePlots.jl (for text based terminal display) has been dropped.

Quick Start

```julia julia> using FHist

julia> a = randn(1000);

julia> h1 = Hist1D(a; binedges = -4:1.0:4) edges: -4.0:1.0:4.0 bin counts: [0, 23, 123, 377, 320, 134, 21, 2] total count: 1000

julia> h2 = Hist1D(; counttype = Int, binedges = -4.0:1.0:4.0);

julia> push!.(h2, a);

julia> Threads.@threads for v in a atomic_push!(h2, v) # thread-safe end

julia> h1+h1 == h2 true ```

Additionally, one can specify overflow=true when creating a histogram to clamp out-of-bounds values into the edge bins. julia julia> Hist1D(rand(1000); binedges = 0:0.2:0.9, overflow=true) edges: 0.0:0.2:0.8 bin counts: [218, 183, 198, 401] total count: 1000

Speed

Single-threaded filling happens at ~1 GHz on modern CPU (Ryzen 7 7840HS) ```julia julia> a = randn(10^6);

julia> @benchmark Hist1D(a; binedges = -3:0.01:3) BenchmarkTools.Trial: 4624 samples with 1 evaluation. Range (min … max): 1.049 ms … 2.035 ms ┊ GC (min … max): 0.00% … 0.00% ```

Features

1D

```julia julia> using FHist, Statistics

julia> h1 = Hist1D(randn(10^4).+2; binedges = -5:0.5:5);

julia> h1 = (h1 + h1*2) edges: -5.0:0.5:5.0 bin counts: [0, 0, 0, 0, 0, 3, 3, 39, 153, 540, 1356, 2640, 4551, 5757, 5727, 4494, 2652, 1326, 546, 168] total count: 29955

julia> bincenters(h1) -4.75:0.5:4.75

julia> println(bincounts(h1)) [0, 0, 0, 0, 0, 3, 3, 39, 153, 540, 1356, 2640, 4551, 5757, 5727, 4494, 2652, 1326, 546, 168]

julia> println(h1.sumw2); [0.0, 0.0, 0.0, 0.0, 0.0, 5.0, 5.0, 65.0, 255.0, 900.0, 2260.0, 4400.0, 7585.0, 9595.0, 9545.0, 7490.0, 4420.0, 2210.0, 910.0, 280.0]

julia> nbins(h1), integral(h1) (20, 29955)

julia> mean(h1), std(h1) (1.993865798698047, 1.0126978885814524)

julia> median(h1), quantile(h1, 0.5) (1.7445284002084418, 1.7445284002084418)

julia> lookup.(h1, [-1.5,0,2.5]) # find bin counts for given x-axis values 3-element Vector{Int64}: 39 1356 4494

julia> Hist1D(sample(h1; n=100)) edges: -1.0:1.0:5.0 bin counts: [4, 15, 41, 28, 10, 2] total count: 100

julia> h1 |> normalize |> integral 1.0 ```

2D

```julia julia> h2 = Hist2D((randn(10^4),randn(10^4)); binedges = (-5:5,-5:5))

edges: (-5:5, -5:5) bin counts: [0 0 … 0 0; 0 0 … 0 0; … ; 0 0 … 0 0; 0 0 … 0 0] total count: 10000

julia> nbins(h2) (10, 10)

julia> project(h2, :x) edges: -5:5 bin counts: [0, 14, 228, 1345, 3399, 3462, 1300, 237, 15, 0] total count: 10000

julia> h2 |> profile(:x) # or pipe

edges: -5:5 bin counts: [0.0, -0.21428571428571427, 0.0, 0.03382899628252788, 0.0025007355104442485, 0.012709416522241479, 0.018461538461538463, 0.035864978902953586, 0.1, 0.0] total count: -0.010920048606008592

julia> h2 |> rebin(10,5)

edges: (-5.0:10.0:5.0, -5.0:5.0:5.0) bin counts: [4953 5047] total count: 10000 ```

3D

```julia julia> h3 = Hist3D((randn(10^4),randn(10^4),randn(10^4)); binedges = (-5:5,-5:5,-5:5)) Hist3D{Int64}, edges=(-5:5, -5:5, -5:5), integral=10000

julia> h3 |> project(:x) |> project(:x) |> std 1.051590599996025 ```

Owner

  • Name: Jerry Ling
  • Login: Moelf
  • Kind: user
  • Location: Cambridge, MA

HEP-ex PhD student @ Harvard LPPC; @JuliaHEP

Citation (CITATION.cff)

cff-version: 1.2.0
message: "Cite this paper whenever FHist.jl played an important role in your research"
authors:
- family-names: "Ling"
  given-names: "Jerry"
  orcid: "https://orcid.org/0000-0002-3359-0380"
- family-names: "Amin"
  given-names: "Nick"
  orcid: "https://orcid.org/0000-0003-2560-0013"
title: "FHist.jl: Fast and featureful histogram in pure Julia"
version: "v0.10"
license: "MIT"
doi: "10.5281/zenodo.10091098"
date-released: 2023-02-22
url: "https://github.com/Moelf/FHist.jl/"

GitHub Events

Total
  • Fork event: 3
  • Create event: 33
  • Commit comment event: 19
  • Release event: 6
  • Issues event: 15
  • Watch event: 10
  • Delete event: 14
  • Member event: 1
  • Issue comment event: 96
  • Push event: 131
  • Pull request review event: 3
  • Pull request review comment event: 5
  • Pull request event: 61
Last Year
  • Fork event: 3
  • Create event: 33
  • Commit comment event: 19
  • Release event: 6
  • Issues event: 15
  • Watch event: 10
  • Delete event: 14
  • Member event: 1
  • Issue comment event: 96
  • Push event: 131
  • Pull request review event: 3
  • Pull request review comment event: 5
  • Pull request event: 61

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 177
  • Total Committers: 12
  • Avg Commits per committer: 14.75
  • Development Distribution Score (DDS): 0.333
Past Year
  • Commits: 21
  • Committers: 4
  • Avg Commits per committer: 5.25
  • Development Distribution Score (DDS): 0.429
Top Committers
Name Email Commits
Jerry Ling p****n@j****v 118
Nick Amin a****j@g****m 28
github-actions[bot] 4****] 13
Tamas Gal h****f@t****m 7
jjgomezcadenas j****s 2
Beforerr 5****r 2
Anshul Singhvi a****i@g****m 2
mivanovska007 9****7 1
Stefano Fanchellucci 9****l 1
Rafael Jacobsen 7****n 1
Francesco Alemanno 5****o 1
Bo Johnson b****5@i****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 46
  • Total pull requests: 152
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 28 days
  • Total issue authors: 19
  • Total pull request authors: 15
  • Average comments per issue: 4.48
  • Average comments per pull request: 2.27
  • Merged pull requests: 118
  • Bot issues: 0
  • Bot pull requests: 36
Past Year
  • Issues: 14
  • Pull requests: 63
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 10 days
  • Issue authors: 7
  • Pull request authors: 6
  • Average comments per issue: 1.79
  • Average comments per pull request: 1.63
  • Merged pull requests: 42
  • Bot issues: 0
  • Bot pull requests: 27
Top Authors
Issue Authors
  • aminnj (10)
  • Moelf (7)
  • sgnoohc (6)
  • mmikhasenko (4)
  • alanedelman (3)
  • Beforerr (2)
  • jjgomezcadenas (2)
  • peremato (2)
  • tamasgal (2)
  • JuliaTagBot (1)
  • FredHucht (1)
  • nicolamos (1)
  • mtagliazucchi (1)
  • YabusameHoulen (1)
  • mivanovska007 (1)
Pull Request Authors
  • Moelf (57)
  • aminnj (33)
  • github-actions[bot] (31)
  • tamasgal (10)
  • asinghvi17 (8)
  • dependabot[bot] (7)
  • mmikhasenko (6)
  • Beforerr (3)
  • sfranchel (3)
  • bojohnson5 (2)
  • VaiTon (2)
  • jjgomezcadenas (1)
  • mivanovska007 (1)
  • francescoalemanno (1)
  • rafaeljacobsen (1)
Top Labels
Issue Labels
enhancement (1) good first issue (1) bug (1) documentation (1) question (1)
Pull Request Labels
dependencies (7) github_actions (7)

Packages

  • Total packages: 1
  • Total downloads:
    • julia 132 total
  • Total dependent packages: 2
  • Total dependent repositories: 0
  • Total versions: 51
juliahub.com: FHist

A pure Julia 1/2/3D histogram package that focus on speed and is thread-safe.

  • Versions: 51
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 132 Total
Rankings
Dependent repos count: 9.9%
Forks count: 19.4%
Stargazers count: 22.0%
Average: 22.6%
Dependent packages count: 38.9%
Last synced: 6 months ago

Dependencies

.github/workflows/TagBot.yml actions
  • JuliaRegistries/TagBot v1 composite
.github/workflows/ci.yml actions
  • actions/checkout v2 composite
  • codecov/codecov-action v1 composite
  • julia-actions/cache v1 composite
  • julia-actions/julia-buildpkg v1 composite
  • julia-actions/julia-processcoverage v1 composite
  • julia-actions/julia-runtest v1 composite
  • julia-actions/setup-julia v1 composite
.github/workflows/CompatHelper.yml actions