This commit is contained in:
sfop
2016-07-05 11:28:23 +02:00
parent 04f3985742
commit 396d0410b3
2 changed files with 31 additions and 2 deletions
+29
View File
@@ -0,0 +1,29 @@
from mathutils import *
from plotutils import *
x = [ 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0,18.0]
y = [ 30.0, 22.0, 12.0, 10.0, 11.0, 14.0, 21.0, 32.0]
v = [ 0.3, 0.8, 0.4, 0.3, 0.5, 0.4, 0.3, 0.2]
w = [ 1/ max(i,0.1) for i in v]
p=plot(None)[0]
p.setStyle(p.Style.ErrorY)
p.setLegendVisible(True)
s1 = LinePlotErrorSeries("Observed Data")
p.addSeries(s1)
for i in range(len(x)):\
s1.appendData(x[i], y[i], v[i])
pars_polynomial= fit_polynomial(y, x, 2, None, w)
function = PolynomialFunction(pars_polynomial)
plot_function(p, function, "Fit" , frange (min(x), max(x), 0.1), False)
print "(a0,a1,a2) = " , pars_polynomial
for xp in x:
print xp, poly(xp, pars_polynomial)
+2 -2
View File
@@ -1,7 +1,7 @@
import ch.psi.pshell.epics.ControlledVariable as ControlledVariable
#if get_context().source != CommandSource.ui:
# prefix = args[0] + "-RSYS"
if get_context().source != CommandSource.ui:
prefix = args[0] + "-RSYS"
start = caget(prefix + ":SET-SCAN-START")
stop = caget(prefix + ":SET-SCAN-STOP")