Fix astropy_introduction notebook
"# can check what version of Numpy and Astropy you have\n",
"# All examples should work with Astropy 1.3,\n",
"# most even with Astropy 1.0\n",
+ "from gammapy.extern.pathlib import Path\n",
"import numpy as np\n",
"import astropy\n",
"import os\n",
"outputs": [],
"source": [
"# Open Fermi 3FGL from the repo\n",
- "filename = os.environ[\"GAMMAPY_DATA\"] + \"catalogs/fermi/gll_psc_v16.fit.gz\"\n",
- "table = Table.read(filename, hdu=1)\n",
+ "filename = os.environ[\"GAMMAPY_DATA\"] / Path(\n",
+ " \"catalogs/fermi/gll_psc_v16.fit.gz\"\n",
+ ")\n",
+ "table = Table.read(str(filename), hdu=1)\n",
"# Alternatively, one can grab it from the server.\n",
"# table = Table.read(\"http://fermi.gsfc.nasa.gov/ssc/data/access/lat/4yr_catalog/gll_psc_v16.fit\")"
]
"outputs": [],
"source": [
"# Note that a single FITS file might contain different tables in different HDUs\n",
- "filename = os.environ[\"GAMMAPY_DATA\"] + \"catalogs/fermi/gll_psc_v16.fit.gz\"\n",
+ "filename = os.environ[\"GAMMAPY_DATA\"] / Path(\n",
+ " \"catalogs/fermi/gll_psc_v16.fit.gz\"\n",
+ ")\n",
"# You can load a `fits.HDUList` and check the extension names\n",
- "print([_.name for _ in fits.open(filename)])\n",
+ "print([_.name for _ in fits.open(str(filename))])\n",
"# Then you can load by name or integer index via the `hdu` option\n",
- "extended_source_table = Table.read(filename, hdu=\"ExtendedSources\")"
+ "extended_source_table = Table.read(str(filename), hdu=\"ExtendedSources\")"
]
},
{
