Randomized separator in randomized sequence of trials

PennController for IBEX Forums Support Randomized separator in randomized sequence of trials

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #10887
    bta
    Participant

    I am trying to do some fancy work with my Sequence in an experiment, and there are essentially two parts to what I’m trying to do, and I can’t seem to put them together to do what I actually want.

    First, I’m trying to take a certain number of trials (e.g., 8) and presented them in a random order, and then have those randomly presented trials be separated at a fixed interval with a “take a break” style trial. I know that this part of the work can be done by: (i) putting the 8 trials in a Template, (ii) randomizing the order with randomize(NAMEOFTRIAL), and (iii) using a function like sepWithN (as documented in several places on these forums, e.g., [this post](https://www.pcibex.net/forums/topic/how-to-add-page-breaks-in-between-randomized-items/#post-8514)).

    Second, I’m trying to have the “take a break” trial be one of a certain number of trials (e.g., 4), where each of the breaks is a random (and different) break trial. To achieve this, I put the 4 break items into a csv and created a Template of trials, and I tried using the randomProportion function (as defined in [this post](https://groups.google.com/g/ibexexperiments/c/ap4qV9TUJ3Q/m/OOU7pQBtAwAJ)) to show only one of the 4 items in the csv after 2 stimuli.

    Using these ideas together, I defined the sequence through Sequence( sepWithN(randomProportion("theSeparator", .25), randomize("theStimuli"), 2) ). **The problem is** that this shows the same random trial from the Template for theSeparator for all 4 separator trials (when I would hope to have each separator trial use a different trial for theSeparator).

    For example, if my stimuli are [abc, def, ghi, jkl, mno, pqrs, tuv, wxyz] and my separators are [separatorA, separatorB, separatorB, separatorD], I am getting outputs like ghi, mno, separatorB, abc, wxyz, separatorB, def, jkl, separatorB, tuv, pqrs, separatorB. Instead, what I would like is an output like ghi, mno, separatorA, abc, wxyz, separatorD, def, jkl, separatorB, tuv, pqrs, separatorC.

    Anyone have any thoughts on how to get the desired output? I’ve created a demo experiment at this URL: [https://farm.pcibex.net/r/gdHZAR/](https://farm.pcibex.net/r/gdHZAR/).

    #10927
    Jeremy
    Keymaster

    Hi,

    If you already know how many trials you will have of each type, I would probably use the pick function, like this:

    N_SEP = 4;
    N_STIM = 8;
    
    stims = randomize("theStimuli")
    seps = randomize("theSeparator")
    
    subseq = []
    for (let i=0; i<N_STIM; i += N_STIM/N_SEP) {
      subseq.push( pick(stims, N_STIM/N_SEP) )
      subseq.push( pick(seps, 1) )
    }
    
    Sequence( "intro" , ...subseq , "end" )
    

    Jeremy

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.