 |
Interactive non-linear fit using HFit
Source code name: "fit_interactive.py"
Programming language: Python
Topic: Data fitting/hfitter
DMelt Version 1. Last modified: 12/08/2015. License: Pro
https://datamelt.org/code/cache/fit_interactive_6905.py
To run this script using the DMelt IDE,
copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.
from java.awt import Color
from java.util import Random
from jhplot import *
c1 = HPlot("Canvas",600,400,1, 1)
c1.setGTitle("Global labels: F_{2} , x_{γ} #bar{p}p F_{2}^{c#bar{c}}"); #put title
c1.visible(1)
c1.setAutoRange()
h1 = H1D("Simple1",20, -2.0, 2.0)
rand = Random()
# fill histogram
for i in range(100):
h1.fill(rand.nextGaussian())
c1.draw(h1)
# fit interactively this histogram
# pass objects and names (for code generation)
a=HFit(c1,"c1",h1,"h1")
# add a user function if you want to
a.addFunc("User1", "Tooltip", "a*x[0]+b","a,b")
#
# after you did the fit, press "generate source".
# JAIDA source code will be appended in this file
You see the box below because you did not login.