original_docstring: 
      Modify dataframe by adding a column 'teleport' (boolean) to identify vision glitches.
      
docstring: Modify dataframe by adding a column 'teleport' (boolean) to identify vision glitches.
docstring_tokens: Modify dataframe by adding a column ' teleport ' ( boolean ) to identify vision glitches .
code: def calc_teleport(df, thresholdXY=0.2, thresholdRz=0.5):
      """
      Modify dataframe by adding a column 'teleport' (boolean) to identify vision glitches.
      """
      delta_x = df['pos_x'] - np.roll(df['pos_x'], 1)
      delta_y = df['pos_y'] - np.roll(df['pos_y'], 1)
      delta_Rz = df['pos_Rz'] - np.roll(df['pos_Rz'], 1)
      df['teleport'] = (abs(delta_x) > thresholdXY)
      df['teleport'] |= (abs(delta_y) > thresholdXY)
      df['teleport'] |= (abs(delta_Rz) > thresholdRz)
      # fix edge
      df.loc[0, 'teleport'] = False
      # ignore going inplay
      df['teleport'] &= (np.roll(df['inplay'], 1) == True)
code_tokens: def calc_teleport ( df , thresholdXY = 0.2 , thresholdRz = 0.5 ) : delta_x = df [ 'pos_x' ] - np . roll ( df [ 'pos_x' ] , 1 ) delta_y = df [ 'pos_y' ] - np . roll ( df [ 'pos_y' ] , 1 ) delta_Rz = df [ 'pos_Rz' ] - np . roll ( df [ 'pos_Rz' ] , 1 ) df [ 'teleport' ] = ( abs ( delta_x ) > thresholdXY ) df [ 'teleport' ] |= ( abs ( delta_y ) > thresholdXY ) df [ 'teleport' ] |= ( abs ( delta_Rz ) > thresholdRz ) df . loc [ 0 , 'teleport' ] = False df [ 'teleport' ] &= ( np . roll ( df [ 'inplay' ] , 1 ) == True )
short_docstring: Modify dataframe by adding a column 'teleport' (boolean) to identify vision glitches.
short_docstring_tokens: Modify dataframe by adding a column ' teleport ' ( boolean ) to identify vision glitches .
comment: """
      Modify dataframe by adding a column 'teleport' (boolean) to identify vision glitches.
      """$SEP$# fix edge$SEP$# ignore going inplay