Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[solved] Looking for a flicker-fusion task

edited November 2012 in OpenSesame

Hi guys,

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?


  • edited 5:16AM

    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:

    Good luck!

  • edited 5:16AM

    Hi sebastiaan,

    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:

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

  • edited October 2012

    So my idea was to do it with a inline script goes like this:

    while not [certain button pressed]
    draw patch1
    draw patch2
    while [flickering]
    your script to let it flicker
    if [certain button pressed]
    change col1

    You've might already spot the problem: How do I get a live update on whether the PP pressed a button without a e.g. keyboard response item?
  • edited 5:16AM

    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:


    Good luck!

  • edited October 2012

    Thanks! But I get this error:

    Error: Inline script error
    In: part1_flickerfusion (run phase)
    File "psychopy\visual.pyo", line 2319, in draw Python traceback:
    AttributeError: PatchStim instance has no attribute 'rgb' Full traceback in debug window
  • edited 5:16AM

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


  • edited 5:16AM

    Hi Sebastiaan,

    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?

  • edited October 2012
    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.

  • edited 5:16AM

    Hey sebastiaan,

    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!

  • edited 5:16AM

    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?

  • edited 5:16AM

    Yes, makes sense. That fixed all my issues. Works properly now.

    Big thanks, really appreciate it!!!

  • Hello Michif,

    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,


  • Hi Laurie,

    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:


Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games