code/vexptoolbox/replay.py
def replayCurrentFrame(self, advance=True):
        """ Replay task. Sets up gaze position for each upcoming frame 
        
        Args:
            advance (bool): if True, advance to next frame (default).
        """
        if self._frame < len(self._samples):
            f = self._samples[self._frame]

            # Set up eye representation(s)
            for eye_pos in list(self._gaze.keys()):
                if self._gaze[eye_pos]['node'] is not None:
                    if self._gaze[eye_pos]['data']:
                        node = self._gaze[eye_pos][self._gaze[eye_pos]['node']]
                        eye_mat = viz.Matrix()
                        eye_mat.setEuler([f['gaze{:s}_dirX'.format(eye_pos)],
                                        f['gaze{:s}_dirY'.format(eye_pos)],
                                        f['gaze{:s}_dirZ'.format(eye_pos)]])
                        eye_mat.setPosition([f['gaze{:s}_posX'.format(eye_pos)],
                                            f['gaze{:s}_posY'.format(eye_pos)],
                                            f['gaze{:s}_posZ'.format(eye_pos)]])
                        eye_mat.setScale(node.getScale())
                        node.setMatrix(eye_mat)
                        node.visible(True)
                    else:
                        self._gaze[eye_pos][self._gaze[eye_pos]['node']].visible(False) 

            # Position the 3D gaze cursor and other nodes
            for node in self._nodes.keys():
                if self._nodes[node]['visible']:
                    self._nodes[node]['obj'].setPosition([f['{:s}_posX'.format(node)], f['{:s}_posY'.format(node)], f['{:s}_posZ'.format(node)]])

            if self.replay_view:
                viz.MainView.setEuler([f['view_dirX'], f['view_dirY'], f['view_dirZ']])
                viz.MainView.setPosition([f['view_posX'], f['view_posY'], f['view_posZ']])

            if self.console:
                st = 't={:.2f}s, f={:d}\tgaze3d=[{:0.2f}, {:0.2f}, {:0.2f}]\tgaze=[{:0.2f}, {:0.2f}, {:0.2f}]'
                print(st.format((f['time'] - self._sample_time_offset)/1000.0, self._frame, f['gaze3d_posX'], f['gaze3d_posY'], f['gaze3d_posZ'], f['gaze_dirX'], f['gaze_dirY'], f['gaze_dirZ']))
            else:
                if self._frame == 0 or self._frame == len(self._samples) or self._frame % 100 == 0:
                    print('Replaying frame {:d}/{:d}, t={:.1f} s'.format(self._frame, len(self._samples), 
                                                                    (f['time'] - self._sample_time_offset)/1000.0))

            if advance:
                self._frame += 1

        else:
            # Reached last frame, stop replay and reset
            self.replaying = False
            self.finished = True
            if self._player is not None:
                self._player.setEnabled(False)
            print('Replay finished.')

        self._set_ui()
 Replay task. Sets up gaze position for each upcoming frame 
        
        Args:
            advance (bool): if True, advance to next frame (default).
        
Replay task. Sets up gaze position for each upcoming frame
Replay task . Sets up gaze position for each upcoming frame
def replayCurrentFrame(self, advance=True):
        if self._frame < len(self._samples):
            f = self._samples[self._frame]
            for eye_pos in list(self._gaze.keys()):
                if self._gaze[eye_pos]['node'] is not None:
                    if self._gaze[eye_pos]['data']:
                        node = self._gaze[eye_pos][self._gaze[eye_pos]['node']]
                        eye_mat = viz.Matrix()
                        eye_mat.setEuler([f['gaze{:s}_dirX'.format(eye_pos)],
                                        f['gaze{:s}_dirY'.format(eye_pos)],
                                        f['gaze{:s}_dirZ'.format(eye_pos)]])
                        eye_mat.setPosition([f['gaze{:s}_posX'.format(eye_pos)],
                                            f['gaze{:s}_posY'.format(eye_pos)],
                                            f['gaze{:s}_posZ'.format(eye_pos)]])
                        eye_mat.setScale(node.getScale())
                        node.setMatrix(eye_mat)
                        node.visible(True)
                    else:
                        self._gaze[eye_pos][self._gaze[eye_pos]['node']].visible(False) 
            for node in self._nodes.keys():
                if self._nodes[node]['visible']:
                    self._nodes[node]['obj'].setPosition([f['{:s}_posX'.format(node)], f['{:s}_posY'.format(node)], f['{:s}_posZ'.format(node)]])
            if self.replay_view:
                viz.MainView.setEuler([f['view_dirX'], f['view_dirY'], f['view_dirZ']])
                viz.MainView.setPosition([f['view_posX'], f['view_posY'], f['view_posZ']])
            if self.console:
                st = 't={:.2f}s, f={:d}\tgaze3d=[{:0.2f}, {:0.2f}, {:0.2f}]\tgaze=[{:0.2f}, {:0.2f}, {:0.2f}]'
                print(st.format((f['time'] - self._sample_time_offset)/1000.0, self._frame, f['gaze3d_posX'], f['gaze3d_posY'], f['gaze3d_posZ'], f['gaze_dirX'], f['gaze_dirY'], f['gaze_dirZ']))
            else:
                if self._frame == 0 or self._frame == len(self._samples) or self._frame % 100 == 0:
                    print('Replaying frame {:d}/{:d}, t={:.1f} s'.format(self._frame, len(self._samples), 
                                                                    (f['time'] - self._sample_time_offset)/1000.0))
            if advance:
                self._frame += 1
        else:
            self.replaying = False
            self.finished = True
            if self._player is not None:
                self._player.setEnabled(False)
            print('Replay finished.')
        self._set_ui()
def replayCurrentFrame ( self , advance = True ) : if self . _frame < len ( self . _samples ) : f = self . _samples [ self . _frame ] for eye_pos in list ( self . _gaze . keys ( ) ) : if self . _gaze [ eye_pos ] [ 'node' ] is not None : if self . _gaze [ eye_pos ] [ 'data' ] : node = self . _gaze [ eye_pos ] [ self . _gaze [ eye_pos ] [ 'node' ] ] eye_mat = viz . Matrix ( ) eye_mat . setEuler ( [ f [ 'gaze{:s}_dirX' . format ( eye_pos ) ] , f [ 'gaze{:s}_dirY' . format ( eye_pos ) ] , f [ 'gaze{:s}_dirZ' . format ( eye_pos ) ] ] ) eye_mat . setPosition ( [ f [ 'gaze{:s}_posX' . format ( eye_pos ) ] , f [ 'gaze{:s}_posY' . format ( eye_pos ) ] , f [ 'gaze{:s}_posZ' . format ( eye_pos ) ] ] ) eye_mat . setScale ( node . getScale ( ) ) node . setMatrix ( eye_mat ) node . visible ( True ) else : self . _gaze [ eye_pos ] [ self . _gaze [ eye_pos ] [ 'node' ] ] . visible ( False ) for node in self . _nodes . keys ( ) : if self . _nodes [ node ] [ 'visible' ] : self . _nodes [ node ] [ 'obj' ] . setPosition ( [ f [ '{:s}_posX' . format ( node ) ] , f [ '{:s}_posY' . format ( node ) ] , f [ '{:s}_posZ' . format ( node ) ] ] ) if self . replay_view : viz . MainView . setEuler ( [ f [ 'view_dirX' ] , f [ 'view_dirY' ] , f [ 'view_dirZ' ] ] ) viz . MainView . setPosition ( [ f [ 'view_posX' ] , f [ 'view_posY' ] , f [ 'view_posZ' ] ] ) if self . console : st = 't={:.2f}s, f={:d}\tgaze3d=[{:0.2f}, {:0.2f}, {:0.2f}]\tgaze=[{:0.2f}, {:0.2f}, {:0.2f}]' print ( st . format ( ( f [ 'time' ] - self . _sample_time_offset ) / 1000.0 , self . _frame , f [ 'gaze3d_posX' ] , f [ 'gaze3d_posY' ] , f [ 'gaze3d_posZ' ] , f [ 'gaze_dirX' ] , f [ 'gaze_dirY' ] , f [ 'gaze_dirZ' ] ) ) else : if self . _frame == 0 or self . _frame == len ( self . _samples ) or self . _frame % 100 == 0 : print ( 'Replaying frame {:d}/{:d}, t={:.1f} s' . format ( self . _frame , len ( self . _samples ) , ( f [ 'time' ] - self . _sample_time_offset ) / 1000.0 ) ) if advance : self . _frame += 1 else : self . replaying = False self . finished = True if self . _player is not None : self . _player . setEnabled ( False ) print ( 'Replay finished.' ) self . _set_ui ( )
Replay task.
Replay task .
""" Replay task. Sets up gaze position for each upcoming frame 
        
        Args:
            advance (bool): if True, advance to next frame (default).
        """ # Set up eye representation(s) # Position the 3D gaze cursor and other nodes # Reached last frame, stop replay and reset
self
advance
if True, advance to next frame (default).
if True advance to next frame ( default ) .