Skip to content

Instantly share code, notes, and snippets.

@MShirazAhmad
Created February 2, 2020 12:15
Show Gist options
  • Save MShirazAhmad/50a168e59278ae98d7a0bc6cb56bc7e6 to your computer and use it in GitHub Desktop.
Save MShirazAhmad/50a168e59278ae98d7a0bc6cb56bc7e6 to your computer and use it in GitHub Desktop.
Finding indices and time stamps of raw data
import numpy as np
def indices(CH, time):
k = 0
i = 0
T = []
while i < (len(CH) - 2):
if CH[i] == 0 and CH[i + 1] == 1 and CH[i + 2] == 1:
T.append(time[i + 1])
k = k + 1
if CH[i] == 1 and CH[i + 1] == 0 and CH[i + 2] == 0:
T.append(time[i])
k = k + 1
i = i + 1
return T
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment