Skip to content

Commit

Permalink
Merge pull request #4 from tombeesley/develop
Browse files Browse the repository at this point in the history
Merge develop to master for version 0.6.0
  • Loading branch information
tombeesley authored Sep 26, 2024
2 parents 2d0df26 + 8900fff commit 0b682df
Show file tree
Hide file tree
Showing 104 changed files with 118,378 additions and 670 deletions.
8 changes: 0 additions & 8 deletions .Rbuildignore.rej

This file was deleted.

5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
**/.DS_Store
.Rproj.user
.Rhistory
.RData
.Ruserdata
<<<<<<< .merge_file_a05752
=======

>>>>>>> .merge_file_a13928
115,910 changes: 115,910 additions & 0 deletions 102_EG_dec.csv

Large diffs are not rendered by default.

120 changes: 120 additions & 0 deletions 102_training.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
1,1,1,6,1,1,0,1,2,1,2,0,0,6851.5,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
1,2,2,6,2,2,0,1,1,1,2,1,1,5435.8,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
1,3,1,5,1,1,0,1,2,2,2,0,0,14410,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
1,4,2,5,2,2,0,1,2,2,2,1,1,9056.1,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
2,1,1,6,1,1,0,1,1,1,1,1,1,3665.8,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
2,2,1,5,1,1,0,1,2,1,1,1,1,3927.5,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
2,3,2,6,2,2,0,1,1,2,2,1,1,4587.5,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
2,4,2,5,2,2,0,1,2,2,2,1,1,3322,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
3,1,1,6,1,1,0,1,2,2,1,1,1,2941.1,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
3,2,2,5,2,2,0,1,2,1,2,1,1,2927.5,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
3,3,2,6,2,2,0,1,1,1,2,1,1,4729.9,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
3,4,1,5,1,1,0,1,2,2,1,1,1,5613.9,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
4,1,2,6,2,2,0,1,2,1,2,1,1,3467,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
4,2,1,6,1,1,0,1,2,1,1,1,1,2544,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
4,3,1,5,1,1,0,1,2,2,2,0,0,6611.6,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
4,4,2,5,2,2,0,1,2,2,2,1,1,2346.2,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
5,1,1,5,1,1,0,1,1,1,1,1,1,2597.7,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
5,2,2,5,2,2,0,1,2,1,2,1,1,4035.5,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
5,3,1,6,1,1,0,1,1,2,1,1,1,2490.8,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
5,4,2,6,2,2,0,1,2,2,2,1,1,2359.2,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
6,1,2,5,2,2,0,1,1,1,2,1,1,2829.1,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
6,2,1,6,1,1,0,1,1,2,1,1,1,2132.2,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
6,3,1,5,1,1,0,1,2,2,1,1,1,3456.4,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
6,4,2,6,2,2,0,1,1,1,2,1,1,2518.1,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
7,1,1,5,1,1,0,1,1,2,1,1,1,2209.2,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
7,2,1,6,1,1,0,1,1,1,1,1,1,2201,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
7,3,2,6,2,2,0,1,1,2,2,1,1,2866.7,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
7,4,2,5,2,2,0,1,1,1,2,1,1,3399.9,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
8,1,1,6,1,1,0,1,1,1,1,1,1,3415.6,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
8,2,2,6,2,2,0,1,2,2,2,1,1,2528.3,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
8,3,1,5,1,1,0,1,1,2,1,1,1,1852.3,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
8,4,2,5,2,2,0,1,2,1,2,1,1,2585.2,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
9,1,2,6,2,2,0,1,1,1,2,1,1,5202.7,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
9,2,1,5,1,1,0,1,2,1,1,1,1,2098.5,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
9,3,2,5,2,2,0,1,2,2,2,1,1,2695,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
9,4,1,6,1,1,0,1,2,2,1,1,1,2220.4,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
10,1,2,5,2,2,0,1,1,1,2,1,1,2979.6,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
10,2,2,6,2,2,0,1,2,1,2,1,1,2509.6,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
10,3,1,5,1,1,0,1,1,2,1,1,1,2066.3,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
10,4,1,6,1,1,0,1,2,2,1,1,1,1943.5,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
11,1,1,5,1,1,0,1,1,2,1,1,1,2632.5,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
11,2,2,6,2,2,0,1,1,1,2,1,1,2104.6,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
11,3,1,6,1,1,0,1,1,2,1,1,1,2060.4,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
11,4,2,5,2,2,0,1,2,1,2,1,1,2562.2,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
12,1,2,6,2,2,0,1,1,2,2,1,1,2260.9,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
12,2,1,6,1,1,0,1,1,1,1,1,1,2203.8,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
12,3,1,5,1,1,0,1,1,2,1,1,1,1732.5,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
12,4,2,5,2,2,0,1,1,1,2,1,1,2263.1,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
13,1,2,6,2,2,0,1,2,1,2,1,1,2077.8,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
13,2,1,6,1,1,0,1,1,2,1,1,1,1996,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
13,3,1,5,1,1,0,1,2,2,1,1,1,1955.4,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
13,4,2,5,2,2,0,1,1,1,2,1,1,1767.2,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
14,1,1,6,1,1,0,1,2,1,1,1,1,1960.4,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
14,2,2,5,2,2,0,1,2,2,2,1,1,2906.3,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
14,3,2,6,2,2,0,1,1,1,2,1,1,2239,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
14,4,1,5,1,1,0,1,1,2,1,1,1,2797.5,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
15,1,2,5,2,2,0,1,1,1,2,1,1,2342.9,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
15,2,1,5,1,1,0,1,2,2,1,1,1,3610.4,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
15,3,1,6,1,1,0,1,2,1,1,1,1,2323,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
15,4,2,6,2,2,0,1,2,2,2,1,1,2206.1,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
16,1,2,5,2,2,0,1,1,2,2,1,1,2145.8,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
16,2,1,6,1,1,0,1,2,1,1,1,1,2052.2,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
16,3,1,5,1,1,0,1,1,1,1,1,1,2531.1,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
16,4,2,6,2,2,0,1,2,2,2,1,1,2727.2,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
17,1,1,5,1,1,0,1,2,1,1,1,1,1939.2,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
17,2,1,6,1,1,0,1,2,2,1,1,1,2155,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
17,3,2,5,2,2,0,1,2,1,2,1,1,2189.2,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
17,4,2,6,2,2,0,1,2,2,2,1,1,1893.6,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
18,1,2,5,2,2,0,1,2,2,2,1,1,2832.4,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
18,2,2,6,2,2,0,1,1,2,2,1,1,2016.5,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
18,3,1,5,1,1,0,1,2,1,1,1,1,2077,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
18,4,1,6,1,1,0,1,2,1,1,1,1,3512.4,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
19,1,2,6,2,2,0,1,2,1,2,1,1,2043.1,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
19,2,1,5,1,1,0,1,1,1,1,1,1,4994.7,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
19,3,2,5,2,2,0,1,1,2,2,1,1,1746.2,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
19,4,1,6,1,1,0,1,1,2,1,1,1,1597.7,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
20,1,1,5,1,1,0,1,1,2,1,1,1,1774.2,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
20,2,2,6,2,2,0,1,2,2,2,1,1,2025.4,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
20,3,2,5,2,2,0,1,1,1,2,1,1,1775.5,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
20,4,1,6,1,1,0,1,1,1,1,1,1,1713.6,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
21,1,2,6,2,2,0,1,2,2,2,1,1,1783.7,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
21,2,1,6,1,1,0,1,1,2,1,1,1,1721.1,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
21,3,1,5,1,1,0,1,1,1,1,1,1,1796.3,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
21,4,2,5,2,2,0,1,1,1,2,1,1,1700.8,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
22,1,1,5,1,1,0,1,1,1,1,1,1,1578.6,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
22,2,2,6,2,2,0,1,1,1,2,1,1,2058.8,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
22,3,2,5,2,2,0,1,1,2,2,1,1,1818.6,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
22,4,1,6,1,1,0,1,2,2,1,1,1,1921.8,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
23,1,1,5,1,1,0,1,2,1,1,1,1,1612.9,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
23,2,2,6,2,2,0,1,2,1,2,1,1,1917.8,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
23,3,2,5,2,2,0,1,2,2,2,1,1,2233,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
23,4,1,6,1,1,0,1,2,2,1,1,1,1648.4,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
24,1,2,5,2,2,0,1,1,1,2,1,1,1598.9,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
24,2,1,6,1,1,0,1,1,2,1,1,1,2041.4,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
24,3,2,6,2,2,0,1,1,1,2,1,1,1864.9,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
24,4,1,5,1,1,0,1,2,2,1,1,1,1877.7,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
1,1,4,8,4,4,0,2,2,1,3,0,0,6288,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
1,2,3,7,3,3,0,2,2,2,3,1,1,2994.8,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
1,3,1,5,3,3,0,1,1,2,4,0,0,5428.2,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
1,4,2,6,4,4,0,1,1,1,4,1,1,3338.4,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
2,1,4,8,4,4,0,2,1,2,4,1,1,11572,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
2,2,3,7,3,3,0,2,2,1,3,1,1,3491.9,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
2,3,1,5,3,3,0,1,2,2,4,0,0,8609.4,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
2,4,2,6,4,4,0,1,2,1,4,1,1,4559.9,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
3,1,3,7,3,3,0,2,1,2,3,1,1,5720.9,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
3,2,2,6,4,4,0,1,1,2,4,1,1,4540,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
3,3,4,8,4,4,0,2,2,1,3,0,0,5133.6,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
3,4,1,5,3,3,0,1,1,1,3,1,1,4455.2,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
4,1,3,7,3,3,0,2,1,1,4,0,0,5837.2,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
4,2,4,8,4,4,0,2,1,2,4,1,1,12227,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
4,3,2,6,4,4,0,1,2,1,4,1,1,4334.7,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
4,4,1,5,3,3,0,1,2,2,3,1,1,2457.2,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
5,1,2,6,4,4,0,1,2,1,4,1,1,3976.1,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
5,2,1,5,3,3,0,1,1,2,3,1,1,2544.3,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
5,3,4,8,4,4,0,2,1,2,4,1,1,6234.9,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
5,4,3,7,3,3,0,2,1,1,3,1,1,3650.3,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
6,1,2,6,4,4,0,1,1,2,4,1,1,3014.3,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
6,2,1,5,3,3,0,1,2,2,3,1,1,1671,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
6,3,4,8,4,4,0,2,2,1,4,1,1,2717.2,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
6,4,3,7,3,3,0,2,2,1,3,1,1,2945.3,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15,1.3751e+15
17 changes: 10 additions & 7 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
Type: Package
Package: eyetools
Title: Tools for eye data analysis
Version: 0.5.1
Author: Tom Beesley
Maintainer: Tom Beesley <t.beesley@lancaster.ac.uk>
Version: 0.6.0
Authors@R: c(
person("Beesley", "Tom", email = "t.beesley@lancaster.ac.uk", role = c("aut", "cre")),
person("Ivory", "Matthew", email = "matthew.ivory@lancaster.ac.uk", role = "aut"))
Description: A set of tools for eye data processing. The intended flow is
from data processing, to fixation analysis, to data visualisation and
trial level summaries.
Expand All @@ -15,6 +16,7 @@ Imports:
ggforce,
ggplot2,
glue,
hdf5r,
lifecycle,
magick,
magrittr,
Expand All @@ -26,11 +28,12 @@ Imports:
zoo
Suggests:
knitr,
rmarkdown
VignetteBuilder:
knitr
rmarkdown,
testthat (>= 3.0.0)
VignetteBuilder: knitr
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.2
RoxygenNote: 7.3.1
URL: https://tombeesley.github.io/eyetools/
Config/testthat/edition: 3
25 changes: 18 additions & 7 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,33 +1,44 @@
# Generated by roxygen2: do not edit by hand

export("%>%")
export(AOI_seq)
export(AOI_time)
export(VTI_saccade)
export(combine_eyes)
export(compare_algorithms)
export(conditional_transform)
export(dist_to_visual_angle)
export(fix_dispersion)
export(fixation_VTI)
export(fixation_dispersion)
export(hdf5_to_csv)
export(interpolate)
export(seq_plot)
export(plot_seq)
export(plot_spatial)
export(saccade_VTI)
export(smoother)
export(spatial_plot)
import(dplyr)
import(ggforce)
import(ggplot2)
import(hdf5r)
import(rlang)
importFrom(dplyr,between)
importFrom(glue,glue)
importFrom(lifecycle,deprecated)
importFrom(magick,image_read)
importFrom(magrittr,"%>%")
importFrom(pbapply,pblapply)
importFrom(rlang,.data)
importFrom(stats,aggregate)
importFrom(stats,complete.cases)
importFrom(stats,cor.test)
importFrom(stats,dist)
importFrom(stats,loess)
importFrom(stats,median)
importFrom(stats,na.exclude)
importFrom(stats,na.omit)
importFrom(stats,predict)
importFrom(stats,reshape)
importFrom(stats,setNames)
importFrom(stats,time)
importFrom(utils,head)
importFrom(utils,stack)
importFrom(utils,tail)
importFrom(zoo,na.approx)
importFrom(zoo,na.spline)
importFrom(zoo,na.trim)
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# eyetools 0.6.0

# eyetools 0.5.1

# eyetools 0.5.0
Expand Down
46 changes: 35 additions & 11 deletions R/AOI_seq.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,22 @@
#' @param AOIs A dataframe of areas of interest (AOIs), with one row per AOI (x, y, width_radius, height).
#' @param AOI_names An optional vector of AOI names to replace the default "AOI_1", "AOI_2", etc.
#' @param sample_rate Optional sample rate of the eye-tracker (Hz) for use with raw_data. If not supplied, the sample rate will be estimated from the time column and the number of samples.
#'
#' @return a dataframe containing the sequence of entries into AOIs on each trial
#' @param long Whether to return the AOI fixations in long or wide format. Defaults to long
#' @return a long format dataframe containing the sequence of entries into AOIs on each trial
#' @export
#'
#' @examples
#' fix_d <- fix_dispersion(eyetools::example_raw_WM)
#' AOI_seq(fix_d, eyetools::AOIs_WM)
#'
#' @importFrom dplyr between
#' fix_d <- fixation_dispersion(example_raw_WM)
#' AOI_seq(fix_d, AOIs_WM)
#'
#' @importFrom stats setNames complete.cases
#' @importFrom utils stack

AOI_seq <- function(data,
AOIs,
AOI_names = NULL,
sample_rate = NULL) {
sample_rate = NULL,
long = TRUE) {

# split data by trial
proc_data <- sapply(split(data, data$trial),
Expand All @@ -31,6 +32,29 @@ AOI_seq <- function(data,
data <- data.frame(trial = unique(data$trial),
AOI_entry_seq = proc_data)

if (long == TRUE) {

split_list <- strsplit(data$AOI_entry_seq,';')

split_list_names <- setNames(split_list, data$trial)

data <- stack(split_list_names)

data <- data.frame(trial = as.numeric(data$ind),
AOI = as.numeric(data$value))

# add in entry_n by way of indexing each trial
get_row_n <- function(i) {
store <- data[data$trial == i,]
store$entry_n <- 1:nrow(store)

store
}

data <- do.call(rbind.data.frame, lapply(1:max(data$trial), get_row_n))

}


return(data)

Expand All @@ -47,13 +71,14 @@ AOI_seq_trial_process <- function(trial_data, AOIs, AOI_names) {

if (sum(!is.na(AOIs[a,])) == 4) {
# square AOI
aoi_entries[,a] <- (between(trial_data$x, AOIs[a,1]-AOIs[a,3]/2, AOIs[a,1]+AOIs[a,3]/2) &
between(trial_data$y, AOIs[a,2]-AOIs[a,4]/2, AOIs[a,2]+AOIs[a,4]/2))
} else if (sum(!is.na(AOIs[a,])) == 3) {
aoi_entries[,a] <- ((trial_data$x >= AOIs[a,1]-AOIs[a,3]/2 & trial_data$x <= AOIs[a,1]+AOIs[a,3]/2) &
(trial_data$y >= AOIs[a,2]-AOIs[a,4]/2 & trial_data$y <= AOIs[a,2]+AOIs[a,4]/2))
} else if (sum(!is.na(AOIs[a,])) == 3) {
# circle AOI
aoi_entries[,a] <- sqrt((AOIs[a,1]-trial_data$x)^2+(AOIs[a,2]-trial_data$y)^2) < AOIs[a,3]
} else {
# report error message of bad AOI definition
stop("bad definition of AOI. Cannot identify AOI region")

}
}
Expand All @@ -71,7 +96,6 @@ AOI_seq_trial_process <- function(trial_data, AOIs, AOI_names) {
} else {
aoi_seq <- paste0(aoi_seq, collapse = ";")
}

return(aoi_seq)

}
Expand Down
21 changes: 14 additions & 7 deletions R/AOI_time.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@
#' @export
#'
#' @examples
#' fix_d <- fix_dispersion(eyetools::example_raw_WM)
#' AOI_time(fix_data = fix_d, AOIs = eyetools::AOIs_WM)
#' AOI_time(raw_data = eyetools::example_raw_WM, AOIs = eyetools::AOIs_WM, sample_rate = 120)
#'
#'#' @importFrom dplyr between
#' fix_d <- fixation_dispersion(example_raw_WM)
#' AOI_time(fix_data = fix_d, AOIs = AOIs_WM)
#' AOI_time(raw_data = example_raw_WM, AOIs = AOIs_WM, sample_rate = 120)
#'

AOI_time <- function(fix_data = NULL, raw_data = NULL, AOIs, AOI_names = NULL, sample_rate = NULL) {
Expand Down Expand Up @@ -58,6 +56,15 @@ AOI_time <- function(fix_data = NULL, raw_data = NULL, AOIs, AOI_names = NULL, s
}

colnames(data) <- c("trial", AOI_name_text)

data <- do.call(cbind.data.frame, lapply(1:length(colnames(data)), function(i) {

data[,i] <- as.numeric(data[,i])

}))

colnames(data) <- c("trial", AOI_name_text)

return(data.frame(data))

}
Expand Down Expand Up @@ -107,8 +114,8 @@ AOI_time_trial_process_raw <- function(trial_data, AOIs, sample_rate) {

if (sum(!is.na(AOIs[a,])) == 4) {
# square AOI
xy_hits <- (between(trial_data$x, AOIs[a,1]-AOIs[a,3]/2, AOIs[a,1]+AOIs[a,3]/2) &
between(trial_data$y, AOIs[a,2]-AOIs[a,4]/2, AOIs[a,2]+AOIs[a,4]/2))
xy_hits <- ((trial_data$x >= AOIs[a,1]-AOIs[a,3]/2 & trial_data$x <= AOIs[a,1]+AOIs[a,3]/2) &
(trial_data$y >= AOIs[a,2]-AOIs[a,4]/2 & trial_data$y <= AOIs[a,2]+AOIs[a,4]/2))
} else if (sum(!is.na(AOIs[a,])) == 3) {
# circle AOI
xy_hits <- sqrt((AOIs[a,1]-trial_data$x)^2+(AOIs[a,2]-trial_data$y)^2) < AOIs[a,3]
Expand Down
2 changes: 1 addition & 1 deletion R/combine_eyes.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#' @param data raw data with columns time, left_x, left_y, right_x, right_y, and trial
#' @param method either "average" or "best_eye" - see description.
#'
#' @return
#' @return a dataframe of form c("time", "x", "y", "trial")
#' @export
#'
#' @examples combine_eyes(example_raw_binocular, method = "average")
Expand Down
Loading

0 comments on commit 0b682df

Please sign in to comment.