jar_project/gain_fit.py
2020-09-10 17:38:04 +02:00

49 lines
1.3 KiB
Python

from scipy import signal
import matplotlib.pyplot as plt
import numpy as np
import pylab
from IPython import embed
from scipy.optimize import curve_fit
from jar_functions import gain_curve_fit
identifier = ['2018lepto1',
'2018lepto4',
'2018lepto5',
'2018lepto76',
'2018lepto98',
'2019lepto03',
'2019lepto24',
'2019lepto27',
'2019lepto30',
'2020lepto04',
'2020lepto06',
'2020lepto16',
'2020lepto19',
'2020lepto20'
]
tau = []
f_c = []
for ID in identifier:
print(ID)
amf = np.load('amf_%s.npy' %ID)
gain = np.load('gain_%s.npy' %ID)
sinv, sinc = curve_fit(gain_curve_fit, amf, gain)
print('tau:', sinv[0])
tau.append(sinv[0])
f_cutoff = 1 / (2*np.pi*sinv[0])
print('f_cutoff:', f_cutoff)
f_c.append(f_cutoff)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(amf, gain, 'o')
amff = np.logspace(-3, 0, 200)
ax.plot(amff, gain_curve_fit(amff, *sinv))
ax.set_yscale('log')
ax.set_xscale('log')
plt.show()
#welche zeitkonstante ist das? was ist mit der zweiten? --> eher zweite zeitkonstante obwohl werte so klein?