add an small sentence before each block
I have a block design experiment. Before each block, I want to introduce a rule in a sentence in order to help to the participant to answer the questions.
In the stimuli excel file, in the last column, I have mentioned the rule for each block.
For the better understanding of the code, I would like to explain the structure of data.csv file. Here is an example of the rows and columns in the data.csv file:
word_A word_B rule(a sentence)
book pen "move the mouse towards the right"
Here is the structure of the code ( I removed unnecessary parts).
for trials in [data[x:x+7] for x in range(0, len(data), 7)]: % each 7 words are one block
b = expyriment.design.Block()
#################my comment##################
(??) I would like to represent the rule of the block here
################
for trial in trials:
t = expyriment.design.Trial()
stim1 = expyriment.stimuli.TextLine(text=trial[0], position=(0,200), text_size=32)
stim1 = expyriment.stimuli.TextLine(text=trial[1], position=(0,200), text_size=32)
canvas = expyriment.stimuli.Canvas(size=(600, 600))
stim1.plot(canvas)
canvas.preload()
t.add_stimulus(canvas)
b.add_trial(t)
exp.add_block(b)
for block in exp.blocks:
brt=block_rule.present() ## here I expect block rule
exp.clock.wait(2000-brt)
for trial in block.trials:
st=trial.stimuli[0].present()
response_keys, rt = exp.keyboard.wait.....
The blocks rule is in the "trial[2]". This rule is defined after where "b" is defined. looking back to how "exp.block" I could not figure out how I could mention the rule of the block before each block.
PS: I could define the rule of the block as an independent vector but it was interesting for me how I can do this using exp.blocks characteristic.
Any comments will be highly appreciated.
Thanks
Comments
Hi Juliette,
I might miss something, but isn't your rule accessible at
trials[0][2]
at that point?I also did not understand why you need it to be defined as part of the block. Is this for logging purposes? (In that case, you could just do
b.rule = trials[0]2]
).Best,
Florian
Dear Flad,
I could solve the problem with creating a list of rules and append it to the main list and zip it to the loop.
Thank you for your help
...