np.where(np.diff(np.sign(x)))[0] Find points of x crossing the threshold T : np.where(np.diff(x > T))[0] Find points of x crossing threshold ascending : np.where(np.diff(x > T) & (x[1:] > T)) Remove points that are close, i.e. given a sorted array …
Datetime Get the current date/time and format it (e.g. to create a filename) : import datetime print(datetime.datetime.now().strftime('%d%b%Y-%Hh%M')) >> '10Oct2018-18h01' See Comportement de strftime() et strptime() for the availables directives