Reply To: Switching between multiple tasks

PennController for IBEX Forums Support Switching between multiple tasks Reply To: Switching between multiple tasks

#8147
Jeremy
Keymaster

Hi,

I thought you wanted the sentence vs flanker tasks to be totally independent, because you stated that half of your items need to form sentence-sentence or flanker-flanker subsequences. I’m not sure how you would achieve that with a table where each line has references for both a sentence and a flanker task: it would seem to me that such a table would systematically pair a sentence task with a flanker task, regardless of whether the former precedes or follows the latter, but that it wouldn’t really allow for sentence-sentence or flanker-flanker pairs. Or am I missing something?

The latinMix function I proposed accepts only two arguments (see assert(arrays.length == 2, "Wrong number of arguments (or bad argument) to LatinMix");) so you will get an error if you try Sequence( latinMix(randomize("flanker-sentence"), randomize("sentence"),randomize("flanker")) ). I also don’t know what output exactly you would expect to get from that, since in your first message you listed four types of pairs resulting from crossing two types of tasks, and this is exactly what latinMix does

To reiterate, I don’t know how one could modify the code I suggested, or come up with another implementation, because I don’t know how to determine the sentence-sentence and flanker-flanker pairs if you need to systematically associate one sentence with one flanker task (ie. how would you decide which two sentences or which flanker images to associate to form pairs?)

Note that if all you want really are sentence-flanker and flanker-sentence pairs, then once you put all those pairs one after the other in a sequence of trials, you will for example get a general sequence like sentence-flanker-flanker-sentence-flanker-sentence-sentence-flanker-etc., which does technically contains both sentence-sentence and flanker-flanker subsequences, because sometimes you’ll have a pair that starts with one task type following another pair that ends with that same task type. If that’s what you’re after, then all you need to do is alternate which bit of code comes first in your existing newTrial, eg:

// Flanker task
flanker = row => [
  newTimer("RT",1000).start()
  ,
  newCanvas("FlankerCanvas", 1800, 900)
    .add(675,400, newImage(row.FlankerImage))
    .scaling("page")
    .print("center at 50vw","middle at 50vh")
  ,
  newKey("flankerFJ", "FJ")
    .log("first")
    .callback(getTimer("RT").stop())
  ,
  getTimer("RT").wait()
  ,
  getKey("flankerFJ").disable()
  ,
  getCanvas("FlankerCanvas").remove()
]
// Sentence task
sentence = row => [
  newAudio("audio", row.AudioFile).play()
  ,
  defaultImage.size(225, 225)
  ,
  newImage("TL", row.TL)
  ,
  newImage("TR", row.TR)
  ,
  newImage("BL", row.BL)
  ,  
  newImage("BR", row.BR)
  ,
  newCanvas("visualWorld", 1800, 900)
    .add(    "left at 50px" ,     "top at 50px" , getImage("TL"))
    .add(    "left at 50px" , "bottom at 850px" , getImage("BL"))
    .add( "right at 1700px" ,     "top at 50px" , getImage("TR"))
    .add( "right at 1700px" , "bottom at 850px" , getImage("BR"))
    .scaling("page")
    .print("center at 50vw","middle at 50vh")
  ,
  getAudio("audio").wait("first")
  ,
  newSelector().add(getImage("TL"), getImage("BL"), getImage("TR"), getImage("BR"))
    .wait()
    .log()
  ,
  getCanvas("visualWorld").remove()
  ,
  newText("comp-question", row.Question)
    .cssContainer({"font-size": "160%", "color": "black"})
    .center()
    .print()
  ,
  newText("yesno", "<p>YES &nbsp; &nbsp; &nbsp; NO</p>")
    .cssContainer({"font-size": "160%", "color": "black"})
    .center()
    .print()
  ,
  newKey("SentenceFJ", "FJ").log("first").wait().disable()
  ,
  getText("comp-question").remove()
  ,
  getText("yesno").remove()
]

ABorBAs = []    // Browse the table once to fill ABorBAs with alternating 0s and 1s
Template("flanker-sentence.csv", row => newTrial("__dummy__", ABorBAs.push(ABorBAs.length%2)) )
Template("flanker-sentence.csv", row =>
  newTrial( "test" ,
    fisherYates(ABorBAs)    // Shuffle ABorBAs
    ,
    ABorBA = ABorBAs.pop()  // Pick the last entry from ABorBAs
    ,
    newCanvas("FixationCanvas", 1800, 900)
      .add(675,400, newImage("Fixation.png"))
      .scaling("page")
      .print("center at 50vw","middle at 50vh")
    ,
    newTimer("wait", 1000).start().wait()
    ,
    clear()
    ,
    ...(ABorBA?flanker(row):sentence(row))  // Flanker if 1, sentence otherwise
    ,
    getTimer("wait").start().wait()
    ,
    getCanvas("FixationCanvas").print("center at 50vw","middle at 50vh")
    ,
    getTimer("wait").start().wait()
    ,
    clear()
    ,
    ...(ABorBA?sentence(row):flanker(row))  // Sentence if 1, flanker otherwise
  )
  .log("flankerFirst", ABorBA)
  .setOption("hideProgressBar",true)
)

Sequence( randomize("test") )

Jeremy