Howdy, Stranger!

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

Supported by

[solved] Recording responses during and after a displayed object

edited November 2013 in OpenSesame

Hi Sebastiaan,

I am trying to re-create an old E-prime Flanker task where an object was displayed for 120ms. In E-prime the display properties allowed independent settings of the duration (120ms) and time-limit (2000ms) for responses. This would then record a response value of between 0-2000ms without using a timeout feature.

The nearest I have found is here:-

How do I collect the keyboard_response after a stimulus disappears?
http://forum.cogsci.nl/index.php?p=/discussion/143/open-how-do-i-collect-the-keyboard_response-after-a-stimulus-disappears/p1

I need to ensure that the experiment length stays consistent.

Thanks

Anthony McGuffie

Comments

  • edited November 2012

    Hi Anthony,

    Just so we're on the same page: You want to present a target stimulus for 120ms, followed by a blank display (or a mask or something) and you want to collect a keyboard response from the start of the target stimulus with a timeout of 2000ms. Is that correct?

    I can think of two fairly easy ways to do this:

    Sequential approach

    You could use the following structure:

    • target (120ms duration)
    • blank (0ms duration)
    • keyboard_response (1880ms timeout)

    This simply assumes that subject will never press a key within 120ms, so there is no need to poll for responses while the target is on the screen. It's not very elegant perhaps, but I think it will work just fine.

    The parallel approach

    Edit: I should add, of course, that this plug-in is only available in 0.27. You can download the latest pre-release here. If you prefer to keep using 0.26, it is possible to copy the plugins/parallel folder from 0.27 to your 0.26 installation.

    The parallel plug-in allows you to run two items simultaneously. So you could start a keyboard_response, and at the same time start a sequence that presents your two displays. The parallel plug-in looks and works very similar to the sequence plug-in, except for the obvious difference that it executes items in parallel, rather than sequentially. Just to make things a bit clearer, here's a screenshot of the trial_sequence using the parallel plug-in:

    image

    The parallel plug-in is still new and somewhat experimental, so please let me know how it works for you!

    Cheers,
    Sebastiaan

  • edited 7:46AM

    Hi Sebastiaan,

    Where do I obtain the parallel plugin? Is it only available in pre-release?

    Thanks

    Anthony

  • edited 7:46AM

    Right, yes! I forgot to mention that (crucial) part: See my edit in the previous post.

  • edited 7:46AM

    Hi Sebastiaan,

    Did you manage to try out the above procedure? I am struggling to get it to work.

    I have tried it in v0.26 and v0.27-pre22.

    Please take a look at my test program here - https://www.dropbox.com/s/33qfgtlelr6zj7l/ParTest.opensesame

    It seems that the keyboard_response does not function in the parallel mode.

    Thanks

    Anthony McGuffie

  • edited 7:46AM

    Hi Anthony,

    You are correct: There's a Windows-specific issue in which the 'threads' (i.e. the software processes running in parallel) do not have access to the keyboard. So your experiment is fine, and it does work. Just not under Windows, which is annoying.

    The parallel plug-in will need to be fixed, obviously, so if you're not in a tremendous rush, I would wait until I get a chance to update this in the next pre-release, which should not be more than a few days. Until that time, I would suggest using the 'sequential approach' as I described above, which should be fine, certainly for testing purposes.

    Thanks for finding this bug!

    Cheers,
    Sebastiaan

  • edited November 2012

    Hi Sebastiaan,

    Thank you for looking into this. As I require accuracy, I will wait until the next pre-release.

    In the meantime whilst trying out the parallel functionality, i noticed that the media player plug-in has been removed from all the 0.27 pre-releases.

    Copying across this plug-in for testing it asks for a missing pyffmpeg module. Has this feature been removed on purpose?

    Thanks

    Anthony

  • edited 7:46AM

    Please see 0.27~pre24 (or later).

    The workaround is now that the first item in the parallel plug-in is not run as a thread, but in the main process. Therefore, you should be able to collect keypress responses, but only if you place the keyboard_response as the first item:

    image

    I hope to find a proper solution at some point, but for now this should work.

    In the meantime whilst trying out the parallel functionality, i noticed that the media player plug-in has been removed from all the 0.27 pre-releases. Copying across this plug-in for testing it asks for a missing pyffmpeg module. Has this feature been removed on purpose?

    I now package OpenSesame with Python 2.7 (before it was 2.6), which so far doesn't play nice with pyffmpeg. If we cannot get the media_player plug-in packaged with Python 2.7, I'll probably release a separate package with the media_player based on Python 2.6 (but not in the pre-release stage). In the long run, Daniel's plan is to retire the media_player in favour of a VLC-player based plug-in, but this isn't finished yet.

    Cheers!

  • edited January 2013

    Hi Sebastiaan,
    The parallel plugin works great in 0.27 on windows but I now need to use it on a MACs.

    It seems that the only MAC versions available are the 0.26 executable (without the plugin) and 0.27 source.

    What is the easiest way to run 0.27 with this plugin?

    Running from source seems very long winded way to load onto multiple MacBooks as I have a variety of student laptops with differing setups who require the program to be installed.

    Is the MAC 0.27 version about the be released?

    Thanks

    Anthony McGuffie

  • edited 7:46AM

    Hi Anthony,

    The Mac OS builds are created occasionally by Daniel, using a virtual machine. This is always a bit problematic, because none of the team has a development Mac and therefore we don't have any systematic way to build and test OpenSesame on Mac OS. So unfortunately I don't know whether there will be a Mac build for 0.27 in the near future.

    There are a number of options, though:

    1) You could run OpenSesame from source on a single Mac, and use this environment to build packages with the setup-mac.py script that is included with the source.

    python setup-mac.py py2app

    As I mentioned, the build process can be a bit painful, but if you are/ know of a Mac-savvy person, it's definitely a possibility. It's essentially a matter of getting all the correct Python modules installed, and then running the build script. If you succeed in building a package, please share :) !

    2) If it's just the parallel plug-in that you need, you could copy the plugins/parallel folder from the 0.27 source to the 0.26 package (to the subfolder that contains the plug-ins). Although I haven't tried this, I believe the parallel plug-in should work with 0.26 as well.

    Cheers,
    Sebastiaan

  • edited January 2013

    Packaging OpenSesame 0.27 for Mac is a bit problematic at the moment as this version doesn't work on my old source environment anymore, most likely because of outdated PyQt packages. I therefore need to rebuild this package and the whole source environment from scratch (as I also want to update the other dependencies), which will require some time. I hope to find a moment in the near future to do so.

    The easiest way to run OS from source on a Mac is still by using MacPorts, although the compilation of all the dependencies can take quite some time.

    Buy Me A Coffee

  • edited 7:46AM

    Sorry to drag an old post up, but it is a relevant addition (I think!).

    Regarding the experiment setup below:

    image

    My keyboard response isn't collecting responses. Whilst I can see from this thread that this has been a problem in the past, it seemed as though it was fixed (after a fashion)?

    I have tried arranging the parallel with the kb response at the top and at the bottom (top crashes OS, bottom doesn't collect but does allow exp to run).

    I have also tried a sequential approach, setting the blank at 0ms, but response collection needs to be possible for the 1200ms of the 'question_word' and 1400ms of the 'blank', so this doesn't really work (and doesn't collect responses anyway!).

    I can only think that the parallel plug-in is fixed for the built-in keyboard object, but perhaps not inline script keyboard objects?

    I'm at a dead-end in terms of solutions for this, any help would be received with enthusiasm!

    Thanks,

    Lee

    P.s. full script in pastebin

  • edited 7:46AM

    Hi Lee,

    Whether the parallel plug-in works is very system dependent, so it could well be that it simply doesn't work properly on your system. There is no systematic fix yet, unfortunately.

    Your structure seems fine to me, and using an inline_script instead of a keyboard_response to collect keypresses does not make any fundamental difference.

    What I would do is simply switch to a sequential structure, which should be possible in your case. For example, you could blank the screen after 1200 during the response collection, by slightly expanding the script:

    # (...)
    # Loop until we timeout:
    blank_canvas = canvas(exp)
    start_time = self.time()
    blank_shown = False
    while self.time() - timeout < start_time:
        if not blank_shown and self.time() - start_time > 1200:
            blank_shown = True      
            blank_canvas.show()
        key, key_time = my_keyboard.get_key()
    # (...)
    

    This way you can remove the blank sketchpad altogether, simply set the duration of the question_word sketchpad to 0, and have it be followed by the p_keyboard_response inline_script. Does that make sense?

    Cheers,
    Sebastiaan

  • edited 7:46AM

    That does make sense. I've placed it at the end of the keyboard response script and it seems to work. Still not collecting responses though... I suspect that is more a fault in the way I've connected/not connected the keyboard script into the rest of the experiment.

    Thanks for the loop though - timing is something I've not quite got to grips with yet!

    Best,

    Lee

  • edited 7:46AM

    Right, I have finally sorted this out... yay! Thanks for the pointers, it is now - solved!

    Best,

    Lee

  • edited 7:46AM

    Dear all,

    The parallel plugin works perfect when we run our experiment in the windowed mode. However, Opensesame freezes under fullscreen mode when parelel plugin starts. We would be very happy to hear your suggestions ?

    Many thanks for your help.

    Cumhur

  • edited 7:46AM

    The problem is now partially solved by choosing "no" option in the openGL window. But I am not sure if this would have a huge impact in the timing of an fMRI experiment.
    C

  • edited July 2014

    The problem is now partially solved by choosing "no" option in the openGL window. But I am not sure if this would have a huge impact in the timing of an fMRI experiment.

    The main difference is that you will no longer use a 'blocking flip', which means that you have some uncertainty about the moment at which a display is presented. The temporal error is at most one refresh duration, so 16.7 ms on a 60 Hz monitor.

    See also:

    Although it's usually desirable to use a blocking flip, for most purposes it's not really that important, because the temporal error is so small. But it depends on your specific experiment, of course.

    Cheers!
    Sebastiaan

  • edited 7:46AM

    Dear Sebastiaan,

    Many thanks for this kind reply, that was vey helpfull. I only have one more quesiton. In our case we use an LCD projector to show stimuli for our fMRI experiment. We use an ATI HD graphic card with dual monitor option. So my question is as far as I understand opensesame backends take the refresh rate of the monitor into account before the onset of the experiment. However, in our case we use both the monitor and the LCD projector. Do you have any recommendations that may help us to stay in the safe side ?

    Cheers!

    Cumhur

  • edited 7:46AM

    Hi,

    It's very difficult to say anything general about dual-monitor set-ups. It depends on the operating system, video drivers, and the type of monitor splitting that you're using (e.g., cloning, extended desktop. etc.). There are usually issues, though. For example, two monitors may not use the same refresh rate, and, even if they do, they may be out of phase. So what does v-sync and blocking flip even mean in a set-up like that?

    My recommendation would be to just test the set-up to see if things work well. For example, you can visually check whether v-sync is enabled by presenting a flickering blue/yellow display:

    So checking v-sync is easy. To check the reliability of your timestamps, you'll need to use an external photodiode and co-register the timestamps registered by the photodiode with the display timestamps registered by OpenSesame:

    That's a bit trickier. But if you have a technician, and I imagine you do in an fMRI lab, then it's definitely worth doing.

    Cheers!
    Sebastiaan

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 http://45.77.173.118/ 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