Closedown

This commit is contained in:
gobbo_a
2017-09-05 14:16:03 +02:00
parent 00003869e0
commit 0c1d63ae9a
9 changed files with 38 additions and 278 deletions

View File

@@ -5,14 +5,16 @@ def extremum(x, y):
"""
Return extremum coordinates of quadratic fit
"""
p = np.polyfit(x, y, 2)
pf = np.polyfit(x, y, 2, full=True)
p = pf[0]
res = pf[1][0]
f = np.poly1d(p)
if p[0] != 0:
x_ext = -p[1]/2/p[0]
x_ext = -p[1] / (2 * p[0])
y_ext = f(x_ext)
else:
x_ext = None
y_ext = None
x_fit = np.linspace(min(x), max(x), 100)
y_fit = f(x_fit)
return (x_ext, y_ext, x_fit, y_fit)
return (x_ext, y_ext, x_fit, y_fit, res)

View File

@@ -6,7 +6,7 @@ def hfitoff(data, xdeg):
def extremum(x, y):
ret = call_jep("CPython/extremum", "extremum", [to_npa(x),to_npa(y)])
return (ret[0], ret[1], ret[2].data, ret[3].data)
return (ret[0], ret[1], ret[2].data, ret[3].data, ret[4])
def gfitoff(x, y, off=None, amp=None, com=None, sigma=None):
ret = call_jep("CPython/gfitoff", "gfitoff", [to_npa(x), to_npa(y), off, amp, com, sigma])