diff --git a/recipes/pulsar_phase/pulsar_phase_computation.ipynb b/recipes/pulsar_phase/pulsar_phase_computation.ipynb
index b7dfc94..d83fe6a 100644
--- a/recipes/pulsar_phase/pulsar_phase_computation.ipynb
+++ b/recipes/pulsar_phase/pulsar_phase_computation.ipynb
@@ -54,7 +54,7 @@
"In order to run this notebook, one needs to have installed Gammapy as well as PINT (see documentation above) in the same environment. We recommend to first install Gammapy and then install PINT using your prefered package manager.\n",
"\n",
"\n",
- "`$ conda env create -n gammapy-pint -f gammapy-1.0-environment.yml`\n",
+ "`$ conda env create -n gammapy-pint -f gammapy-pint-environment.yml`\n",
"\n",
"`$ conda activate gammapy-pint`\n",
"\n",
@@ -73,19 +73,10 @@
},
{
"cell_type": "code",
- "execution_count": 1,
+ "execution_count": null,
"id": "b68d2444",
"metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Gammapy version : 1.2\n",
- "PINT version : 1.0\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"import gammapy\n",
"import pint\n",
@@ -96,7 +87,7 @@
},
{
"cell_type": "code",
- "execution_count": 2,
+ "execution_count": null,
"id": "e61b5e3e",
"metadata": {},
"outputs": [],
@@ -106,7 +97,10 @@
"from astropy.coordinates import SkyCoord\n",
"import numpy as np\n",
"from pathlib import Path\n",
- "from gammapy.data import DataStore, EventList, Observation"
+ "from gammapy.data import DataStore, EventList, Observation\n",
+ "import logging\n",
+ "\n",
+ "log = logging.getLogger(__name__)"
]
},
{
@@ -119,7 +113,7 @@
},
{
"cell_type": "code",
- "execution_count": 3,
+ "execution_count": null,
"id": "22ac4aea",
"metadata": {},
"outputs": [],
@@ -146,24 +140,25 @@
},
{
"cell_type": "code",
- "execution_count": 6,
+ "execution_count": null,
"id": "d0e182bb",
"metadata": {},
"outputs": [],
"source": [
"# Define the directory containing the DL3 data\n",
- "DL3_direc = \"$GAMMAPY_DATA/magic/rad_max/data\""
+ "DL3_dir = \"$GAMMAPY_DATA/magic/rad_max/data\"\n",
+ "DL3_dir = \"/Users/mregeard/Workspace/dev/code/gammapy/gammapy-data/magic/rad_max/data/\""
]
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": null,
"id": "b5019a42",
"metadata": {},
"outputs": [],
"source": [
"# Read DataStore from a directory\n",
- "data_store = DataStore.from_dir(DL3_direc)"
+ "data_store = DataStore.from_dir(DL3_dir)"
]
},
{
@@ -176,19 +171,19 @@
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": null,
"id": "9ba16fcc",
"metadata": {},
"outputs": [],
"source": [
"target_pos = SkyCoord(\n",
- " ra=083.6331144560900, dec=+22.0144871383400, unit=\"deg\", frame=\"icrs\"\n",
+ " ra=083.633, dec=+22.014, unit=\"deg\", frame=\"icrs\"\n",
")"
]
},
{
"cell_type": "code",
- "execution_count": 9,
+ "execution_count": null,
"id": "06bda835",
"metadata": {},
"outputs": [],
@@ -205,21 +200,10 @@
},
{
"cell_type": "code",
- "execution_count": 10,
+ "execution_count": null,
"id": "f96ccf30",
"metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- " OBS_ID\n",
- "-------\n",
- "5029748\n",
- "5029747\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"obs_id = selected_obs_table[\"OBS_ID\"]\n",
"print(obs_id)"
@@ -235,7 +219,7 @@
},
{
"cell_type": "code",
- "execution_count": 11,
+ "execution_count": null,
"id": "fa6e36d5",
"metadata": {},
"outputs": [],
@@ -247,29 +231,10 @@
},
{
"cell_type": "code",
- "execution_count": 12,
+ "execution_count": null,
"id": "dec2c1a5",
"metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Observations\n",
- "Number of observations: 1\n",
- "Observation\n",
- "\n",
- "\tobs id : 5029747 \n",
- " \ttstart : 56569.18\n",
- "\ttstop : 56569.19\n",
- "\tduration : 1188.11 s\n",
- "\tpointing (icrs) : 84.0 deg, 22.2 deg\n",
- "\n",
- "\tdeadtime fraction : 0.8%\n",
- "\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"print(observations)"
]
@@ -292,7 +257,7 @@
},
{
"cell_type": "code",
- "execution_count": 13,
+ "execution_count": null,
"id": "2756e72d",
"metadata": {},
"outputs": [],
@@ -304,19 +269,10 @@
},
{
"cell_type": "code",
- "execution_count": 14,
+ "execution_count": null,
"id": "1ac8103a",
"metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "[56569.18112859 56569.18112878 56569.18112978 ... 56569.19487702\n",
- " 56569.19487703 56569.19487876]\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"print(times)"
]
@@ -346,18 +302,18 @@
"\n",
"In the following, we will use an ephemeris file for the Crab provided by Fermi-LAT, see [Kerr, M.; Ray, P. S.; et al; 2015](https://arxiv.org/abs/1510.05099). This ephemeris file for the Crab pulsar can be found alongside other pulsar ephemeris files at this [confluence page]( https://confluence.slac.stanford.edu/display/GLAMCOG/LAT+Gamma-ray+Pulsar+Timing+Models). \n",
"\n",
- "However, be aware that most of these ephemeris files are not up-to-date. Therefore they could give bad results on the phase computation. In particular, one should always checked that the MJD of the observations one wants to phased lies between the `START`and `FINISH`entry of the ephemeris file."
+ "However, be aware that most of these ephemeris files are not up-to-date. Therefore they could give bad results on the phase computation. In particular, one should always checked that the MJD of the observations one wants to phased lies between the `START`and `FINISH`entry of the ephemeris file (see next section)."
]
},
{
"cell_type": "code",
- "execution_count": 15,
+ "execution_count": null,
"id": "d4f89ba4",
"metadata": {},
"outputs": [],
"source": [
"# Path to the ephemeris file\n",
- "ephemeris_file = \"./0534+2200_ApJ_708_1254_2010.par\""
+ "ephemeris_file = \"0534+2200_ApJ_708_1254_2010.par\""
]
},
{
@@ -365,7 +321,9 @@
"id": "52eb3086",
"metadata": {},
"source": [
- "Note that sometimes one needs to change some of the parameters of the ephemeris file that are not used in gamma-ray astronomy by hand. For instance, here we have removed the 'JUMP' line since it does not have any effect in our computation and raise an error in PINT. The ephemeris file provided with this notebook does not have this line. "
+ "Note that *Fermi*-LAT ephemeris file are created primarily by and for [Tempo2](https://www.pulsarastronomy.net/pulsar/software/tempo2). Most of the time, using such ephemeris file with PINT will not raise any issues. However, in a few cases, PINT does not support feature from Tempo2. \n",
+ "\n",
+ "In our case, an error occur when using the ephemeris file with PINT. This is due to the `JUMP` line. In order to proceed, one as to either comment (with #) or remove this line. Note that this line is not important for gamma-ray instrument, so it is totally fine to ignore it."
]
},
{
@@ -394,50 +352,10 @@
},
{
"cell_type": "code",
- "execution_count": 16,
+ "execution_count": null,
"id": "d24e1c92",
"metadata": {},
- "outputs": [
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\u001b[32m2024-06-13 23:55:31.812\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.models.absolute_phase\u001b[0m:\u001b[36mvalidate\u001b[0m:\u001b[36m74\u001b[0m - \u001b[1mTZRFRQ was 0.0 or None. Setting to infinite frequency.\u001b[0m\n",
- "/Users/mregeard/anaconda3/envs/pulsar_recipe/lib/python3.11/site-packages/pint/models/model_builder.py:228: UserWarning: Unrecognized parfile line 'EPHVER 5'\n",
- " warnings.warn(f\"Unrecognized parfile line '{p_line}'\", UserWarning)\n",
- "\u001b[32m2024-06-13 23:55:31.815\u001b[0m | \u001b[33m\u001b[1mWARNING \u001b[0m | \u001b[36mpint.models.model_builder\u001b[0m:\u001b[36m__call__\u001b[0m:\u001b[36m232\u001b[0m - \u001b[33m\u001b[1mUNITS is not specified. Assuming TDB...\u001b[0m\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "AstrometryEquatorial(\n",
- " MJDParameter( POSEPOCH 50739.0000000000000000 (d) frozen=True),\n",
- " floatParameter( PX 0.0 (mas) frozen=True),\n",
- " AngleParameter( RAJ 5:34:31.94000000 (hourangle) frozen=True),\n",
- " AngleParameter( DECJ 22:00:52.10000000 (deg) frozen=True),\n",
- " floatParameter( PMRA -11.8 (mas / yr) +/- 1.0 mas / yr frozen=True),\n",
- " floatParameter( PMDEC 4.4 (mas / yr) +/- 1.0 mas / yr frozen=True))\n",
- "SolarSystemShapiro(\n",
- " boolParameter( PLANET_SHAPIRO N frozen=True))\n",
- "DispersionDM(\n",
- " floatParameter( DM 56.785579397589822356 (pc / cm3) frozen=True),\n",
- " floatParameter( DM1 0.031279168349770640344 (pc / (yr cm3)) frozen=True),\n",
- " MJDParameter( DMEPOCH 55107.8071585532816240 (d) frozen=True))\n",
- "AbsPhase(\n",
- " MJDParameter( TZRMJD 55638.1552775999516551 (d) frozen=True),\n",
- " strParameter( TZRSITE coe frozen=True),\n",
- " floatParameter( TZRFRQ inf (MHz) frozen=True))\n",
- "Spindown(\n",
- " floatParameter( F0 29.716913767510206412 (Hz) +/- 7.440760185772888e-08 Hz frozen=True),\n",
- " MJDParameter( PEPOCH 55555.0000000000000000 (d) frozen=True),\n",
- " floatParameter( F1 -3.7105744257791078768e-10 (Hz / s) +/- 7.182646367277094e-16 Hz / s frozen=True),\n",
- " floatParameter( F2 1.1633675551229037574e-20 (Hz / s2) +/- 2.487306981530037e-23 Hz / s2 frozen=True),\n",
- " floatParameter( F3 -8.6724769747827286635e-31 (Hz / s3) +/- 0.0 Hz / s3 frozen=True))\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"model = pmodels.get_model(ephemeris_file)\n",
"print(model.components[\"AstrometryEquatorial\"])\n",
@@ -452,7 +370,69 @@
"id": "0f8cd0d8",
"metadata": {},
"source": [
- "There are multiple parameters such as the name of the source, the interval of validity of the model (START to FINISH), the frequencies of rotation and its derivatives (F0,F1,F2). There are other additional parameters that can be checked in the [PINT documentation](https://nanograv-pint.readthedocs.io)"
+ "There are multiple parameters such as the name of the source, the frequencies of rotation and its derivatives (F0,F1,F2), the dispersion measure, etc. There are other additional parameters that can be checked in the [PINT documentation](https://nanograv-pint.readthedocs.io). To get the complete set of parameter of the ephemeris file, one can simply print the model:\n",
+ "`print(model)`"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "f02f0ca5-09f2-44d4-ad76-518f8964b6a1",
+ "metadata": {},
+ "source": [
+ "As said above, we should make sure that the time of the observation lies within the ephemeris time definition. In our example, we only have one run, so we can check that manually:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "2584b571-93a9-4fb6-b8e2-60b8810190f6",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "print(f\"Ephemeris time definition:\\n{model.START.value} - {model.FINISH.value}\")\n",
+ "print(f\"Observation time definition:\\n{observation.tstart} - {observation.tstop}\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "86041174-5ec4-43ba-9035-cf567b47a3bb",
+ "metadata": {},
+ "source": [
+ "In the case you have several observations, if you know that they are sorted by time, you can manually check for the start time of the first observation and the stop time of the last one. Otherwise, you can build a small function such as the following one:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "8838ee6c-5b53-4d34-8fd7-94d32daa6bb3",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def check_time(observation, timing_model):\n",
+ " \"\"\"\n",
+ " Check that the observation time lies within the time definition of the pulsar\n",
+ " timing model.\n",
+ "\n",
+ " Parameters\n",
+ " ----------\n",
+ " observation: `gammapy.data.Observation`\n",
+ " Observation to check.\n",
+ " timing_model: `pint.models.TimingModel`\n",
+ " The timing model that will be used.\n",
+ " \"\"\"\n",
+ " model_time = Time([model.START.value, model.FINISH.value], scale=\"tt\", format='mjd')\n",
+ " if (model_time[0].value > observation.tstart.tt.mjd) or (model_time[1].value < observation.tstop.tt.mjd):\n",
+ " log.warning(f\"Warning: Observation time of observation {observation.obs_id} goes out of timing model validity time.\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "0d37e6cc-2cae-4192-87d9-88d52216e83f",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "check_time(observation, model)"
]
},
{
@@ -465,35 +445,10 @@
},
{
"cell_type": "code",
- "execution_count": 17,
+ "execution_count": null,
"id": "a145cdde",
"metadata": {},
- "outputs": [
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\u001b[32m2024-06-13 23:55:38.408\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m1362\u001b[0m - \u001b[34m\u001b[1mNo pulse number flags found in the TOAs\u001b[0m\n",
- "\u001b[32m2024-06-13 23:55:38.418\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mapply_clock_corrections\u001b[0m:\u001b[36m2204\u001b[0m - \u001b[34m\u001b[1mApplying clock corrections (include_gps = False, include_bipm = False)\u001b[0m\n",
- "\u001b[32m2024-06-13 23:55:38.824\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.observatory.topo_obs\u001b[0m:\u001b[36mclock_corrections\u001b[0m:\u001b[36m365\u001b[0m - \u001b[1mObservatory magic requires no clock corrections.\u001b[0m\n",
- "\u001b[32m2024-06-13 23:55:40.732\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2255\u001b[0m - \u001b[34m\u001b[1mComputing TDB columns.\u001b[0m\n",
- "\u001b[32m2024-06-13 23:55:40.733\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2276\u001b[0m - \u001b[34m\u001b[1mUsing EPHEM = DE421 for TDB calculation.\u001b[0m\n",
- "\u001b[32m2024-06-13 23:55:41.481\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2354\u001b[0m - \u001b[34m\u001b[1mComputing PosVels of observatories and Earth, using DE421\u001b[0m\n",
- "\u001b[32m2024-06-13 23:55:42.269\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.solar_system_ephemerides\u001b[0m:\u001b[36m_load_kernel_link\u001b[0m:\u001b[36m55\u001b[0m - \u001b[1mSet solar system ephemeris to de421 from download\u001b[0m\n",
- "\u001b[32m2024-06-13 23:55:43.362\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2407\u001b[0m - \u001b[34m\u001b[1mSSB obs pos [1.47007462e+11 2.56889811e+10 1.11245045e+10] m\u001b[0m\n",
- "\u001b[32m2024-06-13 23:55:44.083\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.solar_system_ephemerides\u001b[0m:\u001b[36m_load_kernel_link\u001b[0m:\u001b[36m55\u001b[0m - \u001b[1mSet solar system ephemeris to de421 from download\u001b[0m\n",
- "\u001b[32m2024-06-13 23:55:44.112\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2421\u001b[0m - \u001b[34m\u001b[1mAdding columns ssb_obs_pos ssb_obs_vel obs_sun_pos\u001b[0m\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "CPU times: user 4.73 s, sys: 53.3 ms, total: 4.79 s\n",
- "Wall time: 6.18 s\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"%%time\n",
"\n",
@@ -528,30 +483,10 @@
},
{
"cell_type": "code",
- "execution_count": 18,
+ "execution_count": null,
"id": "6fbf3ad9",
"metadata": {},
- "outputs": [
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\u001b[32m2024-06-13 23:55:50.651\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.models.glitch\u001b[0m:\u001b[36mglitch_phase\u001b[0m:\u001b[36m213\u001b[0m - \u001b[34m\u001b[1mGlitch phase for glitch 1: 0.0 \u001b[0m\n",
- "\u001b[32m2024-06-13 23:55:50.673\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.models.absolute_phase\u001b[0m:\u001b[36mget_TZR_toa\u001b[0m:\u001b[36m98\u001b[0m - \u001b[34m\u001b[1mCreating and dealing with the single TZR_toa for absolute phase\u001b[0m\n",
- "\u001b[32m2024-06-13 23:55:50.675\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m1362\u001b[0m - \u001b[34m\u001b[1mNo pulse number flags found in the TOAs\u001b[0m\n",
- "\u001b[32m2024-06-13 23:55:50.675\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mapply_clock_corrections\u001b[0m:\u001b[36m2204\u001b[0m - \u001b[34m\u001b[1mApplying clock corrections (include_gps = False, include_bipm = False)\u001b[0m\n",
- "\u001b[32m2024-06-13 23:55:50.676\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2255\u001b[0m - \u001b[34m\u001b[1mComputing TDB columns.\u001b[0m\n",
- "\u001b[32m2024-06-13 23:55:50.677\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2276\u001b[0m - \u001b[34m\u001b[1mUsing EPHEM = DE421 for TDB calculation.\u001b[0m\n",
- "\u001b[32m2024-06-13 23:55:50.679\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2354\u001b[0m - \u001b[34m\u001b[1mComputing PosVels of observatories and Earth, using DE421\u001b[0m\n",
- "\u001b[32m2024-06-13 23:55:51.261\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.solar_system_ephemerides\u001b[0m:\u001b[36m_load_kernel_link\u001b[0m:\u001b[36m55\u001b[0m - \u001b[1mSet solar system ephemeris to de421 from download\u001b[0m\n",
- "\u001b[32m2024-06-13 23:55:51.281\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2407\u001b[0m - \u001b[34m\u001b[1mSSB obs pos [-1.49278181e+08 7.07659442e+06 3.07113250e+06] km\u001b[0m\n",
- "\u001b[32m2024-06-13 23:55:51.871\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.solar_system_ephemerides\u001b[0m:\u001b[36m_load_kernel_link\u001b[0m:\u001b[36m55\u001b[0m - \u001b[1mSet solar system ephemeris to de421 from download\u001b[0m\n",
- "\u001b[32m2024-06-13 23:55:51.888\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2421\u001b[0m - \u001b[34m\u001b[1mAdding columns ssb_obs_pos ssb_obs_vel obs_sun_pos\u001b[0m\n",
- "\u001b[32m2024-06-13 23:55:51.893\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.models.absolute_phase\u001b[0m:\u001b[36mget_TZR_toa\u001b[0m:\u001b[36m121\u001b[0m - \u001b[34m\u001b[1mDone with TZR_toa\u001b[0m\n",
- "\u001b[32m2024-06-13 23:55:51.941\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.models.glitch\u001b[0m:\u001b[36mglitch_phase\u001b[0m:\u001b[36m213\u001b[0m - \u001b[34m\u001b[1mGlitch phase for glitch 1: 0.0 \u001b[0m\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"# Compute phases\n",
"phases = model.phase(toas, abs_phase=True)[1]\n",
@@ -578,7 +513,7 @@
},
{
"cell_type": "code",
- "execution_count": 23,
+ "execution_count": null,
"id": "735ac718",
"metadata": {},
"outputs": [],
@@ -589,71 +524,10 @@
},
{
"cell_type": "code",
- "execution_count": 24,
+ "execution_count": null,
"id": "f3269a2c",
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "
Table length=11189\n",
- "
\n",
- "EVENT_ID | TIME | RA | DEC | ENERGY |
\n",
- " | s | deg | deg | TeV |
\n",
- "int64 | float64 | float32 | float32 | float32 |
\n",
- "2402 | 333778852.5099249 | 84.59457 | 22.03088 | 0.18194601 |
\n",
- "2408 | 333778852.5267153 | 84.21462 | 23.44914 | 0.08397394 |
\n",
- "2434 | 333778852.61315054 | 83.524704 | 22.725792 | 0.10596932 |
\n",
- "2445 | 333778852.6690142 | 83.76957 | 22.451006 | 0.19733498 |
\n",
- "2478 | 333778852.7627939 | 83.478516 | 23.484594 | 0.08522219 |
\n",
- "2481 | 333778852.7778549 | 83.71517 | 21.985115 | 1.0020943 |
\n",
- "2513 | 333778852.8644467 | 82.421196 | 22.567652 | 0.14374068 |
\n",
- "2544 | 333778852.9826064 | 83.64136 | 22.041315 | 0.10316629 |
\n",
- "2559 | 333778853.0269414 | 84.069176 | 22.97337 | 0.047184493 |
\n",
- "... | ... | ... | ... | ... |
\n",
- "356223 | 333780039.4600492 | 84.11615 | 22.557505 | 0.08110082 |
\n",
- "356227 | 333780039.47105366 | 83.41534 | 21.67344 | 0.2096362 |
\n",
- "356242 | 333780039.5179095 | 83.55165 | 22.772985 | 0.17672835 |
\n",
- "356282 | 333780039.62997514 | 84.46133 | 21.69357 | 0.05068718 |
\n",
- "356473 | 333780040.3386479 | 84.45441 | 21.159828 | 0.1831569 |
\n",
- "356478 | 333780040.3548926 | 83.68336 | 23.444988 | 0.06305169 |
\n",
- "356485 | 333780040.3741322 | 84.33517 | 21.28338 | 0.060539745 |
\n",
- "356486 | 333780040.3755159 | 84.85886 | 22.116222 | 0.123453744 |
\n",
- "356526 | 333780040.52476007 | 84.86929 | 21.290916 | 0.13630114 |
\n",
- "
"
- ],
- "text/plain": [
- "\n",
- "EVENT_ID TIME RA DEC ENERGY \n",
- " s deg deg TeV \n",
- " int64 float64 float32 float32 float32 \n",
- "-------- ------------------ --------- --------- -----------\n",
- " 2402 333778852.5099249 84.59457 22.03088 0.18194601\n",
- " 2408 333778852.5267153 84.21462 23.44914 0.08397394\n",
- " 2434 333778852.61315054 83.524704 22.725792 0.10596932\n",
- " 2445 333778852.6690142 83.76957 22.451006 0.19733498\n",
- " 2478 333778852.7627939 83.478516 23.484594 0.08522219\n",
- " 2481 333778852.7778549 83.71517 21.985115 1.0020943\n",
- " 2513 333778852.8644467 82.421196 22.567652 0.14374068\n",
- " 2544 333778852.9826064 83.64136 22.041315 0.10316629\n",
- " 2559 333778853.0269414 84.069176 22.97337 0.047184493\n",
- " ... ... ... ... ...\n",
- " 356223 333780039.4600492 84.11615 22.557505 0.08110082\n",
- " 356227 333780039.47105366 83.41534 21.67344 0.2096362\n",
- " 356242 333780039.5179095 83.55165 22.772985 0.17672835\n",
- " 356282 333780039.62997514 84.46133 21.69357 0.05068718\n",
- " 356473 333780040.3386479 84.45441 21.159828 0.1831569\n",
- " 356478 333780040.3548926 83.68336 23.444988 0.06305169\n",
- " 356485 333780040.3741322 84.33517 21.28338 0.060539745\n",
- " 356486 333780040.3755159 84.85886 22.116222 0.123453744\n",
- " 356526 333780040.52476007 84.86929 21.290916 0.13630114"
- ]
- },
- "execution_count": 24,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"# Show original table\n",
"table"
@@ -661,7 +535,7 @@
},
{
"cell_type": "code",
- "execution_count": 25,
+ "execution_count": null,
"id": "6fc6024c",
"metadata": {},
"outputs": [],
@@ -680,71 +554,10 @@
},
{
"cell_type": "code",
- "execution_count": 26,
+ "execution_count": null,
"id": "7f29187e",
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "Table length=11189\n",
- "
\n",
- "EVENT_ID | TIME | RA | DEC | ENERGY | PHASE |
\n",
- " | s | deg | deg | TeV | |
\n",
- "int64 | float64 | float32 | float32 | float32 | float64 |
\n",
- "2402 | 333778852.5099249 | 84.59457 | 22.03088 | 0.18194601 | 0.39349195931383935 |
\n",
- "2408 | 333778852.5267153 | 84.21462 | 23.44914 | 0.08397394 | 0.8919526790064667 |
\n",
- "2434 | 333778852.61315054 | 83.524704 | 22.725792 | 0.10596932 | 0.4579789031294724 |
\n",
- "2445 | 333778852.6690142 | 83.76957 | 22.451006 | 0.19733498 | 0.11641860219368935 |
\n",
- "2478 | 333778852.7627939 | 83.478516 | 23.484594 | 0.08522219 | 0.9004806857711186 |
\n",
- "2481 | 333778852.7778549 | 83.71517 | 21.985115 | 1.0020943 | 0.3476011689926769 |
\n",
- "2513 | 333778852.8644467 | 82.421196 | 22.567652 | 0.14374068 | 0.9182740999289545 |
\n",
- "2544 | 333778852.9826064 | 83.64136 | 22.041315 | 0.10316629 | 0.42611249421537956 |
\n",
- "2559 | 333778853.0269414 | 84.069176 | 22.97337 | 0.047184493 | 0.7422975122115125 |
\n",
- "... | ... | ... | ... | ... | ... |
\n",
- "356223 | 333780039.4600492 | 84.11615 | 22.557505 | 0.08110082 | 0.6914920486374702 |
\n",
- "356227 | 333780039.47105366 | 83.41534 | 21.67344 | 0.2096362 | 0.018183944316962984 |
\n",
- "356242 | 333780039.5179095 | 83.55165 | 22.772985 | 0.17672835 | 0.40920620046641115 |
\n",
- "356282 | 333780039.62997514 | 84.46133 | 21.69357 | 0.05068718 | 0.7361270955486778 |
\n",
- "356473 | 333780040.3386479 | 84.45441 | 21.159828 | 0.1831569 | 0.7746789518818565 |
\n",
- "356478 | 333780040.3548926 | 83.68336 | 23.444988 | 0.06305169 | 0.2569398572226654 |
\n",
- "356485 | 333780040.3741322 | 84.33517 | 21.28338 | 0.060539745 | 0.8281109722104576 |
\n",
- "356486 | 333780040.3755159 | 84.85886 | 22.116222 | 0.123453744 | 0.8691881135544401 |
\n",
- "356526 | 333780040.52476007 | 84.86929 | 21.290916 | 0.13630114 | 0.29983901925054285 |
\n",
- "
"
- ],
- "text/plain": [
- "\n",
- "EVENT_ID TIME RA DEC ENERGY PHASE \n",
- " s deg deg TeV \n",
- " int64 float64 float32 float32 float32 float64 \n",
- "-------- ------------------ --------- --------- ----------- --------------------\n",
- " 2402 333778852.5099249 84.59457 22.03088 0.18194601 0.39349195931383935\n",
- " 2408 333778852.5267153 84.21462 23.44914 0.08397394 0.8919526790064667\n",
- " 2434 333778852.61315054 83.524704 22.725792 0.10596932 0.4579789031294724\n",
- " 2445 333778852.6690142 83.76957 22.451006 0.19733498 0.11641860219368935\n",
- " 2478 333778852.7627939 83.478516 23.484594 0.08522219 0.9004806857711186\n",
- " 2481 333778852.7778549 83.71517 21.985115 1.0020943 0.3476011689926769\n",
- " 2513 333778852.8644467 82.421196 22.567652 0.14374068 0.9182740999289545\n",
- " 2544 333778852.9826064 83.64136 22.041315 0.10316629 0.42611249421537956\n",
- " 2559 333778853.0269414 84.069176 22.97337 0.047184493 0.7422975122115125\n",
- " ... ... ... ... ... ...\n",
- " 356223 333780039.4600492 84.11615 22.557505 0.08110082 0.6914920486374702\n",
- " 356227 333780039.47105366 83.41534 21.67344 0.2096362 0.018183944316962984\n",
- " 356242 333780039.5179095 83.55165 22.772985 0.17672835 0.40920620046641115\n",
- " 356282 333780039.62997514 84.46133 21.69357 0.05068718 0.7361270955486778\n",
- " 356473 333780040.3386479 84.45441 21.159828 0.1831569 0.7746789518818565\n",
- " 356478 333780040.3548926 83.68336 23.444988 0.06305169 0.2569398572226654\n",
- " 356485 333780040.3741322 84.33517 21.28338 0.060539745 0.8281109722104576\n",
- " 356486 333780040.3755159 84.85886 22.116222 0.123453744 0.8691881135544401\n",
- " 356526 333780040.52476007 84.86929 21.290916 0.13630114 0.29983901925054285"
- ]
- },
- "execution_count": 26,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"# Show table with phases\n",
"table"
@@ -770,62 +583,17 @@
},
{
"cell_type": "code",
- "execution_count": 27,
+ "execution_count": null,
"id": "af220557",
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "OrderedDict([('EXTNAME', 'EVENTS'),\n",
- " ('HDUCLASS', 'GADF'),\n",
- " ('HDUDOC',\n",
- " 'https://github.com/open-gamma-ray-astro/gamma-astro-data-formats'),\n",
- " ('HDUVERS', '0.2'),\n",
- " ('HDUCLAS1', 'EVENTS'),\n",
- " ('OBS_ID', 5029747),\n",
- " ('TSTART', 333778852.435217),\n",
- " ('TSTOP', 333780040.546979),\n",
- " ('ONTIME', 1188.111761868),\n",
- " ('LIVETIME', 1178.06621791733),\n",
- " ('DEADC', 0.991545),\n",
- " ('EQUINOX', 2000.0),\n",
- " ('RADECSYS', 'FK5'),\n",
- " ('ORIGIN', 'MAGIC Collaboration'),\n",
- " ('TELESCOP', 'MAGIC'),\n",
- " ('INSTRUME', 'MAGIC stereo'),\n",
- " ('CREATOR', 'MAGIC_DL3'),\n",
- " ('VERSION', '0.1.8'),\n",
- " ('MJDREFI', 52706),\n",
- " ('MJDREFF', 0.0),\n",
- " ('TIMEUNIT', 's'),\n",
- " ('TIMESYS', 'UTC'),\n",
- " ('TIMEREF', 'local'),\n",
- " ('OBJECT', 'CrabNebula'),\n",
- " ('RA_OBJ', 83.63333),\n",
- " ('DEC_OBJ', 22.01444),\n",
- " ('OBS_MODE', 'POINTING'),\n",
- " ('RA_PNT', 83.98333),\n",
- " ('DEC_PNT', 22.24389),\n",
- " ('GEOLON', -17.89),\n",
- " ('GEOLAT', 28.761944),\n",
- " ('ALTITUDE', 2231.28),\n",
- " ('ALT_PNT', 69.69974),\n",
- " ('AZ_PNT', 103.8848)])"
- ]
- },
- "execution_count": 27,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"table.meta"
]
},
{
"cell_type": "code",
- "execution_count": 28,
+ "execution_count": null,
"id": "c2285fcd",
"metadata": {},
"outputs": [],
@@ -868,18 +636,10 @@
},
{
"cell_type": "code",
- "execution_count": 29,
+ "execution_count": null,
"id": "8c866a5c",
"metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "COLUMN_PHASE: PHASE; PINT_VERS: 1.0; GAMMAPY_VERS: 1.2; EPHEM_FILE: ./0534+2200_ApJ_708_1254_2010.par; PSRJ :J0534+2200; START: 54686.1526259; FINISH: 56583.1591704; TZRMJD: 55638.155277599951656; TZRSITE: coe; TZRFREQ: inf; EPHEM: DE405; EPHEM_RA: 5.575538888888889; EPHEM_DEC: 22.01447222222222; PHASE_OFFSET: default = 0; DATE: 60474.9143641169;\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"phase_log = get_log(ephemeris_file=ephemeris_file, phase_column_name=\"PHASE\")\n",
"print(phase_log)"
@@ -887,7 +647,7 @@
},
{
"cell_type": "code",
- "execution_count": 30,
+ "execution_count": null,
"id": "5a3e56d2",
"metadata": {},
"outputs": [],
@@ -898,57 +658,10 @@
},
{
"cell_type": "code",
- "execution_count": 31,
+ "execution_count": null,
"id": "f6b44e25",
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "OrderedDict([('EXTNAME', 'EVENTS'),\n",
- " ('HDUCLASS', 'GADF'),\n",
- " ('HDUDOC',\n",
- " 'https://github.com/open-gamma-ray-astro/gamma-astro-data-formats'),\n",
- " ('HDUVERS', '0.2'),\n",
- " ('HDUCLAS1', 'EVENTS'),\n",
- " ('OBS_ID', 5029747),\n",
- " ('TSTART', 333778852.435217),\n",
- " ('TSTOP', 333780040.546979),\n",
- " ('ONTIME', 1188.111761868),\n",
- " ('LIVETIME', 1178.06621791733),\n",
- " ('DEADC', 0.991545),\n",
- " ('EQUINOX', 2000.0),\n",
- " ('RADECSYS', 'FK5'),\n",
- " ('ORIGIN', 'MAGIC Collaboration'),\n",
- " ('TELESCOP', 'MAGIC'),\n",
- " ('INSTRUME', 'MAGIC stereo'),\n",
- " ('CREATOR', 'MAGIC_DL3'),\n",
- " ('VERSION', '0.1.8'),\n",
- " ('MJDREFI', 52706),\n",
- " ('MJDREFF', 0.0),\n",
- " ('TIMEUNIT', 's'),\n",
- " ('TIMESYS', 'UTC'),\n",
- " ('TIMEREF', 'local'),\n",
- " ('OBJECT', 'CrabNebula'),\n",
- " ('RA_OBJ', 83.63333),\n",
- " ('DEC_OBJ', 22.01444),\n",
- " ('OBS_MODE', 'POINTING'),\n",
- " ('RA_PNT', 83.98333),\n",
- " ('DEC_PNT', 22.24389),\n",
- " ('GEOLON', -17.89),\n",
- " ('GEOLAT', 28.761944),\n",
- " ('ALTITUDE', 2231.28),\n",
- " ('ALT_PNT', 69.69974),\n",
- " ('AZ_PNT', 103.8848),\n",
- " ('PH_LOG',\n",
- " 'COLUMN_PHASE: PHASE; PINT_VERS: 1.0; GAMMAPY_VERS: 1.2; EPHEM_FILE: ./0534+2200_ApJ_708_1254_2010.par; PSRJ :J0534+2200; START: 54686.1526259; FINISH: 56583.1591704; TZRMJD: 55638.155277599951656; TZRSITE: coe; TZRFREQ: inf; EPHEM: DE405; EPHEM_RA: 5.575538888888889; EPHEM_DEC: 22.01447222222222; PHASE_OFFSET: default = 0; DATE: 60474.9143641169;')])"
- ]
- },
- "execution_count": 31,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"table.meta"
]
@@ -963,20 +676,10 @@
},
{
"cell_type": "code",
- "execution_count": 32,
+ "execution_count": null,
"id": "12545bff",
"metadata": {},
- "outputs": [
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "'THETA' axis is stored as a scalar -- converting to 1D array.\n",
- "'THETA' axis is stored as a scalar -- converting to 1D array.\n",
- "'THETA' axis is stored as a scalar -- converting to 1D array.\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"# Create new event list and add it to observation object\n",
"new_event_list = EventList(table)\n",
@@ -985,71 +688,10 @@
},
{
"cell_type": "code",
- "execution_count": 33,
+ "execution_count": null,
"id": "1ac16c51",
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "Table length=11189\n",
- "
\n",
- "EVENT_ID | TIME | RA | DEC | ENERGY | PHASE |
\n",
- " | s | deg | deg | TeV | |
\n",
- "int64 | float64 | float32 | float32 | float32 | float64 |
\n",
- "2402 | 333778852.5099249 | 84.59457 | 22.03088 | 0.18194601 | 0.39349195931383935 |
\n",
- "2408 | 333778852.5267153 | 84.21462 | 23.44914 | 0.08397394 | 0.8919526790064667 |
\n",
- "2434 | 333778852.61315054 | 83.524704 | 22.725792 | 0.10596932 | 0.4579789031294724 |
\n",
- "2445 | 333778852.6690142 | 83.76957 | 22.451006 | 0.19733498 | 0.11641860219368935 |
\n",
- "2478 | 333778852.7627939 | 83.478516 | 23.484594 | 0.08522219 | 0.9004806857711186 |
\n",
- "2481 | 333778852.7778549 | 83.71517 | 21.985115 | 1.0020943 | 0.3476011689926769 |
\n",
- "2513 | 333778852.8644467 | 82.421196 | 22.567652 | 0.14374068 | 0.9182740999289545 |
\n",
- "2544 | 333778852.9826064 | 83.64136 | 22.041315 | 0.10316629 | 0.42611249421537956 |
\n",
- "2559 | 333778853.0269414 | 84.069176 | 22.97337 | 0.047184493 | 0.7422975122115125 |
\n",
- "... | ... | ... | ... | ... | ... |
\n",
- "356223 | 333780039.4600492 | 84.11615 | 22.557505 | 0.08110082 | 0.6914920486374702 |
\n",
- "356227 | 333780039.47105366 | 83.41534 | 21.67344 | 0.2096362 | 0.018183944316962984 |
\n",
- "356242 | 333780039.5179095 | 83.55165 | 22.772985 | 0.17672835 | 0.40920620046641115 |
\n",
- "356282 | 333780039.62997514 | 84.46133 | 21.69357 | 0.05068718 | 0.7361270955486778 |
\n",
- "356473 | 333780040.3386479 | 84.45441 | 21.159828 | 0.1831569 | 0.7746789518818565 |
\n",
- "356478 | 333780040.3548926 | 83.68336 | 23.444988 | 0.06305169 | 0.2569398572226654 |
\n",
- "356485 | 333780040.3741322 | 84.33517 | 21.28338 | 0.060539745 | 0.8281109722104576 |
\n",
- "356486 | 333780040.3755159 | 84.85886 | 22.116222 | 0.123453744 | 0.8691881135544401 |
\n",
- "356526 | 333780040.52476007 | 84.86929 | 21.290916 | 0.13630114 | 0.29983901925054285 |
\n",
- "
"
- ],
- "text/plain": [
- "\n",
- "EVENT_ID TIME RA DEC ENERGY PHASE \n",
- " s deg deg TeV \n",
- " int64 float64 float32 float32 float32 float64 \n",
- "-------- ------------------ --------- --------- ----------- --------------------\n",
- " 2402 333778852.5099249 84.59457 22.03088 0.18194601 0.39349195931383935\n",
- " 2408 333778852.5267153 84.21462 23.44914 0.08397394 0.8919526790064667\n",
- " 2434 333778852.61315054 83.524704 22.725792 0.10596932 0.4579789031294724\n",
- " 2445 333778852.6690142 83.76957 22.451006 0.19733498 0.11641860219368935\n",
- " 2478 333778852.7627939 83.478516 23.484594 0.08522219 0.9004806857711186\n",
- " 2481 333778852.7778549 83.71517 21.985115 1.0020943 0.3476011689926769\n",
- " 2513 333778852.8644467 82.421196 22.567652 0.14374068 0.9182740999289545\n",
- " 2544 333778852.9826064 83.64136 22.041315 0.10316629 0.42611249421537956\n",
- " 2559 333778853.0269414 84.069176 22.97337 0.047184493 0.7422975122115125\n",
- " ... ... ... ... ... ...\n",
- " 356223 333780039.4600492 84.11615 22.557505 0.08110082 0.6914920486374702\n",
- " 356227 333780039.47105366 83.41534 21.67344 0.2096362 0.018183944316962984\n",
- " 356242 333780039.5179095 83.55165 22.772985 0.17672835 0.40920620046641115\n",
- " 356282 333780039.62997514 84.46133 21.69357 0.05068718 0.7361270955486778\n",
- " 356473 333780040.3386479 84.45441 21.159828 0.1831569 0.7746789518818565\n",
- " 356478 333780040.3548926 83.68336 23.444988 0.06305169 0.2569398572226654\n",
- " 356485 333780040.3741322 84.33517 21.28338 0.060539745 0.8281109722104576\n",
- " 356486 333780040.3755159 84.85886 22.116222 0.123453744 0.8691881135544401\n",
- " 356526 333780040.52476007 84.86929 21.290916 0.13630114 0.29983901925054285"
- ]
- },
- "execution_count": 33,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"new_obs.events.table"
]
@@ -1074,28 +716,17 @@
},
{
"cell_type": "code",
- "execution_count": 34,
+ "execution_count": null,
"id": "f3c8410c",
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "PosixPath('/Users/mregeard/Workspace/dev/code/gammapy/gammapy-data/magic/rad_max/data')"
- ]
- },
- "execution_count": 34,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"data_store.hdu_table.base_dir"
]
},
{
"cell_type": "code",
- "execution_count": 35,
+ "execution_count": null,
"id": "8fd2ce31",
"metadata": {},
"outputs": [],
@@ -1112,39 +743,20 @@
},
{
"cell_type": "code",
- "execution_count": 36,
+ "execution_count": null,
"id": "e6e38fc1",
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "'/Users/mregeard/Workspace/dev/code/gammapy/gammapy-data/magic/rad_max/data/pulsar_events_file/'"
- ]
- },
- "execution_count": 36,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"output_path"
]
},
{
"cell_type": "code",
- "execution_count": 49,
+ "execution_count": null,
"id": "f339c797",
"metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Writing output file in /Users/mregeard/Workspace/dev/code/gammapy/gammapy-data/magic/rad_max/data/pulsar_events_file/dl3_pulsar_5029747.fits.gz\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"# Save the observation object in the specified file_path\n",
"print(\"Writing output file in \" + str(file_path))\n",
@@ -1163,51 +775,10 @@
},
{
"cell_type": "code",
- "execution_count": 50,
+ "execution_count": null,
"id": "4b8dd431",
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "HDUIndexTable length=10\n",
- "
\n",
- "OBS_ID | HDU_TYPE | HDU_CLASS | FILE_DIR | FILE_NAME | HDU_NAME |
\n",
- "int64 | bytes30 | bytes30 | bytes100 | bytes50 | bytes30 |
\n",
- "5029748 | events | events | ./ | 20131004_05029748_DL3_CrabNebula-W0.40+215.fits | EVENTS |
\n",
- "5029748 | gti | gti | ./ | 20131004_05029748_DL3_CrabNebula-W0.40+215.fits | GTI |
\n",
- "5029748 | rad_max | rad_max_2d | ./ | 20131004_05029748_DL3_CrabNebula-W0.40+215.fits | RAD_MAX |
\n",
- "5029748 | aeff | aeff_2d | ./ | 20131004_05029748_DL3_CrabNebula-W0.40+215.fits | EFFECTIVE AREA |
\n",
- "5029748 | edisp | edisp_2d | ./ | 20131004_05029748_DL3_CrabNebula-W0.40+215.fits | ENERGY DISPERSION |
\n",
- "5029747 | events | events | ./ | 20131004_05029747_DL3_CrabNebula-W0.40+035.fits | EVENTS |
\n",
- "5029747 | gti | gti | ./ | 20131004_05029747_DL3_CrabNebula-W0.40+035.fits | GTI |
\n",
- "5029747 | rad_max | rad_max_2d | ./ | 20131004_05029747_DL3_CrabNebula-W0.40+035.fits | RAD_MAX |
\n",
- "5029747 | aeff | aeff_2d | ./ | 20131004_05029747_DL3_CrabNebula-W0.40+035.fits | EFFECTIVE AREA |
\n",
- "5029747 | edisp | edisp_2d | ./ | 20131004_05029747_DL3_CrabNebula-W0.40+035.fits | ENERGY DISPERSION |
\n",
- "
"
- ],
- "text/plain": [
- "\n",
- " OBS_ID HDU_TYPE ... HDU_NAME \n",
- " int64 bytes30 ... bytes30 \n",
- "------- -------- ... -----------------\n",
- "5029748 events ... EVENTS\n",
- "5029748 gti ... GTI\n",
- "5029748 rad_max ... RAD_MAX\n",
- "5029748 aeff ... EFFECTIVE AREA\n",
- "5029748 edisp ... ENERGY DISPERSION\n",
- "5029747 events ... EVENTS\n",
- "5029747 gti ... GTI\n",
- "5029747 rad_max ... RAD_MAX\n",
- "5029747 aeff ... EFFECTIVE AREA\n",
- "5029747 edisp ... ENERGY DISPERSION"
- ]
- },
- "execution_count": 50,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"# Print the current data store HDU table.\n",
"new_hdu = data_store.hdu_table.copy()\n",
@@ -1216,7 +787,7 @@
},
{
"cell_type": "code",
- "execution_count": 57,
+ "execution_count": null,
"id": "6f37e101",
"metadata": {},
"outputs": [],
@@ -1229,51 +800,10 @@
},
{
"cell_type": "code",
- "execution_count": 58,
+ "execution_count": null,
"id": "d89a7739",
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "HDUIndexTable length=10\n",
- "
\n",
- "OBS_ID | HDU_TYPE | HDU_CLASS | FILE_DIR | FILE_NAME | HDU_NAME |
\n",
- "int64 | bytes30 | bytes30 | bytes100 | bytes50 | bytes30 |
\n",
- "5029748 | events | events | ./ | 20131004_05029748_DL3_CrabNebula-W0.40+215.fits | EVENTS |
\n",
- "5029748 | gti | gti | ./ | 20131004_05029748_DL3_CrabNebula-W0.40+215.fits | GTI |
\n",
- "5029748 | rad_max | rad_max_2d | ./ | 20131004_05029748_DL3_CrabNebula-W0.40+215.fits | RAD_MAX |
\n",
- "5029748 | aeff | aeff_2d | ./ | 20131004_05029748_DL3_CrabNebula-W0.40+215.fits | EFFECTIVE AREA |
\n",
- "5029748 | edisp | edisp_2d | ./ | 20131004_05029748_DL3_CrabNebula-W0.40+215.fits | ENERGY DISPERSION |
\n",
- "5029747 | events | events | ./pulsar_events_file/ | dl3_pulsar_5029747.fits.gz | EVENTS |
\n",
- "5029747 | gti | gti | ./ | 20131004_05029747_DL3_CrabNebula-W0.40+035.fits | GTI |
\n",
- "5029747 | rad_max | rad_max_2d | ./ | 20131004_05029747_DL3_CrabNebula-W0.40+035.fits | RAD_MAX |
\n",
- "5029747 | aeff | aeff_2d | ./ | 20131004_05029747_DL3_CrabNebula-W0.40+035.fits | EFFECTIVE AREA |
\n",
- "5029747 | edisp | edisp_2d | ./ | 20131004_05029747_DL3_CrabNebula-W0.40+035.fits | ENERGY DISPERSION |
\n",
- "
"
- ],
- "text/plain": [
- "\n",
- " OBS_ID HDU_TYPE ... HDU_NAME \n",
- " int64 bytes30 ... bytes30 \n",
- "------- -------- ... -----------------\n",
- "5029748 events ... EVENTS\n",
- "5029748 gti ... GTI\n",
- "5029748 rad_max ... RAD_MAX\n",
- "5029748 aeff ... EFFECTIVE AREA\n",
- "5029748 edisp ... ENERGY DISPERSION\n",
- "5029747 events ... EVENTS\n",
- "5029747 gti ... GTI\n",
- "5029747 rad_max ... RAD_MAX\n",
- "5029747 aeff ... EFFECTIVE AREA\n",
- "5029747 edisp ... ENERGY DISPERSION"
- ]
- },
- "execution_count": 58,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"new_hdu"
]
@@ -1296,7 +826,7 @@
},
{
"cell_type": "code",
- "execution_count": 53,
+ "execution_count": null,
"id": "b1633cd5",
"metadata": {},
"outputs": [],
@@ -1332,33 +862,22 @@
},
{
"cell_type": "code",
- "execution_count": 54,
+ "execution_count": null,
"id": "88a0e9c1",
"metadata": {},
"outputs": [],
"source": [
"pulsar_datastore = DataStore.from_dir(\n",
- " DL3_direc, hdu_table_filename=\"hdu-index-pulsar.fits.gz\"\n",
+ " DL3_dir, hdu_table_filename=\"hdu-index-pulsar.fits.gz\"\n",
")"
]
},
{
"cell_type": "code",
- "execution_count": 55,
+ "execution_count": null,
"id": "f7c60c18",
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "['events', 'gti', 'aeff', 'edisp', 'rad_max']"
- ]
- },
- "execution_count": 55,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"observations = pulsar_datastore.get_observations(\n",
" [5029747], required_irf=\"point-like\"\n",
@@ -1368,71 +887,10 @@
},
{
"cell_type": "code",
- "execution_count": 56,
+ "execution_count": null,
"id": "4ae8ebd2",
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "Table length=11189\n",
- "
\n",
- "EVENT_ID | TIME | RA | DEC | ENERGY | PHASE |
\n",
- " | s | deg | deg | TeV | |
\n",
- "int64 | float64 | float32 | float32 | float32 | float64 |
\n",
- "2402 | 333778852.5099249 | 84.59457 | 22.03088 | 0.18194601 | 0.39349195931383935 |
\n",
- "2408 | 333778852.5267153 | 84.21462 | 23.44914 | 0.08397394 | 0.8919526790064667 |
\n",
- "2434 | 333778852.61315054 | 83.524704 | 22.725792 | 0.10596932 | 0.4579789031294724 |
\n",
- "2445 | 333778852.6690142 | 83.76957 | 22.451006 | 0.19733498 | 0.11641860219368935 |
\n",
- "2478 | 333778852.7627939 | 83.478516 | 23.484594 | 0.08522219 | 0.9004806857711186 |
\n",
- "2481 | 333778852.7778549 | 83.71517 | 21.985115 | 1.0020943 | 0.3476011689926769 |
\n",
- "2513 | 333778852.8644467 | 82.421196 | 22.567652 | 0.14374068 | 0.9182740999289545 |
\n",
- "2544 | 333778852.9826064 | 83.64136 | 22.041315 | 0.10316629 | 0.42611249421537956 |
\n",
- "2559 | 333778853.0269414 | 84.069176 | 22.97337 | 0.047184493 | 0.7422975122115125 |
\n",
- "... | ... | ... | ... | ... | ... |
\n",
- "356223 | 333780039.4600492 | 84.11615 | 22.557505 | 0.08110082 | 0.6914920486374702 |
\n",
- "356227 | 333780039.47105366 | 83.41534 | 21.67344 | 0.2096362 | 0.018183944316962984 |
\n",
- "356242 | 333780039.5179095 | 83.55165 | 22.772985 | 0.17672835 | 0.40920620046641115 |
\n",
- "356282 | 333780039.62997514 | 84.46133 | 21.69357 | 0.05068718 | 0.7361270955486778 |
\n",
- "356473 | 333780040.3386479 | 84.45441 | 21.159828 | 0.1831569 | 0.7746789518818565 |
\n",
- "356478 | 333780040.3548926 | 83.68336 | 23.444988 | 0.06305169 | 0.2569398572226654 |
\n",
- "356485 | 333780040.3741322 | 84.33517 | 21.28338 | 0.060539745 | 0.8281109722104576 |
\n",
- "356486 | 333780040.3755159 | 84.85886 | 22.116222 | 0.123453744 | 0.8691881135544401 |
\n",
- "356526 | 333780040.52476007 | 84.86929 | 21.290916 | 0.13630114 | 0.29983901925054285 |
\n",
- "
"
- ],
- "text/plain": [
- "\n",
- "EVENT_ID TIME RA DEC ENERGY PHASE \n",
- " s deg deg TeV \n",
- " int64 float64 float32 float32 float32 float64 \n",
- "-------- ------------------ --------- --------- ----------- --------------------\n",
- " 2402 333778852.5099249 84.59457 22.03088 0.18194601 0.39349195931383935\n",
- " 2408 333778852.5267153 84.21462 23.44914 0.08397394 0.8919526790064667\n",
- " 2434 333778852.61315054 83.524704 22.725792 0.10596932 0.4579789031294724\n",
- " 2445 333778852.6690142 83.76957 22.451006 0.19733498 0.11641860219368935\n",
- " 2478 333778852.7627939 83.478516 23.484594 0.08522219 0.9004806857711186\n",
- " 2481 333778852.7778549 83.71517 21.985115 1.0020943 0.3476011689926769\n",
- " 2513 333778852.8644467 82.421196 22.567652 0.14374068 0.9182740999289545\n",
- " 2544 333778852.9826064 83.64136 22.041315 0.10316629 0.42611249421537956\n",
- " 2559 333778853.0269414 84.069176 22.97337 0.047184493 0.7422975122115125\n",
- " ... ... ... ... ... ...\n",
- " 356223 333780039.4600492 84.11615 22.557505 0.08110082 0.6914920486374702\n",
- " 356227 333780039.47105366 83.41534 21.67344 0.2096362 0.018183944316962984\n",
- " 356242 333780039.5179095 83.55165 22.772985 0.17672835 0.40920620046641115\n",
- " 356282 333780039.62997514 84.46133 21.69357 0.05068718 0.7361270955486778\n",
- " 356473 333780040.3386479 84.45441 21.159828 0.1831569 0.7746789518818565\n",
- " 356478 333780040.3548926 83.68336 23.444988 0.06305169 0.2569398572226654\n",
- " 356485 333780040.3741322 84.33517 21.28338 0.060539745 0.8281109722104576\n",
- " 356486 333780040.3755159 84.85886 22.116222 0.123453744 0.8691881135544401\n",
- " 356526 333780040.52476007 84.86929 21.290916 0.13630114 0.29983901925054285"
- ]
- },
- "execution_count": 56,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"observations[0].events.table"
]
@@ -1469,14 +927,6 @@
"\n",
"Recipe made by [Alvaros Mas](https://github.com/alvmas), [Maxime Regeard](https://github.com/MRegeard), [Jan Lukas Schubert](https://github.com/jalu98)."
]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "17b4f370-f3f6-4c5b-ba09-2d3a329def54",
- "metadata": {},
- "outputs": [],
- "source": []
}
],
"metadata": {