diff --git a/step_response.py b/step_response.py index a348f15..a9a19fa 100644 --- a/step_response.py +++ b/step_response.py @@ -23,10 +23,10 @@ datasets = [#'2020-06-19-aa', #-5Hz delta f, horrible fit #'2020-06-19-ab', #-5Hz delta f, bad fit #'2020-06-22-aa', #-5Hz delta f, bad fit #'2020-06-22-ab', #-5Hz delta f, bad fit - '2020-06-22-ac', #-15Hz delta f, good fit - '2020-06-22-ad', #-15Hz delta f, horrible fit - '2020-06-22-ae', #-15Hz delta f, maxfev way to high so horrible - '2020-06-22-af' #-15Hz delta f, good fit + '2020-06-22-ac', #-15Hz delta f, good fit + '2020-06-22-ad', #-15Hz delta f, horrible fit + '2020-06-22-ae', #-15Hz delta f, horrible fit + '2020-06-22-af' #-15Hz delta f, good fit ] #dat = glob.glob('D:\\jar_project\\JAR\\2020*\\beats-eod.dat') diff --git a/step_response_specto.py b/step_response_specto.py new file mode 100644 index 0000000..fe50312 --- /dev/null +++ b/step_response_specto.py @@ -0,0 +1,66 @@ +import matplotlib.pyplot as plt +import matplotlib as cm +from matplotlib.colors import ListedColormap, LinearSegmentedColormap +from matplotlib.mlab import specgram +import os +import glob +import IPython +import numpy as np +import DataLoader as dl +from IPython import embed +from scipy.optimize import curve_fit +from jar_functions import parse_dataset +from jar_functions import parse_infodataset +from jar_functions import mean_traces +from jar_functions import mean_noise_cut +from jar_functions import norm_function +from jar_functions import step_response +from jar_functions import sort_values +from jar_functions import average + +base_path = 'D:\\jar_project\\JAR' + +#nicht: -5Hz delta f, 19-aa, 22-ae, 22-ad (?) +datasets = [#'2020-06-19-aa', #-5Hz delta f, horrible fit + #'2020-06-19-ab', #-5Hz delta f, bad fit + #'2020-06-22-aa', #-5Hz delta f, bad fit + #'2020-06-22-ab', #-5Hz delta f, bad fit + '2020-06-22-ac', #-15Hz delta f, good fit + #'2020-06-22-ad', #-15Hz delta f, horrible fit + #'2020-06-22-ae', #-15Hz delta f, horrible fit + #'2020-06-22-af' #-15Hz delta f, good fit + ] + +#dat = glob.glob('D:\\jar_project\\JAR\\2020*\\beats-eod.dat') +#infodat = glob.glob('D:\\jar_project\\JAR\\2020*\\info.dat') + +time_all = [] +freq_all = [] + +ID = [] +col = ['dimgrey', 'grey', 'darkgrey', 'silver', 'lightgrey', 'gainsboro', 'whitesmoke'] +labels = zip(ID, datasets) + +for infodataset in datasets: + infodataset = os.path.join(base_path, infodataset, 'info.dat') + i = parse_infodataset(infodataset) + identifier = i[0] + ID.append(identifier) + + +for idx, dataset in enumerate(datasets): + datapath = os.path.join(base_path, dataset) + for info, key, time, data in dl.iload_traces(datapath, repro='Beats', before=0.0, after=0.0): + print( info[1]['RePro'] ) + print(data.shape) + #plt.plot(time, data[0]) # V(t) + #plt.show() + nfft = 2**10 + spec, freqs, times = specgram(data[0], Fs=1.0/(time[1]-time[0]), detrend='mean', NFFT=nfft, noverlap=nfft//10) + dbspec = 10.0*np.log10(spec) # in dB + print(np.min(dbspec), np.max(dbspec)) + plt.imshow(dbspec, cmap='jet', origin='lower', extent=(times[0], times[1], freqs[0], freqs[-1]), aspect='auto', vmin=-80, vmax=-30 ) + # interpolation, vmin, vmax + # plot decibel as function of frequency for one time slot: wieso auflösung von frequenzen schlechter wenn nfft hoch? + plt.show() +embed() \ No newline at end of file