From 65510a3c117658959f54a0f6312ea711fbcf1dc4 Mon Sep 17 00:00:00 2001 From: Maximilian Linhoff Date: Thu, 18 Jan 2024 10:52:30 +0100 Subject: [PATCH] Adapt download in notebook so that nbsphinx is happy --- docs/notebooks/fact_example.ipynb | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/docs/notebooks/fact_example.ipynb b/docs/notebooks/fact_example.ipynb index 5c6fdc266..f1ed1f245 100644 --- a/docs/notebooks/fact_example.ipynb +++ b/docs/notebooks/fact_example.ipynb @@ -20,7 +20,8 @@ "source": [ "import numpy as np\n", "import astropy.units as u\n", - "import matplotlib.pyplot as plt" + "import matplotlib.pyplot as plt\n", + "import subprocess as sp" ] }, { @@ -48,7 +49,11 @@ "metadata": {}, "outputs": [], "source": [ - "! curl -z gamma_test_dl3.hdf5 -fLO https://factdata.app.tu-dortmund.de/dl3/FACT-Tools/v1.1.2/gamma_test_dl3.hdf5" + "path = \"gamma_test_dl3.hdf5\"\n", + "url = f\"https://factdata.app.tu-dortmund.de/dl3/FACT-Tools/v1.1.2/{path}\"\n", + "ret = sp.run([\"curl\", \"-z\", path, \"-fsSLO\", url], stdout=sp.PIPE, stderr=sp.PIPE, encoding='utf-8')\n", + "if ret.returncode != 0:\n", + " raise IOError(ret.stderr)" ] }, { @@ -111,11 +116,10 @@ "source": [ "### DL2 Event List\n", "\n", - "\n", "`pyirf` does not prescribe or use a specific DL2 *file* format.\n", "You need to read the data into an `astropy.table.QTable` following our conventions, detailed in the docs here: \n", "\n", - "https://cta-observatory.github.io/pyirf/introduction.html#dl2-event-lists\n", + "\n", "\n", "The FACT-Tools / aict-tools analysis chain uses a column-oriented hdf5 file written using h5py. \n", "Unfortunately, units have to be known and are not in the metadata." @@ -279,9 +283,7 @@ "cell_type": "code", "execution_count": null, "id": "norman-personal", - "metadata": { - "scrolled": false - }, + "metadata": {}, "outputs": [], "source": [ "# utility function to converet pyirf Quantities to the gammapy classes\n", @@ -414,9 +416,7 @@ "cell_type": "code", "execution_count": null, "id": "heard-plate", - "metadata": { - "scrolled": false - }, + "metadata": {}, "outputs": [], "source": [ "from gammapy.irf import EnergyDispersion2D\n", @@ -480,14 +480,6 @@ "\n", "fits.HDUList(hdus).writeto('fact_irf.fits.gz', overwrite=True)" ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "0d608e4c", - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { @@ -506,7 +498,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.4" + "version": "3.11.7" } }, "nbformat": 4,