Skip to content

Commit ca8cc64

Browse files
authored
Merge pull request #32 from mguidon/odeimaiz-feature/mattward-srv
Odeimaiz feature/mattward srv
2 parents 93296df + 588bd5e commit ca8cc64

File tree

1 file changed

+27
-16
lines changed

1 file changed

+27
-16
lines changed

services/dy-2Dgraph/use-cases/mattward/notebook/mattward.ipynb

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,13 @@
125125
"metadata": {
126126
"hide_input": false,
127127
"init_cell": true,
128-
"scrolled": false
128+
"scrolled": true
129129
},
130130
"outputs": [
131131
{
132132
"data": {
133133
"application/vnd.jupyter.widget-view+json": {
134-
"model_id": "a115ec48129d4fdeb52de4be6436c4e0",
134+
"model_id": "98292748760d48df89e696132a9a86fa",
135135
"version_major": 2,
136136
"version_minor": 0
137137
},
@@ -218,11 +218,11 @@
218218
"import pandas as pd\n",
219219
"from mpl_toolkits.mplot3d import axes3d\n",
220220
"import matplotlib.pyplot as plt\n",
221-
"\n",
221+
"import numpy as np\n",
222222
"%matplotlib notebook\n",
223223
"\n",
224224
"\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",
226226
" data_cv = pd.read_csv(cv_path, sep=',', header=None)\n",
227227
" data_tcnap = pd.read_csv(t_path, sep=',', header=None)\n",
228228
" data_ist = None\n",
@@ -233,16 +233,18 @@
233233
" data_tst = pd.read_csv(tst_path, sep=',', header=None)\n",
234234
" data_CAP = pd.read_csv(qst_path, sep=',', header=None)\n",
235235
" 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",
237237
" dpi = 96\n",
238238
" height = 1024\n",
239239
" width = 800\n",
240240
" fontsize = 16\n",
241241
" \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",
242247
" \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",
246248
" data_cv[data_cv>100] = None\n",
247249
" x_axis = data_cv\n",
248250
" x_label = r'CV (m/s)'\n",
@@ -264,7 +266,7 @@
264266
" y_axis = data_CAP\n",
265267
" y_label = r'$Q_{st}$ (nC)'\n",
266268
" \n",
267-
" \n",
269+
"\n",
268270
" ax1.set_xlabel(x_label)\n",
269271
" ax1.set_xscale(x_scale)\n",
270272
" ax1.set_xlim(x_lim)\n",
@@ -273,8 +275,12 @@
273275
" ax1.plot_wireframe(x_axis, y_axis, data_vpred, rstride=0, cstride=5)\n",
274276
" ax1.grid(which='both')\n",
275277
"\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"
278284
]
279285
},
280286
{
@@ -309,7 +315,7 @@
309315
{
310316
"data": {
311317
"application/vnd.jupyter.widget-view+json": {
312-
"model_id": "da207f7973b640eaa15469521f1229f1",
318+
"model_id": "7ce21833358f4427becea66e7f84b4c5",
313319
"version_major": 2,
314320
"version_minor": 0
315321
},
@@ -416,8 +422,7 @@
416422
" with out2:\n",
417423
" print(\"Current clicked.\", charge_phase_cb.value, time_cb.value, start_ist.value, end_ist.value, step_size_current.value, fixed_tst.value)\n",
418424
" !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",
421426
"predict_CNAPs_current.on_click(on_current_clicked)\n",
422427
"\n",
423428
"\n",
@@ -429,15 +434,21 @@
429434
" with out2:\n",
430435
" print(\"Time clicked.\", charge_phase_cb.value, time_cb.value, start_tst.value, end_tst.value, step_size_duration.value, fixed_ist.value)\n",
431436
" !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",
434438
" \n",
435439
"predict_CNAPs_time.on_click(on_time_clicked)\n",
436440
"\n",
437441
"\n",
438442
"\n",
439443
"vertical_box"
440444
]
445+
},
446+
{
447+
"cell_type": "code",
448+
"execution_count": null,
449+
"metadata": {},
450+
"outputs": [],
451+
"source": []
441452
}
442453
],
443454
"metadata": {

0 commit comments

Comments
 (0)