Hi Danielle,
This is the way the trialHandler works: you don't need to specify how many trials to run, as it assumes that you will want one trial for each row (so it assumes 24 iterations in this case).
nReps says how many times the file should be repeated. In this case, you should end up with 48 trials (not sure why you aren't, but that isn't a problem as it isn't what you want anyway).
In essence, you can get it to do what you want, but you need a second loop, and a way of terminating the trial handler early.
As I understand it, you have 24 possible pairs, but for any given run, you only want three of them to randomly sampled from those 24? But those three should themselves be shown four times.
So what you want is a trialHandler with nReps = 1, pointing to your xlsx file, and specified to be random. Nested within that, you want a *second* simple loop, which just repeats each trial four times. You also want a check so that your trial handler will end early (after just 3 trials rather than 24:
for trials in myTrialHandler:
# repeat each pair 4 times:
for repeatTrial in range(4):
# draw the stimuli
# get a response, etc
# but only do 3 of the possible 24 pairs:
if myTrialHandler.thisN() == 3:
myTrialHandler.finished=True # terminate early
The above is all pseudo code but hopefully shows you the structure you need.
All this assumes you are using Coder. I think you are but if not there is a page here on terminating loops in Builder:
<
http://www.psychopy.org/recipes/builderTerminateLoops.html>
PS do you really have a line saying "OOO_trialList=data.importConditions('OOO.xlsx')"?
Python doesn't accept variables beginning with numbers.
On 2 May, 2013, at 07:58, Danielle Penny <
dpen...@gmail.com> wrote:
> Hello all,
>
> I'm designing an experiment where 3 pairs of images are selected from a list of 24 total pairs. These 3 image pairs are shown in a loop which repeats 4 times. The list of image pairs is stored in an xlsv file; to retrieve them, I defined the trialList as <"OOO_trialList=data.importConditions('OOO.xlsx')"> then in the loop coded <imageA.setImage(StimA)>, where StimA is the title of a column in the spreadsheet. Right now the loop works, and successfully choses 3 image pairs. However, the loop repeats 25 times rather than 4. I believe this is because there are 25 rows in the Excel sheet (no where in my code do I specify the number 25). nReps is currently defined as 2, but seems to have no effect. Any ideas on how to change this? Thank you.
> Best, Danielle
--
Michael R. MacAskill, PhD
michael....@nzbri.org
Research Director,
New Zealand Brain Research Institute
66 Stewart St
http://www.nzbri.org/macaskill
Christchurch 8011 Ph:
+64 3 3786 072
NEW ZEALAND Fax:
+64 3 3786 080