-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake_tab_mult_entries_L1.py
419 lines (387 loc) · 24.1 KB
/
make_tab_mult_entries_L1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
import os
import statistics
from pathlib import Path
import numpy as np
import pandas as pd
import pickle
import matplotlib.pyplot as plt
from dtw import *
import argparse
from numpy import unravel_index
import seaborn as sns
from frechetdist import frdist
from scipy.interpolate import interp1d
from itertools import cycle
from matplotlib import colormaps
import matplotlib.gridspec as gridspec
parser = argparse.ArgumentParser()
parser.add_argument("--input_file1", required=True, type=Path)
parser.add_argument("--input_file2", required=True, type=Path)
parser.add_argument("--input_file3", required=True, type=Path)
parser.add_argument("--input_file4", required=True, type=Path)
parser.add_argument("--input_file5", required=True, type=Path)
parser.add_argument("--input_file6", required=True, type=Path)
args = parser.parse_args()
from itertools import cycle
def categorize(row,cx,cy):
if row[cx] == row[cy]:
return row[cx] # If L1_x and L1_y are the same, return the language (FR/RU)
else:
return str(sorted([row[cx],row[cy]])[0]+" vs "+sorted([row[cx],row[cy]])[1])
lines = ["-","--","-.",":","."]
linecycler = cycle(lines)
UNNO_file1=Path(str(args.input_file1).replace("NORM","UNNO"))
NSPK_file1=Path(str(args.input_file1).replace("NORM","NSPK"))
UNNO_file2=Path(str(args.input_file2).replace("NORM","UNNO"))
NSPK_file2=Path(str(args.input_file2).replace("NORM","NSPK"))
UNNO_file3=Path(str(args.input_file3).replace("NORM","UNNO"))
NSPK_file3=Path(str(args.input_file3).replace("NORM","NSPK"))
UNNO_file4=Path(str(args.input_file4).replace("NORM","UNNO"))
NSPK_file4=Path(str(args.input_file4).replace("NORM","NSPK"))
UNNO_file5=Path(str(args.input_file5).replace("NORM","UNNO"))
NSPK_file5=Path(str(args.input_file5).replace("NORM","NSPK"))
UNNO_file6=Path(str(args.input_file6).replace("NORM","UNNO"))
NSPK_file6=Path(str(args.input_file6).replace("NORM","NSPK"))
os.chdir("/home/mfily/Documents/NOANOA_locallyowned_texfiles/COLING_2025")
df1=pd.read_pickle(args.input_file1)
df2=pd.read_pickle(args.input_file2)
df3=pd.read_pickle(args.input_file3)
df4=pd.read_pickle(args.input_file4)
df5=pd.read_pickle(args.input_file5)
df6=pd.read_pickle(args.input_file6)
df1 = df1[~((df1['spk_x'] == df1['spk_y']) & (df1['file_x'] == df1['file_y']))]
df2 = df2[~((df2['spk_x'] == df2['spk_y']) & (df2['file_x'] == df2['file_y']))]
df3 = df3[~((df3['spk_x'] == df3['spk_y']) & (df3['file_x'] == df3['file_y']))]
df4 = df4[~((df4['spk_x'] == df4['spk_y']) & (df4['file_x'] == df4['file_y']))]
df5 = df5[~((df5['spk_x'] == df5['spk_y']) & (df5['file_x'] == df5['file_y']))]
df6 = df6[~((df6['spk_x'] == df6['spk_y']) & (df6['file_x'] == df6['file_y']))]
df1['L1'] = df1.apply(categorize, axis=1, cx='L1_x', cy='L1_y')
df2['L1'] = df2.apply(categorize, axis=1, cx='L1_x', cy='L1_y')
df3['L1'] = df3.apply(categorize, axis=1, cx='L1_x', cy='L1_y')
df4['L1'] = df4.apply(categorize, axis=1, cx='L1_x', cy='L1_y')
df5['L1'] = df5.apply(categorize, axis=1, cx='L1_x', cy='L1_y')
df6['L1'] = df6.apply(categorize, axis=1, cx='L1_x', cy='L1_y')
# vector
df1_meanR = df1[df1['L1'] == 'ru'].groupby("layer")["Ncost_LD"].mean()
df1_stdR = df1[df1['L1'] == 'ru'].groupby("layer")["Ncost_LD"].std()
df1_meanF = df1[df1['L1'] == 'fr'].groupby("layer")["Ncost_LD"].mean()
df1_stdF = df1[df1['L1'] == 'fr'].groupby("layer")["Ncost_LD"].std()
df1_meanV = df1[df1['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].mean()
df1_stdV = df1[df1['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].std()
# audio cost matrix
df1_meanRref = df1[df1['L1'] == 'ru'].groupby("layer")["Naudio_cost_LD"].mean()
m11=df1_meanRref.iloc[1]
df1_meanFref = df1[df1['L1'] == 'fr'].groupby("layer")["Naudio_cost_LD"].mean()
m12=df1_meanFref.iloc[1]
df1_meanVref = df1[df1['L1'] == 'fr vs ru'].groupby("layer")["Naudio_cost_LD"].mean()
m13=df1_meanVref.iloc[1]
# vector
df2_meanR = df2[df2['L1'] == 'ru'].groupby("layer")["Ncost_LD"].mean()
df2_stdR = df2[df2['L1'] == 'ru'].groupby("layer")["Ncost_LD"].std()
df2_meanF = df2[df2['L1'] == 'fr'].groupby("layer")["Ncost_LD"].mean()
df2_stdF = df2[df2['L1'] == 'fr'].groupby("layer")["Ncost_LD"].std()
df2_meanV = df2[df2['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].mean()
df2_stdV = df2[df2['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].std()
# audio cost matrix
df2_meanRref = df2[df2['L1'] == 'ru'].groupby("layer")["Naudio_cost_LD"].mean()
m21=df2_meanRref.iloc[1]
df2_meanFref = df2[df2['L1'] == 'fr'].groupby("layer")["Naudio_cost_LD"].mean()
m22=df2_meanFref.iloc[1]
df2_meanVref = df2[df2['L1'] == 'fr vs ru'].groupby("layer")["Naudio_cost_LD"].mean()
m23=df2_meanVref.iloc[1]
df3_meanR = df3[df3['L1'] == 'ru'].groupby("layer")["Ncost_LD"].mean()
df3_stdR = df3[df3['L1'] == 'ru'].groupby("layer")["Ncost_LD"].std()
df3_meanF = df3[df3['L1'] == 'fr'].groupby("layer")["Ncost_LD"].mean()
df3_stdF = df3[df3['L1'] == 'fr'].groupby("layer")["Ncost_LD"].std()
df3_meanV = df3[df3['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].mean()
df3_stdV = df3[df3['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].std()
# audio cost matrix
df3_meanRref = df3[df3['L1'] == 'ru'].groupby("layer")["Naudio_cost_LD"].mean()
m31=df3_meanRref.iloc[1]
df3_meanFref = df3[df3['L1'] == 'fr'].groupby("layer")["Naudio_cost_LD"].mean()
m32=df3_meanFref.iloc[1]
df3_meanVref = df3[df3['L1'] == 'fr vs ru'].groupby("layer")["Naudio_cost_LD"].mean()
m33=df3_meanVref.iloc[1]
df4_meanR = df4[df4['L1'] == 'ru'].groupby("layer")["Ncost_LD"].mean()
df4_stdR = df4[df4['L1'] == 'ru'].groupby("layer")["Ncost_LD"].std()
df4_meanF = df4[df4['L1'] == 'fr'].groupby("layer")["Ncost_LD"].mean()
df4_stdF = df4[df4['L1'] == 'fr'].groupby("layer")["Ncost_LD"].std()
df4_meanV = df4[df4['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].mean()
df4_stdV = df4[df4['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].std()
# audio cost matrix
df4_meanRref = df4[df4['L1'] == 'ru'].groupby("layer")["Naudio_cost_LD"].mean()
m41=df4_meanRref.iloc[1]
df4_meanFref = df4[df4['L1'] == 'fr'].groupby("layer")["Naudio_cost_LD"].mean()
m42=df4_meanFref.iloc[1]
df4_meanVref = df4[df4['L1'] == 'fr vs ru'].groupby("layer")["Naudio_cost_LD"].mean()
m43=df4_meanVref.iloc[1]
df5_meanR = df5[df5['L1'] == 'ru'].groupby("layer")["Ncost_LD"].mean()
df5_stdR = df5[df5['L1'] == 'ru'].groupby("layer")["Ncost_LD"].std()
df5_meanF = df5[df5['L1'] == 'fr'].groupby("layer")["Ncost_LD"].mean()
df5_stdF = df5[df5['L1'] == 'fr'].groupby("layer")["Ncost_LD"].std()
df5_meanV = df5[df5['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].mean()
df5_stdV = df5[df5['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].std()
# audio cost matrix
df5_meanRref = df5[df5['L1'] == 'ru'].groupby("layer")["Naudio_cost_LD"].mean()
m51=df5_meanRref.iloc[1]
df5_meanFref = df5[df5['L1'] == 'fr'].groupby("layer")["Naudio_cost_LD"].mean()
m52=df5_meanFref.iloc[1]
df5_meanVref = df5[df5['L1'] == 'fr vs ru'].groupby("layer")["Naudio_cost_LD"].mean()
m53=df5_meanVref.iloc[1]
df6_meanR = df6[df6['L1'] == 'ru'].groupby("layer")["Ncost_LD"].mean()
df6_stdR = df6[df6['L1'] == 'ru'].groupby("layer")["Ncost_LD"].std()
df6_meanF = df6[df6['L1'] == 'fr'].groupby("layer")["Ncost_LD"].mean()
df6_stdF = df6[df6['L1'] == 'fr'].groupby("layer")["Ncost_LD"].std()
df6_meanV = df6[df6['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].mean()
df6_stdV = df6[df6['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].std()
# audio cost matrix
df6_meanRref = df6[df6['L1'] == 'ru'].groupby("layer")["Naudio_cost_LD"].mean()
m61=df6_meanRref.iloc[1]
df6_meanFref = df6[df6['L1'] == 'fr'].groupby("layer")["Naudio_cost_LD"].mean()
m62=df6_meanFref.iloc[1]
df6_meanVref = df6[df6['L1'] == 'fr vs ru'].groupby("layer")["Naudio_cost_LD"].mean()
m63=df6_meanVref.iloc[1]
Lout=[]
for i in range(len(df1_meanR)):
Lout.append([str(args.input_file1).split("_")[1].split("-")[0], i, m11, m12, m13, df1_meanR.iloc[i],df1_meanF.iloc[i],df1_meanV.iloc[i],(m11-m12)/(m13-m12),(df1_meanR.iloc[i]-df1_meanF.iloc[i])/(df1_meanV.iloc[i]-df1_meanF.iloc[i])])
for i in range(len(df2_meanR)):
Lout.append([str(args.input_file2).split("_")[1].split("-")[0], i, m21, m22, m23, df2_meanR.iloc[i],df2_meanF.iloc[i],df1_meanV.iloc[i],(m21-m22)/(m23-m22),(df2_meanR.iloc[i]-df2_meanF.iloc[i])/(df2_meanV.iloc[i]-df2_meanF.iloc[i])])
for i in range(len(df3_meanR)):
Lout.append([str(args.input_file3).split("_")[1].split("-")[0], i, m31, m32, m33, df3_meanR.iloc[i],df3_meanF.iloc[i],df3_meanV.iloc[i],(m31-m32)/(m33-m32),(df3_meanR.iloc[i]-df3_meanF.iloc[i])/(df3_meanV.iloc[i]-df3_meanF.iloc[i])])
for i in range(len(df4_meanR)):
Lout.append([str(args.input_file4).split("_")[1].split("-")[0], i, m41, m42, m43, df4_meanR.iloc[i],df4_meanF.iloc[i],df4_meanV.iloc[i],(m41-m42)/(m43-m42),(df4_meanR.iloc[i]-df4_meanF.iloc[i])/(df4_meanV.iloc[i]-df4_meanF.iloc[i])])
for i in range(len(df5_meanR)):
Lout.append([str(args.input_file5).split("_")[1].split("-")[0], i, m51, m52, m53, df5_meanR.iloc[i],df5_meanF.iloc[i],df5_meanV.iloc[i],(m51-m52)/(m53-m52),(df5_meanR.iloc[i]-df5_meanF.iloc[i])/(df5_meanV.iloc[i]-df5_meanF.iloc[i])])
for i in range(len(df6_meanR)):
Lout.append([str(args.input_file6).split("_")[1].split("-")[0], i, m61, m62, m63, df6_meanR.iloc[i],df6_meanF.iloc[i],df6_meanV.iloc[i],(m61-m62)/(m63-m62),(df6_meanR.iloc[i]-df6_meanF.iloc[i])/(df6_meanV.iloc[i]-df6_meanF.iloc[i])])
dout=pd.DataFrame(Lout)
dout.columns = ["stim","LAY","m1_audio","m2_audio","m3_audio","m1_vect","m2_vect","m3_vect","rat_aud","rat_vect"]
dout.to_csv("audio_v_vect_NORM_thales_pres_L1.csv", index=False)
df1=pd.read_pickle(UNNO_file1)
df2=pd.read_pickle(UNNO_file2)
df3=pd.read_pickle(UNNO_file3)
df4=pd.read_pickle(UNNO_file4)
df5=pd.read_pickle(UNNO_file5)
df6=pd.read_pickle(UNNO_file6)
df1 = df1[~((df1['spk_x'] == df1['spk_y']) & (df1['file_x'] == df1['file_y']))]
df2 = df2[~((df2['spk_x'] == df2['spk_y']) & (df2['file_x'] == df2['file_y']))]
df3 = df3[~((df3['spk_x'] == df3['spk_y']) & (df3['file_x'] == df3['file_y']))]
df4 = df4[~((df4['spk_x'] == df4['spk_y']) & (df4['file_x'] == df4['file_y']))]
df5 = df5[~((df5['spk_x'] == df5['spk_y']) & (df5['file_x'] == df5['file_y']))]
df6 = df6[~((df6['spk_x'] == df6['spk_y']) & (df6['file_x'] == df6['file_y']))]
df1['L1'] = df1.apply(categorize, axis=1, cx='L1_x', cy='L1_y')
df2['L1'] = df2.apply(categorize, axis=1, cx='L1_x', cy='L1_y')
df3['L1'] = df3.apply(categorize, axis=1, cx='L1_x', cy='L1_y')
df4['L1'] = df4.apply(categorize, axis=1, cx='L1_x', cy='L1_y')
df5['L1'] = df5.apply(categorize, axis=1, cx='L1_x', cy='L1_y')
df6['L1'] = df6.apply(categorize, axis=1, cx='L1_x', cy='L1_y')
# vector
df1_meanR = df1[df1['L1'] == 'ru'].groupby("layer")["Ncost_LD"].mean()
df1_stdR = df1[df1['L1'] == 'ru'].groupby("layer")["Ncost_LD"].std()
df1_meanF = df1[df1['L1'] == 'fr'].groupby("layer")["Ncost_LD"].mean()
df1_stdF = df1[df1['L1'] == 'fr'].groupby("layer")["Ncost_LD"].std()
df1_meanV = df1[df1['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].mean()
df1_stdV = df1[df1['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].std()
# audio cost matrix
df1_meanRref = df1[df1['L1'] == 'ru'].groupby("layer")["Naudio_cost_LD"].mean()
m11=df1_meanRref.iloc[1]
df1_meanFref = df1[df1['L1'] == 'fr'].groupby("layer")["Naudio_cost_LD"].mean()
m12=df1_meanFref.iloc[1]
df1_meanVref = df1[df1['L1'] == 'fr vs ru'].groupby("layer")["Naudio_cost_LD"].mean()
m13=df1_meanVref.iloc[1]
# vector
df2_meanR = df2[df2['L1'] == 'ru'].groupby("layer")["Ncost_LD"].mean()
df2_stdR = df2[df2['L1'] == 'ru'].groupby("layer")["Ncost_LD"].std()
df2_meanF = df2[df2['L1'] == 'fr'].groupby("layer")["Ncost_LD"].mean()
df2_stdF = df2[df2['L1'] == 'fr'].groupby("layer")["Ncost_LD"].std()
df2_meanV = df2[df2['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].mean()
df2_stdV = df2[df2['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].std()
# audio cost matrix
df2_meanRref = df2[df2['L1'] == 'ru'].groupby("layer")["Naudio_cost_LD"].mean()
m21=df2_meanRref.iloc[1]
df2_meanFref = df2[df2['L1'] == 'fr'].groupby("layer")["Naudio_cost_LD"].mean()
m22=df2_meanFref.iloc[1]
df2_meanVref = df2[df2['L1'] == 'fr vs ru'].groupby("layer")["Naudio_cost_LD"].mean()
m23=df2_meanVref.iloc[1]
df3_meanR = df3[df3['L1'] == 'ru'].groupby("layer")["Ncost_LD"].mean()
df3_stdR = df3[df3['L1'] == 'ru'].groupby("layer")["Ncost_LD"].std()
df3_meanF = df3[df3['L1'] == 'fr'].groupby("layer")["Ncost_LD"].mean()
df3_stdF = df3[df3['L1'] == 'fr'].groupby("layer")["Ncost_LD"].std()
df3_meanV = df3[df3['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].mean()
df3_stdV = df3[df3['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].std()
# audio cost matrix
df3_meanRref = df3[df3['L1'] == 'ru'].groupby("layer")["Naudio_cost_LD"].mean()
m31=df3_meanRref.iloc[1]
df3_meanFref = df3[df3['L1'] == 'fr'].groupby("layer")["Naudio_cost_LD"].mean()
m32=df3_meanFref.iloc[1]
df3_meanVref = df3[df3['L1'] == 'fr vs ru'].groupby("layer")["Naudio_cost_LD"].mean()
m33=df3_meanVref.iloc[1]
df4_meanR = df4[df4['L1'] == 'ru'].groupby("layer")["Ncost_LD"].mean()
df4_stdR = df4[df4['L1'] == 'ru'].groupby("layer")["Ncost_LD"].std()
df4_meanF = df4[df4['L1'] == 'fr'].groupby("layer")["Ncost_LD"].mean()
df4_stdF = df4[df4['L1'] == 'fr'].groupby("layer")["Ncost_LD"].std()
df4_meanV = df4[df4['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].mean()
df4_stdV = df4[df4['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].std()
# audio cost matrix
df4_meanRref = df4[df4['L1'] == 'ru'].groupby("layer")["Naudio_cost_LD"].mean()
m41=df4_meanRref.iloc[1]
df4_meanFref = df4[df4['L1'] == 'fr'].groupby("layer")["Naudio_cost_LD"].mean()
m42=df4_meanFref.iloc[1]
df4_meanVref = df4[df4['L1'] == 'fr vs ru'].groupby("layer")["Naudio_cost_LD"].mean()
m43=df4_meanVref.iloc[1]
df5_meanR = df5[df5['L1'] == 'ru'].groupby("layer")["Ncost_LD"].mean()
df5_stdR = df5[df5['L1'] == 'ru'].groupby("layer")["Ncost_LD"].std()
df5_meanF = df5[df5['L1'] == 'fr'].groupby("layer")["Ncost_LD"].mean()
df5_stdF = df5[df5['L1'] == 'fr'].groupby("layer")["Ncost_LD"].std()
df5_meanV = df5[df5['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].mean()
df5_stdV = df5[df5['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].std()
# audio cost matrix
df5_meanRref = df5[df5['L1'] == 'ru'].groupby("layer")["Naudio_cost_LD"].mean()
m51=df5_meanRref.iloc[1]
df5_meanFref = df5[df5['L1'] == 'fr'].groupby("layer")["Naudio_cost_LD"].mean()
m52=df5_meanFref.iloc[1]
df5_meanVref = df5[df5['L1'] == 'fr vs ru'].groupby("layer")["Naudio_cost_LD"].mean()
m53=df5_meanVref.iloc[1]
df6_meanR = df6[df6['L1'] == 'ru'].groupby("layer")["Ncost_LD"].mean()
df6_stdR = df6[df6['L1'] == 'ru'].groupby("layer")["Ncost_LD"].std()
df6_meanF = df6[df6['L1'] == 'fr'].groupby("layer")["Ncost_LD"].mean()
df6_stdF = df6[df6['L1'] == 'fr'].groupby("layer")["Ncost_LD"].std()
df6_meanV = df6[df6['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].mean()
df6_stdV = df6[df6['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].std()
# audio cost matrix
df6_meanRref = df6[df6['L1'] == 'ru'].groupby("layer")["Naudio_cost_LD"].mean()
m61=df6_meanRref.iloc[1]
df6_meanFref = df6[df6['L1'] == 'fr'].groupby("layer")["Naudio_cost_LD"].mean()
m62=df6_meanFref.iloc[1]
df6_meanVref = df6[df6['L1'] == 'fr vs ru'].groupby("layer")["Naudio_cost_LD"].mean()
m63=df6_meanVref.iloc[1]
Lout=[]
for i in range(len(df1_meanR)):
Lout.append([str(args.input_file1).split("_")[1].split("-")[0], i, m11, m12, m13, df1_meanR.iloc[i],df1_meanF.iloc[i],df1_meanV.iloc[i],(m11-m12)/(m13-m12),(df1_meanR.iloc[i]-df1_meanF.iloc[i])/(df1_meanV.iloc[i]-df1_meanF.iloc[i])])
for i in range(len(df2_meanR)):
Lout.append([str(args.input_file2).split("_")[1].split("-")[0], i, m21, m22, m23, df2_meanR.iloc[i],df2_meanF.iloc[i],df1_meanV.iloc[i],(m21-m22)/(m23-m22),(df2_meanR.iloc[i]-df2_meanF.iloc[i])/(df2_meanV.iloc[i]-df2_meanF.iloc[i])])
for i in range(len(df3_meanR)):
Lout.append([str(args.input_file3).split("_")[1].split("-")[0], i, m31, m32, m33, df3_meanR.iloc[i],df3_meanF.iloc[i],df3_meanV.iloc[i],(m31-m32)/(m33-m32),(df3_meanR.iloc[i]-df3_meanF.iloc[i])/(df3_meanV.iloc[i]-df3_meanF.iloc[i])])
for i in range(len(df4_meanR)):
Lout.append([str(args.input_file4).split("_")[1].split("-")[0], i, m41, m42, m43, df4_meanR.iloc[i],df4_meanF.iloc[i],df4_meanV.iloc[i],(m41-m42)/(m43-m42),(df4_meanR.iloc[i]-df4_meanF.iloc[i])/(df4_meanV.iloc[i]-df4_meanF.iloc[i])])
for i in range(len(df5_meanR)):
Lout.append([str(args.input_file5).split("_")[1].split("-")[0], i, m51, m52, m53, df5_meanR.iloc[i],df5_meanF.iloc[i],df5_meanV.iloc[i],(m51-m52)/(m53-m52),(df5_meanR.iloc[i]-df5_meanF.iloc[i])/(df5_meanV.iloc[i]-df5_meanF.iloc[i])])
for i in range(len(df6_meanR)):
Lout.append([str(args.input_file6).split("_")[1].split("-")[0], i, m61, m62, m63, df6_meanR.iloc[i],df6_meanF.iloc[i],df6_meanV.iloc[i],(m61-m62)/(m63-m62),(df6_meanR.iloc[i]-df6_meanF.iloc[i])/(df6_meanV.iloc[i]-df6_meanF.iloc[i])])
dout=pd.DataFrame(Lout)
dout.columns = ["stim","LAY","m1_audio","m2_audio","m3_audio","m1_vect","m2_vect","m3_vect","rat_aud","rat_vect"]
dout.to_csv("audio_v_vect_UNNO_thales_pres_L1.csv", index=False)
df1=pd.read_pickle(NSPK_file1)
df2=pd.read_pickle(NSPK_file2)
df3=pd.read_pickle(NSPK_file3)
df4=pd.read_pickle(NSPK_file4)
df5=pd.read_pickle(NSPK_file5)
df6=pd.read_pickle(NSPK_file6)
df1 = df1[~((df1['spk_x'] == df1['spk_y']) & (df1['file_x'] == df1['file_y']))]
df2 = df2[~((df2['spk_x'] == df2['spk_y']) & (df2['file_x'] == df2['file_y']))]
df3 = df3[~((df3['spk_x'] == df3['spk_y']) & (df3['file_x'] == df3['file_y']))]
df4 = df4[~((df4['spk_x'] == df4['spk_y']) & (df4['file_x'] == df4['file_y']))]
df5 = df5[~((df5['spk_x'] == df5['spk_y']) & (df5['file_x'] == df5['file_y']))]
df6 = df6[~((df6['spk_x'] == df6['spk_y']) & (df6['file_x'] == df6['file_y']))]
df1['L1'] = df1.apply(categorize, axis=1, cx='L1_x', cy='L1_y')
df2['L1'] = df2.apply(categorize, axis=1, cx='L1_x', cy='L1_y')
df3['L1'] = df3.apply(categorize, axis=1, cx='L1_x', cy='L1_y')
df4['L1'] = df4.apply(categorize, axis=1, cx='L1_x', cy='L1_y')
df5['L1'] = df5.apply(categorize, axis=1, cx='L1_x', cy='L1_y')
df6['L1'] = df6.apply(categorize, axis=1, cx='L1_x', cy='L1_y')
# vector
df1_meanR = df1[df1['L1'] == 'ru'].groupby("layer")["Ncost_LD"].mean()
df1_stdR = df1[df1['L1'] == 'ru'].groupby("layer")["Ncost_LD"].std()
df1_meanF = df1[df1['L1'] == 'fr'].groupby("layer")["Ncost_LD"].mean()
df1_stdF = df1[df1['L1'] == 'fr'].groupby("layer")["Ncost_LD"].std()
df1_meanV = df1[df1['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].mean()
df1_stdV = df1[df1['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].std()
# audio cost matrix
df1_meanRref = df1[df1['L1'] == 'ru'].groupby("layer")["Naudio_cost_LD"].mean()
m11=df1_meanRref.iloc[1]
df1_meanFref = df1[df1['L1'] == 'fr'].groupby("layer")["Naudio_cost_LD"].mean()
m12=df1_meanFref.iloc[1]
df1_meanVref = df1[df1['L1'] == 'fr vs ru'].groupby("layer")["Naudio_cost_LD"].mean()
m13=df1_meanVref.iloc[1]
# vector
df2_meanR = df2[df2['L1'] == 'ru'].groupby("layer")["Ncost_LD"].mean()
df2_stdR = df2[df2['L1'] == 'ru'].groupby("layer")["Ncost_LD"].std()
df2_meanF = df2[df2['L1'] == 'fr'].groupby("layer")["Ncost_LD"].mean()
df2_stdF = df2[df2['L1'] == 'fr'].groupby("layer")["Ncost_LD"].std()
df2_meanV = df2[df2['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].mean()
df2_stdV = df2[df2['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].std()
# audio cost matrix
df2_meanRref = df2[df2['L1'] == 'ru'].groupby("layer")["Naudio_cost_LD"].mean()
m21=df2_meanRref.iloc[1]
df2_meanFref = df2[df2['L1'] == 'fr'].groupby("layer")["Naudio_cost_LD"].mean()
m22=df2_meanFref.iloc[1]
df2_meanVref = df2[df2['L1'] == 'fr vs ru'].groupby("layer")["Naudio_cost_LD"].mean()
m23=df2_meanVref.iloc[1]
df3_meanR = df3[df3['L1'] == 'ru'].groupby("layer")["Ncost_LD"].mean()
df3_stdR = df3[df3['L1'] == 'ru'].groupby("layer")["Ncost_LD"].std()
df3_meanF = df3[df3['L1'] == 'fr'].groupby("layer")["Ncost_LD"].mean()
df3_stdF = df3[df3['L1'] == 'fr'].groupby("layer")["Ncost_LD"].std()
df3_meanV = df3[df3['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].mean()
df3_stdV = df3[df3['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].std()
# audio cost matrix
df3_meanRref = df3[df3['L1'] == 'ru'].groupby("layer")["Naudio_cost_LD"].mean()
m31=df3_meanRref.iloc[1]
df3_meanFref = df3[df3['L1'] == 'fr'].groupby("layer")["Naudio_cost_LD"].mean()
m32=df3_meanFref.iloc[1]
df3_meanVref = df3[df3['L1'] == 'fr vs ru'].groupby("layer")["Naudio_cost_LD"].mean()
m33=df3_meanVref.iloc[1]
df4_meanR = df4[df4['L1'] == 'ru'].groupby("layer")["Ncost_LD"].mean()
df4_stdR = df4[df4['L1'] == 'ru'].groupby("layer")["Ncost_LD"].std()
df4_meanF = df4[df4['L1'] == 'fr'].groupby("layer")["Ncost_LD"].mean()
df4_stdF = df4[df4['L1'] == 'fr'].groupby("layer")["Ncost_LD"].std()
df4_meanV = df4[df4['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].mean()
df4_stdV = df4[df4['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].std()
# audio cost matrix
df4_meanRref = df4[df4['L1'] == 'ru'].groupby("layer")["Naudio_cost_LD"].mean()
m41=df4_meanRref.iloc[1]
df4_meanFref = df4[df4['L1'] == 'fr'].groupby("layer")["Naudio_cost_LD"].mean()
m42=df4_meanFref.iloc[1]
df4_meanVref = df4[df4['L1'] == 'fr vs ru'].groupby("layer")["Naudio_cost_LD"].mean()
m43=df4_meanVref.iloc[1]
df5_meanR = df5[df5['L1'] == 'ru'].groupby("layer")["Ncost_LD"].mean()
df5_stdR = df5[df5['L1'] == 'ru'].groupby("layer")["Ncost_LD"].std()
df5_meanF = df5[df5['L1'] == 'fr'].groupby("layer")["Ncost_LD"].mean()
df5_stdF = df5[df5['L1'] == 'fr'].groupby("layer")["Ncost_LD"].std()
df5_meanV = df5[df5['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].mean()
df5_stdV = df5[df5['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].std()
# audio cost matrix
df5_meanRref = df5[df5['L1'] == 'ru'].groupby("layer")["Naudio_cost_LD"].mean()
m51=df5_meanRref.iloc[1]
df5_meanFref = df5[df5['L1'] == 'fr'].groupby("layer")["Naudio_cost_LD"].mean()
m52=df5_meanFref.iloc[1]
df5_meanVref = df5[df5['L1'] == 'fr vs ru'].groupby("layer")["Naudio_cost_LD"].mean()
m53=df5_meanVref.iloc[1]
df6_meanR = df6[df6['L1'] == 'ru'].groupby("layer")["Ncost_LD"].mean()
df6_stdR = df6[df6['L1'] == 'ru'].groupby("layer")["Ncost_LD"].std()
df6_meanF = df6[df6['L1'] == 'fr'].groupby("layer")["Ncost_LD"].mean()
df6_stdF = df6[df6['L1'] == 'fr'].groupby("layer")["Ncost_LD"].std()
df6_meanV = df6[df6['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].mean()
df6_stdV = df6[df6['L1'] == 'fr vs ru'].groupby("layer")["Ncost_LD"].std()
# audio cost matrix
df6_meanRref = df6[df6['L1'] == 'ru'].groupby("layer")["Naudio_cost_LD"].mean()
m61=df6_meanRref.iloc[1]
df6_meanFref = df6[df6['L1'] == 'fr'].groupby("layer")["Naudio_cost_LD"].mean()
m62=df6_meanFref.iloc[1]
df6_meanVref = df6[df6['L1'] == 'fr vs ru'].groupby("layer")["Naudio_cost_LD"].mean()
m63=df6_meanVref.iloc[1]
Lout=[]
for i in range(len(df1_meanR)):
Lout.append([str(args.input_file1).split("_")[1].split("-")[0], i, m11, m12, m13, df1_meanR.iloc[i],df1_meanF.iloc[i],df1_meanV.iloc[i],(m11-m12)/(m13-m12),(df1_meanR.iloc[i]-df1_meanF.iloc[i])/(df1_meanV.iloc[i]-df1_meanF.iloc[i])])
for i in range(len(df2_meanR)):
Lout.append([str(args.input_file2).split("_")[1].split("-")[0], i, m21, m22, m23, df2_meanR.iloc[i],df2_meanF.iloc[i],df1_meanV.iloc[i],(m21-m22)/(m23-m22),(df2_meanR.iloc[i]-df2_meanF.iloc[i])/(df2_meanV.iloc[i]-df2_meanF.iloc[i])])
for i in range(len(df3_meanR)):
Lout.append([str(args.input_file3).split("_")[1].split("-")[0], i, m31, m32, m33, df3_meanR.iloc[i],df3_meanF.iloc[i],df3_meanV.iloc[i],(m31-m32)/(m33-m32),(df3_meanR.iloc[i]-df3_meanF.iloc[i])/(df3_meanV.iloc[i]-df3_meanF.iloc[i])])
for i in range(len(df4_meanR)):
Lout.append([str(args.input_file4).split("_")[1].split("-")[0], i, m41, m42, m43, df4_meanR.iloc[i],df4_meanF.iloc[i],df4_meanV.iloc[i],(m41-m42)/(m43-m42),(df4_meanR.iloc[i]-df4_meanF.iloc[i])/(df4_meanV.iloc[i]-df4_meanF.iloc[i])])
for i in range(len(df5_meanR)):
Lout.append([str(args.input_file5).split("_")[1].split("-")[0], i, m51, m52, m53, df5_meanR.iloc[i],df5_meanF.iloc[i],df5_meanV.iloc[i],(m51-m52)/(m53-m52),(df5_meanR.iloc[i]-df5_meanF.iloc[i])/(df5_meanV.iloc[i]-df5_meanF.iloc[i])])
for i in range(len(df6_meanR)):
Lout.append([str(args.input_file6).split("_")[1].split("-")[0], i, m61, m62, m63, df6_meanR.iloc[i],df6_meanF.iloc[i],df6_meanV.iloc[i],(m61-m62)/(m63-m62),(df6_meanR.iloc[i]-df6_meanF.iloc[i])/(df6_meanV.iloc[i]-df6_meanF.iloc[i])])
dout=pd.DataFrame(Lout)
dout.columns = ["stim","LAY","m1_audio","m2_audio","m3_audio","m1_vect","m2_vect","m3_vect","rat_aud","rat_vect"]
dout.to_csv("audio_v_vect_NSPK_thales_pres_L1.csv", index=False)