equal
deleted
inserted
replaced
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 |