fpath = "C:\\Users\\LiquidSpot\\PycharmProjects\\CGDA\Blatt 5\\signal.csv"

t = PhyPraKit.readCSV(fpath)
#print(t)
#Datenformat: Comma seperated values(CSV)
#Datenformat t = Liste von listen

#Numpy list for time and amplitude
time = np.zeros(10000);
amplitude = np.zeros(10000);

time = t[1][0]
amplitude = t[1][1]

#Smooth amplitude by mean, deltaA as difference between original and smooth Amplitude
smoothamplitude = PhyPraKit.meanFilter(amplitude,5)
deltaA = amplitude - smoothamplitude

#Plot amplitude over time
plt.plot(time,amplitude)
plt.title('amplitude over time')
plt.show()

#Plot smooth amplitude over time
plt.plot(time,smoothamplitude)
plt.title('Smooth amplitude over time')
plt.show()

#Plot deltaAmplitude over time
plt.plot(time,deltaA)
plt.title('delta Amplitude over time')
import kafe

#Bestimmung m_e ___________________________________________________________________________
M = 0.14174  #Angaben in kg
M_F = 0.0154
o_me = 0.1 * 10**-3  #Fehler von der Wage

me, o_me = (M + 1. / 3. * M_F), o_me + 1 / 3 * o_me

#Bestimmung von T ___________________________________________________________________________
hlines, data = ppk.readCSV('HandyPendel.csv')
t = data[0]
a = data[2]

#Glätten der Funktion
a_smooth = ppk.meanFilter(a, 7)

# calculate autocorrelation function
ac_a = ppk.autocorrelate(a_smooth)
ac_t = t

# find maxima and minima using convolution peak finder
width = 3
pidxac = ppk.convolutionPeakfinder(ac_a, width, th=0.66)
didxac = ppk.convolutionPeakfinder(-ac_a, width, th=0.66)
if len(pidxac) > 1:
    print(" --> %i auto-correlation peaks found" % (len(pidxac)))
    pidxac[0] = 0  # first peak is at 0 by construction
    ac_tp, ac_ap = np.array(ac_t[pidxac]), np.array(ac_a[pidxac])
    ac_td, ac_ad = np.array(ac_t[didxac]), np.array(ac_a[didxac])
else: