Skip to content

Commit 772eb88

Browse files
committed
ENH add time in sec
1 parent 35b84a2 commit 772eb88

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

tutorials/movies_3T/01_plot_explainable_variance.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,11 @@
6363
import matplotlib.pyplot as plt
6464

6565
voxel_1 = np.argmax(ev)
66+
time = np.arange(Y_test.shape[1]) * 2 # one time point every 2 seconds
6667
plt.figure(figsize=(10, 3))
67-
plt.plot(Y_test[:, :, voxel_1].T, color='C0', alpha=0.5)
68-
plt.plot(Y_test[:, :, voxel_1].mean(0), color='C1', label='average')
69-
plt.xlabel("Time points")
68+
plt.plot(time, Y_test[:, :, voxel_1].T, color='C0', alpha=0.5)
69+
plt.plot(time, Y_test[:, :, voxel_1].mean(0), color='C1', label='average')
70+
plt.xlabel("Time (sec)")
7071
plt.title("Voxel with large explainable variance (%.2f)" % ev[voxel_1])
7172
plt.yticks([])
7273
plt.legend()
@@ -77,9 +78,9 @@
7778
# ... and of a voxel with low explainable variance.
7879
voxel_2 = np.argmin(ev)
7980
plt.figure(figsize=(10, 3))
80-
plt.plot(Y_test[:, :, voxel_2].T, color='C0', alpha=0.5)
81-
plt.plot(Y_test[:, :, voxel_2].mean(0), color='C1', label='average')
82-
plt.xlabel("Time points")
81+
plt.plot(time, Y_test[:, :, voxel_2].T, color='C0', alpha=0.5)
82+
plt.plot(time, Y_test[:, :, voxel_2].mean(0), color='C1', label='average')
83+
plt.xlabel("Time (sec)")
8384
plt.title("Voxel with low explainable variance (%.2f)" % ev[voxel_2])
8485
plt.yticks([])
8586
plt.legend()

tutorials/notebooks/movies_3T/01_plot_explainable_variance.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
},
128128
"outputs": [],
129129
"source": [
130-
"import matplotlib.pyplot as plt\n\nvoxel_1 = np.argmax(ev)\nplt.figure(figsize=(10, 3))\nplt.plot(Y_test[:, :, voxel_1].T, color='C0', alpha=0.5)\nplt.plot(Y_test[:, :, voxel_1].mean(0), color='C1', label='average')\nplt.xlabel(\"Time points\")\nplt.title(\"Voxel with large explainable variance (%.2f)\" % ev[voxel_1])\nplt.yticks([])\nplt.legend()\nplt.tight_layout()\nplt.show()"
130+
"import matplotlib.pyplot as plt\n\nvoxel_1 = np.argmax(ev)\ntime = np.arange(Y_test.shape[1]) * 2 # one time point every 2 seconds\nplt.figure(figsize=(10, 3))\nplt.plot(time, Y_test[:, :, voxel_1].T, color='C0', alpha=0.5)\nplt.plot(time, Y_test[:, :, voxel_1].mean(0), color='C1', label='average')\nplt.xlabel(\"Time (sec)\")\nplt.title(\"Voxel with large explainable variance (%.2f)\" % ev[voxel_1])\nplt.yticks([])\nplt.legend()\nplt.tight_layout()\nplt.show()"
131131
]
132132
},
133133
{
@@ -145,7 +145,7 @@
145145
},
146146
"outputs": [],
147147
"source": [
148-
"voxel_2 = np.argmin(ev)\nplt.figure(figsize=(10, 3))\nplt.plot(Y_test[:, :, voxel_2].T, color='C0', alpha=0.5)\nplt.plot(Y_test[:, :, voxel_2].mean(0), color='C1', label='average')\nplt.xlabel(\"Time points\")\nplt.title(\"Voxel with low explainable variance (%.2f)\" % ev[voxel_2])\nplt.yticks([])\nplt.legend()\nplt.tight_layout()\nplt.show()"
148+
"voxel_2 = np.argmin(ev)\nplt.figure(figsize=(10, 3))\nplt.plot(time, Y_test[:, :, voxel_2].T, color='C0', alpha=0.5)\nplt.plot(time, Y_test[:, :, voxel_2].mean(0), color='C1', label='average')\nplt.xlabel(\"Time (sec)\")\nplt.title(\"Voxel with low explainable variance (%.2f)\" % ev[voxel_2])\nplt.yticks([])\nplt.legend()\nplt.tight_layout()\nplt.show()"
149149
]
150150
},
151151
{

0 commit comments

Comments
 (0)