Discard previous

Hey !

I’m a new user of PsychoPy.

I would like to have some details about what does the option ‘‘discard previous’’ allow to ?

Aurore

Hi @ameugnot, if you are talking about the options for the Keyboard component, it allows the user to choose whether or not to discard all keyboard events that occured before the onset of the keyboard component. It is usually something you want, so is selected by default.

ok thank you for your reply.

I have another question - really basic - I’m sorry I’m not at ease with informatic programming .

I’m trying to display my image - but, what i understand is that i need to declare all my image and condition of the experiment in a file .xsl.
How to organize this file ? At this moment, i just what to present an image - following by a keyboard response (either k or l depending of whether the image is a right or a right hand).
This condition file must be in the file containing my images ?

If you can explain the procedure step by step it will be helpul ! thank

Aurore

No problem. The image component documentation for Builder is here.

Organising stimuli

First, put your images in a folder, in this example the folder is called ‘stim’. This folder should be in the same folder as your Psychopy experiment file.

Creating conditions file

Create an Excel file called ‘condtions’, or anything you want (no spaces in the name). In your Excel file, you will want a column with a name, e.g., ‘myImage’. The rows in the Excel sheet will be your trials. In each row, add the path to an image, so you will use the path to the image relative to the experiment file e.g., stim/myimage.png.

Adding loop

You will need to create a loop in your experiment, and upload the conditions Excel sheet to the loop in the ‘Conditions’ parameter, using the ‘Browse’ button.

Presenting your image

To present your image, add an image component, and use the variable name from your Excel file to present youR image, in this example $myImage. Order of presentation is determined in the loop - i.e., random, sequential, etc.

thank you for your answer.

could you precise me where i have to store the condition Excel file. in or out the image folder ?

also, i have this error message :

Running: /Users/auroremeugnot/Desktop/Tâche_Adrien/essai_lastrun.py

2018-10-26 11:51:42.221 python[74754:148815] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/zt/9mksdktd3693txs7v1jzgw200000gn/T/org.psychopy.PsychoPy3.savedState
Traceback (most recent call last):
File “/Users/auroremeugnot/Desktop/T\xe2che_Adrien/essai_lastrun.py”, line 95, in
texRes=128, interpolate=True, depth=0.0)
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/visual/image.py”, line 102, in init
self.setImage(image, log=False)
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/visual/image.py”, line 301, in setImage
setAttribute(self, ‘image’, value, log)
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/tools/attributetools.py”, line 141, in setAttribute
setattr(self, attrib, value)
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/tools/attributetools.py”, line 32, in set
newValue = self.func(obj, value)
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/visual/image.py”, line 288, in image
forcePOW2=False)
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/visual/basevisual.py”, line 813, in _createTexture
logging.flush()
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/logging.py”, line 300, in flush
logger.flush()
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/logging.py”, line 286, in flush
target.write(formatted[thisEntry] + ‘\n’)
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/logging.py”, line 206, in write
stream.write(txt)
UnicodeEncodeError: ‘ascii’ codec can’t encode character ‘\xe2’ in position 67: ordinal not in range(128)
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/logging.py”, line 300, in flush
logger.flush()
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/logging.py”, line 286, in flush
target.write(formatted[thisEntry] + ‘\n’)
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/logging.py”, line 206, in write
stream.write(txt)
UnicodeEncodeError: ‘ascii’ codec can’t encode character ‘\xe2’ in position 67: ordinal not in range(128)

Do you know where is the problem and how to fix it ?

Do any of your image names have spaces, or accented characters?

Also, if you have copied and pasted some of the lines in the excel file, there may be problems interpretting things like apostrophies.

thank for your advice.
i have fix one aspect of the problem…it was juste because i was using “” instead of “/” when i named my image.

it work when displaying one image so i will now try to insert a loop.

thank you very much for helping ! it is comforting to have support - even if i will try to search more by myself before asking you ! :slight_smile:

1 Like