Howdy, Stranger!

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

Supported by

[open] random trial order but distributed catch trials w/out repetition

edited June 2014 in OpenSesame

Hey guys,

I set up an experiment with 348 trials in one loop item. After 24 trials there are five catch trials (with a variable "catch" being 0 or 1 indicating weather its a catch trial or not), followed by 24 trials and again 5 catch trials and so on (to find out weather the subjects are really doing the task). I want the trials to come up in random order, so I set the order of the trial sequence to random.

But now of course it can happen that one catch trial is directly followed by an other one. Do you have an idea how to prevent that or how to distribute the catch trials evenly througout the experiment still having the "real" trials in random order?

Thanks a lot in advance for your help!

Best,
Hannes

Comments

  • edited June 2014

    To clarify what my experiment looks like, this is the general structure:

    - experiment (sequence)
       *startscreen (scatchpad)
       *run_loop (loop)
          -block_sequence (sequence)
             *trials (loop)
                -trial_sequence (sequence)
                   *check_catch_break (inline script)
                   *question (scatchpad)
                   *jitter (inline script)
                   *reply (scatchpad)
                   *mouse response
                   *logger
                   *catch_log (inline script)
             *thankyou (feedback)
             *question_strategy (text_input)
             *logger
       *end (scatchpad)`
    

    I now tried the following:
    I added a variable "catch_log (0)" to the run_loop in order to keep track of whether the trial before was a catch trial and a variable "catch_twice (0)" which indicates if two catch trials are following each other.
    The check_catch_break inline script is set to run if "always" and contains the following in the prepare phase:

    if exp.get("catch_log") and exp.get("catch"):   #if before and now are catch trials
        exp.set("catch_twice", 1)                               
        exp.items['trial_sequence'].count = exp.items['trial_sequence'].count - 1   
    else:
        exp.set("catch_twice", 0)
        exp.set("catch_log", exp.get("catch"))
        #check if its time for a break [...]`
    

    I was hoping that this will have the effect that if a catch trial is followed by an other one opensesame would go back one step and randomly choose again which trial is coming up, until it is not a catch trial again. Therefore I set all other items in the trial_sequence to run if "not [catch_twice]".

    It seems to work so far that now at least it does not happen that two catch trials are right after each other anymore. It is not the perfect solution, since they are not evenly distributed. But I do not want to do the pseudo randomisation by hand with an inline script since I already added all the stimulus images and other variables in the loop items variable cells which total up to 3828 variables.
    But there is one problem left: It looks like that the catch trials that are skipped because they follow a previous catch trial are lost and do not come up during the entire experiment.

    Any idea how to prevent that? I hope my solution of decrementing the internal item count does not have any other bad consequences, since I am not yet understanding opensesame's underlying internal structure of the items and phases.

    I would appreciate any ideas and comments on this,

    cheers
    Hannes

  • edited 6:49PM

    Hi Hannes,

    One way to do this, a bit easier than what you're doing right now, is to add a catch trial (let's call it catch_sequence) to your trial_sequence, and use a run-if statement so that catch_sequence is only executed once every 24 trials.

    So let's say that you have a structure like this:

    image

    Then you could use the following Python-style run-if statement so that it's only executed after every 24 trials:

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

    For the logic behind this statement (although in a slightly different context), see:

    Of course, you can have catch_sequence do whatever you want, including running five catch trials in a row.

    Does this help?

    Cheers,
    Sebastiaan

Sign In or Register to comment.