fix read_stimuli_file, returns settings and indices separately

This commit is contained in:
Jan Grewe 2019-09-09 14:31:09 +02:00
parent bb352c4a5a
commit 7ba7db5f63

View File

@ -91,10 +91,11 @@ def parse_table(lines, start_index):
return data_indices, start_index
def read_stimuli_file(file_name):
def read_stimuli_file(dataset):
repro_settings = []
stimulus_indices = []
settings = {}
with open(file_name, 'r') as f:
with open(os.path.join(dataset, 'stimuli.dat'), 'r') as f:
lines = f.readlines()
index = 0
current_section = None
@ -118,7 +119,7 @@ def read_stimuli_file(file_name):
index += 1
elif l.lower().startswith("#key"): # table data coming
data, index = parse_table(lines, index)
settings["stim_data"] = data
stimulus_indices.append(data)
# we are done with this repro run
settings[current_section_name] = current_section.copy()
repro_settings.append(settings.copy())
@ -127,7 +128,7 @@ def read_stimuli_file(file_name):
else:
# data lines, ignore them here
index += 1
return repro_settings
return repro_settings, stimulus_indices
def find_key_recursive(dictionary, key, path=[]):