original_docstring: 
          filename:    the file that contains BMI feature-spike packet
          last_N:      only set_data for the last_N spikes in the file
          view_window: x second for visualization
          
docstring: the file that contains BMI feature-spike packet
  last_N:      only set_data for the last_N spikes in the file
  view_window: x second for visualization
docstring_tokens: the file that contains BMI feature - spike packet last_N : only set_data for the last_N spikes in the file view_window : x second for visualization
code: def update_fromfile(self, filename='./fet.bin', last_N=8000):
          '''
          filename:    the file that contains BMI feature-spike packet
          last_N:      only set_data for the last_N spikes in the file
          view_window: x second for visualization
          '''
          try:
              fet_packet = np.memmap(filename, dtype=np.int32).reshape(-1,7)
              # print(fet_packet.shape)
              N = last_N
              if fet_packet.shape[0]>N:
                  spkid_packet = fet_packet[-N:, [0,-1]]
                  spkid_packet = np.delete(spkid_packet, np.where(spkid_packet[:,1]==0), axis=0) 
              else:
                  spkid_packet = fet_packet[:, [0,-1]]
                  spkid_packet = np.delete(spkid_packet, np.where(spkid_packet[:,1]==0), axis=0)                 
              self.set_data(spkid_packet)
              xmin = (spkid_packet[-1, 0]-self._view_window*self._fs)/self._fs
              xmax = spkid_packet[-1, 0]/self._fs
              self._view.camera.set_range(x=(xmin, xmax),  y=self._y_bound)
              self._view2.camera.set_range(x=(xmin, xmax), y=(0, 3+int(self._pfr[:,1].max())))
          except:
              pass
code_tokens: def update_fromfile ( self , filename = './fet.bin' , last_N = 8000 ) : try : fet_packet = np . memmap ( filename , dtype = np . int32 ) . reshape ( - 1 , 7 ) N = last_N if fet_packet . shape [ 0 ] > N : spkid_packet = fet_packet [ - N : , [ 0 , - 1 ] ] spkid_packet = np . delete ( spkid_packet , np . where ( spkid_packet [ : , 1 ] == 0 ) , axis = 0 ) else : spkid_packet = fet_packet [ : , [ 0 , - 1 ] ] spkid_packet = np . delete ( spkid_packet , np . where ( spkid_packet [ : , 1 ] == 0 ) , axis = 0 ) self . set_data ( spkid_packet ) xmin = ( spkid_packet [ - 1 , 0 ] - self . _view_window * self . _fs ) / self . _fs xmax = spkid_packet [ - 1 , 0 ] / self . _fs self . _view . camera . set_range ( x = ( xmin , xmax ) , y = self . _y_bound ) self . _view2 . camera . set_range ( x = ( xmin , xmax ) , y = ( 0 , 3 + int ( self . _pfr [ : , 1 ] . max ( ) ) ) ) except : pass
short_docstring: filename:    the file that contains BMI feature-spike packet
  last_N:      only set_data for the last_N spikes in the file
  view_window: x second for visualization
short_docstring_tokens: filename : the file that contains BMI feature - spike packet last_N : only set_data for the last_N spikes in the file view_window : x second for visualization
comment: '''
          filename:    the file that contains BMI feature-spike packet
          last_N:      only set_data for the last_N spikes in the file
          view_window: x second for visualization
          '''$SEP$# print(fet_packet.shape)
  