PennController for IBEX › Forums › Support › Randomized separator in randomized sequence of trials
- This topic has 1 reply, 2 voices, and was last updated 10 months, 1 week ago by
Jeremy.
-
AuthorPosts
-
October 14, 2023 at 11:03 am #10887
bta
ParticipantI 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 withrandomize(NAMEOFTRIAL)
, and (iii) using a function likesepWithN
(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 fortheSeparator
for all 4 separator trials (when I would hope to have each separator trial use a different trial fortheSeparator
).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 likeghi, mno, separatorB, abc, wxyz, separatorB, def, jkl, separatorB, tuv, pqrs, separatorB
. Instead, what I would like is an output likeghi, 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/).
October 27, 2023 at 9:55 am #10927Jeremy
KeymasterHi,
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
-
AuthorPosts
- You must be logged in to reply to this topic.