Howdy, Stranger!

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

Supported by

[solved] Self paced breaks as an inline script?

edited October 2012 in OpenSesame

Greetings,

First off, I would like to say I’m really happy with Opensesame. I have been using it for a couple of months and I really like it! So, thank you. I’m also working on learning python code to further improve on what I can do in Opensesame (I’m still very much a beginner, though). Now my question:
I’m designing a variation on a ‘delayed match to sample task’ and I need a lot of trials:
My design looks something like this at the moment:

>Instructions
>Practice loop
    Practice sequence
        Block loop (1 x 24 trials)
            Trial Sequence
        Feedback
>End of Practice
>Experimental loop
    Exp sequence
        Exp loop (50 x 24 trials)
            Trial Sequence
>End

Of course, 50 times 24 trials is a lot of trials, taking a lot of time. I would like participants to have a self paced break after 72 trials, also providing feedback (average RT and ACC). Can I add an Inline script somewhere to achieve this? (If I add this inline script in the Trial sequence it will also be in the practice loop.)
I could probably make the ‘Exp loop’ (3 x 24 trials) and then repeat the ‘Experimental loop’ 17 times, but I want the 1200 trials to be completely random.
Your help with the best way to achieve this and the formulation of possible inline scripts is much appreciated!

Thank you very much in advance!
Michel

Comments

  • edited 9:11AM

    Hi Michel,

    Glad you like OpenSesame!

    Indeed, 1200 trials is a bit much. The easiest way to show feedback after 72 trials without subdividing your trials into multiple blocks is probably as follows:

    At the end of the trial_sequence, add a feedback item and (in the trial_sequence) set its Run if condition to:

    [show_feedback] = 1

    Just before the new feedback item, add an inline_script with the following code:

    block_length = 72
    if (self.get('count_trial_sequence')+1) % block_length == 0:
        exp.set('show_feedback', 1)
    else:
        exp.set('show_feedback', 0)

    This script determines based on the count_trial_sequence variable, which contains the number of times that the trial_sequence has been called, whether the show_feedback variable should be set to 0 or to 1.

    Another discussion that might come in handy is this one:

    More info about variables and conditional statements:

    Good luck and don't hesitate to ask questions!

    Sebastiaan

  • edited 9:11AM

    Hi Sebastiaan,

    Thank you very much! It works like a charm. If I have any other questions in the future I'll be sure to ask!

    Greetings,

    Michel

  • edited 9:11AM

    Great!

    For future reference, in 0.27 (currently as pre-release) you can implement this using only a Run if statement. The functionality that has been added is that you can now use Python statements directly in a Run if statement, by prepending an '=' sign:

    Run if:

    =[my Python statement]

    So in your case this would be something like:

    Run if:

    =(self.get('count_trial_sequence')+1)%72 == 0

    There's no real advantage of this method over the one using an inline_script, btw. It's just shorter.

  • Hi,

    unfortunately I'm a very beginner at Open Sesame and I have a similar problem to MichelQ above:
    When I set the Run if: statement of the feedback to
    =(self.get('count_trial_sequence')+1)%32 == 0 (I would like to have a break after 32 Items), opensesame counts the items of the trial sequence plus the items of the practice sequence, because the two are attached. But I just want opensesame to count the items of the trial sequence without the items of the practice sequence. How does this work? Could you help me?

    Greetings
    Karin

  • Hi Karin,

    If you're using OpenSesame 3.1 or later, you can make use of the fact that each loop maintains a variable that indicates the row that is currently active. This variable is called live_row_[loop name].

    So say that you want exit block_loop after 3 trials, and resume where you left of the next time that block_loop is called, then you can do this as follows:

    • Break if: [live_row_block_loop] % 3 = 0
    • Evaluate on first cycle: no
    • Resume after break: yes

    So this allows you to cut up your blocks when they have very long tables.

    Does that clear things up?

    Cheers,
    Sebastiaan

  • Hi,

    I have the same problem but my program says that the variable live_row_[loop name] doesn´t exist. I want my loop to stop every 6 items, so I can change subjects quickly - I'm going to be in an a exhibition, so I can't take much time and the ideia is that each subject can see 6 pictures, there's a break and the next subject can come and continue!

    Greetings,
    Rita Almeida

  • Hi Rita,

    The live_row variable was introduced in OpenSesame 3.1, so I would first make sure that you're not simply using an older version of OpenSesame. If that's not the issue, could you then post the full error message here, including the item stack etc.?

    Cheers,
    Sebastiaan

  • edited May 2018

    Hi,

    I'm using Open Sesame 3.2.4 and have implemented this as per Sebastian's suggestion:

    Break if: [live_row_block_loop] % 3 = 0
    Evaluate on first cycle: no
    Resume after break: yes

    However after the first break, the experiment ends instead of resuming where it left off. Do I need to set something in the sketchpad where I have my break message?

    Thanks,
    Kate

  • Hi stoney,

    YOu still have to make sure that the block loop is called again after the break. If you don't enter this loop again, then the experiment will just end. So eventually, you should have something like a nested loop structure.

    Eduard

    Buy Me A Coffee

  • edited May 2018

    Thanks Eduard.

    A colleague also suggested another option (maybe simpler?): The break sketchpad should be inserted at the end of the trial sequence. Then, if you click on the trial node, you can edit the 'Run if' statement next to the break sketchpad to be [live_row_block_loop] % 3 = 0.

    Best,
    Kate

  • Hi Sebastian,

    I have a similar problem as Michael. Would this also work if I just want to initiate a break without feedback?

    At the moment I have 120 trials and want to initiate a break every 60 trials (without feedback and just a sketchpad that says "Block 2 : Press any key to continue"

    Also, in your tutorial, what is the reason for setting up experiment as Experimental Loop - Exp Sequence - Block Loop when it works the same when I set it up as Experiment Loop - Exp Sequence?

    Thank you so much in advance!

  • Hi,

    Would this also work if I just want to initiate a break without feedback

    Yes, the same procedure applies. Just choose which item you want to show and what you want it to include. Just make a sketchpad that includes only the text "Block 2. Press a key to continue" and set its run_if field to [count_block] or whatever your variable is called.

    Also, in your tutorial, what is the reason for setting up experiment as Experimental Loop - Exp Sequence - Block Loop when it works the same when I set it up as Experiment Loop - Exp Sequence?

    The explanation is here: https://osdoc.cogsci.nl/3.2/manual/prepare-run/

    Essentially, the reason is improved timing.


    Eduard

    Buy Me A Coffee

  • Hi again,

    I tried to introduce the code Sebastian proposed on October 2012 edited 2:02PM in order to seperate my 135 trials in 3 blocks but it does not seem to be working. Do you think that the problem might lies in the co-routine?

    This is my trial sequence before the co-routine. I added the [show_feedback]=1 variable in the Run if here, as it would not let me to add it directly on trial_sequence.

    This is my inline script as proposed above (October 2012 edited 2:02PM)

    So, when the inline_script and feedback are added here, the trial (loop) does not run at all and goes directly to feedback, which then, in order to finish the experiment I have to press esc and Q.

    When I add the inline scrip right after the new_logger it does not recognize the show_feedback variable.

    Could you please support?

    Best,

    Nomi.

  • Hi again.

    Just an update. As mentioned in the previous message, I am not able to fix my problem with the above inline_script. I wish to find the correct code and solution to the above if you could provide one, or if you could spot my mistake :-)

    Nevertheless, I managed to provide "rest breaks" after 45 trials each time along with feedback with the following code =(self.get('count_trial_sequence')+1)%45 == 0 added in the Run if of the feedback item which is found inside the coroutine

    See below:

    Thanks,

    Nomi

  • Hi Nomi,

    I tried to introduce the code Sebastian proposed on October 2012

    Yeah, that is too long ago. That code won't work anymore, it might give you inspiration though how to solve the problem.

    Just to answer some of your questions:

    Do you think that the problem might lies in the co-routine?

    No, that should be unrelated.


    I added the [show_feedback]=1 variable in the Run if here

    Where does that variable come from? If the co-routine is always skipped this variable is not ever 1. The questions is then why this is the case. (Sharing your experiments helps me to help you find out). If you define that variable in the inline_script that follows the co-routine, that yeah, the co-routine will be skipped (as the variable is only properly set afterwards).

    When I add the inline scrip right after the new_logger it does not recognize the show_feedback variable.

    Exactly. So you need to define the variable before the loop, and set it to your needs within the loop (once you hit a specific trial).

    Apart of that, I'm sorry, but I lost track a bit, which part have you made work already, and what is still not working? Is there still stuff you need help with?

    Eduard

    Buy Me A Coffee

  • Hi again,

    Apologies for the mess. I was also lost with the previous code as a nuby!

    I managed to provide "rest breaks" after 45 trials each time along with feedbackwith the following code 

    "=(self.get('count_trial_sequence')+1)%45 == 0" added in the Run if of the feedback item which is found

    inside the coroutine


  • Cool, so all good now? Great :)

    Buy Me A Coffee

  • I guess!

    I am currently trying

    a) to pseudorandomize my trials and

    b) use inline code to give a warning when accuracy drops below 70%

    but no luck yet.

    I will get back with new posts if I will not make it.


    Thanks

    Nomi

  • Sounds good.

    a )

    If the loop table randomization is no option for you, the approach is usually to create a list of stimuli before you enter the trial loop, shuffle it, and then pick one item at a time from that list and use it as stimulus on a specific trial.

    b)

    The variable var.acc that opensesame creates per default could be useful. It requires though that var.correct_response is defined

    Good luck!

    Eduard

    Buy Me A Coffee

  • @eduard Thanks Eduard!

    a) true, an excel file for example because it feels im incompetent with coding!

    b) i have managed to do it with the Run if command, simple as that. The code also worked (after I defined the var.correct_response) but I couldn't managed it to run the time I wanted it, the message would only appear at the end of the cycle. But i think I am OK since it runs through the Run If without coding.

    Best,

    Nomi

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