Howdy, Stranger!

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

Supported by

[open] Ending experiment

edited March 2013 in OpenSesame

I am wondering if there is a way to stop/end the experiment after the participant answers, say like 3 answers correct (after a certain number of stimuli)?

Comments

  • edited March 2013

    I was reading this post but I am not able to find where the "Show advanced options" is (under 'loop'?) in Opensesame. When I create an inline_script before the beginning of the loop, do I type in all of these in the same inline_script?

    [correct_in_a_row] >= 10
    exp.set('correct_in_a_row', 0)
    if self.get('correct') == 1:
        exp.set('correct_in_a_row', self.get('correct_in_a_row')+1)
    else:
        exp.set('correct_in_a_row', 0)
    

    http://forum.cogsci.nl/index.php?p=/discussion/340/consecutive-correct-responses-detection/p1

    Thanks for your help!

  • edited March 2013

    Hi,

    The advanced-options functionality exists from OpenSesame 0.27 onwards (on Windows and Ubuntu) and can be found here:

    image

    If you're using an older version of OpenSesame you should upgrade to be able to use these options. Afterwards, you can proceed as described in the post you linked to. You shouldn't type all the code in a (single) inline_script, but that's explained in the previous post.

    Please let us know if you have any further questions!

    Best,

    Lotje

    Did you like my answer? Feel free to Buy Me A Coffee :)

  • edited 2:31PM

    Thank you for your help, Lotje!

    I actually have a Macbook pro, and in the download page of opensesame, I wasn't sure if Mac users can update to 0.27?

  • edited 2:31PM

    I tried downloading opensesame 0.27 using a windows converter on my mac, but it seems to have errors. Is there another way to reach 10 correct answers in a row, without updating or having to use a windows computer?

  • edited 2:31PM

    Hopefully, there will be a Mac package for 0.27.1 soon, but for now you can accomplish the same thing using Run-if statements. Basically, you use [correct_in_a_row] < 10 as a 'Run-if' statement for all the items in your trial sequence. This will cause your trial sequence to be skipped when correct_in_a_row reaches 10. The downside of this approach is that the prepation phase is not skipped, so you will probably experience some lag due to all the trial sequences being prepared but not executed.

    Does that make sense?

  • edited 2:31PM

    Thanks so much Sebastiaan! It works now =). One other thing: Is there a way to post my experiments online so that other people can access them?

  • edited 2:31PM

    That's very generous of you!

    The best way to share an experiment on-line is probably by pasting the script into a Pastebin and sharing the link. This is script-only, unfortunately, but most other file sharing services will delete your file after a while.

  • edited March 2013

    Hi,

    Just to add: After uploading your script to pastebin, other users can download it and than change the extension to '.opensesame'. After doing so, other OpenSesame users should be able to open the experiment like normally.

    As an example, see this experiment that I uploaded for your previous forum post:

    Did you like my answer? Feel free to Buy Me A Coffee :)

  • edited 2:31PM

    Thank you so much for the Pastebin advice, Sebastiaan and Lotje! On a second thought, I am not quite sure if the "correct in a row" run-if works actually. I think it may not be stopping after 10 correct answers.. Is there something I am missing?

    image

  • edited March 2013

    Hi,

    The variable 'correct_in_a_row' is not a built-in OpenSesame variable. Sebastiaan meant that you have to declare this variable first, in an inline_script item.

    However, for your specific situation I think you don't even need to use the 'Run if' statements in the trial_sequence. You can just count the number of correct responses, and use this counter as a condition for running a next sequence, in the same inline_script item that we made for your previous question:

    More specifically, I advise you to:

    Firstly, append an inline_script at the very beginning of your experiment, and give the 'correct_in_a_row' variable a starting value, like so:

    # Give the counter a starting value:
    # We do this by using the experiment funtion exp.set():
    correct_in_a_row = 0
    
    # Make the variable available in other inline_script
    # items by making it global:
    global correct_in_a_row
    

    Secondly, adapt your current inline_script item (for shuffling the trial_sequence) to something like the following (see comments for a more detailed explanation):

    # Import the built-in Python module random.
    # See: http://docs.python.org/2/library/random.html#random.shuffle
    import random
    
    # Make a list containing the names of the small sequence items:
    small_sequence_list = ['s1', 's2', 's3', 's4']
    
    # Randomise the list by using the random.shuffle() function:
    random.shuffle(small_sequence_list)
    
    # Walk through the (randomised) list:
    for sequence in small_sequence_list:
    
        # Only continue if less than 10 responses in a row
        # were correct:
        if correct_in_a_row < 10:
    
            # Prepare the sequence item:
            exp.items[sequence].prepare()
    
            # Run the sequence item:
            exp.items[sequence].run()
    
        else:
            break
    
        # Check whether the previous response was correct.
        # If so, we add '1' to the counter:
        if self.get("correct") == 1:
            correct_in_a_row +=1
    
        # If not, correct_in_a_row is reset to zero.
        else:
            correct_in_a_row = 0
    
    # Finally, make the variable global again, for the next time
    # this inline_script is run.
    global correct_in_a_row
    

    After applying those suggestions, your overview area should look something like this (note especially the first inline_script item, at the very beginning of your experiment):

    image

    I uploaded a new example experiment here:

    Good luck and don't hesitate to post any further questions!

    Best,

    Lotje

    Did you like my answer? Feel free to Buy Me A Coffee :)

  • edited 2:31PM

    Dear Lotje,

    Thank you so much for your help! I am still having trouble figuring out where I misspelled some things? (There is a quotation error..)

    image

    image

  • edited 2:31PM

    Hi,

    At first sight, your code seems fine. Could you perhaps paste the exact error message (from the debug window) here? To open the debug window, simply click on the red ladybug icon in the main toolbar.

    Many thanks,

    Lotje

    Did you like my answer? Feel free to Buy Me A Coffee :)

  • edited 2:31PM

    Dear Lotje,

    Thank you for being patient. My error message is:

    image

  • edited 2:31PM

    This error is a Mac OS-specific issue with the way that line endings are encoded. I'm not sure what you can do to resolve it, as I don't have a Mac myself, but you can read in this discussion that putting something in both the run and the prepare phase might help (some dummy code, such as pass).

    This is quite a serious bug in the Mac OS package, and we're aware of it. For now, however, you either have to work around it, or use the Windows/ Linux package.

    Cheers,

    Sebastiaan

  • edited 2:31PM

    Hi Sebastiaan and Lotje, thanks for helping me. I was able to open this experiment on a Windows, and it works! The only problem is, my logger data logs everything except for the answer I am seeking the most: how long (how many tries) it takes to reach 10 correct in a row. I added some variables correct_cnt, but the logger always says N/A.

    image

    image

    image

    As a side note, I have opened this experiment on two computers (both windows), and on one computer, it says "out of memory" at the end of the experiment. I thought my computers had lots of memory, but maybe there is a way to expand it?

    Thanks so much!

  • edited 2:31PM

    Hi,

    To make an in-an-inline_script-defined variable available in the interface (e.g. the logger item) as well, you need to set the variable by using the experiment function exp.set() like so:

    exp.set("correct_cnt", correct_cnt)

    You need to do this every time you (potentially) updated the variable. So, for example, after you made the variables global at the end of the inline_script you posted:

    global incorrect_cnt
    global correct_cnt
    exp.set("correct_cnt", correct_cnt)
    exp.set("incorrect_cnt", incorrect_cnt)
    

    After doing so, the variable will have the appropriate values in your logger item.

    Does that make sense?

    Please, also read:

    Regarding your second question, are you perhaps using very large sound files?

    Best,

    Lotje

    Did you like my answer? Feel free to Buy Me A Coffee :)

  • edited 2:31PM

    Thank you so much for all of your help, Lotje and 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