It looks like you're new here. If you want to get involved, click one of these buttons!
I am currently looking for a flicker fusion task. Did someone already program such a task and is willing to share it?
@sebastiaan: Jan told me to put it here. Maybe you can help me out?
If I understand correctly, you basically want to show two patches of a different colour in very rapid succession, right? The script below should get you started. It's not a full experiment, but you can add this script to your trial_sequence, and adjust it to fit your experiment.
For more info, see also:
There's much bigger issues in the world, I know. But I first have to take care of the world I know.
Well eventually the idea is to let participant give the opportunity to adjust the luminance of two stimuli (which are important in the experiment) so that they match the perception of isoluminance. Much like as in this example: http://lite.bu.edu/vision-flash10/applets/Color/Isoluminance/Isoluminance.html
I have seen versions like these on ePrime. However, I wanted to use OpenSesame. Yet, I do not really know how to programme interactive elements in python/OpenSesame that allow live adjustments like you can see in the example...
So my idea was to do it with a inline script goes like this:
while not [certain button pressed]
your script to let it flicker
if [certain button pressed]
Ah, I see. Here's a simple example that allows you to change the luminosity of the two patches with the up and down keys, and accept the colours by pressing space.
The colours are in HSV space, which means that they are defined in terms of hue, saturation, and luminosity. That's obviously convenient in this case, because you want to adjust only the luminosity (I assume). Recommended reading:
Furthermore, if you do not have much experience with programming in Python yet, there are some very good tutorials that are easy to do and will get you started in no time:
Thanks! But I get this error:
Error: Inline script error
In: part1_flickerfusion (run phase)
File "psychopy\visual.pyo", line 2319, in draw
AttributeError: PatchStim instance has no attribute 'rgb'
Full traceback in debug window
I see, that's probably a bug/ difference due to the older version of PsychoPy that is included with 0.26. With 0.27 pre-releases it should work. If you want to stick to 0.26, I would bring this up on the PsychoPy mailinglist, as it's a separate project from OpenSesame (although you can use them together, of course).
so I implemented the whole stuff in the new pre-release. However, the pre-release creates new bugs. Such as that the other parts of my experiment won't do it anymore (e.g. it does not react to keypresses anymore). Is there a work around that maybe does not need the PsychoPy engine?
However, the pre-release creates new bugs. Such as that the other parts of my experiment won't do it anymore (e.g. it does not react to keypresses anymore).
There are slight differences between 0.26 and 0.27, but your experiment should be portable virtually without modification. The pre-releases are at this point less buggy than 0.26 was, so my recommendation would be: Find out why your experiment doesn't respond with 0.27 as it did with 0.26, and go with that. It's probably something trivial and easy to resolve, although from here I cannot say what (perhaps something with the allowed keys?).
Of course, you can write a similar script without PsychoPy, but in this case I wouldn't recommend it: For generating stimuli on the fly and for these types of psychophysical tasks (with colour spaces etc), PsychoPy is really the best option. If you want to explore other options, I would again recommend first walking through a Python tutorial, such as A Byte of Python. Once you get the hang of it, scripts such as the one I posted above are very easy to make, and it will give you a lot of freedom.
Please invest a bit of effort to understand the program and learn (a bit) of Python scripting! This will certainly pay off in the long rung.
thanks for the advice. Really appreciate the help!
I have to say though, it is sometimes beyond 'a bit of effort' to differentiate why e.g. a certain thing does stop working by switch from one version to another version of a program.
I will try to find the error if it is one! Thanks!
Right, based on the file you sent me the problem is clear. There are actually two things. The first is that you continuously poll the keyboard by setting a very low timeout:
my_keyboard = keyboard(self.experiment, keylist=allowedkeys, timeout=0)
In general this is fine, although it wasn't completely clear to me why you implemented your own timeout routine (but there might be a reason). But, as you yourself pointed out, the timeout behaviour was a bit weird before, in the sense that the timeout specified the highest allowed response time. I changed this, so that the timeout now is the lowest non-allowed response time. Therefore, setting a 0ms timeout now always times out.
The other point is a change in how get_key() returns keys. Before, it returned a keycode, and you had to use to_chr() to convert it to a character. This was a bit unnecessary, so now get_key() returns a character straight away. to_chr() is still there, but it doesn't do anything. A timeout is reported as the value None. So in your case, you would check for a timeout as follows:
pressed, presstime = my_keyboard.get_key()
if pressed != None:
( .... )
Does that make sense? The timeout behaviour is the only (intentional) backwards incompatibility with 0.26, and it happened to affect your experiment. I don't like break to compatibility, but in this case I felt it was necessary because the to_chr() function was too unintuitive.
Furthermore, you mentioned that line elements sometimes look a bit off, using PsychoPy. This is because OpenGL is used to draw the display, and it's a bit unpredictable on the (sub)pixel level. In general it looks fine though. If you find it annoying, you could use a bitmap or a circle?
Finally, I can imagine that your experiment is a bit slow when saving, because it's so long. Performance of the GUI is a known problem with large experiments, see this post. There's at this point not much that I can do about it, but you could split up your experiment, at least for development?
Yes, makes sense. That fixed all my issues. Works properly now.
Big thanks, really appreciate it!!!
It's been a while now since you wrote the script, but do you still have it and would you accept to share it with me ? I am trying to make exactly the same task, but my skills in Python are quite limited and I am stucked for the moment...
I would really appreciate it ! Thanks,
The script that Michel has was written for a much older version of opensesame and probably wouldn't run with the current one. If you give me a detailed description of what exactly your flicker-fusion task should include, I can make you a little template that you can tweak to your liking. In the mean time, you could consider doing a few python tutorials. It's really worth the invested time!
Check for example these resources here: http://osdoc.cogsci.nl/3.2/manual/python/about/#learning-python