Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionLast revisionBoth sides next revision | ||
technical:sliding_window [2019/09/25 14:25] – created chunchung | technical:sliding_window [2020/10/13 19:27] – [Sliding window time histogram] chunchung | ||
---|---|---|---|
Line 1: | Line 1: | ||
=====Sliding window time histogram===== | =====Sliding window time histogram===== | ||
+ | Given the spike time, plot the event rate within a sliding window. | ||
<code python> | <code python> | ||
def sliding_window(ts, | def sliding_window(ts, | ||
Line 36: | Line 37: | ||
tts.append(tw) | tts.append(tw) | ||
rrs.append(0) | rrs.append(0) | ||
- | return np.array(tts)+wsz/ | + | return np.array(tts)+wsz/ |
</ | </ | ||
+ | ====Example==== | ||
+ | <code python> | ||
+ | a = np.array([1, | ||
+ | tts,rrs = sliding_window(a) | ||
+ | plt.plot(tts, | ||
+ | plt.plot(a, | ||
+ | </ | ||
+ | {{ : |