Independent random sequences?

2145 views
Skip to first unread message

andrewp

unread,
Mar 21, 2012, 5:17:14 PM3/21/12
to psychopy-users
Hi,

I am wondering if there is a way to have two random sequences that
pull from the same ref file be independent of one another. I have a
routine in which an object appears, and then a number. The routine is
set to random, but for whichever object is chosen randomly, the
number that appears next is always the one adjacent to the object in
the ref file. For example, if my ref file looks like this:

1 A
2 B
3 C
4 D

Then, one is always accompanied by A, 2 by B, and so on. Is there a
way to fix this in the builder?

Thanks!
Andrew

Andrew Poppe

unread,
Mar 21, 2012, 5:28:53 PM3/21/12
to psychop...@googlegroups.com
Add a code component at the beginning of the file that creates the order file at each run of the task. Something like this:

import random
import csv

first=[1,2,3,4]
second=["A","B","C","D"]

firstRand=random.sample(first,len(first))
secondRand=random.sample(second,len(second))

with open('order_file.csv','wb') as w:
  write=csv.writer(w)
  writer.writerow(['first','second'])
  for i in range(len(first)):
    writer.writerow([first[i],second[i]])



Then, you put order_file.csv in the loop dialog box as your order file.


Hope this helps,


Andrew Poppe




--
You received this message because you are subscribed to the Google Groups "psychopy-users" group.
To post to this group, send email to psychop...@googlegroups.com.
To unsubscribe from this group, send email to psychopy-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/psychopy-users?hl=en.


Andrew Poppe

unread,
Mar 21, 2012, 5:35:01 PM3/21/12
to psychop...@googlegroups.com
Apologies, the last line was in error.

import random
import csv

first=[1,2,3,4]
second=["A","B","C","D"]

firstRand=random.sample(first,len(first))
secondRand=random.sample(second,len(second))

with open('order_file.csv','wb') as w:
  write=csv.writer(w)
  writer.writerow(['first','second'])
  for i in range(len(firstRand)):
    writer.writerow([firstRand[i],secondRand[i]])


Andrew Poppe

Graduate Student, Clinical Science and Psychopathology Research Program
University of Minnesota
N427 Elliott Hall
75 E. River Rd.
Minneapolis, MN 55455

Popp...@UMN.edu

Vikki

unread,
Jun 27, 2012, 11:36:02 AM6/27/12
to psychop...@googlegroups.com
Thank you for this post, however, I cannot seem to get the code to work in my experiment, could you be more specific about where it goes etc? Please :)

Thank you,

Vikki 
To post to this group, send email to psychopy-users@googlegroups.com.
To unsubscribe from this group, send email to psychopy-users+unsubscribe@googlegroups.com.

Andrew Poppe

unread,
Jun 27, 2012, 12:15:36 PM6/27/12
to psychop...@googlegroups.com
Hi, 

Apparently there is another typo in that code (apologies, I wrote that out quickly). The line that says write=csv.writer(w) should say this instead:

writer=csv.writer(w)

So, if you define first and second to be your actual stimuli (or whatever you're randomizing), this should work. You should put the code into the part of a code component that gets run at the beginning of the experiment. 

I have attached a demo builder script that takes a list of stimuli from a csv, randomizes the order independently, and then saves the new order file using the participant number and session number so they don't get overwritten. Hopefully it helps.


Andrew Poppe
Graduate Student 
Clinical Science and Psychopathology Research Program
University of Minnesota


To post to this group, send email to psychop...@googlegroups.com.
To unsubscribe from this group, send email to psychopy-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/psychopy-users/-/J4BgE1me5h8J.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

original_list.csv
example_script2.psyexp

Vikki Kroll

unread,
Jun 27, 2012, 3:37:48 PM6/27/12
to psychop...@googlegroups.com
Hi Andrew,

That is really helpful, thank you very much 

Much appreciated!
Kind Regards,
Vikki 
338.gif

Vikki

unread,
Jul 30, 2012, 12:16:16 PM7/30/12
to psychop...@googlegroups.com, vikki...@googlemail.com
Hi Andrew,

I have used the code you kindly posted, however, I am trying to get psychopy to display images (two different stimulus pictures) not words from a word list and I am getting this error message "IOError: Found file '_001_order1.csv' [= /Users/victoriakroll/Desktop/PhD_Exp_4/Exp-Data From Discussion/_001_order1.csv] but it failed to load as an image" - i am guessing this is because the lists in my csv file are directions to where my stimulus picture is (e.g. ./stim/P1FB.png), rather than a word displayed on the screen. Essentially I want my experiment two display two images at the same time, but I want it to pick these images at random, is there a way to do this simply using the builder?

Thank you,
Kindest Regards,
Vikki 
To view this discussion on the web visit https://groups.google.com/d/msg/psychopy-users/-/J4BgE1me5h8J.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "psychopy-users" group.
To post to this group, send email to psychopy-users@googlegroups.com.
To unsubscribe from this group, send email to psychopy-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Michael MacAskill

unread,
Jul 30, 2012, 8:57:19 PM7/30/12
to psychop...@googlegroups.com
Dear Vikki,

(1) That simply looks like you have put the name of your csv file in the "image" field of the stimulus rather than the name of the column WITHIN that csv file which contains your picture paths (preceded by a $ symbol).

(2) Yes, Builder can do what you want, following Andrew's suggestions.

Regards,

Michael

Vikki

unread,
Aug 2, 2012, 10:41:02 AM8/2/12
to psychop...@googlegroups.com
Hello,

I have used the code above and whilst it is randomly picking from my two lists, it is however always pairing my stimuli :

e.g say I have my two lists:
List one:         List Two:

Person1.jpg     Dog1.jpg
Person2.jpg     Dog2.jpg
Person3.jpg     Dog3.jpg
.....etc
it is always pairing Person1 with Dog1 and always pairing Person2 with Dog2 and so on and so forth. Is there a way to make it randomly pick one stimulus from list one and randomly pick another stimulus from list two?

Thank you,
Kindest Regards,
Vikki 

Michael MacAskill

unread,
Aug 2, 2012, 5:29:26 PM8/2/12
to psychop...@googlegroups.com
Dear Vikki,

This is the way PsychoPy works: it always cycles through an entire row in a given CSV file, whether that row is chosen sequentially or randomly. The way to get around this to achieve what you want is to implement the code usefully provided by Andrew Poppe a number of times on this list (and even before in this thread?)

i.e. his code will read in your CSV file prior to the experiment, randomly shuffle the two lists independently, and then save the shuffled file back to disk. PsychoPy will still cycle through entire rows, but the shuffling now means that the stimuli are not paired across runs. And then it doesn't actually matter whether PsychoPy loops through the rows randomly or sequentially, as they are shuffled anyway.

Regards,

Michael



On 3 Aug, 2012, at 02:41, Vikki wrote:

> Hello,
>
> I have used the code above and whilst it is randomly picking from my two lists, it is however always pairing my stimuli :
>
> e.g say I have my two lists:
> List one: List Two:
>
> Person1.jpg Dog1.jpg
> Person2.jpg Dog2.jpg
> Person3.jpg Dog3.jpg
> .....etc
> it is always pairing Person1 with Dog1 and always pairing Person2 with Dog2 and so on and so forth. Is there a way to make it randomly pick one stimulus from list one and randomly pick another stimulus from list two?
>
> Thank you,
> Kindest Regards,
> Vikki

--
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










Vikki

unread,
Aug 3, 2012, 10:59:12 AM8/3/12
to psychop...@googlegroups.com
Hi Michael,

Thank you for your response, I had a play around with it and it is now picking the two stimuli at random which is great. 

However, I now have another problem, this being that I also have other things going on within each trial, such as a having a background and a random changing of the position of the two stimuli, additionally the trial is followed by the brief presentation of a grey screen. Normally i'd set this up by creating columns within the conditions file where you define stimuli, and would use the '$' to direct psychopy to that column. However, now the conditions file (filename1) is created prior to the trial, to create the random order for the two main stimuli.

So how do I now get the trial to run my other things such as a background/changing positions for my stimuli if I can't define it in my conditions file as I normally would? In the loop bit where you select your conditions file now it says' filename1', rather than the excel/csv sheet in which i'd normally create with all columns defining some part of the experiment, e.g. background stimulus, or stimulus location coordination.  As far as i'm aware you can't have two condition files for the same trial can you? 

How did I go about solving this issue?

Thank you for your help, it's most appreciated, as a novice psychopy is quite overwhelming.
Regards,
Vikki 

On Thursday, August 2, 2012 10:29:26 PM UTC+1, Michael MacAskill wrote:
Dear Vikki,

This is the way PsychoPy works: it always cycles through an entire row in a given CSV file, whether that row is chosen sequentially or randomly.  The way to get around this to achieve what you want is to implement the code usefully provided by Andrew Poppe a number of times on this list (and even before in this thread?)

i.e. his code will read in your CSV file prior to the experiment, randomly shuffle the two lists independently, and then save the shuffled file back to disk.  PsychoPy will still cycle through entire rows, but the shuffling now means that the stimuli are not paired across runs.  And then it doesn't actually matter whether PsychoPy loops through the rows randomly or sequentially, as they are shuffled anyway.

Regards,

Michael



On 3 Aug, 2012, at 02:41, Vikki wrote:

> Hello,
>
> I have used the code above and whilst it is randomly picking from my two lists, it is however always pairing my stimuli :
>
> e.g say I have my two lists:
> List one:         List Two:
>
> Person1.jpg     Dog1.jpg
> Person2.jpg     Dog2.jpg
> Person3.jpg     Dog3.jpg
> .....etc
> it is always pairing Person1 with Dog1 and always pairing Person2 with Dog2 and so on and so forth. Is there a way to make it randomly pick one stimulus from list one and randomly pick another stimulus from list two?
>
> Thank you,
> Kindest Regards,
> Vikki

--
Michael R. MacAskill, PhD                michael.maca...@nzbri.org

Michael MacAskill

unread,
Aug 5, 2012, 6:23:28 PM8/5/12
to psychop...@googlegroups.com

On 4 Aug, 2012, at 02:59, Vikki wrote:
> Thank you for your help, it's most appreciated, as a novice psychopy is quite overwhelming.
It seems like you have a handle on things, but you're pushing up against something that the Builder just isn't set up to do: the idea that some variables need to be randomised within a row/trial rather than just randomising the order of entire rows/trials. So the solution is a bit complex.

The question has come up a few times, though, so perhaps we need to think about a way of building in this capacity directly into PsychoPy. In the meantime, I'd suggest extending Andrew Poppe's solution as described below.

> However, I now have another problem, this being that I also have other things going on within each trial, such as a having a background and a random changing of the position of the two stimuli, additionally the trial is followed by the brief presentation of a grey screen. Normally i'd set this up by creating columns within the conditions file where you define stimuli, and would use the '$' to direct psychopy to that column. However, now the conditions file (filename1) is created prior to the trial, to create the random order for the two main stimuli.
>
> So how do I now get the trial to run my other things such as a background/changing positions for my stimuli if I can't define it in my conditions file as I normally would? In the loop bit where you select your conditions file now it says' filename1', rather than the excel/csv sheet in which i'd normally create with all columns defining some part of the experiment, e.g. background stimulus, or stimulus location coordination. As far as i'm aware you can't have two condition files for the same trial can you?
I don't have time to test any of this just at the moment, so it is highly likely to not work without some debugging. And I'm sure someone else could come up with a general solution rather than one tied to your specific variables.

First I would suggest creating a single CSV file which contains all of your variables, e.g. with a header row like:

image1, image2, background, position1, position2

Then, modifying Andrew's code, we can read in that file, shuffle just the first two variables, and then save the whole thing back to disk in a new file (which you will use in your Builder loop):


import random
import csv

f = csv.reader(open('original_file.csv'))
image1, image2, background, position1, position2 = zip(*f)

image1rand = random.sample(image1,len(image1))
image2rand = random.sample(image2,len(image2))

with open('shuffled_file.csv','wb') as w:
writer = csv.writer(w)
writer.writerow(['image1', 'image2', 'background', 'position1', 'position2'])
for i in range(len(image1rand)):
writer.writerow([image1rand[i], image2rand[i], background[i], position1[i], position2[i]])




--
Michael R. MacAskill, PhD michael....@nzbri.org

Jonathan Peirce

unread,
Aug 6, 2012, 4:23:39 AM8/6/12
to psychop...@googlegroups.com
Vikki,

You can also create/change variables with Code Components at any point
in the experiment. So if you're needing to randomise the location of a
stimulus on each trial you could add a code component that, at the start
of a trial created a variable like;
picPos = [random()*2, random()*3]
and then set your stimulus position to e.g. $picPos
You'd probably want to save this too in your data files by doing
trials.addData('picPosition',picPos)
That will add a column called picPosition to your data file and insert
the picPos value in it.

it sounds like your experiment is varying an awful lot of things in one
go though. The sort of things that most GUI-driven packages couldn't
achieve. You might want to start thinking about how to write scripts
instead...?

Jon
Jonathan Peirce
Nottingham Visual Neuroscience

http://www.peirce.org.uk


This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.

Jonathan Peirce

unread,
Aug 6, 2012, 4:28:17 AM8/6/12
to psychop...@googlegroups.com
And actually, if you really don't need to save the variable in your data
file you don't even need to create it - you can create the value
on-the-fly within the stimulus entries by setting, say, position to be
$[random()*2, random()*3]

By the way, I didn't explain the line with the random values, but that's
simply creating a random value between 0 and 2 for the X position and
another between 0 and 3 for the Y.

Jon

lau fan

unread,
Apr 20, 2014, 12:55:31 PM4/20/14
to psychop...@googlegroups.com
Is there any way to create a random sequence of images with the image stimulus entries? 
For example, the head row is like :

image1  image2   image3, which indicate 3 types of image paths.

If I want the "image2" variable to be randomly presented and keep "image1" and "image3" paired, I can just type something like "random.sample($image2, len($image2))".

在 2012年8月6日星期一UTC+8下午4时28分17秒,Jon写道:

lau fan

unread,
Apr 20, 2014, 1:32:31 PM4/20/14
to psychop...@googlegroups.com
Hi, I used your modified code to shuffle one of my 3 variables. But something went wrong.

My original head row looks like this:

path1

path2

path3

aligned

congruent

corr

same_target

I want to shuffle path2 while keeping path1 and path3 paired, so I modified your code into:
import random
import csv

f = csv.reader(open('conditions.csv'))
path1, path2, path3, aligned, congruent, corr, same_target = zip(*f)

path2rand1 = random.sample(path2, len(path2))
path2rand2 = random.sample(path2, len(path2))

with open('shuffledFirst.csv', 'wb') as w:
    writer = csv.writer(w)
    writer.writerow([path1, path2, path3, aligned, congruent, corr, same_target])
    for i in range(len(path2rand1)):
        writer.writerow([path1[i], path2rand1[i], path3[i], aligned[i], congruent[i], corr[i], same_target[i]])

with open('shuffledSecond.csv', 'wb') as w:
    writer = csv.writer(w)
    writer.writerow([path1, path2, path3, aligned, congruent, corr, same_target])
    for i in range(len(path2rand2)):
        writer.writerow([path1[i], path2rand2[i], path3[i], aligned[i], congruent[i], corr[i], same_target[i]])

The code did generate two condition files with the path2 values shuffled. But the typography of the csv file is somehow not right. Variable names are not all at the top row and there are also other mistakes. The original condition file and the two shuffled files are attached. 

Would you please take a look at the files and identify where the problem is ?



在 2012年8月6日星期一UTC+8上午6时23分28秒,Michael MacAskill写道:
Michael R. MacAskill, PhD                michael.maca...@nzbri.org
conditions.csv
shuffledFirst.csv
shuffledSecond.csv

Michael MacAskill

unread,
Apr 20, 2014, 5:43:16 PM4/20/14
to psychop...@googlegroups.com
You've done the complicated stuff, well done. The remaining fixes should be simple.

On 21/04/2014, at 5:32 AM, lau fan <firewo...@gmail.com> wrote:
> writer.writerow([path1, path2, path3, aligned, congruent, corr, same_target])

I think that line of code is supposed to just write out the names of the variables in a header row, but you are asking it to write out the variables themselves. Try putting quotes around those names so that actual literal text gets written, rather than the variable contents. e.g.

writer.writerow(['path1', 'path2', 'path3', 'aligned', 'congruent', 'corr', 'same_target'])

But actually you'll notice that when you read in those variables from the file, they already have the header name in their first entry, so you don't need that line at all. If you look at the second line of your shuffled files, you'll see it contains the header names anyway.

The problem is for your shuffled columns: the header name gets shuffled just like it was a regular entry. So for example, in line 8 of column 2 of 'shuffledFirst.csv', you have the text 'path2' instead of an actual path, and vice versa for what should be the header name.

So a solution could be to remove the first cell of each column to be randomised before it gets shuffled, and then put it back in: e.g.

header = path2.pop(0) # remove the header item
shuffle(path2) # randomise the actual values (simpler than random.sample)
path2.insert(0, header) # restore the header at the top

And just delete the first 'writer.writerow(…' line. You don't need it any more, as the variables contain their own headers in their top entry.

You can also delete the 'import random' line, as Builder automatically imports the shuffle function from numpy.random



Regards,

Mike

lau fan

unread,
Apr 20, 2014, 10:49:09 PM4/20/14
to psychop...@googlegroups.com
I really appreciate your help. It finally worked.
However, the path2 is originally a tuple object and I need to convert it into a list. I only learned a little Python last year and here is my modified code in case someone else need it.

import csv

f = csv.reader(open('conditions.csv'))
path1, path2, path3, aligned, congruent, corr, same_target = zip(*f)

path2 = list(path2) # convert the tuple to a list to make it editable
header = path2.pop(0) # remove the header item 
shuffle(path2) # randomise the actual values (simpler than random.sample) 
path2.insert(0, header) # restore the header at the top 
 
with open('shuffled_file1.csv', 'wb') as w:
    writer = csv.writer(w)
    for i in range(len(path2)):
        writer.writerow([path1[i], path2[i], path3[i], aligned[i], congruent[i], corr[i], same_target[i]]) 

header = path2.pop(0)
shuffle(path2)
path2.insert(0, header)

with open('shuffled_file2.csv', 'wb') as w:
    writer = csv.writer(w)
    for i in range(len(path2)):
        writer.writerow([path1[i], path2[i], path3[i], aligned[i], congruent[i], corr[i], same_target[i]])

With this code, I generated two shuffled condition files which allow the 'path2' variable to be randomized while keeping 'path1' and 'path2' paired. (Maybe it is not the most efficient way).

Again, thank you for your help.

在 2014年4月21日星期一UTC+8上午5时43分16秒,Michael MacAskill写道:

Michael MacAskill

unread,
Apr 20, 2014, 10:54:55 PM4/20/14
to psychop...@googlegroups.com

On 21/04/2014, at 2:49 PM, lau fan <firewo...@gmail.com> wrote:

> However, the path2 is originally a tuple object and I need to convert it into a list. I only learned a little Python last year and here is my modified code in case someone else need it.

Ahh, that was why you were sampling rather than shuffling. Great that you have it working.

Cheers,

Michael

>

shradhanjali tripathi

unread,
Oct 10, 2014, 1:33:54 PM10/10/14
to psychop...@googlegroups.com


hi, i am trying to present gabor patches as stimulus at four different locations in the periphery instead of the center. how can i change the stimulus display at prefixed locations as well as orientation should also be randomly changing.


help would be appreciated
shreya. 

Brian Drwecki

unread,
Jan 9, 2015, 5:20:07 PM1/9/15
to psychop...@googlegroups.com

I just really wanted to thank Andrew P for doing this.  Your code made my life so much easier. Thank you so much for making a difficult job so much easier! 

Giulia

unread,
Mar 12, 2015, 6:40:15 AM3/12/15
to psychop...@googlegroups.com
Hi,
I am a beginner of PsychoPy and I would really need help with my experiment:
I have two list of auditory and visual stimuli, for example:

sounds          pictures
sound1          pic1
sound2          pic2
sound3          pic3

I need to randomize the order of the stimuli, but the pairs must be kept, for example:
sound3-pic3
sound1-pic1
sound2-pic2

I created a xlsx file (specifying for each file the extension: wav and bmp) with the lists and I browsed it in the "trials properties conditions".
I used the code suggested above in the "each frame" section of the code, changing "csv" with "xlsx", as shown below:
import random
import xlsx

first=[caldo.wav,molti.wav,stampa.wav]
second=["caldo_lista1parola18.bmp","molti_lista1parola1.bmp","stampa_lista1parola2.bmp"]

firstRand=random.sample(first,len(first))
secondRand=random.sample(second,len(second))

with open('order_file.xlsx','wb') as w:
  writer=xlsx.writer(w)
  writer.writerow(['first','second'])
  for i in range(len(firstRand)):
    writer.writerow([firstRand[i],secondRand[i]])

but it doesn't work! For sure I made some mistakes...please help me!
Thanks!
Giulia

Michael MacAskill

unread,
Mar 12, 2015, 4:55:11 PM3/12/15
to psychop...@googlegroups.com
Hi Giulia,

Welcome aboard.
> I am a beginner of PsychoPy and I would really need help with my experiment:
> I have two list of auditory and visual stimuli, for example:
>
> sounds pictures
> sound1 pic1
> sound2 pic2
> sound3 pic3
>
> I need to randomize the order of the stimuli, but the pairs must be kept, for example:
> sound3-pic3
> sound1-pic1
> sound2-pic2

You're overthinking it ;-)
PsychoPy does this for you automatically. Create a loop in Builder, link it to your Excel file containing the sounds and pictures columns above, and set the loop to be "random".

What this does is randomly sort the order of rows while keeping the entries in each column paired, as you require.

Regards,

Michael


Giulia

unread,
Mar 13, 2015, 8:54:41 AM3/13/15
to psychop...@googlegroups.com
Dear Michael,
thank you so much!!! It works perfectly!
I have just another question: I need to record responses by the keyboard during the visual stimuli display, so I added this element in "responses"(specifying the right answer on each row of the stimuli list in the excel file)...but I can't find the relative data from that (wich key was effectively pushed and times). I think I read that there is the possibility to obtain an excel file with these responses....but how???
Thanks in advance!
Giulia

Michael MacAskill

unread,
Mar 15, 2015, 3:42:28 PM3/15/15
to psychop...@googlegroups.com
PsychoPy saves all of this data for you automatically. Look in the folder where your experiment (i.e. .psyexp) file is and you'll find a folder there called "Data". The .csv file is probably the best option for you to use.

Regards,

Michael

Giulia

unread,
Mar 16, 2015, 4:49:23 AM3/16/15
to psychop...@googlegroups.com
Dear Michael,
thank you again for your help! In the Data folder I found only: some "text documents" and "PSYDAT files"...should I convert these formats in .csv or excel fies? And how?
Thanks, sorry for bothering!
Best,
Giulia

Giulia

unread,
Mar 16, 2015, 5:58:06 AM3/16/15
to psychop...@googlegroups.com
...I figured out how to do that: flagging excel file in the "experiment setting"
Thank you for your help!
Best,
Giulia

Jonathan Peirce

unread,
Mar 16, 2015, 6:31:37 AM3/16/15
to psychop...@googlegroups.com
Actually Giulia, I would recommend leaving that off. The file you want is the one labelled "csv file (trial-by-trial). Although your operating system might refer to the csv file as a text file (it is just text with commas to separate each cell) it can still be opened with excel. So look for a file that ends in csv and use that.

cheers
Jon
--
You received this message because you are subscribed to the Google Groups "psychopy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to psychopy-user...@googlegroups.com.
To post to this group, send email to psychop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/psychopy-users/154b68c7-c999-49d8-a31b-7612a9a25fd0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
Jonathan Peirce
University of Nottingham

http://www.peirce.org.uk


This message and any attachment are intended solely for the addressee
and may contain confidential information. If you have received this
message in error, please send it back to me, and immediately delete it. 

Please do not use, copy or disclose the information contained in this
message or in any attachment.  Any views or opinions expressed by the
author of this email do not necessarily reflect the views of the
University of Nottingham.

This message has been checked for viruses but the contents of an
attachment may still contain software viruses which could damage your
computer system, you are advised to perform your own checks. Email
communications with the University of Nottingham may be monitored as
permitted by UK legislation.

Giulia

unread,
Mar 16, 2015, 2:00:34 PM3/16/15
to psychop...@googlegroups.com
Thank you very much for your suggestion Jon! I will follow it for sure!
Best,
Giulia

Daniel Rueda

unread,
Mar 14, 2016, 12:02:50 PM3/14/16
to psychopy-users
Hello,

I am also new to PsychoPy and I have never used code.
I am creating an experiment with Builder View where two images appear at the same time: LC and HC (one left and one right)

1. The images appear always paired up (not independent) I saw the code from Andrew but I am not sure which part applies to me as he used a cvs file. I want the images independent.

2. Is there a way to randomize the right and left position of the images but still having an image left and another one right and also not paired up?

  Example:
LC   HC
HC  LC
HC  LC
LC  HC

 

Thank you for your help!

Daniel
conditions.xlsx
example_segundo_ensayo des.psyexp

Michael MacAskill

unread,
Mar 14, 2016, 4:28:02 PM3/14/16
to psychop...@googlegroups.com
Dear Daniel,

> 1. The images appear always paired up (not independent) I saw the code from Andrew but I am not sure which part applies to me as he used a cvs file. I want the images independent.

You just need to export your conditions file to .csv, and try to implement Andrew Poppe's code.

> 2. Is there a way to randomize the right and left position of the images but still having an image left and another one right and also not paired up?
Yes. Perhaps just come back to us when you have the step above implemented.

Regards,

Michael

--
Michael R. MacAskill, PhD 66 Stewart St
Research Director, Christchurch 8011
New Zealand Brain Research Institute NEW ZEALAND

Senior Research Fellow, michael....@nzbri.org
Te Whare Wānanga o Otāgo, Otautahi Ph: +64 3 3786 072
University of Otago, Christchurch http://www.nzbri.org/macaskill

Reply all
Reply to author
Forward
Message has been deleted
0 new messages