Reply To: Choosing subet of items to present

PennController for IBEX Forums Support Choosing subet of items to present Reply To: Choosing subet of items to present

#6200
Jeremy
Keymaster

Hi,

Do I understand you correctly that you have rows in your table from which you generate both training and test trials, so that each row is associated with two trials (one training, one test) and that you want to show some training trials in the training phase, and in the test phase, you want to select half of those training trials but show the corresponding test trial instead (ie. the one that was generated from the same row, but using a different template) and then show the test trials corresponding to the training trials that were not shown in the training phase?

If that’s what you want to do, the problem with the current solution is that you generate separate training and test trials (even if generated from the same rows) so that the trials picked by the pick function will either be the training or the test ones, and so applying pick again later will not exclude the dual trials of the type that was not picked before.

From here, you have two options: either you generate a single trial for each row, whose content can dynamically switch between training or test depending on as part of which phase you’re running it, or you give up on the pick function and manually use arrays for the specific needs of your design. The latter option requires good knowledge of javascript and how (PC)Ibex generates and orders its trials though.

If you decide to go with the former option (if feasible at all with your design), you could do something like this:

Sequence( "intro", "trials", "transition", "trials" )

AddTable("table", "Text\nhello\nworld\nbye\ntown")

newTrial("intro", newVar("phase", "training").global() )
newTrial("transition", getVar("phase").set("test") )

const test_trial = row => [
  newText("test "+row.Text).print()
  ,
  newButton("Next").print().wait()
]

const training_trial = row => [
  newText("training "+row.Text).print()
  ,
  newButton("Next").print().wait()
]


Template( "table" , row =>
  newTrial( "trials" ,
    getVar("phase").test.is("training")
        .success( ...test_trial(row) )
        .failure( ...training_trial(row) ) 
  )
  .log("phase", getVar("phase") )
)

This way, you have a single label (trials in my example) for the two versions of each item, and you can use pick as intended (not illustrated above)

Let me know if you have questions

Jeremy