|
125 | 125 | "metadata": {
|
126 | 126 | "hide_input": false,
|
127 | 127 | "init_cell": true,
|
128 |
| - "scrolled": false |
| 128 | + "scrolled": true |
129 | 129 | },
|
130 | 130 | "outputs": [
|
131 | 131 | {
|
132 | 132 | "data": {
|
133 | 133 | "application/vnd.jupyter.widget-view+json": {
|
134 |
| - "model_id": "a115ec48129d4fdeb52de4be6436c4e0", |
| 134 | + "model_id": "98292748760d48df89e696132a9a86fa", |
135 | 135 | "version_major": 2,
|
136 | 136 | "version_minor": 0
|
137 | 137 | },
|
|
218 | 218 | "import pandas as pd\n",
|
219 | 219 | "from mpl_toolkits.mplot3d import axes3d\n",
|
220 | 220 | "import matplotlib.pyplot as plt\n",
|
221 |
| - "\n", |
| 221 | + "import numpy as np\n", |
222 | 222 | "%matplotlib notebook\n",
|
223 | 223 | "\n",
|
224 | 224 | "\n",
|
225 |
| - "def create_predicted_compound_nerve_action(cv_path, t_path, ist_path, tst_path, qst_path, vpred_path, fixed_tst, plot_vs_qst, plot_vs_tCNAP):\n", |
| 225 | + "def create_predicted_compound_nerve_action(cv_path, t_path, ist_path, tst_path, qst_path, vpred_path, lpred_path, fixed_tst, plot_vs_qst, plot_vs_tCNAP):\n", |
226 | 226 | " data_cv = pd.read_csv(cv_path, sep=',', header=None)\n",
|
227 | 227 | " data_tcnap = pd.read_csv(t_path, sep=',', header=None)\n",
|
228 | 228 | " data_ist = None\n",
|
|
233 | 233 | " data_tst = pd.read_csv(tst_path, sep=',', header=None)\n",
|
234 | 234 | " data_CAP = pd.read_csv(qst_path, sep=',', header=None)\n",
|
235 | 235 | " data_vpred = pd.read_csv(vpred_path, sep=',', header=None)\n",
|
236 |
| - "\n", |
| 236 | + " data_lpred = pd.read_csv(lpred_path, sep=',', header=None)\n", |
237 | 237 | " dpi = 96\n",
|
238 | 238 | " height = 1024\n",
|
239 | 239 | " width = 800\n",
|
240 | 240 | " fontsize = 16\n",
|
241 | 241 | " \n",
|
| 242 | + " fig = plt.figure(figsize=(width / dpi, height / dpi), dpi=dpi)\n", |
| 243 | + " fig.suptitle(r'Predicted Compound Nerve Action Potentials')\n", |
| 244 | + " gs = fig.add_gridspec(2, 1)\n", |
| 245 | + " ax1 = fig.add_subplot(gs[0, 0], projection='3d')\n", |
| 246 | + " ax2 = fig.add_subplot(gs[1, 0])\n", |
242 | 247 | " \n",
|
243 |
| - " #plt.title(r'Predicted Compound Nerve Action Potentials', fontsize=20)\n", |
244 |
| - " fig, [ax1, ax2] = plt.subplots(2, 1, figsize=(width / dpi, height / dpi), dpi=dpi, subplot_kw={'projection': '3d'})\n", |
245 |
| - " ax1.set_title(r'Predicted Compound Nerve Action Potentials', fontsize=20)\n", |
246 | 248 | " data_cv[data_cv>100] = None\n",
|
247 | 249 | " x_axis = data_cv\n",
|
248 | 250 | " x_label = r'CV (m/s)'\n",
|
|
264 | 266 | " y_axis = data_CAP\n",
|
265 | 267 | " y_label = r'$Q_{st}$ (nC)'\n",
|
266 | 268 | " \n",
|
267 |
| - " \n", |
| 269 | + "\n", |
268 | 270 | " ax1.set_xlabel(x_label)\n",
|
269 | 271 | " ax1.set_xscale(x_scale)\n",
|
270 | 272 | " ax1.set_xlim(x_lim)\n",
|
|
273 | 275 | " ax1.plot_wireframe(x_axis, y_axis, data_vpred, rstride=0, cstride=5)\n",
|
274 | 276 | " ax1.grid(which='both')\n",
|
275 | 277 | "\n",
|
276 |
| - "# plt.subplot(2,1,2)\n", |
277 |
| - " plt.show()\n" |
| 278 | + " ax2.set_xscale(x_scale)\n", |
| 279 | + " ax2.set_xlabel(x_label)\n", |
| 280 | + " ax2.set_ylabel(y_label)\n", |
| 281 | + " pcm = ax2.pcolormesh(np.nan_to_num(x_axis), y_axis, data_lpred)\n", |
| 282 | + " cbar = plt.colorbar(pcm, orientation='horizontal')\n", |
| 283 | + " cbar.ax.set_xlabel(\"%Activation\")\n" |
278 | 284 | ]
|
279 | 285 | },
|
280 | 286 | {
|
|
309 | 315 | {
|
310 | 316 | "data": {
|
311 | 317 | "application/vnd.jupyter.widget-view+json": {
|
312 |
| - "model_id": "da207f7973b640eaa15469521f1229f1", |
| 318 | + "model_id": "7ce21833358f4427becea66e7f84b4c5", |
313 | 319 | "version_major": 2,
|
314 | 320 | "version_minor": 0
|
315 | 321 | },
|
|
416 | 422 | " with out2:\n",
|
417 | 423 | " print(\"Current clicked.\", charge_phase_cb.value, time_cb.value, start_ist.value, end_ist.value, step_size_current.value, fixed_tst.value)\n",
|
418 | 424 | " !execute_cnap.sh $model_id $sweep_param $start_ist.value $end_ist.value $step_size_current.value $fixed_tst.value \n",
|
419 |
| - " create_predicted_compound_nerve_action(cv_path='/home/jovyan/outputs/CV_plot.csv', t_path='/home/jovyan/outputs/t_plot.csv', ist_path='/home/jovyan/outputs/Ist_plot.csv', tst_path='/home/jovyan/outputs/tst_plot.csv', qst_path='/home/jovyan/outputs/CAP_plot.csv', vpred_path='/home/jovyan/outputs/V_pred_plot.csv', fixed_tst=True, plot_vs_qst=charge_phase_cb.value, plot_vs_tCNAP=time_cb.value), \n", |
420 |
| - " move_files_to_output()\n", |
| 425 | + " create_predicted_compound_nerve_action(cv_path='/home/jovyan/outputs/CV_plot.csv', t_path='/home/jovyan/outputs/t_plot.csv', ist_path='/home/jovyan/outputs/Ist_plot.csv', tst_path='/home/jovyan/outputs/tst_plot.csv', qst_path='/home/jovyan/outputs/CAP_plot.csv', vpred_path='/home/jovyan/outputs/V_pred_plot.csv', lpred_path='/home/jovyan/outputs/Lpred_plot.csv', fixed_tst=True, plot_vs_qst=charge_phase_cb.value, plot_vs_tCNAP=time_cb.value), \n", |
421 | 426 | "predict_CNAPs_current.on_click(on_current_clicked)\n",
|
422 | 427 | "\n",
|
423 | 428 | "\n",
|
|
429 | 434 | " with out2:\n",
|
430 | 435 | " print(\"Time clicked.\", charge_phase_cb.value, time_cb.value, start_tst.value, end_tst.value, step_size_duration.value, fixed_ist.value)\n",
|
431 | 436 | " !execute_cnap.sh $model_id $sweep_param $start_ist.value $end_ist.value $step_size_current.value $fixed_tst.value \n",
|
432 |
| - " create_predicted_compound_nerve_action(cv_path='/home/jovyan/outputs/CV_plot.csv', t_path='/home/jovyan/outputs/t_plot.csv', ist_path='/home/jovyan/outputs/Ist_plot.csv', tst_path='/home/jovyan/outputs/tst_plot.csv', qst_path='/home/jovyan/outputs/CAP_plot.csv', vpred_path='/home/jovyan/outputs/V_pred_plot.csv', fixed_tst=False, plot_vs_qst=charge_phase_cb.value, plot_vs_tCNAP=time_cb.value), \n", |
433 |
| - " move_files_to_output()\n", |
| 437 | + " create_predicted_compound_nerve_action(cv_path='/home/jovyan/outputs/CV_plot.csv', t_path='/home/jovyan/outputs/t_plot.csv', ist_path='/home/jovyan/outputs/Ist_plot.csv', tst_path='/home/jovyan/outputs/tst_plot.csv', qst_path='/home/jovyan/outputs/CAP_plot.csv', vpred_path='/home/jovyan/outputs/V_pred_plot.csv', lpred_path='/home/jovyan/outputs/Lpred_plot.csv', fixed_tst=False, plot_vs_qst=charge_phase_cb.value, plot_vs_tCNAP=time_cb.value), \n", |
434 | 438 | " \n",
|
435 | 439 | "predict_CNAPs_time.on_click(on_time_clicked)\n",
|
436 | 440 | "\n",
|
437 | 441 | "\n",
|
438 | 442 | "\n",
|
439 | 443 | "vertical_box"
|
440 | 444 | ]
|
| 445 | + }, |
| 446 | + { |
| 447 | + "cell_type": "code", |
| 448 | + "execution_count": null, |
| 449 | + "metadata": {}, |
| 450 | + "outputs": [], |
| 451 | + "source": [] |
441 | 452 | }
|
442 | 453 | ],
|
443 | 454 | "metadata": {
|
|
0 commit comments