diff --git a/sin_response_fit.py b/sin_response_fit.py index f8068a6..54fa7c6 100644 --- a/sin_response_fit.py +++ b/sin_response_fit.py @@ -5,6 +5,7 @@ import pylab from IPython import embed from scipy.optimize import curve_fit from jar_functions import sin_response +from jar_functions import mean_noise_cut def take_second(elem): # function for taking the names out of files return elem[1] @@ -33,6 +34,15 @@ for i, d in enumerate(data): print(dd) time = np.load('%s time.npy' %dd) # time file + for float(d[1]) = 0.001: #ähnlich wie das, einfach passenstens n verwenden? + n = int((len(jar) / time[-1]) * (1 / 15)) + print(n) + cutf, cutt = mean_noise_cut(jar, time, n = 2) + plt.plot(cutt, cutf, label='cut amfreq') + plt.plot(time, jar, label='spec') + plt.legend() + plt.show() + #embed() b, a = signal.butter(4, (float(d[1]) / 2) / 10000, 'high', analog=True) # high pass filtering so our fit gets a bit better y = signal.filtfilt(b, a, jm) @@ -115,5 +125,5 @@ embed() # AM-frequency / envelope-frequency scale title? # bevor fit noch filtern mit 15Hz damit AM-Modulation rausgefiltert wird und nur noch envelope übrig bleibt. -# Dazu running average mit n wobei n über samplingrate und delta f bestimmt wird +# Dazu running average mit n wobei n über samplingrate von spectogram und delta f bestimmt wird # samplingrate über overlap muss dabei aber größer sein als samplingrate die noch übrig bleibt wenn ich mit delta f frequency gefiltert hab \ No newline at end of file diff --git a/sin_response_specto.py b/sin_response_specto.py index dec10a1..da36942 100644 --- a/sin_response_specto.py +++ b/sin_response_specto.py @@ -23,10 +23,6 @@ from jar_functions import import_amfreq base_path = 'D:\\jar_project\\JAR\\sin\\2020lepto16' -#nicht: -5Hz delta f, 19-aa, 22-ae, 22-ad (?) - -#dat = glob.glob('D:\\jar_project\\JAR\\2020*\\beats-eod.dat') -#infodat = glob.glob('D:\\jar_project\\JAR\\2020*\\info.dat') datasets = ['2020-08-04-ab', '2020-08-04-ac', '2020-08-04-ad', @@ -82,7 +78,7 @@ for idx, dataset in enumerate(datasets): if float(amfreq) < 0.01: spec, freqs, times = specgram(dat, Fs=1/dt, detrend='mean', NFFT=nfft, noverlap=nfft * 0.8) else: - spec, freqs, times = specgram(dat, Fs=1 / dt, detrend='mean', NFFT=nfft, noverlap=nfft * 0.95) + spec, freqs, times = specgram(dat, Fs=1 / dt, detrend='mean', NFFT=nfft, noverlap=nfft * 0.96) dbspec = 10.0*np.log10(spec) # in dB power = dbspec[:, 50] @@ -111,22 +107,8 @@ for idx, dataset in enumerate(datasets): np.save('%s time' % file_name, cut_times) np.save('%s' % file_name, jar4) - cutf, cutt = mean_noise_cut(jar4, cut_times, 40000 * (1/15)) - plt.plot(cutt, cutf) - plt.show() - embed() - - #plt.plot(cut_times, jm, '-k') - - #cf, ct = mean_noise_cut(jar4, cut_times, n = int(round(len(jar4)/((times[-1] - times [0]) * amfreq)))) - #plt.plot(ct, cf, '-k') - #plt.imshow(spec4, cmap='jet', origin='lower', extent=(times[0], times[-1], lim0, lim1), aspect='auto', vmin=-80, vmax=-10) - #plt.legend() - #plt.ylim(lim0, lim1) - #plt.legend() - #plt.show() np.save('files.npy', files) #embed()