controls/DebugVariablePanel/DebugVariableItem.py
changeset 2742 5f7445b582d4
parent 2741 3cc5663af196
child 3292 ef04cedee08b
equal deleted inserted replaced
2741:3cc5663af196 2742:5f7445b582d4
   382 
   382 
   383         # Extract data ticks
   383         # Extract data ticks
   384         ticks = self.Data.view[:, 0]
   384         ticks = self.Data.view[:, 0]
   385 
   385 
   386         # Get nearest data from tick
   386         # Get nearest data from tick
   387         idx = np.searchsorted(ticks, tick)
   387         idx = min(np.searchsorted(ticks, tick), self.Data.count - 1)
   388 
   388 
   389         # Adjust data index according to constraint
   389         # Adjust data index according to constraint
   390         if adjust < 0 and ticks[idx] > tick and idx > 0 or \
   390         if adjust < 0 and ticks[idx] > tick and idx > 0 or \
   391            adjust > 0 and ticks[idx] < tick and idx < len(ticks):
   391            adjust > 0 and ticks[idx] < tick and idx < len(ticks):
   392             idx += adjust
   392             idx += adjust