From 05f36177cd72a8e516e27bab68a466e2a7e1d656 Mon Sep 17 00:00:00 2001 From: Atharva Arya Date: Fri, 18 Jun 2021 13:47:50 +0530 Subject: [PATCH] suppressing errors while displaying vbox plots --- docs/using/visualization/cplots_vbox.ipynb | 146 +++++++++++++++++---- 1 file changed, 117 insertions(+), 29 deletions(-) diff --git a/docs/using/visualization/cplots_vbox.ipynb b/docs/using/visualization/cplots_vbox.ipynb index a60110e12db..a5f3840218a 100644 --- a/docs/using/visualization/cplots_vbox.ipynb +++ b/docs/using/visualization/cplots_vbox.ipynb @@ -189,13 +189,13 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "fd052bc7d28d4a0d938cf09c47688779", + "model_id": "829ade799c8542fbb59288c1d7174625", "version_major": 2, "version_minor": 0 }, "text/plain": [ "VBox(children=(FigureWidget({\n", - " 'data': [{'type': 'scatter', 'uid': 'b717018b-1b2d-4470-8c91-2f11bf8d3ae8', …" + " 'data': [{'type': 'scatter', 'uid': 'd4e5fbd0-94c7-4073-9501-91ef445f3032', …" ] }, "metadata": {}, @@ -325,7 +325,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 8, "id": "4d0979c4", "metadata": { "scrolled": true @@ -701,7 +701,7 @@ " (\u001b[1mwarnings.py\u001b[0m:110)\n", "Running post-merge numba montecarlo (with C close lines)!\n", "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Luminosity emitted = 1.26319e+43 erg / s Luminosity absorbed = 4.10706e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (\u001b[1mbase.py\u001b[0m:438)\n", - "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Simulation finished in 20 iterations and took 34.87 s (\u001b[1mbase.py\u001b[0m:381)\n" + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Simulation finished in 20 iterations and took 35.15 s (\u001b[1mbase.py\u001b[0m:381)\n" ] } ], @@ -712,7 +712,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 9, "id": "a719878a", "metadata": { "scrolled": false @@ -720,13 +720,113 @@ "outputs": [ { "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "8dfa9a96dbb04deca28d0baec5940d4d", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "VBox(children=(Output(), Output()))" + "text/html": [ + " \n", + " " + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + " \n", + " " + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "
" ] }, "metadata": {}, @@ -734,28 +834,16 @@ } ], "source": [ - "plasma_fig_out = widgets.Output()\n", - "lum_fig_out = widgets.Output()\n", - "widgets.VBox([plasma_fig_out, lum_fig_out])" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "id": "0b9e4a66", - "metadata": {}, - "outputs": [], - "source": [ - "with plasma_fig_out:\n", - " plasma_fig.show(renderer = \"notebook_connected\")\n", - "with lum_fig_out:\n", - " luminosity_fig.show(renderer = \"notebook_connected\")" + "from contextlib import suppress\n", + "with suppress(Exception):\n", + " widgets.VBox([plasma_fig.show(renderer = \"notebook_connected\"), \n", + " luminosity_fig.show(renderer = \"notebook_connected\")])\n" ] }, { "cell_type": "code", "execution_count": null, - "id": "be84f6d6", + "id": "d2ca29a7", "metadata": {}, "outputs": [], "source": []