This commit is contained in:
xaver
2020-09-21 20:12:16 +02:00
parent 042bdd7aa3
commit f1b7291ecf
4 changed files with 204 additions and 23 deletions

View File

@@ -43,12 +43,13 @@ for infodataset in datasets:
for ID in identifier:
base_path = 'D:\\jar_project\\JAR\\eigenmannia\\step\\%s' %ID
res_df = []
response = []
stim_ampl = []
for idx, dataset in enumerate(os.listdir(base_path)):
dataset = os.path.join(base_path, dataset, 'beats-eod.dat')
print(dataset)
#input of the function
frequency, time, amplitude, eodf, deltaf, stimulusf, duration, pause = parse_dataset(dataset)
frequency, time, amplitude, eodf, deltaf, stimulusf, stimulusamplitude, duration, pause = parse_dataset(dataset)
dm = np.mean(duration)
pm = np.mean(pause)
timespan = dm + pm
@@ -57,20 +58,15 @@ for ID in identifier:
if len(frequency) == 5:
continue
norm, base, jar = norm_function(frequency, time, onset_point=dm - dm, offset_point=dm) # dm-dm funktioniert nur wenn onset = 0 sec
print(jar)
if jar[0] == 0.0:
continue
mf, tnew = mean_traces(start, stop, timespan, norm, time) # maybe fixed timespan/sampling rate
mf, tnew = mean_traces(start, stop, timespan, frequency, time) # maybe fixed timespan/sampling rate
cf, ct = mean_noise_cut_eigen(mf, tnew, n=1250)
cf_arr = np.array(cf)
ct_arr = np.array(ct)
onset_point = dm - dm
offset_point = dm
onset_end = onset_point - 10
offset_start = offset_point - 10
freq_all.append(cf_arr)
time_all.append(ct_arr)
b = []
for index, i in enumerate(ct):
@@ -84,15 +80,37 @@ for ID in identifier:
print(h)
print(indexx)
print(cf[indexx])
''' sounds good, doesnt work somehow: in norm devision by 0 (jar) or index doesnt fit
norm, base, jar = norm_function(frequency, time, onset_point=dm - dm,
offset_point=dm) # dm-dm funktioniert nur wenn onset = 0 sec
b = []
for index, i in enumerate(ct):
if i > -45 and i < -5:
b.append(cf[index])
j = []
for indexx, h in enumerate(ct):
if h > 195 and h < 145:
j.append(cf[indexx])
print(h)
print(indexx)
print(cf[indexx])
b = np.median(cf[(ct >= onset_end) & (ct < onset_point)])
j = np.median(cf[(ct >= offset_start) & (ct < offset_point)])
'''
r = np.median(j) - np.median(b)
#response.append(r)
embed()
response.append(r)
stim_ampl.append(stimulusamplitude)
res_ampl = sorted(zip(stim_ampl, response))
base_line = plt.axhline(y = 0, color = 'black', ls = 'dotted', linewidth = '1')
plt.xlim([-10,220])
plt.xlabel('time [s]')
plt.ylabel('rel. JAR magnitude')
plt.title('relative JAR')
plt.xlabel('Stimulusamplitude')
plt.ylabel('absolute JAR magnitude')
plt.title('absolute JAR')
plt.savefig('relative JAR')
plt.legend(loc = 'lower right')
plt.show()