Reply To: Using pick with several conditions

PennController for IBEX Forums Support Using pick with several conditions Reply To: Using pick with several conditions


Hi Josiane,

I think your design will require some tailored coding. What I can propose is you use a single CSV table and rename your column Experiment as Group, so that PennController knows to pick only the Exp1 or Exp2 rows at a time

Now doing just that would include all the items of one experiment, but you actually have specific requirements for your sequence of trials. What I suggest is you label your trials Family+Condition: we can create a javascript array containing all the labels ("1normal","1weird","1opposite","2normal", etc.) shuffle the array, and pick the first N entries from this array (with an additional trick to handle conditions distribution)

On top of that, if I understood your description correctly, you have different numbers of conditions in exp1 vs exp2, and also an essentially different sequence of trials, since for exp1 you want the test trials in a randomized order followed by all the filler trials in a randomized order, whereas for exp2 you want a subset of the trial and of the filler items intertwined in a randomized order. In order to handle the two differently, we will need to look up the value of the internal counter (__counter_value_from_server__) and execute distinct pieces of javascript code base on it (using a switch statement)

Here is an example, assuming a simpler table with just 8 non-filler items, 2 conditions in exp1 (“a” and “b”) and 4 in exp2 (“a,” “b,” “c” and “d”). For exp1, we show 4 trials (2 repetitions of each condition) followed by all the filler items; for exp2 we show 8 trials (again, 2 repetitions of each condition) intertwined with 8 filler items (50/50 in condition “a”/”b”)

switch (__counter_value_from_server__ % 2) {
    case 0:
        n_families_total = 8;
        n_families_keep = 4;
        conditions = ["a","b"];
        families = [ Array(n_families_total)].map((v,i)=>>String(i+1)+c));
    case 1:
        n_families_total = 8;
        n_families_keep = 8;
        conditions_families = ["a","b","c","d"];
        families = [ Array(n_families_total)].map((v,i)=>>String(i+1)+c));
        n_fillers_total = 16;
        conditions_fillers = ["a","b"];
        fillers = [ Array(n_fillers_total)].map((v,i)=>>"filler"+String(i+1)+c));

Template( row=>
    newTrial( row.Family + row.Condition ,
        newText(row.Item + row.Group).print(),

Here’s an edited excerpt of the table I’m using:

1,a,item 1a,eval 1a,exp1
1,b,item 1b,eval 1b,exp1
2,a,item 2a,eval 2a,exp1
2,b,item 2b,eval 2b,exp1
filler1,a,filler item 1a,filler eval 1a,exp1
filler1,b,filler item 1b,filler eval 1b,exp1
filler2,a,filler item 2a,filler eval 2a,exp1
filler2,b,filler item 2b,filler eval 2b,exp1
1,a,item 1a,eval 1a,exp2
1,b,item 1b,eval 1b,exp2
1,c,item 1c,eval 1c,exp2
1,d,item 1d,eval 1d,exp2
2,a,item 2a,eval 2a,exp2
2,b,item 2b,eval 2b,exp2
2,c,item 2c,eval 2c,exp2
2,d,item 2d,eval 2d,exp2
filler1,a,filler item 1a,filler eval 1a,exp2
filler1,b,filler item 1b,filler eval 1b,exp2
filler2,a,filler item 2a,filler eval 2a,exp2
filler2,b,filler item 2b,filler eval 2b,exp2

And here is a link to a demo project so you can see it live and inspect its code:

Let me know if you have questions