Commit 9035bbd2 authored by Max Capelle's avatar Max Capelle

deleted offset in test function: solved runtime en optimize error

parent b962767a
......@@ -46,10 +46,10 @@ def chi(A,x):
# return
return chi
def test_func(x, a, b, c):
def test_func(x, a, b):
"""
exponential function to fit chi
last modified: 19/03/2019
last modified: 26/03/2019
input:
x: x_data
......@@ -58,20 +58,18 @@ def test_func(x, a, b, c):
(float)
b: tau
(float)
c: offset
(float)
output:
a*np.exp(-x/b)+c: function
(1,N) array
"""
return a*np.exp(-x/b)+c
return a*np.exp(-x/b)
def tau(y_data):
"""
function to find correlation time of the simulation (tau) by fitting chi to exponential test function
last modified: 19/03/2019
last modified: 26/03/2019
input:
y_data: data to which function is fitted
......@@ -85,7 +83,7 @@ def tau(y_data):
x_data = np.array(range(len(y_data)))
# fit and determine tau
[amplitude, tau, offset], params_covariance = optimize.curve_fit(test_func, x_data,y_data)
[amplitude, tau], params_covariance = optimize.curve_fit(test_func, x_data,y_data)
# return
return tau
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment