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
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.6%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

Basic Info
Statistics
  • Stars: 2
  • Watchers: 1
  • Forks: 2
  • Open Issues: 1
  • Releases: 0
Created 11 months ago · Last pushed 7 months ago
Metadata Files
Readme License Citation

README.md

BinnedDistributionFit

Build Status

[Work In Progress]

Everything is subject to change, including type names and type hierarchy.

The Scope of this Package

We try to cover a core set of usages common in HEP, namely, fitting one or multiple distributions to binned data, using Chi2 or Likelihood objective.

Conceptually, given user defined function ("shape"), we can treat it as if it's a PDF by numerically normalizing it at every evaluating point. We then package that with a user defined histogram using the FHist package which can be used with an optimization or plotting package.

Quick Start

The following code provides a framework for optimizing a single function with any number of parameters. The guess must be relatively close to the real parameters. ```julia using BinnedDistributionFit, FHist, Optimization, ForwardDiff, ComponentArrays

function fitpdfto_hist(hist::Hist1D, pdf, guess::Vector) support = extrema(binedges(hist))

NLL = LikelihoodSpec(ExtendPdf(pdf, support), hist)

opt_f = OptimizationFunction(NLL, AutoForwardDiff())
opt_p = OptimizationProblem(opt_f, ComponentArray(norms = integral(hist), p1 = guess))
sol = solve(opt_p, Optimization.LBFGS())

return sol.u

end

Example

hist = Hist1D(; binedges=1:2:21, bincounts=[1:4; 1; 6:10]) pdf_input(x, ps) = ps[1]*x + ps[2] guess = [5, 5]

fitpdftohist(hist, pdfinput, guess)

output

ComponentVector{Float64}(norms = 51.0, p1 = [6.975319732308675, -0.8718290560996027]) ```

Math for One PDF fitting to Data: (i.e. ExtendPdf)

For main.py and main.jl (just the ExtendPdf)

if you change the observed bincounts from [2.0, 4.0] to [4.0, 8.0], the NLL becomes 1.3655798792934464

If on top of that, you also change p0 from 2.0 to 4.0, you get NLL -4.952186287425897

image

Math for sum of two PDFs fitting to data: (i.e. SUM:: in RooFit)

image

Owner

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

HEP-ex PhD student @ Harvard LPPC; @JuliaHEP

Citation (CITATION.cff)

# Go to https://citation-file-format.github.io/cff-initializer-javascript/#/ to finish this
cff-version: 1.2.0
title: BinnedDistributionFit.jl
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: Moelf
    email: proton@jling.dev

GitHub Events

Total
  • Watch event: 2
  • Delete event: 4
  • Issue comment event: 7
  • Push event: 80
  • Pull request review comment event: 3
  • Pull request review event: 5
  • Pull request event: 13
  • Fork event: 2
  • Create event: 11
Last Year
  • Watch event: 2
  • Delete event: 4
  • Issue comment event: 7
  • Push event: 80
  • Pull request review comment event: 3
  • Pull request review event: 5
  • Pull request event: 13
  • Fork event: 2
  • Create event: 11

Dependencies

.github/workflows/CI.yml actions
  • actions/checkout v4 composite
  • julia-actions/cache v2 composite
  • julia-actions/julia-buildpkg v1 composite
  • julia-actions/julia-runtest v1 composite
  • julia-actions/setup-julia v2 composite
.github/workflows/CompatHelper.yml actions
.github/workflows/TagBot.yml actions
  • JuliaRegistries/TagBot v1 composite
.github/workflows/Docs.yml actions
  • actions/checkout v4 composite
  • julia-actions/cache v2 composite
  • julia-actions/setup-julia v2 composite
.github/workflows/ReusableTest.yml actions
  • actions/checkout v4 composite
  • codecov/codecov-action v4 composite
  • julia-actions/cache v2 composite
  • julia-actions/julia-buildpkg v1 composite
  • julia-actions/julia-processcoverage v1 composite
  • julia-actions/julia-runtest v1 composite
  • julia-actions/setup-julia v2 composite
.github/workflows/Test.yml actions
.github/workflows/TestOnPRs.yml actions