tjmahr / lookr

Scripts for looking-while-listening and visual-world eyetracking experiments
Other
7 stars 2 forks source link

don't renumber trials in a Session #16

Closed tjmahr closed 8 years ago

tjmahr commented 8 years ago

Let's load two Blocks of eyetracking from the same participant with Block and then alternatively with Session.

block1 <- Block("data/RWL_WFFArea_Long/001P00XA1/RWL_Block1_001P00XA1")
block2 <- Block("data/RWL_WFFArea_Long/001P00XA1/RWL_Block2_001P00XA1")
block1
#> Block object with 1 Subject IDs and 24 trials: 
#>   SubjectID             Basename Trials
#> 1 001P00XA1 RWL_Block1_001P00XA1     24
block2
#> Block object with 1 Subject IDs and 24 trials: 
#>   SubjectID             Basename Trials
#> 1 001P00XA1 RWL_Block2_001P00XA1     24

trials <- Session("data/RWL_WFFArea_Long/001P00XA1/")
trials
#> Session object with 1 Subject IDs and 48 trials: 
#>   SubjectID             Basename Trials
#> 1 001P00XA1 RWL_Block1_001P00XA1     24
#> 2 001P00XA1 RWL_Block2_001P00XA1     24

(This may seem redundant but recall that Session is meant to abstract over blocks. Block takes a path to a specific experiment administration as an argument, whereas Session takes a path to a participant's folder and loads all the blocks contained therein. Session operates at the participant level. BTW, Task is the next level of abstraction, taking as its argument a folder full of participant folders.)

With Session, the trials in the second block are renumbered.

trials %@% "TrialNo"
#>  [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#> [25] 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
block1 %@% "TrialNo"
#> [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
block2 %@% "TrialNo"
#> [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

There's no good reason to keep this behavior around. The ordering does not reflect the ordering which the participant saw items (Block1 is always ordered before Block2). It also makes it harder to isolate specific trials in blocks.