How to use the pyroofit.models.Chebychev function in pyroofit

To help you get started, we’ve selected a few pyroofit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github simonUU / PyrooFit / tests / test_composites.py View on Github external
def test_AddPdf_fit():
    import ROOT
    df = get_test_df()
    assert isinstance(df, pd.DataFrame)
    bkg = Chebychev(('mbc', 0, 1))
    sig = Gauss(('mbc', 0, 1))

    pdf = sig+bkg

    pdf.fit(df)
    #pdf.plot('test2.pdf')

    assert isinstance(pdf, AddPdf)
    assert isinstance(pdf.roo_pdf, ROOT.RooAbsPdf)
github simonUU / PyrooFit / tests / test_models.py View on Github external
def test_Chebychev():
    import ROOT
    df = get_test_df()
    assert isinstance(df, pd.DataFrame)
    pdf = Chebychev(('mbc', 0, 1))
    pdf.fix(True)
    #pdf.fit(df)
    #pdf.plot('test.pdf')
    pdf.observables.mbc # test that mbc is available by attribute lookup
    assert isinstance(pdf.roo_pdf, ROOT.RooChebychev)
github simonUU / PyrooFit / tests / test_composites.py View on Github external
def test_AddPdf():
    import ROOT
    df = get_test_df()
    assert isinstance(df, pd.DataFrame)
    bkg = Chebychev(('mbc', 0, 1))
    sig = Gauss(('mbc', 0, 1))

    pdf = sig+bkg

    #pdf.fit(df)
    #pdf.plot('test2.pdf')

    assert isinstance(pdf, AddPdf)
    assert isinstance(pdf.roo_pdf, ROOT.RooAbsPdf)
github simonUU / PyrooFit / tests / test_pdf.py View on Github external
def test_PDF_init_RooRealVar():
    import ROOT
    x = ROOT.RooRealVar('mbc', '', 0, 0, 1)
    pdf = Chebychev(x)
    assert isinstance(pdf.roo_pdf, ROOT.RooAbsPdf)
github simonUU / PyrooFit / tests / test_pdf.py View on Github external
def test_PDF_init_list():
    import ROOT
    pdf = Chebychev(['mbc', 0, 1])
    assert isinstance(pdf.roo_pdf, ROOT.RooAbsPdf)
github simonUU / PyrooFit / tests / test_composites.py View on Github external
def test_ProdPdf():
    import ROOT
    df = get_test_df()
    assert isinstance(df, pd.DataFrame)

    bkg = Chebychev(('mbc', 0, 1))
    sig = Gauss(('mbc', 0, 1))

    pdf = sig*bkg

    assert isinstance(pdf, ProdPdf)
    assert isinstance(pdf.roo_pdf, ROOT.RooAbsPdf)
github simonUU / PyrooFit / tests / test_pdf.py View on Github external
def test_PDF_Chebychev():
    import ROOT
    x = ROOT.RooRealVar('mbc', '', 0, 0, 1)
    pdf = Chebychev(x, n=10)
    assert isinstance(pdf.roo_pdf, ROOT.RooAbsPdf)
github simonUU / PyrooFit / tests / test_composites.py View on Github external
def test_Convolution():
    import ROOT
    df = get_test_df()
    assert isinstance(df, pd.DataFrame)
    bkg = Chebychev(('mbc', 0, 1))
    sig = Gauss(('mbc', 0, 1))

    pdf = Convolution(bkg, sig)

    assert isinstance(pdf, Convolution)
    assert isinstance(pdf.roo_pdf, ROOT.RooAbsPdf)
github simonUU / PyrooFit / examples / signal_and_background.py View on Github external
"""

from pyroofit.models import Gauss, Chebychev
import numpy as np
import pandas as pd
import ROOT


df = {'mass': np.append(np.random.random_sample(1000)*10 + 745, np.random.normal(750, 1, 1000))}
df = pd.DataFrame(df)

x = ROOT.RooRealVar('mass', 'M', 750, 745, 755, 'GeV')  # or x = ('mass', 745, 755)

pdf_sig = Gauss(x, mean=(745, 755), sigma=(0.1, 1, 2), title="Signal")
pdf_bkg = Chebychev(x, n=1, title="Background")

pdf = pdf_sig + pdf_bkg

pdf.fit(df)
pdf.plot('signal_and_background.pdf', legend=True)
pdf.get()
github simonUU / PyrooFit / examples / simultaneous_fit.py View on Github external
from pyroofit.composites import SimFit
import numpy as np
import pandas as pd
import ROOT


df_mixed = {'mass': np.append(np.random.random_sample(1000)*7 - 3.5, np.random.normal(0, 0.5, 1000))}
df_mixed = pd.DataFrame(df_mixed)

df_bkg = {'mass': np.random.random_sample(2000)*7 - 3.5}
df_bkg = pd.DataFrame(df_bkg)

x = ROOT.RooRealVar('mass', 'M', 0, -3, 3, 'GeV')

pdf_sig = Gauss(x, mean=(-1, 1))
pdf_bkg = Chebychev(x, n=1)

pdf = pdf_sig + pdf_bkg

sf = SimFit(pdf, pdf_bkg)
sf.use_extended = True  # bug
sf.use_minos = True
sf.fit([(pdf, df_mixed), (pdf_bkg, df_bkg)])

#pdf_bkg.plot('simultaneous_fit_bkg.pdf', df_bkg)
pdf.plot('simultaneous_fit.pdf',
         df_mixed,
         nbins=20,
         extra_info=[["Legend"], ["More Legend"], ['#mu', *pdf_sig.get('mean')], ['#sigma', *pdf_sig.get('sigma')]])
pdf.get()

pyroofit

Python wrapper for RooFit to create fits easily with pandas DataFrames.

MIT
Latest version published 4 years ago

Package Health Score

39 / 100
Full package analysis

Similar packages