Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f406d7d

Browse files
committed
Remove convolution from cohere_demo
1 parent 998af8b commit f406d7d

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

examples/lines_bars_and_markers/cohere_demo.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,14 @@
1515
t = np.arange(0, 30, dt)
1616
nse1 = np.random.randn(len(t)) # white noise 1
1717
nse2 = np.random.randn(len(t)) # white noise 2
18-
r = np.exp(-t / 0.05)
1918

20-
cnse1 = np.convolve(nse1, r, mode='same') * dt # colored noise 1
21-
cnse2 = np.convolve(nse2, r, mode='same') * dt # colored noise 2
22-
23-
# two signals with a coherent part and a random part
24-
s1 = 0.01 * np.sin(2 * np.pi * 10 * t) + cnse1
25-
s2 = 0.01 * np.sin(2 * np.pi * 10 * t) + cnse2
19+
# Two signals with a coherent part at 10Hz and a random part
20+
s1 = np.sin(2 * np.pi * 10 * t) + nse1
21+
s2 = np.sin(2 * np.pi * 10 * t) + nse2
2622

2723
fig, axs = plt.subplots(2, 1)
2824
axs[0].plot(t, s1, t, s2)
29-
axs[0].set_xlim(0, 5)
25+
axs[0].set_xlim(0, 2)
3026
axs[0].set_xlabel('time')
3127
axs[0].set_ylabel('s1 and s2')
3228
axs[0].grid(True)

0 commit comments

Comments
 (0)