forked from neuroscan/curry-python-reader
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_ref_results.py
More file actions
44 lines (30 loc) · 1.26 KB
/
create_ref_results.py
File metadata and controls
44 lines (30 loc) · 1.26 KB
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
import os
import curryreader as cr
import numpy as np
############
def compose_output(data):
output = ''
for key, item in data.items():
output += (key + ': ')
line = ' '.join(str(item[x]) for x in item) if isinstance(item, dict) else ' '.join(str(x) for x in item)
output += (line + '\n')
return output
def create_reference_output(test_file, ref_output_case):
currydata = cr.read(os.path.join(test_folder, test_file), 0)
f = open(os.path.join(test_ref_folder, 'ref_params_' + ref_output_case + '.txt'), 'w')
np.save(os.path.join(test_ref_folder, 'ref_data_' + ref_output_case), currydata['data'])
currydata.pop('data')
output = compose_output(currydata)
f.write(output)
f.close()
#############
test_folder = "test_data"
test_ref_folder = os.path.join(test_folder, "tests_ref_output")
raw_float_cdt = "Float.cdt"
legacy_raw_float_dat = "Legacy.dat"
hpi_cdt = "HPI.cdt"
meg_eeg_cdt = "MEG2085.cdt"
create_reference_output(raw_float_cdt, 'continuos')
create_reference_output(legacy_raw_float_dat, 'epochs')
create_reference_output(hpi_cdt, 'hpi')
create_reference_output(meg_eeg_cdt, 'meg_eeg')