@@ -202,13 +202,35 @@ def test_bino_to_mono(tmp_path, fname):
202202 in_file = Path (fname )
203203
204204 with in_file .open () as file :
205+ # We'll also add some binocular velocity data to increase our testing coverage.
205206 lines = file .readlines ()
207+ start_idx = [li for li , line in enumerate (lines ) if line .startswith ("START" )][0 ]
208+ for li , line in enumerate (lines [start_idx :- 2 ], start = start_idx ):
209+ tokens = line .split ("\t " )
210+ event_type = tokens [0 ]
211+ if event_type == "SAMPLES" :
212+ tokens .insert (3 , "VEL" )
213+ lines [li ] = "\t " .join (tokens )
214+ elif event_type .isnumeric ():
215+ # fake velocity values for x/y left/right
216+ tokens [4 :4 ] = ["999.1" , "999.2" , "999.3" , "999.4" ]
217+ lines [li ] = "\t " .join (tokens )
206218 end_line = lines [- 2 ]
207219 end_ts = int (end_line .split ("\t " )[1 ])
208220 # Now only left eye data
209221 second_block = []
210222 new_ts = end_ts + 1
211- info = ["GAZE" , "LEFT" , "RATE" , "500.00" , "TRACKING" , "CR" , "FILTER" , "2" ]
223+ info = [
224+ "GAZE" ,
225+ "LEFT" ,
226+ "VEL" ,
227+ "RATE" ,
228+ "500.00" ,
229+ "TRACKING" ,
230+ "CR" ,
231+ "FILTER" ,
232+ "2" ,
233+ ]
212234 start = ["START" , f"{ new_ts } " , "LEFT" , "SAMPLES" , "EVENTS" ]
213235 pupil = ["PUPIL" , "DIAMETER" ]
214236 samples = ["SAMPLES" ] + info
@@ -217,8 +239,8 @@ def test_bino_to_mono(tmp_path, fname):
217239 second_block .append ("\t " .join (pupil ) + "\n " )
218240 second_block .append ("\t " .join (samples ) + "\n " )
219241 second_block .append ("\t " .join (events ) + "\n " )
220- # Some fake data
221- left = ["960" , "540" , "0.0" , "..." ] # x, y, pupil, status
242+ # Some fake data.. # x, y, pupil, velicty x/y status
243+ left = ["960" , "540" , "0.0" , "999.1" , "999.2" , "..." ]
222244 NUM_FAKE_SAMPLES = 4000
223245 for ii in range (NUM_FAKE_SAMPLES ):
224246 ts = new_ts + ii
@@ -273,6 +295,10 @@ def test_bino_to_mono(tmp_path, fname):
273295 "xpos_right" ,
274296 "ypos_right" ,
275297 "pupil_right" ,
298+ "xvel_left" ,
299+ "yvel_left" ,
300+ "xvel_right" ,
301+ "yvel_right" ,
276302 ]
277303 assert len (set (raw .info ["ch_names" ]).difference (set (want_channels ))) == 0
278304
0 commit comments