Archived
Initial commit
This commit is contained in:
commit
d89b82be4a
103 files changed
+23110
No files matched your search
@@ -0,0 +1,37 @@
|
||||
import os
|
||||
import numpy as np
|
||||
from gender_build_conditions import expe_build_conditions as buildConditions
|
||||
from gender_makeStimuli import makeStimuli
|
||||
|
||||
|
||||
def generateStimuli(options, phase):
|
||||
if os.path.exists(options["res_filename"]):
|
||||
os.remove(options["res_filename"])
|
||||
|
||||
opt = raw_input("Delete previously processed sound files? (Y/n): ")
|
||||
if opt.lower() == "y":
|
||||
# os.remove(os.path.join(options["sound_path"], '*.wav'))
|
||||
old = [f for f in os.listdir(
|
||||
options["tmp_path"]) if f.endswith(".wav")]
|
||||
for o in old:
|
||||
os.remove(os.path.join(options["tmp_path"], o))
|
||||
elif opt.lower() == 'n':
|
||||
return
|
||||
else:
|
||||
raise ValueError("That is not a valid option")
|
||||
|
||||
expe, options = buildConditions(options)
|
||||
|
||||
done = []
|
||||
while np.mean(done) != 1:
|
||||
done = []
|
||||
|
||||
for i in range(len(expe[phase]["trials"])):
|
||||
done.append(expe[phase]["trials"][i]["done"])
|
||||
try:
|
||||
itrial = done.index(0)
|
||||
except ValueError:
|
||||
break
|
||||
trial = expe[phase]["trials"][itrial]
|
||||
makeStimuli(options, trial)
|
||||
expe[phase]["trials"][itrial]["done"] = 1
|
||||
Reference in new issue
Block a user