Startup
This commit is contained in:
18
script/CPython/ext.py
Normal file
18
script/CPython/ext.py
Normal file
@@ -0,0 +1,18 @@
|
||||
import numpy as np
|
||||
|
||||
|
||||
def ext(x, y):
|
||||
"""
|
||||
Return extremum coordinates of quadratic fit
|
||||
"""
|
||||
p = np.polyfit(x, y, 2)
|
||||
f = np.poly1d(p)
|
||||
x_fit = 1.0 #np.linspace(min(x), max(x), 100)
|
||||
#y_fit = 2.0 #f(x_fit)
|
||||
if p[0] != 0:
|
||||
x_ext = -p[1]/2/p[0]
|
||||
y_ext = f(x_ext)
|
||||
else:
|
||||
x_ext = None
|
||||
y_ext = None
|
||||
return (x_ext, y_ext, x_ext)
|
||||
@@ -2,9 +2,14 @@ from jeputils import *
|
||||
|
||||
def hfitoff(data, xdeg):
|
||||
ret = call_jep("CPython/hfitoff", "hfitoff", [to_npa(data),to_npa(xdeg)])
|
||||
print ret
|
||||
return (ret[0], ret[1], ret[2],ret[3], ret[4].data,ret[5].data)
|
||||
return (ret[0], ret[1], ret[2],ret[3], ret[4].data, ret[5].data)
|
||||
|
||||
def ext(x, y):
|
||||
ret = call_jep("CPython/ext", "ext", [to_npa(x),to_npa(y)])
|
||||
#return (ret[0], ret[1], ret[2].data, ret[3].data)
|
||||
return (ret[0], ret[1], ret[2])
|
||||
|
||||
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])
|
||||
return ret if ret is None or is_list(ret) else ret.data
|
||||
return ret if ret is None or is_list(ret) else ret.data
|
||||
|
||||
Reference in New Issue
Block a user