forked from jgrewe/fishbook
fix read_stimuli_file, returns settings and indices separately
This commit is contained in:
parent
bb352c4a5a
commit
7ba7db5f63
9
util.py
9
util.py
@ -91,10 +91,11 @@ def parse_table(lines, start_index):
|
|||||||
return data_indices, start_index
|
return data_indices, start_index
|
||||||
|
|
||||||
|
|
||||||
def read_stimuli_file(file_name):
|
def read_stimuli_file(dataset):
|
||||||
repro_settings = []
|
repro_settings = []
|
||||||
|
stimulus_indices = []
|
||||||
settings = {}
|
settings = {}
|
||||||
with open(file_name, 'r') as f:
|
with open(os.path.join(dataset, 'stimuli.dat'), 'r') as f:
|
||||||
lines = f.readlines()
|
lines = f.readlines()
|
||||||
index = 0
|
index = 0
|
||||||
current_section = None
|
current_section = None
|
||||||
@ -118,7 +119,7 @@ def read_stimuli_file(file_name):
|
|||||||
index += 1
|
index += 1
|
||||||
elif l.lower().startswith("#key"): # table data coming
|
elif l.lower().startswith("#key"): # table data coming
|
||||||
data, index = parse_table(lines, index)
|
data, index = parse_table(lines, index)
|
||||||
settings["stim_data"] = data
|
stimulus_indices.append(data)
|
||||||
# we are done with this repro run
|
# we are done with this repro run
|
||||||
settings[current_section_name] = current_section.copy()
|
settings[current_section_name] = current_section.copy()
|
||||||
repro_settings.append(settings.copy())
|
repro_settings.append(settings.copy())
|
||||||
@ -127,7 +128,7 @@ def read_stimuli_file(file_name):
|
|||||||
else:
|
else:
|
||||||
# data lines, ignore them here
|
# data lines, ignore them here
|
||||||
index += 1
|
index += 1
|
||||||
return repro_settings
|
return repro_settings, stimulus_indices
|
||||||
|
|
||||||
|
|
||||||
def find_key_recursive(dictionary, key, path=[]):
|
def find_key_recursive(dictionary, key, path=[]):
|
||||||
|
Loading…
Reference in New Issue
Block a user