-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplot_results.py
executable file
·46 lines (35 loc) · 1.19 KB
/
plot_results.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!python
import os
import sys
import matplotlib.pyplot as plt
import numpy as np
def plot_lfp(path):
fig, ax = plt.subplots()
ref_fname = os.path.join(path, "ref.npy")
if os.path.exists(ref_fname):
ax.plot(np.load(ref_fname), lw=2, c="gray")
lfp = np.load(os.path.join(path, "tklfp.npy"))
ax.plot(lfp, c="black")
ax.set(title="TKLFP", ylabel="μV", xlabel="ms")
if os.path.exists(ref_fname):
plt.legend(["reference", "measured"])
fig, ax = plt.subplots()
rwslfp = np.load(os.path.join(path, "rwslfp.npy"))
ax.plot(rwslfp, c="black")
ax.set(title="RWSLFP", ylabel="a.u.", xlabel="ms")
def plot_input(path):
npz = np.load(os.path.join(path, "input.npz"))
fig, (ax1, ax2) = plt.subplots(2, 1, sharex=True)
ax1.plot(npz["t_s"] * 1000, npz["inputs1"])
ax1.set(title="external current", ylabel="$I_{ext}$ (nA)")
try:
ax2.step(npz["t_opto_ms"], npz["Irr0_mW_per_mm2"], where="post")
ax2.set(
title="optogenetic input", xlabel="t (ms)", ylabel="$Irr_0$ (mW/mm$^2$)"
)
except KeyError:
pass
if __name__ == "__main__":
plot_lfp(sys.argv[1])
plot_input(sys.argv[1])
plt.show()