diff --git a/docs/_build/html/.buildinfo b/docs/_build/html/.buildinfo index 6d52a5e..564baed 100644 --- a/docs/_build/html/.buildinfo +++ b/docs/_build/html/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: 422422d3bdb302d57b3d8ae560d6877f +config: 57cd3214c1ceb8d8216bf7efb7342c6a tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/_build/html/.doctrees/environment.pickle b/docs/_build/html/.doctrees/environment.pickle index 3b48546..8f294fa 100644 Binary files a/docs/_build/html/.doctrees/environment.pickle and b/docs/_build/html/.doctrees/environment.pickle differ diff --git a/docs/_build/html/.doctrees/nbsphinx/notebooks/pulsar_phase/pulsar_phase_computation.ipynb b/docs/_build/html/.doctrees/nbsphinx/notebooks/pulsar_phase/pulsar_phase_computation.ipynb index 1c6f2f9..c355b6c 100644 --- a/docs/_build/html/.doctrees/nbsphinx/notebooks/pulsar_phase/pulsar_phase_computation.ipynb +++ b/docs/_build/html/.doctrees/nbsphinx/notebooks/pulsar_phase/pulsar_phase_computation.ipynb @@ -33,9 +33,9 @@ "source": [ "This notebook has been done for the following version of Gammapy and PINT:\n", "\n", - "Gammapy version : 1.0.1\n", + "Gammapy version : 1.2\n", "\n", - "PINT version : 0.9.5" + "PINT version : 1.0" ] }, { @@ -48,7 +48,7 @@ "1. The time of arrivals (TOAs). These times should have very high precision due to the common fast periods of pulsars. Usually these times are already stored in the EventList. For the computation of pulsar timing, times must be corrected in order to be referenced in the Solar System barycenter (SSB) because this system can nearly be regarded as an inertial reference frame with respect to the pulsar.\n", "\n", "\n", - "2. The model of rotation of the pulsar, also known as ephemeris, at the epoch of the observations. These ephemerides are stored in an specific format and saved as .par files and contain informations on the periods, derivatives of the periods, coordinates, glitches, etc.\n", + "2. The model of rotation of the pulsar, also known as ephemeris, at the epoch of the observations. These ephemerides are stored in a specific format and saved as .par files which contain the periods, derivatives of the periods, coordinates, glitches, etc.\n", "\n", "__For the following steps of this tutorial, we need the original EventLists from the DL3 files, and a model in .par format.__\n", "\n", @@ -69,10 +69,10 @@ "id": "a9c72d26", "metadata": {}, "source": [ - "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", + "To run this notebook, you must have Gammapy and PINT (see documentation above) installed in the same environment. We recommend installing Gammapy first and then installing PINT using your preferred 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", @@ -95,10 +95,10 @@ "id": "b68d2444", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:25.357930Z", - "iopub.status.busy": "2024-03-27T11:26:25.357759Z", - "iopub.status.idle": "2024-03-27T11:26:25.831345Z", - "shell.execute_reply": "2024-03-27T11:26:25.830742Z" + "iopub.execute_input": "2024-08-30T13:43:53.336099Z", + "iopub.status.busy": "2024-08-30T13:43:53.335935Z", + "iopub.status.idle": "2024-08-30T13:43:53.836216Z", + "shell.execute_reply": "2024-08-30T13:43:53.835669Z" } }, "outputs": [ @@ -106,8 +106,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "Gammapy version : 1.0.2\n", - "PINT version : 0.9.8\n" + "Gammapy version : 1.2\n", + "PINT version : 1.0.1\n" ] } ], @@ -125,10 +125,10 @@ "id": "e61b5e3e", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:25.833998Z", - "iopub.status.busy": "2024-03-27T11:26:25.833639Z", - "iopub.status.idle": "2024-03-27T11:26:26.506462Z", - "shell.execute_reply": "2024-03-27T11:26:26.505816Z" + "iopub.execute_input": "2024-08-30T13:43:53.838441Z", + "iopub.status.busy": "2024-08-30T13:43:53.838106Z", + "iopub.status.idle": "2024-08-30T13:43:54.626040Z", + "shell.execute_reply": "2024-08-30T13:43:54.625476Z" } }, "outputs": [], @@ -138,7 +138,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__)" ] }, { @@ -146,7 +149,7 @@ "id": "81ae3a58", "metadata": {}, "source": [ - "And we also need some imports from PINT:" + "We also need some imports from PINT:" ] }, { @@ -155,10 +158,10 @@ "id": "22ac4aea", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.509540Z", - "iopub.status.busy": "2024-03-27T11:26:26.509079Z", - "iopub.status.idle": "2024-03-27T11:26:26.624488Z", - "shell.execute_reply": "2024-03-27T11:26:26.623985Z" + "iopub.execute_input": "2024-08-30T13:43:54.628537Z", + "iopub.status.busy": "2024-08-30T13:43:54.628244Z", + "iopub.status.idle": "2024-08-30T13:43:54.656522Z", + "shell.execute_reply": "2024-08-30T13:43:54.655994Z" } }, "outputs": [], @@ -180,7 +183,7 @@ "id": "b486ec45", "metadata": {}, "source": [ - "First we neeed to define the data sample. In this notebook we will use two runs from the MAGIC gammapy data sample available in https://github.com/gammapy/gammapy-data" + "First we need to define the data sample. In this notebook we will use two runs from the MAGIC gammapy data sample available in https://github.com/gammapy/gammapy-data" ] }, { @@ -189,16 +192,16 @@ "id": "d0e182bb", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.627105Z", - "iopub.status.busy": "2024-03-27T11:26:26.626738Z", - "iopub.status.idle": "2024-03-27T11:26:26.629431Z", - "shell.execute_reply": "2024-03-27T11:26:26.628877Z" + "iopub.execute_input": "2024-08-30T13:43:54.658921Z", + "iopub.status.busy": "2024-08-30T13:43:54.658599Z", + "iopub.status.idle": "2024-08-30T13:43:54.660775Z", + "shell.execute_reply": "2024-08-30T13:43:54.660345Z" } }, "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\"" ] }, { @@ -207,16 +210,16 @@ "id": "b5019a42", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.631734Z", - "iopub.status.busy": "2024-03-27T11:26:26.631306Z", - "iopub.status.idle": "2024-03-27T11:26:26.646554Z", - "shell.execute_reply": "2024-03-27T11:26:26.646010Z" + "iopub.execute_input": "2024-08-30T13:43:54.662674Z", + "iopub.status.busy": "2024-08-30T13:43:54.662366Z", + "iopub.status.idle": "2024-08-30T13:43:54.676462Z", + "shell.execute_reply": "2024-08-30T13:43:54.675957Z" } }, "outputs": [], "source": [ "# Read DataStore from a directory\n", - "data_store = DataStore.from_dir(DL3_direc)" + "data_store = DataStore.from_dir(DL3_dir)" ] }, { @@ -233,17 +236,15 @@ "id": "9ba16fcc", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.648835Z", - "iopub.status.busy": "2024-03-27T11:26:26.648528Z", - "iopub.status.idle": "2024-03-27T11:26:26.651855Z", - "shell.execute_reply": "2024-03-27T11:26:26.651323Z" + "iopub.execute_input": "2024-08-30T13:43:54.678608Z", + "iopub.status.busy": "2024-08-30T13:43:54.678236Z", + "iopub.status.idle": "2024-08-30T13:43:54.681323Z", + "shell.execute_reply": "2024-08-30T13:43:54.680828Z" } }, "outputs": [], "source": [ - "target_pos = SkyCoord(\n", - " ra=083.6331144560900, dec=+22.0144871383400, unit=\"deg\", frame=\"icrs\"\n", - ")" + "target_pos = SkyCoord(ra=083.633, dec=+22.014, unit=\"deg\", frame=\"icrs\")" ] }, { @@ -252,10 +253,10 @@ "id": "06bda835", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.654049Z", - "iopub.status.busy": "2024-03-27T11:26:26.653646Z", - "iopub.status.idle": "2024-03-27T11:26:26.660513Z", - "shell.execute_reply": "2024-03-27T11:26:26.659953Z" + "iopub.execute_input": "2024-08-30T13:43:54.683221Z", + "iopub.status.busy": "2024-08-30T13:43:54.682910Z", + "iopub.status.idle": "2024-08-30T13:43:54.687923Z", + "shell.execute_reply": "2024-08-30T13:43:54.687497Z" } }, "outputs": [], @@ -276,10 +277,10 @@ "id": "f96ccf30", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.662615Z", - "iopub.status.busy": "2024-03-27T11:26:26.662199Z", - "iopub.status.idle": "2024-03-27T11:26:26.665420Z", - "shell.execute_reply": "2024-03-27T11:26:26.664873Z" + "iopub.execute_input": "2024-08-30T13:43:54.689878Z", + "iopub.status.busy": "2024-08-30T13:43:54.689440Z", + "iopub.status.idle": "2024-08-30T13:43:54.692452Z", + "shell.execute_reply": "2024-08-30T13:43:54.691937Z" } }, "outputs": [ @@ -313,10 +314,10 @@ "id": "fa6e36d5", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.667386Z", - "iopub.status.busy": "2024-03-27T11:26:26.667228Z", - "iopub.status.idle": "2024-03-27T11:26:26.670890Z", - "shell.execute_reply": "2024-03-27T11:26:26.670425Z" + "iopub.execute_input": "2024-08-30T13:43:54.694439Z", + "iopub.status.busy": "2024-08-30T13:43:54.694155Z", + "iopub.status.idle": "2024-08-30T13:43:54.699214Z", + "shell.execute_reply": "2024-08-30T13:43:54.698826Z" } }, "outputs": [], @@ -332,10 +333,10 @@ "id": "dec2c1a5", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.673075Z", - "iopub.status.busy": "2024-03-27T11:26:26.672669Z", - "iopub.status.idle": "2024-03-27T11:26:26.780999Z", - "shell.execute_reply": "2024-03-27T11:26:26.780438Z" + "iopub.execute_input": "2024-08-30T13:43:54.701143Z", + "iopub.status.busy": "2024-08-30T13:43:54.700820Z", + "iopub.status.idle": "2024-08-30T13:43:54.755258Z", + "shell.execute_reply": "2024-08-30T13:43:54.754750Z" } }, "outputs": [ @@ -384,10 +385,10 @@ "id": "2756e72d", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.783640Z", - "iopub.status.busy": "2024-03-27T11:26:26.783173Z", - "iopub.status.idle": "2024-03-27T11:26:26.799711Z", - "shell.execute_reply": "2024-03-27T11:26:26.799261Z" + "iopub.execute_input": "2024-08-30T13:43:54.757339Z", + "iopub.status.busy": "2024-08-30T13:43:54.757008Z", + "iopub.status.idle": "2024-08-30T13:43:54.770138Z", + "shell.execute_reply": "2024-08-30T13:43:54.769738Z" } }, "outputs": [], @@ -403,10 +404,10 @@ "id": "1ac8103a", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.801834Z", - "iopub.status.busy": "2024-03-27T11:26:26.801523Z", - "iopub.status.idle": "2024-03-27T11:26:26.804890Z", - "shell.execute_reply": "2024-03-27T11:26:26.804365Z" + "iopub.execute_input": "2024-08-30T13:43:54.772090Z", + "iopub.status.busy": "2024-08-30T13:43:54.771779Z", + "iopub.status.idle": "2024-08-30T13:43:54.774716Z", + "shell.execute_reply": "2024-08-30T13:43:54.774242Z" } }, "outputs": [ @@ -428,7 +429,7 @@ "id": "e93bfbeb", "metadata": {}, "source": [ - "Now we have the TOAs of the events in the system of the telescope. Please note that the actual precision of the times is higher than the diplayed output (and we really need this precision for the pulsar analysis!). In the next step, the timing in the SSB and the phase for each TOA has to be created. " + "Now we have the TOAs for the events in the system of the telescope. Please note: the actual precision of the times is higher than the displayed output (and we really need this precision for the pulsar analysis!). In the next step, the timing in the SSB and the phase for each TOA has to be created." ] }, { @@ -444,11 +445,11 @@ "id": "fb536b7e", "metadata": {}, "source": [ - "In order to compute the phases of a pulsar, one needs an ephemeris file, usually store as a .par file. \n", + "In order to compute the phases of a pulsar, one needs an ephemeris file, typically stored as a .par file.\n", "\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, it is important to note that many of the ephemeris files are not up-to-date. Therefore, they could give bad results on the phase computation. In particular, you should always check that the MJD of the observations one wants to phase lies between the `START` and `FINISH` entries of the ephemeris file (see next section)." ] }, { @@ -457,16 +458,16 @@ "id": "d4f89ba4", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.807135Z", - "iopub.status.busy": "2024-03-27T11:26:26.806833Z", - "iopub.status.idle": "2024-03-27T11:26:26.809301Z", - "shell.execute_reply": "2024-03-27T11:26:26.808783Z" + "iopub.execute_input": "2024-08-30T13:43:54.776686Z", + "iopub.status.busy": "2024-08-30T13:43:54.776389Z", + "iopub.status.idle": "2024-08-30T13:43:54.778777Z", + "shell.execute_reply": "2024-08-30T13:43:54.778358Z" } }, "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\"" ] }, { @@ -474,7 +475,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 files 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 features from Tempo2. \n", + "\n", + "In our case, an error occurs when using the ephemeris file with PINT. This is due to the `JUMP` line. To proceed, simply comment out the line (with #) or remove it. Note that this line is not important for the gamma-ray instruments, so it is acceptable to disregard it." ] }, { @@ -507,22 +510,21 @@ "id": "d24e1c92", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.811565Z", - "iopub.status.busy": "2024-03-27T11:26:26.811265Z", - "iopub.status.idle": "2024-03-27T11:26:26.907510Z", - "shell.execute_reply": "2024-03-27T11:26:26.906967Z" - }, - "scrolled": false + "iopub.execute_input": "2024-08-30T13:43:54.780756Z", + "iopub.status.busy": "2024-08-30T13:43:54.780435Z", + "iopub.status.idle": "2024-08-30T13:43:54.876016Z", + "shell.execute_reply": "2024-08-30T13:43:54.875575Z" + } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "\u001b[32m2024-03-27 11:26:26.901\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", - "/usr/share/miniconda3/envs/gammapy-recipes/lib/python3.9/site-packages/pint/models/model_builder.py:198: UserWarning: Unrecognized parfile line 'EPHVER 5'\n", + "\u001b[32m2024-08-30 13:43:54.870\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.models.absolute_phase\u001b[0m:\u001b[36mvalidate\u001b[0m:\u001b[36m77\u001b[0m - \u001b[1mTZRFRQ was 0.0 or None. Setting to infinite frequency.\u001b[0m\n", + "/home/runner/miniconda3/envs/gammapy-recipes/lib/python3.11/site-packages/pint/models/model_builder.py:230: UserWarning: Unrecognized parfile line 'EPHVER 5'\n", " warnings.warn(f\"Unrecognized parfile line '{p_line}'\", UserWarning)\n", - "\u001b[32m2024-03-27 11:26:26.903\u001b[0m | \u001b[33m\u001b[1mWARNING \u001b[0m | \u001b[36mpint.models.model_builder\u001b[0m:\u001b[36m__call__\u001b[0m:\u001b[36m202\u001b[0m - \u001b[33m\u001b[1mUNITS is not specified. Assuming TDB...\u001b[0m\n" + "\u001b[32m2024-08-30 13:43:54.872\u001b[0m | \u001b[33m\u001b[1mWARNING \u001b[0m | \u001b[36mpint.models.model_builder\u001b[0m:\u001b[36m__call__\u001b[0m:\u001b[36m234\u001b[0m - \u001b[33m\u001b[1mUNITS is not specified. Assuming TDB...\u001b[0m\n" ] }, { @@ -569,7 +571,111 @@ "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. Check the [PINT documentation](https://nanograv-pint.readthedocs.io) for a list of additional parameters. To obtain the complete set of parameters from the ephemeris file, one can simply print the model:\n", + "`print(model)`" + ] + }, + { + "cell_type": "markdown", + "id": "f02f0ca5-09f2-44d4-ad76-518f8964b6a1", + "metadata": {}, + "source": [ + "As mentioned previously, we should ensure 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": 15, + "id": "2584b571-93a9-4fb6-b8e2-60b8810190f6", + "metadata": { + "execution": { + "iopub.execute_input": "2024-08-30T13:43:54.878085Z", + "iopub.status.busy": "2024-08-30T13:43:54.877785Z", + "iopub.status.idle": "2024-08-30T13:43:54.881053Z", + "shell.execute_reply": "2024-08-30T13:43:54.880542Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Ephemeris time definition:\n", + "54686.1526259 - 56583.1591704\n", + "Observation time definition:\n", + "56569.18112772242 - 56569.19487901596\n" + ] + } + ], + "source": [ + "print(\n", + " f\"Ephemeris time definition:\\n{model.START.value} - {model.FINISH.value}\"\n", + ")\n", + "print(\n", + " f\"Observation time definition:\\n{observation.tstart} - {observation.tstop}\"\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "86041174-5ec4-43ba-9035-cf567b47a3bb", + "metadata": {}, + "source": [ + "If you have several observations that 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 create a small function like the following one:" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "8838ee6c-5b53-4d34-8fd7-94d32daa6bb3", + "metadata": { + "execution": { + "iopub.execute_input": "2024-08-30T13:43:54.882764Z", + "iopub.status.busy": "2024-08-30T13:43:54.882615Z", + "iopub.status.idle": "2024-08-30T13:43:54.886095Z", + "shell.execute_reply": "2024-08-30T13:43:54.885667Z" + } + }, + "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(\n", + " [model.START.value, model.FINISH.value], scale=\"tt\", format=\"mjd\"\n", + " )\n", + " if (model_time[0].value > observation.tstart.tt.mjd) or (\n", + " model_time[1].value < observation.tstop.tt.mjd\n", + " ):\n", + " log.warning(\n", + " f\"Warning: Observation time of observation {observation.obs_id} goes out of timing model validity time.\"\n", + " )" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "0d37e6cc-2cae-4192-87d9-88d52216e83f", + "metadata": { + "execution": { + "iopub.execute_input": "2024-08-30T13:43:54.887762Z", + "iopub.status.busy": "2024-08-30T13:43:54.887614Z", + "iopub.status.idle": "2024-08-30T13:43:54.890615Z", + "shell.execute_reply": "2024-08-30T13:43:54.890203Z" + } + }, + "outputs": [], + "source": [ + "check_time(observation, model)" ] }, { @@ -582,47 +688,53 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 18, "id": "a145cdde", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.909929Z", - "iopub.status.busy": "2024-03-27T11:26:26.909738Z", - "iopub.status.idle": "2024-03-27T11:26:44.597210Z", - "shell.execute_reply": "2024-03-27T11:26:44.596640Z" - }, - "scrolled": false + "iopub.execute_input": "2024-08-30T13:43:54.892323Z", + "iopub.status.busy": "2024-08-30T13:43:54.892174Z", + "iopub.status.idle": "2024-08-30T13:44:15.697802Z", + "shell.execute_reply": "2024-08-30T13:44:15.697299Z" + } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "\u001b[32m2024-03-27 11:26:27.247\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m1358\u001b[0m - \u001b[34m\u001b[1mNo pulse number flags found in the TOAs\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:27.263\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mapply_clock_corrections\u001b[0m:\u001b[36m2200\u001b[0m - \u001b[34m\u001b[1mApplying clock corrections (include_gps = False, include_bipm = False)\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:27.923\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-03-27 11:26:31.192\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2251\u001b[0m - \u001b[34m\u001b[1mComputing TDB columns.\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:31.193\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2272\u001b[0m - \u001b[34m\u001b[1mUsing EPHEM = DE421 for TDB calculation.\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:32.378\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2350\u001b[0m - \u001b[34m\u001b[1mComputing PosVels of observatories and Earth, using DE421\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:33.420\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-03-27 11:26:44.359\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2403\u001b[0m - \u001b[34m\u001b[1mSSB obs pos [1.47007462e+11 2.56889811e+10 1.11245045e+10] m\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.587\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-03-27 11:26:44.593\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2417\u001b[0m - \u001b[34m\u001b[1mAdding columns ssb_obs_pos ssb_obs_vel obs_sun_pos\u001b[0m\n" + "\u001b[32m2024-08-30 13:43:55.618\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m1377\u001b[0m - \u001b[34m\u001b[1mNo pulse number flags found in the TOAs\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:55.633\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mapply_clock_corrections\u001b[0m:\u001b[36m2224\u001b[0m - \u001b[34m\u001b[1mApplying clock corrections (include_bipm = False)\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.294\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.observatory\u001b[0m:\u001b[36mgps_correction\u001b[0m:\u001b[36m248\u001b[0m - \u001b[1mApplying GPS to UTC clock correction (~few nanoseconds)\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.294\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.observatory\u001b[0m:\u001b[36m_load_gps_clock\u001b[0m:\u001b[36m122\u001b[0m - \u001b[34m\u001b[1mLoading global GPS clock file\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.297\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.observatory.global_clock_corrections\u001b[0m:\u001b[36mget_file\u001b[0m:\u001b[36m128\u001b[0m - \u001b[1mFile index.txt to be downloaded due to download policy if_expired: https://raw.githubusercontent.com/ipta/pulsar-clock-corrections/main/index.txt\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.451\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.observatory.clock_file\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m812\u001b[0m - \u001b[34m\u001b[1mGlobal clock file gps2utc.clk saving kwargs={'bogus_last_correction': False, 'valid_beyond_ends': False}\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.452\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.observatory.global_clock_corrections\u001b[0m:\u001b[36mget_file\u001b[0m:\u001b[36m128\u001b[0m - \u001b[1mFile T2runtime/clock/gps2utc.clk to be downloaded due to download policy if_missing: https://raw.githubusercontent.com/ipta/pulsar-clock-corrections/main/T2runtime/clock/gps2utc.clk\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.668\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.observatory.clock_file\u001b[0m:\u001b[36mread_tempo2_clock_file\u001b[0m:\u001b[36m463\u001b[0m - \u001b[34m\u001b[1mLoading TEMPO2-format observatory clock correction file gps2utc.clk (/home/runner/.astropy/cache/download/url/d3c81b5766f4bfb84e65504c8a453085/contents) with bogus_last_correction=False\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.687\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.observatory\u001b[0m:\u001b[36mfind_clock_file\u001b[0m:\u001b[36m994\u001b[0m - \u001b[1mUsing global clock file for gps2utc.clk with bogus_last_correction=False\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.689\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.observatory.topo_obs\u001b[0m:\u001b[36mclock_corrections\u001b[0m:\u001b[36m354\u001b[0m - \u001b[1mObservatory magic requires no clock corrections.\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:59.900\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2270\u001b[0m - \u001b[34m\u001b[1mComputing TDB columns.\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:59.901\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2291\u001b[0m - \u001b[34m\u001b[1mUsing EPHEM = DE421 for TDB calculation.\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:00.968\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2371\u001b[0m - \u001b[34m\u001b[1mComputing PosVels of observatories and Earth, using DE421\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:02.516\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-08-30 13:44:15.633\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2424\u001b[0m - \u001b[34m\u001b[1mSSB obs pos [1.47007462e+11 2.56889811e+10 1.11245045e+10] m\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.688\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-08-30 13:44:15.694\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2438\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 7.02 s, sys: 188 ms, total: 7.21 s\n", - "Wall time: 17.7 s\n" + "CPU times: user 7.15 s, sys: 199 ms, total: 7.35 s\n", + "Wall time: 20.8 s\n" ] } ], "source": [ "%%time\n", "\n", - "# Put these to True is your observatory has clock correction files.\n", + "# Set these to True is your observatory has clock correction files.\n", "# If it is set to True but your observatory does not have clock correction files, it will be ignored.\n", "include_bipm = False\n", "include_gps = False\n", @@ -648,19 +760,19 @@ "id": "db97ea5b", "metadata": {}, "source": [ - "Once we have the TOAs object and the model, the phases are easily computed using the model.phase() method. Note that the phases are computed in the interval [-0.5,0.5]. Most of the times, we use the phases in the interval [0,1] so we have to shift the negative ones." + "Once we have the TOAs object and the model, the phases are easily computed using the model.phase() method. Note that the phases are computed in the interval [-0.5,0.5]. Most of the time, we use the phases in the interval [0,1] so we have to shift the negative ones." ] }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 19, "id": "6fbf3ad9", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:44.599538Z", - "iopub.status.busy": "2024-03-27T11:26:44.599353Z", - "iopub.status.idle": "2024-03-27T11:26:45.194277Z", - "shell.execute_reply": "2024-03-27T11:26:45.193696Z" + "iopub.execute_input": "2024-08-30T13:44:15.699970Z", + "iopub.status.busy": "2024-08-30T13:44:15.699584Z", + "iopub.status.idle": "2024-08-30T13:44:15.924450Z", + "shell.execute_reply": "2024-08-30T13:44:15.924037Z" } }, "outputs": [ @@ -668,19 +780,19 @@ "name": "stderr", "output_type": "stream", "text": [ - "\u001b[32m2024-03-27 11:26:44.636\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-03-27 11:26:44.640\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-03-27 11:26:44.646\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m1358\u001b[0m - \u001b[34m\u001b[1mNo pulse number flags found in the TOAs\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.646\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mapply_clock_corrections\u001b[0m:\u001b[36m2200\u001b[0m - \u001b[34m\u001b[1mApplying clock corrections (include_gps = False, include_bipm = False)\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.648\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2251\u001b[0m - \u001b[34m\u001b[1mComputing TDB columns.\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.648\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2272\u001b[0m - \u001b[34m\u001b[1mUsing EPHEM = DE421 for TDB calculation.\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.651\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2350\u001b[0m - \u001b[34m\u001b[1mComputing PosVels of observatories and Earth, using DE421\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.929\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-03-27 11:26:44.931\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2403\u001b[0m - \u001b[34m\u001b[1mSSB obs pos [-1.49278181e+08 7.07659442e+06 3.07113250e+06] km\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:45.150\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-03-27 11:26:45.176\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2417\u001b[0m - \u001b[34m\u001b[1mAdding columns ssb_obs_pos ssb_obs_vel obs_sun_pos\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:45.177\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-03-27 11:26:45.188\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-08-30 13:44:15.729\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.models.glitch\u001b[0m:\u001b[36mglitch_phase\u001b[0m:\u001b[36m221\u001b[0m - \u001b[34m\u001b[1mGlitch phase for glitch 1: 0.0 \u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.735\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.models.absolute_phase\u001b[0m:\u001b[36mget_TZR_toa\u001b[0m:\u001b[36m100\u001b[0m - \u001b[34m\u001b[1mCreating and dealing with the single TZR_toa for absolute phase\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.738\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m1377\u001b[0m - \u001b[34m\u001b[1mNo pulse number flags found in the TOAs\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.738\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mapply_clock_corrections\u001b[0m:\u001b[36m2224\u001b[0m - \u001b[34m\u001b[1mApplying clock corrections (include_bipm = False)\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.760\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2270\u001b[0m - \u001b[34m\u001b[1mComputing TDB columns.\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.761\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2291\u001b[0m - \u001b[34m\u001b[1mUsing EPHEM = DE421 for TDB calculation.\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.764\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2371\u001b[0m - \u001b[34m\u001b[1mComputing PosVels of observatories and Earth, using DE421\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.834\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-08-30 13:44:15.836\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2424\u001b[0m - \u001b[34m\u001b[1mSSB obs pos [-1.49278181e+08 7.07659442e+06 3.07113250e+06] km\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.907\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-08-30 13:44:15.908\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2438\u001b[0m - \u001b[34m\u001b[1mAdding columns ssb_obs_pos ssb_obs_vel obs_sun_pos\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.909\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-08-30 13:44:15.916\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.models.glitch\u001b[0m:\u001b[36mglitch_phase\u001b[0m:\u001b[36m221\u001b[0m - \u001b[34m\u001b[1mGlitch phase for glitch 1: 0.0 \u001b[0m\n" ] } ], @@ -710,14 +822,14 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 20, "id": "735ac718", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.196779Z", - "iopub.status.busy": "2024-03-27T11:26:45.196431Z", - "iopub.status.idle": "2024-03-27T11:26:45.206792Z", - "shell.execute_reply": "2024-03-27T11:26:45.206263Z" + "iopub.execute_input": "2024-08-30T13:44:15.926698Z", + "iopub.status.busy": "2024-08-30T13:44:15.926261Z", + "iopub.status.idle": "2024-08-30T13:44:15.935066Z", + "shell.execute_reply": "2024-08-30T13:44:15.934677Z" } }, "outputs": [], @@ -728,65 +840,93 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 21, "id": "f3269a2c", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.209126Z", - "iopub.status.busy": "2024-03-27T11:26:45.208686Z", - "iopub.status.idle": "2024-03-27T11:26:45.212621Z", - "shell.execute_reply": "2024-03-27T11:26:45.212125Z" - }, - "scrolled": false + "iopub.execute_input": "2024-08-30T13:44:15.936748Z", + "iopub.status.busy": "2024-08-30T13:44:15.936604Z", + "iopub.status.idle": "2024-08-30T13:44:15.942656Z", + "shell.execute_reply": "2024-08-30T13:44:15.942183Z" + } }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "EVENT_ID TIME RA DEC ENERGY \n", - " s deg deg TeV \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", - " 2561 333778853.0339344 84.84237 22.175398 0.118843034\n", - " ... ... ... ... ...\n", - " 356222 333780039.4520397 84.74482 20.894981 0.043312162\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", - "Length = 11189 rows\n" - ] + "data": { + "text/html": [ + "
Table length=11189\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
EVENT_IDTIMERADECENERGY
sdegdegTeV
int64float64float32float32float32
2402333778852.509924984.5945722.030880.18194601
2408333778852.526715384.2146223.449140.08397394
2434333778852.6131505483.52470422.7257920.10596932
2445333778852.669014283.7695722.4510060.19733498
2478333778852.762793983.47851623.4845940.08522219
2481333778852.777854983.7151721.9851151.0020943
2513333778852.864446782.42119622.5676520.14374068
2544333778852.982606483.6413622.0413150.10316629
2559333778853.026941484.06917622.973370.047184493
...............
356223333780039.460049284.1161522.5575050.08110082
356227333780039.4710536683.4153421.673440.2096362
356242333780039.517909583.5516522.7729850.17672835
356282333780039.6299751484.4613321.693570.05068718
356473333780040.338647984.4544121.1598280.1831569
356478333780040.354892683.6833623.4449880.06305169
356485333780040.374132284.3351721.283380.060539745
356486333780040.375515984.8588622.1162220.123453744
356526333780040.5247600784.8692921.2909160.13630114
" + ], + "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": 21, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ "# Show original table\n", - "print(table)" + "table" ] }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 22, "id": "6fc6024c", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.214559Z", - "iopub.status.busy": "2024-03-27T11:26:45.214389Z", - "iopub.status.idle": "2024-03-27T11:26:45.216994Z", - "shell.execute_reply": "2024-03-27T11:26:45.216564Z" + "iopub.execute_input": "2024-08-30T13:44:15.944440Z", + "iopub.status.busy": "2024-08-30T13:44:15.944274Z", + "iopub.status.idle": "2024-08-30T13:44:15.946972Z", + "shell.execute_reply": "2024-08-30T13:44:15.946502Z" } }, "outputs": [], @@ -805,46 +945,44 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 23, "id": "7f29187e", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.219230Z", - "iopub.status.busy": "2024-03-27T11:26:45.218856Z", - "iopub.status.idle": "2024-03-27T11:26:45.225134Z", - "shell.execute_reply": "2024-03-27T11:26:45.224604Z" - }, - "scrolled": false + "iopub.execute_input": "2024-08-30T13:44:15.948805Z", + "iopub.status.busy": "2024-08-30T13:44:15.948513Z", + "iopub.status.idle": "2024-08-30T13:44:15.952984Z", + "shell.execute_reply": "2024-08-30T13:44:15.952497Z" + } }, "outputs": [ { "data": { "text/html": [ "
Table length=11189\n", - "
\n", + "
\n", "\n", "\n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", "
EVENT_IDTIMERADECENERGYPHASE
sdegdegTeV
int64float64float32float32float32float64
2402333778852.509924984.5945722.030880.181946010.39349195931383935
2408333778852.526715384.2146223.449140.083973940.8919526790064667
2434333778852.6131505483.52470422.7257920.105969320.4579789031294724
2445333778852.669014283.7695722.4510060.197334980.11641860219368935
2478333778852.762793983.47851623.4845940.085222190.9004806857711186
2481333778852.777854983.7151721.9851151.00209430.3476011689926769
2513333778852.864446782.42119622.5676520.143740680.9182740999289545
2544333778852.982606483.6413622.0413150.103166290.42611249421537956
2559333778853.026941484.06917622.973370.0471844930.7422975122115125
2402333778852.509924984.5945722.030880.181946010.3934918682770723
2408333778852.526715384.2146223.449140.083973940.8919525879696997
2434333778852.6131505483.52470422.7257920.105969320.45797881185987477
2445333778852.669014283.7695722.4510060.197334980.11641851092409164
2478333778852.762793983.47851623.4845940.085222190.900480594501521
2481333778852.777854983.7151721.9851151.00209430.34760107795590983
2513333778852.864446782.42119622.5676520.143740680.9182740088921875
2544333778852.982606483.6413622.0413150.103166290.42611240294578184
2559333778853.026941484.06917622.973370.0471844930.7422974209419148
..................
356222333780039.452039784.7448220.8949810.0433121620.4537121484157113
356223333780039.460049284.1161522.5575050.081100820.6914920486374702
356227333780039.4710536683.4153421.673440.20963620.018183944316962984
356242333780039.517909583.5516522.7729850.176728350.40920620046641115
356282333780039.6299751484.4613321.693570.050687180.7361270955486778
356473333780040.338647984.4544121.1598280.18315690.7746789518818565
356478333780040.354892683.6833623.4449880.063051690.2569398572226654
356485333780040.374132284.3351721.283380.0605397450.8281109722104576
356486333780040.375515984.8588622.1162220.1234537440.8691881135544401
356526333780040.5247600784.8692921.2909160.136301140.29983901925054285
356223333780039.460049284.1161522.5575050.081100820.6914919573678725
356227333780039.4710536683.4153421.673440.20963620.018183853280195963
356242333780039.517909583.5516522.7729850.176728350.4092061182772071
356282333780039.6299751484.4613321.693570.050687180.7361270045119108
356473333780040.338647984.4544121.1598280.18315690.7746788606122589
356478333780040.354892683.6833623.4449880.063051690.25693976618589837
356485333780040.374132284.3351721.283380.0605397450.8281108809408599
356486333780040.375515984.8588622.1162220.1234537440.8691880225176731
356526333780040.5247600784.8692921.2909160.136301140.29983892821377583
" ], "text/plain": [ @@ -853,29 +991,28 @@ " 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", + " 2402 333778852.5099249 84.59457 22.03088 0.18194601 0.3934918682770723\n", + " 2408 333778852.5267153 84.21462 23.44914 0.08397394 0.8919525879696997\n", + " 2434 333778852.61315054 83.524704 22.725792 0.10596932 0.45797881185987477\n", + " 2445 333778852.6690142 83.76957 22.451006 0.19733498 0.11641851092409164\n", + " 2478 333778852.7627939 83.478516 23.484594 0.08522219 0.900480594501521\n", + " 2481 333778852.7778549 83.71517 21.985115 1.0020943 0.34760107795590983\n", + " 2513 333778852.8644467 82.421196 22.567652 0.14374068 0.9182740088921875\n", + " 2544 333778852.9826064 83.64136 22.041315 0.10316629 0.42611240294578184\n", + " 2559 333778853.0269414 84.069176 22.97337 0.047184493 0.7422974209419148\n", " ... ... ... ... ... ...\n", - " 356222 333780039.4520397 84.74482 20.894981 0.043312162 0.4537121484157113\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" + " 356223 333780039.4600492 84.11615 22.557505 0.08110082 0.6914919573678725\n", + " 356227 333780039.47105366 83.41534 21.67344 0.2096362 0.018183853280195963\n", + " 356242 333780039.5179095 83.55165 22.772985 0.17672835 0.4092061182772071\n", + " 356282 333780039.62997514 84.46133 21.69357 0.05068718 0.7361270045119108\n", + " 356473 333780040.3386479 84.45441 21.159828 0.1831569 0.7746788606122589\n", + " 356478 333780040.3548926 83.68336 23.444988 0.06305169 0.25693976618589837\n", + " 356485 333780040.3741322 84.33517 21.28338 0.060539745 0.8281108809408599\n", + " 356486 333780040.3755159 84.85886 22.116222 0.123453744 0.8691880225176731\n", + " 356526 333780040.52476007 84.86929 21.290916 0.13630114 0.29983892821377583" ] }, - "execution_count": 20, + "execution_count": 23, "metadata": {}, "output_type": "execute_result" } @@ -898,23 +1035,22 @@ "id": "ea9ba223", "metadata": {}, "source": [ - "At this point, we also want to add meta data to the table. It is very useful to keep track of what has been done to the file. For instance, if we have multiple pulsars in the same file, we want to be able to know quickly which column correspond to which pulsar. Moreover, experience shows that one often use different ephemeris file for the same pulsar. Therefore, it is very useful to have several phase columns in the same file and to be able to know which column correspond to which ephemeris file, parameters, etc.\n", + "At this point, we also want to add metadata to the table. It is very useful to keep track of what has been done to the file. For instance, if a file contains multiple pulsars, we want identify quickly which column corresponds to each pulsar. Moreover, experience has shown that it is common to have different ephemeris files for the same pulsar. Therefore, it is useful to have several phase columns in the same file to easily identify which column corresponds to each ephemeris file, parameters, etc.\n", "\n", - "Since there is not yet a \"standard\" format for such metadata, we propose a template for the essential informations that one wants to save in the header of the event file. First, we look at the present meta info on the table." + "Since there is currently no \"standard\" format for such metadata, we propose a template for the essential information that one wants to save in the header of the event file. First, we look at the present meta info on the table." ] }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 24, "id": "af220557", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.227594Z", - "iopub.status.busy": "2024-03-27T11:26:45.227257Z", - "iopub.status.idle": "2024-03-27T11:26:45.231629Z", - "shell.execute_reply": "2024-03-27T11:26:45.231108Z" - }, - "scrolled": false + "iopub.execute_input": "2024-08-30T13:44:15.955025Z", + "iopub.status.busy": "2024-08-30T13:44:15.954655Z", + "iopub.status.idle": "2024-08-30T13:44:15.958777Z", + "shell.execute_reply": "2024-08-30T13:44:15.958278Z" + } }, "outputs": [ { @@ -957,7 +1093,7 @@ " ('AZ_PNT', 103.8848)])" ] }, - "execution_count": 21, + "execution_count": 24, "metadata": {}, "output_type": "execute_result" } @@ -968,14 +1104,14 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 25, "id": "c2285fcd", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.233745Z", - "iopub.status.busy": "2024-03-27T11:26:45.233423Z", - "iopub.status.idle": "2024-03-27T11:26:45.237873Z", - "shell.execute_reply": "2024-03-27T11:26:45.237324Z" + "iopub.execute_input": "2024-08-30T13:44:15.960712Z", + "iopub.status.busy": "2024-08-30T13:44:15.960430Z", + "iopub.status.idle": "2024-08-30T13:44:15.964154Z", + "shell.execute_reply": "2024-08-30T13:44:15.963725Z" } }, "outputs": [], @@ -1018,14 +1154,14 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 26, "id": "8c866a5c", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.240180Z", - "iopub.status.busy": "2024-03-27T11:26:45.239749Z", - "iopub.status.idle": "2024-03-27T11:26:45.243507Z", - "shell.execute_reply": "2024-03-27T11:26:45.242970Z" + "iopub.execute_input": "2024-08-30T13:44:15.966078Z", + "iopub.status.busy": "2024-08-30T13:44:15.965699Z", + "iopub.status.idle": "2024-08-30T13:44:15.968960Z", + "shell.execute_reply": "2024-08-30T13:44:15.968447Z" } }, "outputs": [ @@ -1033,7 +1169,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "COLUMN_PHASE: PHASE; PINT_VERS: 0.9.8; GAMMAPY_VERS: 1.0.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: 60396.4769125122;\n" + "COLUMN_PHASE: PHASE; PINT_VERS: 1.0.1; 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: 60552.572407022526;\n" ] } ], @@ -1044,14 +1180,14 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 27, "id": "5a3e56d2", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.245447Z", - "iopub.status.busy": "2024-03-27T11:26:45.245279Z", - "iopub.status.idle": "2024-03-27T11:26:45.247890Z", - "shell.execute_reply": "2024-03-27T11:26:45.247345Z" + "iopub.execute_input": "2024-08-30T13:44:15.971018Z", + "iopub.status.busy": "2024-08-30T13:44:15.970621Z", + "iopub.status.idle": "2024-08-30T13:44:15.973109Z", + "shell.execute_reply": "2024-08-30T13:44:15.972658Z" } }, "outputs": [], @@ -1062,14 +1198,14 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 28, "id": "f6b44e25", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.250137Z", - "iopub.status.busy": "2024-03-27T11:26:45.249693Z", - "iopub.status.idle": "2024-03-27T11:26:45.254108Z", - "shell.execute_reply": "2024-03-27T11:26:45.253667Z" + "iopub.execute_input": "2024-08-30T13:44:15.974924Z", + "iopub.status.busy": "2024-08-30T13:44:15.974603Z", + "iopub.status.idle": "2024-08-30T13:44:15.978533Z", + "shell.execute_reply": "2024-08-30T13:44:15.978032Z" } }, "outputs": [ @@ -1112,10 +1248,10 @@ " ('ALT_PNT', 69.69974),\n", " ('AZ_PNT', 103.8848),\n", " ('PH_LOG',\n", - " 'COLUMN_PHASE: PHASE; PINT_VERS: 0.9.8; GAMMAPY_VERS: 1.0.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: 60396.4769125122;')])" + " 'COLUMN_PHASE: PHASE; PINT_VERS: 1.0.1; 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: 60552.572407022526;')])" ] }, - "execution_count": 25, + "execution_count": 28, "metadata": {}, "output_type": "execute_result" } @@ -1134,14 +1270,14 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 29, "id": "12545bff", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.256140Z", - "iopub.status.busy": "2024-03-27T11:26:45.255965Z", - "iopub.status.idle": "2024-03-27T11:26:45.306335Z", - "shell.execute_reply": "2024-03-27T11:26:45.305804Z" + "iopub.execute_input": "2024-08-30T13:44:15.980471Z", + "iopub.status.busy": "2024-08-30T13:44:15.980173Z", + "iopub.status.idle": "2024-08-30T13:44:16.013868Z", + "shell.execute_reply": "2024-08-30T13:44:16.013376Z" } }, "outputs": [ @@ -1149,7 +1285,6 @@ "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", "'THETA' axis is stored as a scalar -- converting to 1D array.\n" @@ -1164,14 +1299,14 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 30, "id": "1ac16c51", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.308633Z", - "iopub.status.busy": "2024-03-27T11:26:45.308216Z", - "iopub.status.idle": "2024-03-27T11:26:45.313310Z", - "shell.execute_reply": "2024-03-27T11:26:45.312737Z" + "iopub.execute_input": "2024-08-30T13:44:16.015882Z", + "iopub.status.busy": "2024-08-30T13:44:16.015596Z", + "iopub.status.idle": "2024-08-30T13:44:16.020193Z", + "shell.execute_reply": "2024-08-30T13:44:16.019715Z" } }, "outputs": [ @@ -1179,30 +1314,29 @@ "data": { "text/html": [ "
Table length=11189\n", - "\n", + "
\n", "\n", "\n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", "
EVENT_IDTIMERADECENERGYPHASE
sdegdegTeV
int64float64float32float32float32float64
2402333778852.509924984.5945722.030880.181946010.39349195931383935
2408333778852.526715384.2146223.449140.083973940.8919526790064667
2434333778852.6131505483.52470422.7257920.105969320.4579789031294724
2445333778852.669014283.7695722.4510060.197334980.11641860219368935
2478333778852.762793983.47851623.4845940.085222190.9004806857711186
2481333778852.777854983.7151721.9851151.00209430.3476011689926769
2513333778852.864446782.42119622.5676520.143740680.9182740999289545
2544333778852.982606483.6413622.0413150.103166290.42611249421537956
2559333778853.026941484.06917622.973370.0471844930.7422975122115125
2402333778852.509924984.5945722.030880.181946010.3934918682770723
2408333778852.526715384.2146223.449140.083973940.8919525879696997
2434333778852.6131505483.52470422.7257920.105969320.45797881185987477
2445333778852.669014283.7695722.4510060.197334980.11641851092409164
2478333778852.762793983.47851623.4845940.085222190.900480594501521
2481333778852.777854983.7151721.9851151.00209430.34760107795590983
2513333778852.864446782.42119622.5676520.143740680.9182740088921875
2544333778852.982606483.6413622.0413150.103166290.42611240294578184
2559333778853.026941484.06917622.973370.0471844930.7422974209419148
..................
356222333780039.452039784.7448220.8949810.0433121620.4537121484157113
356223333780039.460049284.1161522.5575050.081100820.6914920486374702
356227333780039.4710536683.4153421.673440.20963620.018183944316962984
356242333780039.517909583.5516522.7729850.176728350.40920620046641115
356282333780039.6299751484.4613321.693570.050687180.7361270955486778
356473333780040.338647984.4544121.1598280.18315690.7746789518818565
356478333780040.354892683.6833623.4449880.063051690.2569398572226654
356485333780040.374132284.3351721.283380.0605397450.8281109722104576
356486333780040.375515984.8588622.1162220.1234537440.8691881135544401
356526333780040.5247600784.8692921.2909160.136301140.29983901925054285
356223333780039.460049284.1161522.5575050.081100820.6914919573678725
356227333780039.4710536683.4153421.673440.20963620.018183853280195963
356242333780039.517909583.5516522.7729850.176728350.4092061182772071
356282333780039.6299751484.4613321.693570.050687180.7361270045119108
356473333780040.338647984.4544121.1598280.18315690.7746788606122589
356478333780040.354892683.6833623.4449880.063051690.25693976618589837
356485333780040.374132284.3351721.283380.0605397450.8281108809408599
356486333780040.375515984.8588622.1162220.1234537440.8691880225176731
356526333780040.5247600784.8692921.2909160.136301140.29983892821377583
" ], "text/plain": [ @@ -1211,29 +1345,28 @@ " 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", + " 2402 333778852.5099249 84.59457 22.03088 0.18194601 0.3934918682770723\n", + " 2408 333778852.5267153 84.21462 23.44914 0.08397394 0.8919525879696997\n", + " 2434 333778852.61315054 83.524704 22.725792 0.10596932 0.45797881185987477\n", + " 2445 333778852.6690142 83.76957 22.451006 0.19733498 0.11641851092409164\n", + " 2478 333778852.7627939 83.478516 23.484594 0.08522219 0.900480594501521\n", + " 2481 333778852.7778549 83.71517 21.985115 1.0020943 0.34760107795590983\n", + " 2513 333778852.8644467 82.421196 22.567652 0.14374068 0.9182740088921875\n", + " 2544 333778852.9826064 83.64136 22.041315 0.10316629 0.42611240294578184\n", + " 2559 333778853.0269414 84.069176 22.97337 0.047184493 0.7422974209419148\n", " ... ... ... ... ... ...\n", - " 356222 333780039.4520397 84.74482 20.894981 0.043312162 0.4537121484157113\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" + " 356223 333780039.4600492 84.11615 22.557505 0.08110082 0.6914919573678725\n", + " 356227 333780039.47105366 83.41534 21.67344 0.2096362 0.018183853280195963\n", + " 356242 333780039.5179095 83.55165 22.772985 0.17672835 0.4092061182772071\n", + " 356282 333780039.62997514 84.46133 21.69357 0.05068718 0.7361270045119108\n", + " 356473 333780040.3386479 84.45441 21.159828 0.1831569 0.7746788606122589\n", + " 356478 333780040.3548926 83.68336 23.444988 0.06305169 0.25693976618589837\n", + " 356485 333780040.3741322 84.33517 21.28338 0.060539745 0.8281108809408599\n", + " 356486 333780040.3755159 84.85886 22.116222 0.123453744 0.8691880225176731\n", + " 356526 333780040.52476007 84.86929 21.290916 0.13630114 0.29983892821377583" ] }, - "execution_count": 27, + "execution_count": 30, "metadata": {}, "output_type": "execute_result" } @@ -1255,31 +1388,31 @@ "id": "e369d2dc", "metadata": {}, "source": [ - "In the following, we show how to write the files in a directory contained in the original datastore directory. This follows the logic of DL3 data store and facilitate the manipulation of the HDU table.\n", + "In the following, we show how to write the files in a directory contained in the original datastore directory. This follows the logic of DL3 data store and facilitates the manipulation of the HDU table.\n", "\n", - "If one does not want to save the events files and directly perform the pulsar analysis, this step is not required as well as the step of the meta data handling. However, be aware that for large dataset, the computation of phases can take tens of minutes. " + "If you do not want to save the events files bur rather directly perform the pulsar analysis, you can skip both this step and the step of the handling metadata. However, be aware that for large datasets, the computation of the phases can take tens of minutes." ] }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 31, "id": "f3c8410c", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.315528Z", - "iopub.status.busy": "2024-03-27T11:26:45.315188Z", - "iopub.status.idle": "2024-03-27T11:26:45.318777Z", - "shell.execute_reply": "2024-03-27T11:26:45.318308Z" + "iopub.execute_input": "2024-08-30T13:44:16.022167Z", + "iopub.status.busy": "2024-08-30T13:44:16.021883Z", + "iopub.status.idle": "2024-08-30T13:44:16.025164Z", + "shell.execute_reply": "2024-08-30T13:44:16.024650Z" } }, "outputs": [ { "data": { "text/plain": [ - "PosixPath('/home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.0.2/magic/rad_max/data')" + "PosixPath('/home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.2/magic/rad_max/data')" ] }, - "execution_count": 28, + "execution_count": 31, "metadata": {}, "output_type": "execute_result" } @@ -1290,14 +1423,14 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 32, "id": "8fd2ce31", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.320738Z", - "iopub.status.busy": "2024-03-27T11:26:45.320560Z", - "iopub.status.idle": "2024-03-27T11:26:45.323746Z", - "shell.execute_reply": "2024-03-27T11:26:45.323305Z" + "iopub.execute_input": "2024-08-30T13:44:16.027018Z", + "iopub.status.busy": "2024-08-30T13:44:16.026717Z", + "iopub.status.idle": "2024-08-30T13:44:16.029663Z", + "shell.execute_reply": "2024-08-30T13:44:16.029226Z" } }, "outputs": [], @@ -1314,24 +1447,24 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 33, "id": "e6e38fc1", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.325950Z", - "iopub.status.busy": "2024-03-27T11:26:45.325616Z", - "iopub.status.idle": "2024-03-27T11:26:45.329021Z", - "shell.execute_reply": "2024-03-27T11:26:45.328467Z" + "iopub.execute_input": "2024-08-30T13:44:16.031501Z", + "iopub.status.busy": "2024-08-30T13:44:16.031183Z", + "iopub.status.idle": "2024-08-30T13:44:16.034289Z", + "shell.execute_reply": "2024-08-30T13:44:16.033820Z" } }, "outputs": [ { "data": { "text/plain": [ - "'/home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.0.2/magic/rad_max/data/pulsar_events_file/'" + "'/home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.2/magic/rad_max/data/pulsar_events_file/'" ] }, - "execution_count": 30, + "execution_count": 33, "metadata": {}, "output_type": "execute_result" } @@ -1342,32 +1475,29 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 34, "id": "f339c797", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.331194Z", - "iopub.status.busy": "2024-03-27T11:26:45.330781Z", - "iopub.status.idle": "2024-03-27T11:26:45.489597Z", - "shell.execute_reply": "2024-03-27T11:26:45.488969Z" - }, - "scrolled": true + "iopub.execute_input": "2024-08-30T13:44:16.036030Z", + "iopub.status.busy": "2024-08-30T13:44:16.035881Z", + "iopub.status.idle": "2024-08-30T13:44:16.168565Z", + "shell.execute_reply": "2024-08-30T13:44:16.168088Z" + } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Writing outputfile in /home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.0.2/magic/rad_max/data/pulsar_events_file/dl3_pulsar_5029747.fits.gz\n" + "Writing output file in /home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.2/magic/rad_max/data/pulsar_events_file/dl3_pulsar_5029747.fits.gz\n" ] } ], "source": [ "# Save the observation object in the specified file_path\n", - "print(\"Writing outputfile in \" + str(file_path))\n", - "observation.events.write(\n", - " filename=file_path, gti=observation.gti, overwrite=True\n", - ")" + "print(\"Writing output file in \" + str(file_path))\n", + "new_obs.write(path=file_path, include_irfs=False, overwrite=True)" ] }, { @@ -1380,14 +1510,14 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 35, "id": "4b8dd431", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.492294Z", - "iopub.status.busy": "2024-03-27T11:26:45.491941Z", - "iopub.status.idle": "2024-03-27T11:26:45.497464Z", - "shell.execute_reply": "2024-03-27T11:26:45.496931Z" + "iopub.execute_input": "2024-08-30T13:44:16.170679Z", + "iopub.status.busy": "2024-08-30T13:44:16.170369Z", + "iopub.status.idle": "2024-08-30T13:44:16.175339Z", + "shell.execute_reply": "2024-08-30T13:44:16.174869Z" } }, "outputs": [ @@ -1395,7 +1525,7 @@ "data": { "text/html": [ "
HDUIndexTable length=10\n", - "\n", + "
\n", "\n", "\n", "\n", @@ -1427,7 +1557,7 @@ "5029747 edisp ... ENERGY DISPERSION" ] }, - "execution_count": 32, + "execution_count": 35, "metadata": {}, "output_type": "execute_result" } @@ -1440,34 +1570,36 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 36, "id": "6f37e101", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.499587Z", - "iopub.status.busy": "2024-03-27T11:26:45.499179Z", - "iopub.status.idle": "2024-03-27T11:26:45.502364Z", - "shell.execute_reply": "2024-03-27T11:26:45.501887Z" + "iopub.execute_input": "2024-08-30T13:44:16.177243Z", + "iopub.status.busy": "2024-08-30T13:44:16.176916Z", + "iopub.status.idle": "2024-08-30T13:44:16.179856Z", + "shell.execute_reply": "2024-08-30T13:44:16.179447Z" } }, "outputs": [], "source": [ "for entry in new_hdu:\n", - " if entry[\"HDU_NAME\"] == \"EVENTS\" and entry[\"OBS_ID\"] == observation.obs_id:\n", + " if (entry[\"HDU_NAME\"] == \"EVENTS\") and (\n", + " entry[\"OBS_ID\"] == observation.obs_id\n", + " ):\n", " entry[\"FILE_DIR\"] = \"./\" + str(output_directory)\n", " entry[\"FILE_NAME\"] = filename" ] }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 37, "id": "d89a7739", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.504469Z", - "iopub.status.busy": "2024-03-27T11:26:45.504078Z", - "iopub.status.idle": "2024-03-27T11:26:45.508565Z", - "shell.execute_reply": "2024-03-27T11:26:45.507988Z" + "iopub.execute_input": "2024-08-30T13:44:16.181702Z", + "iopub.status.busy": "2024-08-30T13:44:16.181410Z", + "iopub.status.idle": "2024-08-30T13:44:16.185572Z", + "shell.execute_reply": "2024-08-30T13:44:16.185152Z" } }, "outputs": [ @@ -1475,7 +1607,7 @@ "data": { "text/html": [ "
HDUIndexTable length=10\n", - "
OBS_IDHDU_TYPEHDU_CLASSFILE_DIRFILE_NAMEHDU_NAME
int64bytes30bytes30bytes100bytes50bytes30
5029748eventsevents./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsEVENTS
\n", + "
\n", "\n", "\n", "\n", @@ -1507,7 +1639,7 @@ "5029747 edisp ... ENERGY DISPERSION" ] }, - "execution_count": 34, + "execution_count": 37, "metadata": {}, "output_type": "execute_result" } @@ -1529,19 +1661,19 @@ "id": "e08bf493", "metadata": {}, "source": [ - "Finally, we need to save the new HDU table in the origianl DL3 directory. Here one should be very careful to not name the new HDU file with the same name as the original HDU file of the data store. Otherwise, the original HDU file will be overwrited. " + "Finally, we need to save the new HDU table in the original DL3 directory. One must be very careful with naming the new HDU file, such that it does not have the same name as the original HDU file of the data store. Otherwise, the original HDU file will be overwritten." ] }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 38, "id": "b1633cd5", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.510689Z", - "iopub.status.busy": "2024-03-27T11:26:45.510412Z", - "iopub.status.idle": "2024-03-27T11:26:45.521520Z", - "shell.execute_reply": "2024-03-27T11:26:45.520994Z" + "iopub.execute_input": "2024-08-30T13:44:16.187343Z", + "iopub.status.busy": "2024-08-30T13:44:16.187186Z", + "iopub.status.idle": "2024-08-30T13:44:16.197275Z", + "shell.execute_reply": "2024-08-30T13:44:16.196738Z" } }, "outputs": [], @@ -1556,7 +1688,7 @@ "id": "e92cf68c", "metadata": {}, "source": [ - "**Note: Here we use only one approach that could be useful, showing the steps to save the new Event files in a random directory and generate a new modified HDU index table. However, the user is free to chose the absolute path of the EventList and DataStore. For instance, another approach could be making a full copy of the DataStore, or changing the location of the pulsar event files to one that could be more convinient for the user.**" + "**Note: Here we demonstrate only one approach that could be useful, showing the steps to save the new Event files in a directory and generate a new modified HDU index table. However, the user is free to choose the absolute path of the EventList and DataStore. Another approach, for instance, could be making a full copy of the DataStore, or changing the location of the pulsar event files to one that is more convenient for the user.**" ] }, { @@ -1572,38 +1704,38 @@ "id": "e1036448", "metadata": {}, "source": [ - "Once all of this is done, we just have to open the data store using `DataStore.from_dir()`and passing the pulsar HDU table to it :" + "Once all of this is done, we just have to open the data store using DataStore.from_dir() and pass the pulsar HDU table to it :" ] }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 39, "id": "88a0e9c1", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.523852Z", - "iopub.status.busy": "2024-03-27T11:26:45.523517Z", - "iopub.status.idle": "2024-03-27T11:26:45.537115Z", - "shell.execute_reply": "2024-03-27T11:26:45.536595Z" + "iopub.execute_input": "2024-08-30T13:44:16.199418Z", + "iopub.status.busy": "2024-08-30T13:44:16.199114Z", + "iopub.status.idle": "2024-08-30T13:44:16.210872Z", + "shell.execute_reply": "2024-08-30T13:44:16.210389Z" } }, "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": 37, + "execution_count": 40, "id": "f7c60c18", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.539197Z", - "iopub.status.busy": "2024-03-27T11:26:45.538882Z", - "iopub.status.idle": "2024-03-27T11:26:45.543864Z", - "shell.execute_reply": "2024-03-27T11:26:45.543346Z" + "iopub.execute_input": "2024-08-30T13:44:16.213029Z", + "iopub.status.busy": "2024-08-30T13:44:16.212605Z", + "iopub.status.idle": "2024-08-30T13:44:16.217590Z", + "shell.execute_reply": "2024-08-30T13:44:16.217079Z" } }, "outputs": [ @@ -1613,7 +1745,7 @@ "['events', 'gti', 'aeff', 'edisp', 'rad_max']" ] }, - "execution_count": 37, + "execution_count": 40, "metadata": {}, "output_type": "execute_result" } @@ -1627,14 +1759,14 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 41, "id": "4ae8ebd2", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.545837Z", - "iopub.status.busy": "2024-03-27T11:26:45.545678Z", - "iopub.status.idle": "2024-03-27T11:26:45.559836Z", - "shell.execute_reply": "2024-03-27T11:26:45.559308Z" + "iopub.execute_input": "2024-08-30T13:44:16.219467Z", + "iopub.status.busy": "2024-08-30T13:44:16.219161Z", + "iopub.status.idle": "2024-08-30T13:44:16.233657Z", + "shell.execute_reply": "2024-08-30T13:44:16.233153Z" } }, "outputs": [ @@ -1642,61 +1774,59 @@ "data": { "text/html": [ "
Table length=11189\n", - "
OBS_IDHDU_TYPEHDU_CLASSFILE_DIRFILE_NAMEHDU_NAME
int64bytes30bytes30bytes100bytes50bytes30
5029748eventsevents./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsEVENTS
\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "
EVENT_IDTIMERADECENERGY
sdegdegTeV
int64float64float32float32float32
2402333778852.509924984.5945722.030880.18194601
2408333778852.526715384.2146223.449140.08397394
2434333778852.6131505483.52470422.7257920.10596932
2445333778852.669014283.7695722.4510060.19733498
2478333778852.762793983.47851623.4845940.08522219
2481333778852.777854983.7151721.9851151.0020943
2513333778852.864446782.42119622.5676520.14374068
2544333778852.982606483.6413622.0413150.10316629
2559333778853.026941484.06917622.973370.047184493
...............
356222333780039.452039784.7448220.8949810.043312162
356223333780039.460049284.1161522.5575050.08110082
356227333780039.4710536683.4153421.673440.2096362
356242333780039.517909583.5516522.7729850.17672835
356282333780039.6299751484.4613321.693570.05068718
356473333780040.338647984.4544121.1598280.1831569
356478333780040.354892683.6833623.4449880.06305169
356485333780040.374132284.3351721.283380.060539745
356486333780040.375515984.8588622.1162220.123453744
356526333780040.5247600784.8692921.2909160.13630114
\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", "
EVENT_IDTIMERADECENERGYPHASE
sdegdegTeV
int64float64float32float32float32float64
2402333778852.509924984.5945722.030880.181946010.3934918682770723
2408333778852.526715384.2146223.449140.083973940.8919525879696997
2434333778852.6131505483.52470422.7257920.105969320.45797881185987477
2445333778852.669014283.7695722.4510060.197334980.11641851092409164
2478333778852.762793983.47851623.4845940.085222190.900480594501521
2481333778852.777854983.7151721.9851151.00209430.34760107795590983
2513333778852.864446782.42119622.5676520.143740680.9182740088921875
2544333778852.982606483.6413622.0413150.103166290.42611240294578184
2559333778853.026941484.06917622.973370.0471844930.7422974209419148
..................
356223333780039.460049284.1161522.5575050.081100820.6914919573678725
356227333780039.4710536683.4153421.673440.20963620.018183853280195963
356242333780039.517909583.5516522.7729850.176728350.4092061182772071
356282333780039.6299751484.4613321.693570.050687180.7361270045119108
356473333780040.338647984.4544121.1598280.18315690.7746788606122589
356478333780040.354892683.6833623.4449880.063051690.25693976618589837
356485333780040.374132284.3351721.283380.0605397450.8281108809408599
356486333780040.375515984.8588622.1162220.1234537440.8691880225176731
356526333780040.5247600784.8692921.2909160.136301140.29983892821377583
" ], "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", - " 356222 333780039.4520397 84.74482 20.894981 0.043312162\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" + "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.3934918682770723\n", + " 2408 333778852.5267153 84.21462 23.44914 0.08397394 0.8919525879696997\n", + " 2434 333778852.61315054 83.524704 22.725792 0.10596932 0.45797881185987477\n", + " 2445 333778852.6690142 83.76957 22.451006 0.19733498 0.11641851092409164\n", + " 2478 333778852.7627939 83.478516 23.484594 0.08522219 0.900480594501521\n", + " 2481 333778852.7778549 83.71517 21.985115 1.0020943 0.34760107795590983\n", + " 2513 333778852.8644467 82.421196 22.567652 0.14374068 0.9182740088921875\n", + " 2544 333778852.9826064 83.64136 22.041315 0.10316629 0.42611240294578184\n", + " 2559 333778853.0269414 84.069176 22.97337 0.047184493 0.7422974209419148\n", + " ... ... ... ... ... ...\n", + " 356223 333780039.4600492 84.11615 22.557505 0.08110082 0.6914919573678725\n", + " 356227 333780039.47105366 83.41534 21.67344 0.2096362 0.018183853280195963\n", + " 356242 333780039.5179095 83.55165 22.772985 0.17672835 0.4092061182772071\n", + " 356282 333780039.62997514 84.46133 21.69357 0.05068718 0.7361270045119108\n", + " 356473 333780040.3386479 84.45441 21.159828 0.1831569 0.7746788606122589\n", + " 356478 333780040.3548926 83.68336 23.444988 0.06305169 0.25693976618589837\n", + " 356485 333780040.3741322 84.33517 21.28338 0.060539745 0.8281108809408599\n", + " 356486 333780040.3755159 84.85886 22.116222 0.123453744 0.8691880225176731\n", + " 356526 333780040.52476007 84.86929 21.290916 0.13630114 0.29983892821377583" ] }, - "execution_count": 38, + "execution_count": 41, "metadata": {}, "output_type": "execute_result" } @@ -1726,7 +1856,7 @@ "id": "1fe89d60", "metadata": {}, "source": [ - "Once we have the corret DataStore and the modified EventList with the phase information, we can do the pulsar analysis using different tools for Gammapy to compute the phaseogram, maps, SED, lightcurve, etc... To do so, one can check the following [Gammapy tutorial](https://docs.gammapy.org/1.0/tutorials/analysis-time/pulsar_analysis.html#sphx-glr-tutorials-analysis-time-pulsar-analysis-py)." + "Once we have the correct DataStore and the modified EventList with the phase information, we can perform the pulsar analysis using different tools available in Gammapy. Allowing us to compute the phaseogram, maps, SED, lightcurve and more. To do so, please refer to the following [Gammapy tutorial](https://docs.gammapy.org/1.0/tutorials/analysis-time/pulsar_analysis.html#sphx-glr-tutorials-analysis-time-pulsar-analysis-py)." ] }, { @@ -1755,7 +1885,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.19" + "version": "3.11.9" }, "nbsphinx": { "orphan": true diff --git a/docs/_build/html/.doctrees/notebooks/mcmc-sampling-emcee/mcmc_sampling.doctree b/docs/_build/html/.doctrees/notebooks/mcmc-sampling-emcee/mcmc_sampling.doctree index 718cc01..e8977ed 100644 Binary files a/docs/_build/html/.doctrees/notebooks/mcmc-sampling-emcee/mcmc_sampling.doctree and b/docs/_build/html/.doctrees/notebooks/mcmc-sampling-emcee/mcmc_sampling.doctree differ diff --git a/docs/_build/html/.doctrees/notebooks/pulsar_phase/pulsar_phase_computation.doctree b/docs/_build/html/.doctrees/notebooks/pulsar_phase/pulsar_phase_computation.doctree index 409e8aa..bb6e1cc 100644 Binary files a/docs/_build/html/.doctrees/notebooks/pulsar_phase/pulsar_phase_computation.doctree and b/docs/_build/html/.doctrees/notebooks/pulsar_phase/pulsar_phase_computation.doctree differ diff --git a/docs/_build/html/_sources/notebooks/pulsar_phase/pulsar_phase_computation.ipynb.txt b/docs/_build/html/_sources/notebooks/pulsar_phase/pulsar_phase_computation.ipynb.txt index 1c6f2f9..c355b6c 100644 --- a/docs/_build/html/_sources/notebooks/pulsar_phase/pulsar_phase_computation.ipynb.txt +++ b/docs/_build/html/_sources/notebooks/pulsar_phase/pulsar_phase_computation.ipynb.txt @@ -33,9 +33,9 @@ "source": [ "This notebook has been done for the following version of Gammapy and PINT:\n", "\n", - "Gammapy version : 1.0.1\n", + "Gammapy version : 1.2\n", "\n", - "PINT version : 0.9.5" + "PINT version : 1.0" ] }, { @@ -48,7 +48,7 @@ "1. The time of arrivals (TOAs). These times should have very high precision due to the common fast periods of pulsars. Usually these times are already stored in the EventList. For the computation of pulsar timing, times must be corrected in order to be referenced in the Solar System barycenter (SSB) because this system can nearly be regarded as an inertial reference frame with respect to the pulsar.\n", "\n", "\n", - "2. The model of rotation of the pulsar, also known as ephemeris, at the epoch of the observations. These ephemerides are stored in an specific format and saved as .par files and contain informations on the periods, derivatives of the periods, coordinates, glitches, etc.\n", + "2. The model of rotation of the pulsar, also known as ephemeris, at the epoch of the observations. These ephemerides are stored in a specific format and saved as .par files which contain the periods, derivatives of the periods, coordinates, glitches, etc.\n", "\n", "__For the following steps of this tutorial, we need the original EventLists from the DL3 files, and a model in .par format.__\n", "\n", @@ -69,10 +69,10 @@ "id": "a9c72d26", "metadata": {}, "source": [ - "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", + "To run this notebook, you must have Gammapy and PINT (see documentation above) installed in the same environment. We recommend installing Gammapy first and then installing PINT using your preferred 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", @@ -95,10 +95,10 @@ "id": "b68d2444", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:25.357930Z", - "iopub.status.busy": "2024-03-27T11:26:25.357759Z", - "iopub.status.idle": "2024-03-27T11:26:25.831345Z", - "shell.execute_reply": "2024-03-27T11:26:25.830742Z" + "iopub.execute_input": "2024-08-30T13:43:53.336099Z", + "iopub.status.busy": "2024-08-30T13:43:53.335935Z", + "iopub.status.idle": "2024-08-30T13:43:53.836216Z", + "shell.execute_reply": "2024-08-30T13:43:53.835669Z" } }, "outputs": [ @@ -106,8 +106,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "Gammapy version : 1.0.2\n", - "PINT version : 0.9.8\n" + "Gammapy version : 1.2\n", + "PINT version : 1.0.1\n" ] } ], @@ -125,10 +125,10 @@ "id": "e61b5e3e", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:25.833998Z", - "iopub.status.busy": "2024-03-27T11:26:25.833639Z", - "iopub.status.idle": "2024-03-27T11:26:26.506462Z", - "shell.execute_reply": "2024-03-27T11:26:26.505816Z" + "iopub.execute_input": "2024-08-30T13:43:53.838441Z", + "iopub.status.busy": "2024-08-30T13:43:53.838106Z", + "iopub.status.idle": "2024-08-30T13:43:54.626040Z", + "shell.execute_reply": "2024-08-30T13:43:54.625476Z" } }, "outputs": [], @@ -138,7 +138,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__)" ] }, { @@ -146,7 +149,7 @@ "id": "81ae3a58", "metadata": {}, "source": [ - "And we also need some imports from PINT:" + "We also need some imports from PINT:" ] }, { @@ -155,10 +158,10 @@ "id": "22ac4aea", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.509540Z", - "iopub.status.busy": "2024-03-27T11:26:26.509079Z", - "iopub.status.idle": "2024-03-27T11:26:26.624488Z", - "shell.execute_reply": "2024-03-27T11:26:26.623985Z" + "iopub.execute_input": "2024-08-30T13:43:54.628537Z", + "iopub.status.busy": "2024-08-30T13:43:54.628244Z", + "iopub.status.idle": "2024-08-30T13:43:54.656522Z", + "shell.execute_reply": "2024-08-30T13:43:54.655994Z" } }, "outputs": [], @@ -180,7 +183,7 @@ "id": "b486ec45", "metadata": {}, "source": [ - "First we neeed to define the data sample. In this notebook we will use two runs from the MAGIC gammapy data sample available in https://github.com/gammapy/gammapy-data" + "First we need to define the data sample. In this notebook we will use two runs from the MAGIC gammapy data sample available in https://github.com/gammapy/gammapy-data" ] }, { @@ -189,16 +192,16 @@ "id": "d0e182bb", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.627105Z", - "iopub.status.busy": "2024-03-27T11:26:26.626738Z", - "iopub.status.idle": "2024-03-27T11:26:26.629431Z", - "shell.execute_reply": "2024-03-27T11:26:26.628877Z" + "iopub.execute_input": "2024-08-30T13:43:54.658921Z", + "iopub.status.busy": "2024-08-30T13:43:54.658599Z", + "iopub.status.idle": "2024-08-30T13:43:54.660775Z", + "shell.execute_reply": "2024-08-30T13:43:54.660345Z" } }, "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\"" ] }, { @@ -207,16 +210,16 @@ "id": "b5019a42", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.631734Z", - "iopub.status.busy": "2024-03-27T11:26:26.631306Z", - "iopub.status.idle": "2024-03-27T11:26:26.646554Z", - "shell.execute_reply": "2024-03-27T11:26:26.646010Z" + "iopub.execute_input": "2024-08-30T13:43:54.662674Z", + "iopub.status.busy": "2024-08-30T13:43:54.662366Z", + "iopub.status.idle": "2024-08-30T13:43:54.676462Z", + "shell.execute_reply": "2024-08-30T13:43:54.675957Z" } }, "outputs": [], "source": [ "# Read DataStore from a directory\n", - "data_store = DataStore.from_dir(DL3_direc)" + "data_store = DataStore.from_dir(DL3_dir)" ] }, { @@ -233,17 +236,15 @@ "id": "9ba16fcc", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.648835Z", - "iopub.status.busy": "2024-03-27T11:26:26.648528Z", - "iopub.status.idle": "2024-03-27T11:26:26.651855Z", - "shell.execute_reply": "2024-03-27T11:26:26.651323Z" + "iopub.execute_input": "2024-08-30T13:43:54.678608Z", + "iopub.status.busy": "2024-08-30T13:43:54.678236Z", + "iopub.status.idle": "2024-08-30T13:43:54.681323Z", + "shell.execute_reply": "2024-08-30T13:43:54.680828Z" } }, "outputs": [], "source": [ - "target_pos = SkyCoord(\n", - " ra=083.6331144560900, dec=+22.0144871383400, unit=\"deg\", frame=\"icrs\"\n", - ")" + "target_pos = SkyCoord(ra=083.633, dec=+22.014, unit=\"deg\", frame=\"icrs\")" ] }, { @@ -252,10 +253,10 @@ "id": "06bda835", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.654049Z", - "iopub.status.busy": "2024-03-27T11:26:26.653646Z", - "iopub.status.idle": "2024-03-27T11:26:26.660513Z", - "shell.execute_reply": "2024-03-27T11:26:26.659953Z" + "iopub.execute_input": "2024-08-30T13:43:54.683221Z", + "iopub.status.busy": "2024-08-30T13:43:54.682910Z", + "iopub.status.idle": "2024-08-30T13:43:54.687923Z", + "shell.execute_reply": "2024-08-30T13:43:54.687497Z" } }, "outputs": [], @@ -276,10 +277,10 @@ "id": "f96ccf30", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.662615Z", - "iopub.status.busy": "2024-03-27T11:26:26.662199Z", - "iopub.status.idle": "2024-03-27T11:26:26.665420Z", - "shell.execute_reply": "2024-03-27T11:26:26.664873Z" + "iopub.execute_input": "2024-08-30T13:43:54.689878Z", + "iopub.status.busy": "2024-08-30T13:43:54.689440Z", + "iopub.status.idle": "2024-08-30T13:43:54.692452Z", + "shell.execute_reply": "2024-08-30T13:43:54.691937Z" } }, "outputs": [ @@ -313,10 +314,10 @@ "id": "fa6e36d5", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.667386Z", - "iopub.status.busy": "2024-03-27T11:26:26.667228Z", - "iopub.status.idle": "2024-03-27T11:26:26.670890Z", - "shell.execute_reply": "2024-03-27T11:26:26.670425Z" + "iopub.execute_input": "2024-08-30T13:43:54.694439Z", + "iopub.status.busy": "2024-08-30T13:43:54.694155Z", + "iopub.status.idle": "2024-08-30T13:43:54.699214Z", + "shell.execute_reply": "2024-08-30T13:43:54.698826Z" } }, "outputs": [], @@ -332,10 +333,10 @@ "id": "dec2c1a5", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.673075Z", - "iopub.status.busy": "2024-03-27T11:26:26.672669Z", - "iopub.status.idle": "2024-03-27T11:26:26.780999Z", - "shell.execute_reply": "2024-03-27T11:26:26.780438Z" + "iopub.execute_input": "2024-08-30T13:43:54.701143Z", + "iopub.status.busy": "2024-08-30T13:43:54.700820Z", + "iopub.status.idle": "2024-08-30T13:43:54.755258Z", + "shell.execute_reply": "2024-08-30T13:43:54.754750Z" } }, "outputs": [ @@ -384,10 +385,10 @@ "id": "2756e72d", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.783640Z", - "iopub.status.busy": "2024-03-27T11:26:26.783173Z", - "iopub.status.idle": "2024-03-27T11:26:26.799711Z", - "shell.execute_reply": "2024-03-27T11:26:26.799261Z" + "iopub.execute_input": "2024-08-30T13:43:54.757339Z", + "iopub.status.busy": "2024-08-30T13:43:54.757008Z", + "iopub.status.idle": "2024-08-30T13:43:54.770138Z", + "shell.execute_reply": "2024-08-30T13:43:54.769738Z" } }, "outputs": [], @@ -403,10 +404,10 @@ "id": "1ac8103a", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.801834Z", - "iopub.status.busy": "2024-03-27T11:26:26.801523Z", - "iopub.status.idle": "2024-03-27T11:26:26.804890Z", - "shell.execute_reply": "2024-03-27T11:26:26.804365Z" + "iopub.execute_input": "2024-08-30T13:43:54.772090Z", + "iopub.status.busy": "2024-08-30T13:43:54.771779Z", + "iopub.status.idle": "2024-08-30T13:43:54.774716Z", + "shell.execute_reply": "2024-08-30T13:43:54.774242Z" } }, "outputs": [ @@ -428,7 +429,7 @@ "id": "e93bfbeb", "metadata": {}, "source": [ - "Now we have the TOAs of the events in the system of the telescope. Please note that the actual precision of the times is higher than the diplayed output (and we really need this precision for the pulsar analysis!). In the next step, the timing in the SSB and the phase for each TOA has to be created. " + "Now we have the TOAs for the events in the system of the telescope. Please note: the actual precision of the times is higher than the displayed output (and we really need this precision for the pulsar analysis!). In the next step, the timing in the SSB and the phase for each TOA has to be created." ] }, { @@ -444,11 +445,11 @@ "id": "fb536b7e", "metadata": {}, "source": [ - "In order to compute the phases of a pulsar, one needs an ephemeris file, usually store as a .par file. \n", + "In order to compute the phases of a pulsar, one needs an ephemeris file, typically stored as a .par file.\n", "\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, it is important to note that many of the ephemeris files are not up-to-date. Therefore, they could give bad results on the phase computation. In particular, you should always check that the MJD of the observations one wants to phase lies between the `START` and `FINISH` entries of the ephemeris file (see next section)." ] }, { @@ -457,16 +458,16 @@ "id": "d4f89ba4", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.807135Z", - "iopub.status.busy": "2024-03-27T11:26:26.806833Z", - "iopub.status.idle": "2024-03-27T11:26:26.809301Z", - "shell.execute_reply": "2024-03-27T11:26:26.808783Z" + "iopub.execute_input": "2024-08-30T13:43:54.776686Z", + "iopub.status.busy": "2024-08-30T13:43:54.776389Z", + "iopub.status.idle": "2024-08-30T13:43:54.778777Z", + "shell.execute_reply": "2024-08-30T13:43:54.778358Z" } }, "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\"" ] }, { @@ -474,7 +475,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 files 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 features from Tempo2. \n", + "\n", + "In our case, an error occurs when using the ephemeris file with PINT. This is due to the `JUMP` line. To proceed, simply comment out the line (with #) or remove it. Note that this line is not important for the gamma-ray instruments, so it is acceptable to disregard it." ] }, { @@ -507,22 +510,21 @@ "id": "d24e1c92", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.811565Z", - "iopub.status.busy": "2024-03-27T11:26:26.811265Z", - "iopub.status.idle": "2024-03-27T11:26:26.907510Z", - "shell.execute_reply": "2024-03-27T11:26:26.906967Z" - }, - "scrolled": false + "iopub.execute_input": "2024-08-30T13:43:54.780756Z", + "iopub.status.busy": "2024-08-30T13:43:54.780435Z", + "iopub.status.idle": "2024-08-30T13:43:54.876016Z", + "shell.execute_reply": "2024-08-30T13:43:54.875575Z" + } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "\u001b[32m2024-03-27 11:26:26.901\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", - "/usr/share/miniconda3/envs/gammapy-recipes/lib/python3.9/site-packages/pint/models/model_builder.py:198: UserWarning: Unrecognized parfile line 'EPHVER 5'\n", + "\u001b[32m2024-08-30 13:43:54.870\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.models.absolute_phase\u001b[0m:\u001b[36mvalidate\u001b[0m:\u001b[36m77\u001b[0m - \u001b[1mTZRFRQ was 0.0 or None. Setting to infinite frequency.\u001b[0m\n", + "/home/runner/miniconda3/envs/gammapy-recipes/lib/python3.11/site-packages/pint/models/model_builder.py:230: UserWarning: Unrecognized parfile line 'EPHVER 5'\n", " warnings.warn(f\"Unrecognized parfile line '{p_line}'\", UserWarning)\n", - "\u001b[32m2024-03-27 11:26:26.903\u001b[0m | \u001b[33m\u001b[1mWARNING \u001b[0m | \u001b[36mpint.models.model_builder\u001b[0m:\u001b[36m__call__\u001b[0m:\u001b[36m202\u001b[0m - \u001b[33m\u001b[1mUNITS is not specified. Assuming TDB...\u001b[0m\n" + "\u001b[32m2024-08-30 13:43:54.872\u001b[0m | \u001b[33m\u001b[1mWARNING \u001b[0m | \u001b[36mpint.models.model_builder\u001b[0m:\u001b[36m__call__\u001b[0m:\u001b[36m234\u001b[0m - \u001b[33m\u001b[1mUNITS is not specified. Assuming TDB...\u001b[0m\n" ] }, { @@ -569,7 +571,111 @@ "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. Check the [PINT documentation](https://nanograv-pint.readthedocs.io) for a list of additional parameters. To obtain the complete set of parameters from the ephemeris file, one can simply print the model:\n", + "`print(model)`" + ] + }, + { + "cell_type": "markdown", + "id": "f02f0ca5-09f2-44d4-ad76-518f8964b6a1", + "metadata": {}, + "source": [ + "As mentioned previously, we should ensure 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": 15, + "id": "2584b571-93a9-4fb6-b8e2-60b8810190f6", + "metadata": { + "execution": { + "iopub.execute_input": "2024-08-30T13:43:54.878085Z", + "iopub.status.busy": "2024-08-30T13:43:54.877785Z", + "iopub.status.idle": "2024-08-30T13:43:54.881053Z", + "shell.execute_reply": "2024-08-30T13:43:54.880542Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Ephemeris time definition:\n", + "54686.1526259 - 56583.1591704\n", + "Observation time definition:\n", + "56569.18112772242 - 56569.19487901596\n" + ] + } + ], + "source": [ + "print(\n", + " f\"Ephemeris time definition:\\n{model.START.value} - {model.FINISH.value}\"\n", + ")\n", + "print(\n", + " f\"Observation time definition:\\n{observation.tstart} - {observation.tstop}\"\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "86041174-5ec4-43ba-9035-cf567b47a3bb", + "metadata": {}, + "source": [ + "If you have several observations that 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 create a small function like the following one:" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "8838ee6c-5b53-4d34-8fd7-94d32daa6bb3", + "metadata": { + "execution": { + "iopub.execute_input": "2024-08-30T13:43:54.882764Z", + "iopub.status.busy": "2024-08-30T13:43:54.882615Z", + "iopub.status.idle": "2024-08-30T13:43:54.886095Z", + "shell.execute_reply": "2024-08-30T13:43:54.885667Z" + } + }, + "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(\n", + " [model.START.value, model.FINISH.value], scale=\"tt\", format=\"mjd\"\n", + " )\n", + " if (model_time[0].value > observation.tstart.tt.mjd) or (\n", + " model_time[1].value < observation.tstop.tt.mjd\n", + " ):\n", + " log.warning(\n", + " f\"Warning: Observation time of observation {observation.obs_id} goes out of timing model validity time.\"\n", + " )" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "0d37e6cc-2cae-4192-87d9-88d52216e83f", + "metadata": { + "execution": { + "iopub.execute_input": "2024-08-30T13:43:54.887762Z", + "iopub.status.busy": "2024-08-30T13:43:54.887614Z", + "iopub.status.idle": "2024-08-30T13:43:54.890615Z", + "shell.execute_reply": "2024-08-30T13:43:54.890203Z" + } + }, + "outputs": [], + "source": [ + "check_time(observation, model)" ] }, { @@ -582,47 +688,53 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 18, "id": "a145cdde", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.909929Z", - "iopub.status.busy": "2024-03-27T11:26:26.909738Z", - "iopub.status.idle": "2024-03-27T11:26:44.597210Z", - "shell.execute_reply": "2024-03-27T11:26:44.596640Z" - }, - "scrolled": false + "iopub.execute_input": "2024-08-30T13:43:54.892323Z", + "iopub.status.busy": "2024-08-30T13:43:54.892174Z", + "iopub.status.idle": "2024-08-30T13:44:15.697802Z", + "shell.execute_reply": "2024-08-30T13:44:15.697299Z" + } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "\u001b[32m2024-03-27 11:26:27.247\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m1358\u001b[0m - \u001b[34m\u001b[1mNo pulse number flags found in the TOAs\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:27.263\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mapply_clock_corrections\u001b[0m:\u001b[36m2200\u001b[0m - \u001b[34m\u001b[1mApplying clock corrections (include_gps = False, include_bipm = False)\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:27.923\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-03-27 11:26:31.192\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2251\u001b[0m - \u001b[34m\u001b[1mComputing TDB columns.\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:31.193\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2272\u001b[0m - \u001b[34m\u001b[1mUsing EPHEM = DE421 for TDB calculation.\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:32.378\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2350\u001b[0m - \u001b[34m\u001b[1mComputing PosVels of observatories and Earth, using DE421\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:33.420\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-03-27 11:26:44.359\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2403\u001b[0m - \u001b[34m\u001b[1mSSB obs pos [1.47007462e+11 2.56889811e+10 1.11245045e+10] m\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.587\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-03-27 11:26:44.593\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2417\u001b[0m - \u001b[34m\u001b[1mAdding columns ssb_obs_pos ssb_obs_vel obs_sun_pos\u001b[0m\n" + "\u001b[32m2024-08-30 13:43:55.618\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m1377\u001b[0m - \u001b[34m\u001b[1mNo pulse number flags found in the TOAs\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:55.633\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mapply_clock_corrections\u001b[0m:\u001b[36m2224\u001b[0m - \u001b[34m\u001b[1mApplying clock corrections (include_bipm = False)\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.294\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.observatory\u001b[0m:\u001b[36mgps_correction\u001b[0m:\u001b[36m248\u001b[0m - \u001b[1mApplying GPS to UTC clock correction (~few nanoseconds)\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.294\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.observatory\u001b[0m:\u001b[36m_load_gps_clock\u001b[0m:\u001b[36m122\u001b[0m - \u001b[34m\u001b[1mLoading global GPS clock file\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.297\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.observatory.global_clock_corrections\u001b[0m:\u001b[36mget_file\u001b[0m:\u001b[36m128\u001b[0m - \u001b[1mFile index.txt to be downloaded due to download policy if_expired: https://raw.githubusercontent.com/ipta/pulsar-clock-corrections/main/index.txt\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.451\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.observatory.clock_file\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m812\u001b[0m - \u001b[34m\u001b[1mGlobal clock file gps2utc.clk saving kwargs={'bogus_last_correction': False, 'valid_beyond_ends': False}\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.452\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.observatory.global_clock_corrections\u001b[0m:\u001b[36mget_file\u001b[0m:\u001b[36m128\u001b[0m - \u001b[1mFile T2runtime/clock/gps2utc.clk to be downloaded due to download policy if_missing: https://raw.githubusercontent.com/ipta/pulsar-clock-corrections/main/T2runtime/clock/gps2utc.clk\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.668\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.observatory.clock_file\u001b[0m:\u001b[36mread_tempo2_clock_file\u001b[0m:\u001b[36m463\u001b[0m - \u001b[34m\u001b[1mLoading TEMPO2-format observatory clock correction file gps2utc.clk (/home/runner/.astropy/cache/download/url/d3c81b5766f4bfb84e65504c8a453085/contents) with bogus_last_correction=False\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.687\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.observatory\u001b[0m:\u001b[36mfind_clock_file\u001b[0m:\u001b[36m994\u001b[0m - \u001b[1mUsing global clock file for gps2utc.clk with bogus_last_correction=False\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.689\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.observatory.topo_obs\u001b[0m:\u001b[36mclock_corrections\u001b[0m:\u001b[36m354\u001b[0m - \u001b[1mObservatory magic requires no clock corrections.\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:59.900\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2270\u001b[0m - \u001b[34m\u001b[1mComputing TDB columns.\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:59.901\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2291\u001b[0m - \u001b[34m\u001b[1mUsing EPHEM = DE421 for TDB calculation.\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:00.968\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2371\u001b[0m - \u001b[34m\u001b[1mComputing PosVels of observatories and Earth, using DE421\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:02.516\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-08-30 13:44:15.633\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2424\u001b[0m - \u001b[34m\u001b[1mSSB obs pos [1.47007462e+11 2.56889811e+10 1.11245045e+10] m\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.688\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-08-30 13:44:15.694\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2438\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 7.02 s, sys: 188 ms, total: 7.21 s\n", - "Wall time: 17.7 s\n" + "CPU times: user 7.15 s, sys: 199 ms, total: 7.35 s\n", + "Wall time: 20.8 s\n" ] } ], "source": [ "%%time\n", "\n", - "# Put these to True is your observatory has clock correction files.\n", + "# Set these to True is your observatory has clock correction files.\n", "# If it is set to True but your observatory does not have clock correction files, it will be ignored.\n", "include_bipm = False\n", "include_gps = False\n", @@ -648,19 +760,19 @@ "id": "db97ea5b", "metadata": {}, "source": [ - "Once we have the TOAs object and the model, the phases are easily computed using the model.phase() method. Note that the phases are computed in the interval [-0.5,0.5]. Most of the times, we use the phases in the interval [0,1] so we have to shift the negative ones." + "Once we have the TOAs object and the model, the phases are easily computed using the model.phase() method. Note that the phases are computed in the interval [-0.5,0.5]. Most of the time, we use the phases in the interval [0,1] so we have to shift the negative ones." ] }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 19, "id": "6fbf3ad9", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:44.599538Z", - "iopub.status.busy": "2024-03-27T11:26:44.599353Z", - "iopub.status.idle": "2024-03-27T11:26:45.194277Z", - "shell.execute_reply": "2024-03-27T11:26:45.193696Z" + "iopub.execute_input": "2024-08-30T13:44:15.699970Z", + "iopub.status.busy": "2024-08-30T13:44:15.699584Z", + "iopub.status.idle": "2024-08-30T13:44:15.924450Z", + "shell.execute_reply": "2024-08-30T13:44:15.924037Z" } }, "outputs": [ @@ -668,19 +780,19 @@ "name": "stderr", "output_type": "stream", "text": [ - "\u001b[32m2024-03-27 11:26:44.636\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-03-27 11:26:44.640\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-03-27 11:26:44.646\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m1358\u001b[0m - \u001b[34m\u001b[1mNo pulse number flags found in the TOAs\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.646\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mapply_clock_corrections\u001b[0m:\u001b[36m2200\u001b[0m - \u001b[34m\u001b[1mApplying clock corrections (include_gps = False, include_bipm = False)\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.648\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2251\u001b[0m - \u001b[34m\u001b[1mComputing TDB columns.\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.648\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2272\u001b[0m - \u001b[34m\u001b[1mUsing EPHEM = DE421 for TDB calculation.\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.651\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2350\u001b[0m - \u001b[34m\u001b[1mComputing PosVels of observatories and Earth, using DE421\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.929\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-03-27 11:26:44.931\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2403\u001b[0m - \u001b[34m\u001b[1mSSB obs pos [-1.49278181e+08 7.07659442e+06 3.07113250e+06] km\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:45.150\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-03-27 11:26:45.176\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2417\u001b[0m - \u001b[34m\u001b[1mAdding columns ssb_obs_pos ssb_obs_vel obs_sun_pos\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:45.177\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-03-27 11:26:45.188\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-08-30 13:44:15.729\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.models.glitch\u001b[0m:\u001b[36mglitch_phase\u001b[0m:\u001b[36m221\u001b[0m - \u001b[34m\u001b[1mGlitch phase for glitch 1: 0.0 \u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.735\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.models.absolute_phase\u001b[0m:\u001b[36mget_TZR_toa\u001b[0m:\u001b[36m100\u001b[0m - \u001b[34m\u001b[1mCreating and dealing with the single TZR_toa for absolute phase\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.738\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m1377\u001b[0m - \u001b[34m\u001b[1mNo pulse number flags found in the TOAs\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.738\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mapply_clock_corrections\u001b[0m:\u001b[36m2224\u001b[0m - \u001b[34m\u001b[1mApplying clock corrections (include_bipm = False)\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.760\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2270\u001b[0m - \u001b[34m\u001b[1mComputing TDB columns.\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.761\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2291\u001b[0m - \u001b[34m\u001b[1mUsing EPHEM = DE421 for TDB calculation.\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.764\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2371\u001b[0m - \u001b[34m\u001b[1mComputing PosVels of observatories and Earth, using DE421\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.834\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-08-30 13:44:15.836\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2424\u001b[0m - \u001b[34m\u001b[1mSSB obs pos [-1.49278181e+08 7.07659442e+06 3.07113250e+06] km\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.907\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-08-30 13:44:15.908\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2438\u001b[0m - \u001b[34m\u001b[1mAdding columns ssb_obs_pos ssb_obs_vel obs_sun_pos\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.909\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-08-30 13:44:15.916\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.models.glitch\u001b[0m:\u001b[36mglitch_phase\u001b[0m:\u001b[36m221\u001b[0m - \u001b[34m\u001b[1mGlitch phase for glitch 1: 0.0 \u001b[0m\n" ] } ], @@ -710,14 +822,14 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 20, "id": "735ac718", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.196779Z", - "iopub.status.busy": "2024-03-27T11:26:45.196431Z", - "iopub.status.idle": "2024-03-27T11:26:45.206792Z", - "shell.execute_reply": "2024-03-27T11:26:45.206263Z" + "iopub.execute_input": "2024-08-30T13:44:15.926698Z", + "iopub.status.busy": "2024-08-30T13:44:15.926261Z", + "iopub.status.idle": "2024-08-30T13:44:15.935066Z", + "shell.execute_reply": "2024-08-30T13:44:15.934677Z" } }, "outputs": [], @@ -728,65 +840,93 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 21, "id": "f3269a2c", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.209126Z", - "iopub.status.busy": "2024-03-27T11:26:45.208686Z", - "iopub.status.idle": "2024-03-27T11:26:45.212621Z", - "shell.execute_reply": "2024-03-27T11:26:45.212125Z" - }, - "scrolled": false + "iopub.execute_input": "2024-08-30T13:44:15.936748Z", + "iopub.status.busy": "2024-08-30T13:44:15.936604Z", + "iopub.status.idle": "2024-08-30T13:44:15.942656Z", + "shell.execute_reply": "2024-08-30T13:44:15.942183Z" + } }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "EVENT_ID TIME RA DEC ENERGY \n", - " s deg deg TeV \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", - " 2561 333778853.0339344 84.84237 22.175398 0.118843034\n", - " ... ... ... ... ...\n", - " 356222 333780039.4520397 84.74482 20.894981 0.043312162\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", - "Length = 11189 rows\n" - ] + "data": { + "text/html": [ + "
Table length=11189\n", + "
\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
EVENT_IDTIMERADECENERGY
sdegdegTeV
int64float64float32float32float32
2402333778852.509924984.5945722.030880.18194601
2408333778852.526715384.2146223.449140.08397394
2434333778852.6131505483.52470422.7257920.10596932
2445333778852.669014283.7695722.4510060.19733498
2478333778852.762793983.47851623.4845940.08522219
2481333778852.777854983.7151721.9851151.0020943
2513333778852.864446782.42119622.5676520.14374068
2544333778852.982606483.6413622.0413150.10316629
2559333778853.026941484.06917622.973370.047184493
...............
356223333780039.460049284.1161522.5575050.08110082
356227333780039.4710536683.4153421.673440.2096362
356242333780039.517909583.5516522.7729850.17672835
356282333780039.6299751484.4613321.693570.05068718
356473333780040.338647984.4544121.1598280.1831569
356478333780040.354892683.6833623.4449880.06305169
356485333780040.374132284.3351721.283380.060539745
356486333780040.375515984.8588622.1162220.123453744
356526333780040.5247600784.8692921.2909160.13630114
" + ], + "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": 21, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ "# Show original table\n", - "print(table)" + "table" ] }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 22, "id": "6fc6024c", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.214559Z", - "iopub.status.busy": "2024-03-27T11:26:45.214389Z", - "iopub.status.idle": "2024-03-27T11:26:45.216994Z", - "shell.execute_reply": "2024-03-27T11:26:45.216564Z" + "iopub.execute_input": "2024-08-30T13:44:15.944440Z", + "iopub.status.busy": "2024-08-30T13:44:15.944274Z", + "iopub.status.idle": "2024-08-30T13:44:15.946972Z", + "shell.execute_reply": "2024-08-30T13:44:15.946502Z" } }, "outputs": [], @@ -805,46 +945,44 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 23, "id": "7f29187e", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.219230Z", - "iopub.status.busy": "2024-03-27T11:26:45.218856Z", - "iopub.status.idle": "2024-03-27T11:26:45.225134Z", - "shell.execute_reply": "2024-03-27T11:26:45.224604Z" - }, - "scrolled": false + "iopub.execute_input": "2024-08-30T13:44:15.948805Z", + "iopub.status.busy": "2024-08-30T13:44:15.948513Z", + "iopub.status.idle": "2024-08-30T13:44:15.952984Z", + "shell.execute_reply": "2024-08-30T13:44:15.952497Z" + } }, "outputs": [ { "data": { "text/html": [ "
Table length=11189\n", - "
\n", + "
\n", "\n", "\n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", "
EVENT_IDTIMERADECENERGYPHASE
sdegdegTeV
int64float64float32float32float32float64
2402333778852.509924984.5945722.030880.181946010.39349195931383935
2408333778852.526715384.2146223.449140.083973940.8919526790064667
2434333778852.6131505483.52470422.7257920.105969320.4579789031294724
2445333778852.669014283.7695722.4510060.197334980.11641860219368935
2478333778852.762793983.47851623.4845940.085222190.9004806857711186
2481333778852.777854983.7151721.9851151.00209430.3476011689926769
2513333778852.864446782.42119622.5676520.143740680.9182740999289545
2544333778852.982606483.6413622.0413150.103166290.42611249421537956
2559333778853.026941484.06917622.973370.0471844930.7422975122115125
2402333778852.509924984.5945722.030880.181946010.3934918682770723
2408333778852.526715384.2146223.449140.083973940.8919525879696997
2434333778852.6131505483.52470422.7257920.105969320.45797881185987477
2445333778852.669014283.7695722.4510060.197334980.11641851092409164
2478333778852.762793983.47851623.4845940.085222190.900480594501521
2481333778852.777854983.7151721.9851151.00209430.34760107795590983
2513333778852.864446782.42119622.5676520.143740680.9182740088921875
2544333778852.982606483.6413622.0413150.103166290.42611240294578184
2559333778853.026941484.06917622.973370.0471844930.7422974209419148
..................
356222333780039.452039784.7448220.8949810.0433121620.4537121484157113
356223333780039.460049284.1161522.5575050.081100820.6914920486374702
356227333780039.4710536683.4153421.673440.20963620.018183944316962984
356242333780039.517909583.5516522.7729850.176728350.40920620046641115
356282333780039.6299751484.4613321.693570.050687180.7361270955486778
356473333780040.338647984.4544121.1598280.18315690.7746789518818565
356478333780040.354892683.6833623.4449880.063051690.2569398572226654
356485333780040.374132284.3351721.283380.0605397450.8281109722104576
356486333780040.375515984.8588622.1162220.1234537440.8691881135544401
356526333780040.5247600784.8692921.2909160.136301140.29983901925054285
356223333780039.460049284.1161522.5575050.081100820.6914919573678725
356227333780039.4710536683.4153421.673440.20963620.018183853280195963
356242333780039.517909583.5516522.7729850.176728350.4092061182772071
356282333780039.6299751484.4613321.693570.050687180.7361270045119108
356473333780040.338647984.4544121.1598280.18315690.7746788606122589
356478333780040.354892683.6833623.4449880.063051690.25693976618589837
356485333780040.374132284.3351721.283380.0605397450.8281108809408599
356486333780040.375515984.8588622.1162220.1234537440.8691880225176731
356526333780040.5247600784.8692921.2909160.136301140.29983892821377583
" ], "text/plain": [ @@ -853,29 +991,28 @@ " 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", + " 2402 333778852.5099249 84.59457 22.03088 0.18194601 0.3934918682770723\n", + " 2408 333778852.5267153 84.21462 23.44914 0.08397394 0.8919525879696997\n", + " 2434 333778852.61315054 83.524704 22.725792 0.10596932 0.45797881185987477\n", + " 2445 333778852.6690142 83.76957 22.451006 0.19733498 0.11641851092409164\n", + " 2478 333778852.7627939 83.478516 23.484594 0.08522219 0.900480594501521\n", + " 2481 333778852.7778549 83.71517 21.985115 1.0020943 0.34760107795590983\n", + " 2513 333778852.8644467 82.421196 22.567652 0.14374068 0.9182740088921875\n", + " 2544 333778852.9826064 83.64136 22.041315 0.10316629 0.42611240294578184\n", + " 2559 333778853.0269414 84.069176 22.97337 0.047184493 0.7422974209419148\n", " ... ... ... ... ... ...\n", - " 356222 333780039.4520397 84.74482 20.894981 0.043312162 0.4537121484157113\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" + " 356223 333780039.4600492 84.11615 22.557505 0.08110082 0.6914919573678725\n", + " 356227 333780039.47105366 83.41534 21.67344 0.2096362 0.018183853280195963\n", + " 356242 333780039.5179095 83.55165 22.772985 0.17672835 0.4092061182772071\n", + " 356282 333780039.62997514 84.46133 21.69357 0.05068718 0.7361270045119108\n", + " 356473 333780040.3386479 84.45441 21.159828 0.1831569 0.7746788606122589\n", + " 356478 333780040.3548926 83.68336 23.444988 0.06305169 0.25693976618589837\n", + " 356485 333780040.3741322 84.33517 21.28338 0.060539745 0.8281108809408599\n", + " 356486 333780040.3755159 84.85886 22.116222 0.123453744 0.8691880225176731\n", + " 356526 333780040.52476007 84.86929 21.290916 0.13630114 0.29983892821377583" ] }, - "execution_count": 20, + "execution_count": 23, "metadata": {}, "output_type": "execute_result" } @@ -898,23 +1035,22 @@ "id": "ea9ba223", "metadata": {}, "source": [ - "At this point, we also want to add meta data to the table. It is very useful to keep track of what has been done to the file. For instance, if we have multiple pulsars in the same file, we want to be able to know quickly which column correspond to which pulsar. Moreover, experience shows that one often use different ephemeris file for the same pulsar. Therefore, it is very useful to have several phase columns in the same file and to be able to know which column correspond to which ephemeris file, parameters, etc.\n", + "At this point, we also want to add metadata to the table. It is very useful to keep track of what has been done to the file. For instance, if a file contains multiple pulsars, we want identify quickly which column corresponds to each pulsar. Moreover, experience has shown that it is common to have different ephemeris files for the same pulsar. Therefore, it is useful to have several phase columns in the same file to easily identify which column corresponds to each ephemeris file, parameters, etc.\n", "\n", - "Since there is not yet a \"standard\" format for such metadata, we propose a template for the essential informations that one wants to save in the header of the event file. First, we look at the present meta info on the table." + "Since there is currently no \"standard\" format for such metadata, we propose a template for the essential information that one wants to save in the header of the event file. First, we look at the present meta info on the table." ] }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 24, "id": "af220557", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.227594Z", - "iopub.status.busy": "2024-03-27T11:26:45.227257Z", - "iopub.status.idle": "2024-03-27T11:26:45.231629Z", - "shell.execute_reply": "2024-03-27T11:26:45.231108Z" - }, - "scrolled": false + "iopub.execute_input": "2024-08-30T13:44:15.955025Z", + "iopub.status.busy": "2024-08-30T13:44:15.954655Z", + "iopub.status.idle": "2024-08-30T13:44:15.958777Z", + "shell.execute_reply": "2024-08-30T13:44:15.958278Z" + } }, "outputs": [ { @@ -957,7 +1093,7 @@ " ('AZ_PNT', 103.8848)])" ] }, - "execution_count": 21, + "execution_count": 24, "metadata": {}, "output_type": "execute_result" } @@ -968,14 +1104,14 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 25, "id": "c2285fcd", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.233745Z", - "iopub.status.busy": "2024-03-27T11:26:45.233423Z", - "iopub.status.idle": "2024-03-27T11:26:45.237873Z", - "shell.execute_reply": "2024-03-27T11:26:45.237324Z" + "iopub.execute_input": "2024-08-30T13:44:15.960712Z", + "iopub.status.busy": "2024-08-30T13:44:15.960430Z", + "iopub.status.idle": "2024-08-30T13:44:15.964154Z", + "shell.execute_reply": "2024-08-30T13:44:15.963725Z" } }, "outputs": [], @@ -1018,14 +1154,14 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 26, "id": "8c866a5c", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.240180Z", - "iopub.status.busy": "2024-03-27T11:26:45.239749Z", - "iopub.status.idle": "2024-03-27T11:26:45.243507Z", - "shell.execute_reply": "2024-03-27T11:26:45.242970Z" + "iopub.execute_input": "2024-08-30T13:44:15.966078Z", + "iopub.status.busy": "2024-08-30T13:44:15.965699Z", + "iopub.status.idle": "2024-08-30T13:44:15.968960Z", + "shell.execute_reply": "2024-08-30T13:44:15.968447Z" } }, "outputs": [ @@ -1033,7 +1169,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "COLUMN_PHASE: PHASE; PINT_VERS: 0.9.8; GAMMAPY_VERS: 1.0.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: 60396.4769125122;\n" + "COLUMN_PHASE: PHASE; PINT_VERS: 1.0.1; 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: 60552.572407022526;\n" ] } ], @@ -1044,14 +1180,14 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 27, "id": "5a3e56d2", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.245447Z", - "iopub.status.busy": "2024-03-27T11:26:45.245279Z", - "iopub.status.idle": "2024-03-27T11:26:45.247890Z", - "shell.execute_reply": "2024-03-27T11:26:45.247345Z" + "iopub.execute_input": "2024-08-30T13:44:15.971018Z", + "iopub.status.busy": "2024-08-30T13:44:15.970621Z", + "iopub.status.idle": "2024-08-30T13:44:15.973109Z", + "shell.execute_reply": "2024-08-30T13:44:15.972658Z" } }, "outputs": [], @@ -1062,14 +1198,14 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 28, "id": "f6b44e25", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.250137Z", - "iopub.status.busy": "2024-03-27T11:26:45.249693Z", - "iopub.status.idle": "2024-03-27T11:26:45.254108Z", - "shell.execute_reply": "2024-03-27T11:26:45.253667Z" + "iopub.execute_input": "2024-08-30T13:44:15.974924Z", + "iopub.status.busy": "2024-08-30T13:44:15.974603Z", + "iopub.status.idle": "2024-08-30T13:44:15.978533Z", + "shell.execute_reply": "2024-08-30T13:44:15.978032Z" } }, "outputs": [ @@ -1112,10 +1248,10 @@ " ('ALT_PNT', 69.69974),\n", " ('AZ_PNT', 103.8848),\n", " ('PH_LOG',\n", - " 'COLUMN_PHASE: PHASE; PINT_VERS: 0.9.8; GAMMAPY_VERS: 1.0.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: 60396.4769125122;')])" + " 'COLUMN_PHASE: PHASE; PINT_VERS: 1.0.1; 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: 60552.572407022526;')])" ] }, - "execution_count": 25, + "execution_count": 28, "metadata": {}, "output_type": "execute_result" } @@ -1134,14 +1270,14 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 29, "id": "12545bff", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.256140Z", - "iopub.status.busy": "2024-03-27T11:26:45.255965Z", - "iopub.status.idle": "2024-03-27T11:26:45.306335Z", - "shell.execute_reply": "2024-03-27T11:26:45.305804Z" + "iopub.execute_input": "2024-08-30T13:44:15.980471Z", + "iopub.status.busy": "2024-08-30T13:44:15.980173Z", + "iopub.status.idle": "2024-08-30T13:44:16.013868Z", + "shell.execute_reply": "2024-08-30T13:44:16.013376Z" } }, "outputs": [ @@ -1149,7 +1285,6 @@ "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", "'THETA' axis is stored as a scalar -- converting to 1D array.\n" @@ -1164,14 +1299,14 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 30, "id": "1ac16c51", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.308633Z", - "iopub.status.busy": "2024-03-27T11:26:45.308216Z", - "iopub.status.idle": "2024-03-27T11:26:45.313310Z", - "shell.execute_reply": "2024-03-27T11:26:45.312737Z" + "iopub.execute_input": "2024-08-30T13:44:16.015882Z", + "iopub.status.busy": "2024-08-30T13:44:16.015596Z", + "iopub.status.idle": "2024-08-30T13:44:16.020193Z", + "shell.execute_reply": "2024-08-30T13:44:16.019715Z" } }, "outputs": [ @@ -1179,30 +1314,29 @@ "data": { "text/html": [ "
Table length=11189\n", - "\n", + "
\n", "\n", "\n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", "
EVENT_IDTIMERADECENERGYPHASE
sdegdegTeV
int64float64float32float32float32float64
2402333778852.509924984.5945722.030880.181946010.39349195931383935
2408333778852.526715384.2146223.449140.083973940.8919526790064667
2434333778852.6131505483.52470422.7257920.105969320.4579789031294724
2445333778852.669014283.7695722.4510060.197334980.11641860219368935
2478333778852.762793983.47851623.4845940.085222190.9004806857711186
2481333778852.777854983.7151721.9851151.00209430.3476011689926769
2513333778852.864446782.42119622.5676520.143740680.9182740999289545
2544333778852.982606483.6413622.0413150.103166290.42611249421537956
2559333778853.026941484.06917622.973370.0471844930.7422975122115125
2402333778852.509924984.5945722.030880.181946010.3934918682770723
2408333778852.526715384.2146223.449140.083973940.8919525879696997
2434333778852.6131505483.52470422.7257920.105969320.45797881185987477
2445333778852.669014283.7695722.4510060.197334980.11641851092409164
2478333778852.762793983.47851623.4845940.085222190.900480594501521
2481333778852.777854983.7151721.9851151.00209430.34760107795590983
2513333778852.864446782.42119622.5676520.143740680.9182740088921875
2544333778852.982606483.6413622.0413150.103166290.42611240294578184
2559333778853.026941484.06917622.973370.0471844930.7422974209419148
..................
356222333780039.452039784.7448220.8949810.0433121620.4537121484157113
356223333780039.460049284.1161522.5575050.081100820.6914920486374702
356227333780039.4710536683.4153421.673440.20963620.018183944316962984
356242333780039.517909583.5516522.7729850.176728350.40920620046641115
356282333780039.6299751484.4613321.693570.050687180.7361270955486778
356473333780040.338647984.4544121.1598280.18315690.7746789518818565
356478333780040.354892683.6833623.4449880.063051690.2569398572226654
356485333780040.374132284.3351721.283380.0605397450.8281109722104576
356486333780040.375515984.8588622.1162220.1234537440.8691881135544401
356526333780040.5247600784.8692921.2909160.136301140.29983901925054285
356223333780039.460049284.1161522.5575050.081100820.6914919573678725
356227333780039.4710536683.4153421.673440.20963620.018183853280195963
356242333780039.517909583.5516522.7729850.176728350.4092061182772071
356282333780039.6299751484.4613321.693570.050687180.7361270045119108
356473333780040.338647984.4544121.1598280.18315690.7746788606122589
356478333780040.354892683.6833623.4449880.063051690.25693976618589837
356485333780040.374132284.3351721.283380.0605397450.8281108809408599
356486333780040.375515984.8588622.1162220.1234537440.8691880225176731
356526333780040.5247600784.8692921.2909160.136301140.29983892821377583
" ], "text/plain": [ @@ -1211,29 +1345,28 @@ " 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", + " 2402 333778852.5099249 84.59457 22.03088 0.18194601 0.3934918682770723\n", + " 2408 333778852.5267153 84.21462 23.44914 0.08397394 0.8919525879696997\n", + " 2434 333778852.61315054 83.524704 22.725792 0.10596932 0.45797881185987477\n", + " 2445 333778852.6690142 83.76957 22.451006 0.19733498 0.11641851092409164\n", + " 2478 333778852.7627939 83.478516 23.484594 0.08522219 0.900480594501521\n", + " 2481 333778852.7778549 83.71517 21.985115 1.0020943 0.34760107795590983\n", + " 2513 333778852.8644467 82.421196 22.567652 0.14374068 0.9182740088921875\n", + " 2544 333778852.9826064 83.64136 22.041315 0.10316629 0.42611240294578184\n", + " 2559 333778853.0269414 84.069176 22.97337 0.047184493 0.7422974209419148\n", " ... ... ... ... ... ...\n", - " 356222 333780039.4520397 84.74482 20.894981 0.043312162 0.4537121484157113\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" + " 356223 333780039.4600492 84.11615 22.557505 0.08110082 0.6914919573678725\n", + " 356227 333780039.47105366 83.41534 21.67344 0.2096362 0.018183853280195963\n", + " 356242 333780039.5179095 83.55165 22.772985 0.17672835 0.4092061182772071\n", + " 356282 333780039.62997514 84.46133 21.69357 0.05068718 0.7361270045119108\n", + " 356473 333780040.3386479 84.45441 21.159828 0.1831569 0.7746788606122589\n", + " 356478 333780040.3548926 83.68336 23.444988 0.06305169 0.25693976618589837\n", + " 356485 333780040.3741322 84.33517 21.28338 0.060539745 0.8281108809408599\n", + " 356486 333780040.3755159 84.85886 22.116222 0.123453744 0.8691880225176731\n", + " 356526 333780040.52476007 84.86929 21.290916 0.13630114 0.29983892821377583" ] }, - "execution_count": 27, + "execution_count": 30, "metadata": {}, "output_type": "execute_result" } @@ -1255,31 +1388,31 @@ "id": "e369d2dc", "metadata": {}, "source": [ - "In the following, we show how to write the files in a directory contained in the original datastore directory. This follows the logic of DL3 data store and facilitate the manipulation of the HDU table.\n", + "In the following, we show how to write the files in a directory contained in the original datastore directory. This follows the logic of DL3 data store and facilitates the manipulation of the HDU table.\n", "\n", - "If one does not want to save the events files and directly perform the pulsar analysis, this step is not required as well as the step of the meta data handling. However, be aware that for large dataset, the computation of phases can take tens of minutes. " + "If you do not want to save the events files bur rather directly perform the pulsar analysis, you can skip both this step and the step of the handling metadata. However, be aware that for large datasets, the computation of the phases can take tens of minutes." ] }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 31, "id": "f3c8410c", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.315528Z", - "iopub.status.busy": "2024-03-27T11:26:45.315188Z", - "iopub.status.idle": "2024-03-27T11:26:45.318777Z", - "shell.execute_reply": "2024-03-27T11:26:45.318308Z" + "iopub.execute_input": "2024-08-30T13:44:16.022167Z", + "iopub.status.busy": "2024-08-30T13:44:16.021883Z", + "iopub.status.idle": "2024-08-30T13:44:16.025164Z", + "shell.execute_reply": "2024-08-30T13:44:16.024650Z" } }, "outputs": [ { "data": { "text/plain": [ - "PosixPath('/home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.0.2/magic/rad_max/data')" + "PosixPath('/home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.2/magic/rad_max/data')" ] }, - "execution_count": 28, + "execution_count": 31, "metadata": {}, "output_type": "execute_result" } @@ -1290,14 +1423,14 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 32, "id": "8fd2ce31", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.320738Z", - "iopub.status.busy": "2024-03-27T11:26:45.320560Z", - "iopub.status.idle": "2024-03-27T11:26:45.323746Z", - "shell.execute_reply": "2024-03-27T11:26:45.323305Z" + "iopub.execute_input": "2024-08-30T13:44:16.027018Z", + "iopub.status.busy": "2024-08-30T13:44:16.026717Z", + "iopub.status.idle": "2024-08-30T13:44:16.029663Z", + "shell.execute_reply": "2024-08-30T13:44:16.029226Z" } }, "outputs": [], @@ -1314,24 +1447,24 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 33, "id": "e6e38fc1", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.325950Z", - "iopub.status.busy": "2024-03-27T11:26:45.325616Z", - "iopub.status.idle": "2024-03-27T11:26:45.329021Z", - "shell.execute_reply": "2024-03-27T11:26:45.328467Z" + "iopub.execute_input": "2024-08-30T13:44:16.031501Z", + "iopub.status.busy": "2024-08-30T13:44:16.031183Z", + "iopub.status.idle": "2024-08-30T13:44:16.034289Z", + "shell.execute_reply": "2024-08-30T13:44:16.033820Z" } }, "outputs": [ { "data": { "text/plain": [ - "'/home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.0.2/magic/rad_max/data/pulsar_events_file/'" + "'/home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.2/magic/rad_max/data/pulsar_events_file/'" ] }, - "execution_count": 30, + "execution_count": 33, "metadata": {}, "output_type": "execute_result" } @@ -1342,32 +1475,29 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 34, "id": "f339c797", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.331194Z", - "iopub.status.busy": "2024-03-27T11:26:45.330781Z", - "iopub.status.idle": "2024-03-27T11:26:45.489597Z", - "shell.execute_reply": "2024-03-27T11:26:45.488969Z" - }, - "scrolled": true + "iopub.execute_input": "2024-08-30T13:44:16.036030Z", + "iopub.status.busy": "2024-08-30T13:44:16.035881Z", + "iopub.status.idle": "2024-08-30T13:44:16.168565Z", + "shell.execute_reply": "2024-08-30T13:44:16.168088Z" + } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Writing outputfile in /home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.0.2/magic/rad_max/data/pulsar_events_file/dl3_pulsar_5029747.fits.gz\n" + "Writing output file in /home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.2/magic/rad_max/data/pulsar_events_file/dl3_pulsar_5029747.fits.gz\n" ] } ], "source": [ "# Save the observation object in the specified file_path\n", - "print(\"Writing outputfile in \" + str(file_path))\n", - "observation.events.write(\n", - " filename=file_path, gti=observation.gti, overwrite=True\n", - ")" + "print(\"Writing output file in \" + str(file_path))\n", + "new_obs.write(path=file_path, include_irfs=False, overwrite=True)" ] }, { @@ -1380,14 +1510,14 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 35, "id": "4b8dd431", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.492294Z", - "iopub.status.busy": "2024-03-27T11:26:45.491941Z", - "iopub.status.idle": "2024-03-27T11:26:45.497464Z", - "shell.execute_reply": "2024-03-27T11:26:45.496931Z" + "iopub.execute_input": "2024-08-30T13:44:16.170679Z", + "iopub.status.busy": "2024-08-30T13:44:16.170369Z", + "iopub.status.idle": "2024-08-30T13:44:16.175339Z", + "shell.execute_reply": "2024-08-30T13:44:16.174869Z" } }, "outputs": [ @@ -1395,7 +1525,7 @@ "data": { "text/html": [ "
HDUIndexTable length=10\n", - "\n", + "
\n", "\n", "\n", "\n", @@ -1427,7 +1557,7 @@ "5029747 edisp ... ENERGY DISPERSION" ] }, - "execution_count": 32, + "execution_count": 35, "metadata": {}, "output_type": "execute_result" } @@ -1440,34 +1570,36 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 36, "id": "6f37e101", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.499587Z", - "iopub.status.busy": "2024-03-27T11:26:45.499179Z", - "iopub.status.idle": "2024-03-27T11:26:45.502364Z", - "shell.execute_reply": "2024-03-27T11:26:45.501887Z" + "iopub.execute_input": "2024-08-30T13:44:16.177243Z", + "iopub.status.busy": "2024-08-30T13:44:16.176916Z", + "iopub.status.idle": "2024-08-30T13:44:16.179856Z", + "shell.execute_reply": "2024-08-30T13:44:16.179447Z" } }, "outputs": [], "source": [ "for entry in new_hdu:\n", - " if entry[\"HDU_NAME\"] == \"EVENTS\" and entry[\"OBS_ID\"] == observation.obs_id:\n", + " if (entry[\"HDU_NAME\"] == \"EVENTS\") and (\n", + " entry[\"OBS_ID\"] == observation.obs_id\n", + " ):\n", " entry[\"FILE_DIR\"] = \"./\" + str(output_directory)\n", " entry[\"FILE_NAME\"] = filename" ] }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 37, "id": "d89a7739", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.504469Z", - "iopub.status.busy": "2024-03-27T11:26:45.504078Z", - "iopub.status.idle": "2024-03-27T11:26:45.508565Z", - "shell.execute_reply": "2024-03-27T11:26:45.507988Z" + "iopub.execute_input": "2024-08-30T13:44:16.181702Z", + "iopub.status.busy": "2024-08-30T13:44:16.181410Z", + "iopub.status.idle": "2024-08-30T13:44:16.185572Z", + "shell.execute_reply": "2024-08-30T13:44:16.185152Z" } }, "outputs": [ @@ -1475,7 +1607,7 @@ "data": { "text/html": [ "
HDUIndexTable length=10\n", - "
OBS_IDHDU_TYPEHDU_CLASSFILE_DIRFILE_NAMEHDU_NAME
int64bytes30bytes30bytes100bytes50bytes30
5029748eventsevents./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsEVENTS
\n", + "
\n", "\n", "\n", "\n", @@ -1507,7 +1639,7 @@ "5029747 edisp ... ENERGY DISPERSION" ] }, - "execution_count": 34, + "execution_count": 37, "metadata": {}, "output_type": "execute_result" } @@ -1529,19 +1661,19 @@ "id": "e08bf493", "metadata": {}, "source": [ - "Finally, we need to save the new HDU table in the origianl DL3 directory. Here one should be very careful to not name the new HDU file with the same name as the original HDU file of the data store. Otherwise, the original HDU file will be overwrited. " + "Finally, we need to save the new HDU table in the original DL3 directory. One must be very careful with naming the new HDU file, such that it does not have the same name as the original HDU file of the data store. Otherwise, the original HDU file will be overwritten." ] }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 38, "id": "b1633cd5", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.510689Z", - "iopub.status.busy": "2024-03-27T11:26:45.510412Z", - "iopub.status.idle": "2024-03-27T11:26:45.521520Z", - "shell.execute_reply": "2024-03-27T11:26:45.520994Z" + "iopub.execute_input": "2024-08-30T13:44:16.187343Z", + "iopub.status.busy": "2024-08-30T13:44:16.187186Z", + "iopub.status.idle": "2024-08-30T13:44:16.197275Z", + "shell.execute_reply": "2024-08-30T13:44:16.196738Z" } }, "outputs": [], @@ -1556,7 +1688,7 @@ "id": "e92cf68c", "metadata": {}, "source": [ - "**Note: Here we use only one approach that could be useful, showing the steps to save the new Event files in a random directory and generate a new modified HDU index table. However, the user is free to chose the absolute path of the EventList and DataStore. For instance, another approach could be making a full copy of the DataStore, or changing the location of the pulsar event files to one that could be more convinient for the user.**" + "**Note: Here we demonstrate only one approach that could be useful, showing the steps to save the new Event files in a directory and generate a new modified HDU index table. However, the user is free to choose the absolute path of the EventList and DataStore. Another approach, for instance, could be making a full copy of the DataStore, or changing the location of the pulsar event files to one that is more convenient for the user.**" ] }, { @@ -1572,38 +1704,38 @@ "id": "e1036448", "metadata": {}, "source": [ - "Once all of this is done, we just have to open the data store using `DataStore.from_dir()`and passing the pulsar HDU table to it :" + "Once all of this is done, we just have to open the data store using DataStore.from_dir() and pass the pulsar HDU table to it :" ] }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 39, "id": "88a0e9c1", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.523852Z", - "iopub.status.busy": "2024-03-27T11:26:45.523517Z", - "iopub.status.idle": "2024-03-27T11:26:45.537115Z", - "shell.execute_reply": "2024-03-27T11:26:45.536595Z" + "iopub.execute_input": "2024-08-30T13:44:16.199418Z", + "iopub.status.busy": "2024-08-30T13:44:16.199114Z", + "iopub.status.idle": "2024-08-30T13:44:16.210872Z", + "shell.execute_reply": "2024-08-30T13:44:16.210389Z" } }, "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": 37, + "execution_count": 40, "id": "f7c60c18", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.539197Z", - "iopub.status.busy": "2024-03-27T11:26:45.538882Z", - "iopub.status.idle": "2024-03-27T11:26:45.543864Z", - "shell.execute_reply": "2024-03-27T11:26:45.543346Z" + "iopub.execute_input": "2024-08-30T13:44:16.213029Z", + "iopub.status.busy": "2024-08-30T13:44:16.212605Z", + "iopub.status.idle": "2024-08-30T13:44:16.217590Z", + "shell.execute_reply": "2024-08-30T13:44:16.217079Z" } }, "outputs": [ @@ -1613,7 +1745,7 @@ "['events', 'gti', 'aeff', 'edisp', 'rad_max']" ] }, - "execution_count": 37, + "execution_count": 40, "metadata": {}, "output_type": "execute_result" } @@ -1627,14 +1759,14 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 41, "id": "4ae8ebd2", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.545837Z", - "iopub.status.busy": "2024-03-27T11:26:45.545678Z", - "iopub.status.idle": "2024-03-27T11:26:45.559836Z", - "shell.execute_reply": "2024-03-27T11:26:45.559308Z" + "iopub.execute_input": "2024-08-30T13:44:16.219467Z", + "iopub.status.busy": "2024-08-30T13:44:16.219161Z", + "iopub.status.idle": "2024-08-30T13:44:16.233657Z", + "shell.execute_reply": "2024-08-30T13:44:16.233153Z" } }, "outputs": [ @@ -1642,61 +1774,59 @@ "data": { "text/html": [ "
Table length=11189\n", - "
OBS_IDHDU_TYPEHDU_CLASSFILE_DIRFILE_NAMEHDU_NAME
int64bytes30bytes30bytes100bytes50bytes30
5029748eventsevents./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsEVENTS
\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "
EVENT_IDTIMERADECENERGY
sdegdegTeV
int64float64float32float32float32
2402333778852.509924984.5945722.030880.18194601
2408333778852.526715384.2146223.449140.08397394
2434333778852.6131505483.52470422.7257920.10596932
2445333778852.669014283.7695722.4510060.19733498
2478333778852.762793983.47851623.4845940.08522219
2481333778852.777854983.7151721.9851151.0020943
2513333778852.864446782.42119622.5676520.14374068
2544333778852.982606483.6413622.0413150.10316629
2559333778853.026941484.06917622.973370.047184493
...............
356222333780039.452039784.7448220.8949810.043312162
356223333780039.460049284.1161522.5575050.08110082
356227333780039.4710536683.4153421.673440.2096362
356242333780039.517909583.5516522.7729850.17672835
356282333780039.6299751484.4613321.693570.05068718
356473333780040.338647984.4544121.1598280.1831569
356478333780040.354892683.6833623.4449880.06305169
356485333780040.374132284.3351721.283380.060539745
356486333780040.375515984.8588622.1162220.123453744
356526333780040.5247600784.8692921.2909160.13630114
\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", "
EVENT_IDTIMERADECENERGYPHASE
sdegdegTeV
int64float64float32float32float32float64
2402333778852.509924984.5945722.030880.181946010.3934918682770723
2408333778852.526715384.2146223.449140.083973940.8919525879696997
2434333778852.6131505483.52470422.7257920.105969320.45797881185987477
2445333778852.669014283.7695722.4510060.197334980.11641851092409164
2478333778852.762793983.47851623.4845940.085222190.900480594501521
2481333778852.777854983.7151721.9851151.00209430.34760107795590983
2513333778852.864446782.42119622.5676520.143740680.9182740088921875
2544333778852.982606483.6413622.0413150.103166290.42611240294578184
2559333778853.026941484.06917622.973370.0471844930.7422974209419148
..................
356223333780039.460049284.1161522.5575050.081100820.6914919573678725
356227333780039.4710536683.4153421.673440.20963620.018183853280195963
356242333780039.517909583.5516522.7729850.176728350.4092061182772071
356282333780039.6299751484.4613321.693570.050687180.7361270045119108
356473333780040.338647984.4544121.1598280.18315690.7746788606122589
356478333780040.354892683.6833623.4449880.063051690.25693976618589837
356485333780040.374132284.3351721.283380.0605397450.8281108809408599
356486333780040.375515984.8588622.1162220.1234537440.8691880225176731
356526333780040.5247600784.8692921.2909160.136301140.29983892821377583
" ], "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", - " 356222 333780039.4520397 84.74482 20.894981 0.043312162\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" + "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.3934918682770723\n", + " 2408 333778852.5267153 84.21462 23.44914 0.08397394 0.8919525879696997\n", + " 2434 333778852.61315054 83.524704 22.725792 0.10596932 0.45797881185987477\n", + " 2445 333778852.6690142 83.76957 22.451006 0.19733498 0.11641851092409164\n", + " 2478 333778852.7627939 83.478516 23.484594 0.08522219 0.900480594501521\n", + " 2481 333778852.7778549 83.71517 21.985115 1.0020943 0.34760107795590983\n", + " 2513 333778852.8644467 82.421196 22.567652 0.14374068 0.9182740088921875\n", + " 2544 333778852.9826064 83.64136 22.041315 0.10316629 0.42611240294578184\n", + " 2559 333778853.0269414 84.069176 22.97337 0.047184493 0.7422974209419148\n", + " ... ... ... ... ... ...\n", + " 356223 333780039.4600492 84.11615 22.557505 0.08110082 0.6914919573678725\n", + " 356227 333780039.47105366 83.41534 21.67344 0.2096362 0.018183853280195963\n", + " 356242 333780039.5179095 83.55165 22.772985 0.17672835 0.4092061182772071\n", + " 356282 333780039.62997514 84.46133 21.69357 0.05068718 0.7361270045119108\n", + " 356473 333780040.3386479 84.45441 21.159828 0.1831569 0.7746788606122589\n", + " 356478 333780040.3548926 83.68336 23.444988 0.06305169 0.25693976618589837\n", + " 356485 333780040.3741322 84.33517 21.28338 0.060539745 0.8281108809408599\n", + " 356486 333780040.3755159 84.85886 22.116222 0.123453744 0.8691880225176731\n", + " 356526 333780040.52476007 84.86929 21.290916 0.13630114 0.29983892821377583" ] }, - "execution_count": 38, + "execution_count": 41, "metadata": {}, "output_type": "execute_result" } @@ -1726,7 +1856,7 @@ "id": "1fe89d60", "metadata": {}, "source": [ - "Once we have the corret DataStore and the modified EventList with the phase information, we can do the pulsar analysis using different tools for Gammapy to compute the phaseogram, maps, SED, lightcurve, etc... To do so, one can check the following [Gammapy tutorial](https://docs.gammapy.org/1.0/tutorials/analysis-time/pulsar_analysis.html#sphx-glr-tutorials-analysis-time-pulsar-analysis-py)." + "Once we have the correct DataStore and the modified EventList with the phase information, we can perform the pulsar analysis using different tools available in Gammapy. Allowing us to compute the phaseogram, maps, SED, lightcurve and more. To do so, please refer to the following [Gammapy tutorial](https://docs.gammapy.org/1.0/tutorials/analysis-time/pulsar_analysis.html#sphx-glr-tutorials-analysis-time-pulsar-analysis-py)." ] }, { @@ -1755,7 +1885,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.19" + "version": "3.11.9" }, "nbsphinx": { "orphan": true diff --git a/docs/_build/html/_static/notebooks/pulsar_phase/env.yml b/docs/_build/html/_static/notebooks/pulsar_phase/env.yml index 4d44158..a3d6b11 100644 --- a/docs/_build/html/_static/notebooks/pulsar_phase/env.yml +++ b/docs/_build/html/_static/notebooks/pulsar_phase/env.yml @@ -5,10 +5,11 @@ channels: - conda-forge dependencies: - - gammapy=1.0.2 - - python=3.9 + - gammapy=1.2 + - python=3.11 - scipy<1.12 - jupyter - pip - pip: - - pint-pulsar~=0.9.3 + - pint-pulsar~=1.0 + diff --git a/docs/_build/html/_static/notebooks/pulsar_phase/pulsar_phase_computation.ipynb b/docs/_build/html/_static/notebooks/pulsar_phase/pulsar_phase_computation.ipynb index a5f36ac..73c9079 100644 --- a/docs/_build/html/_static/notebooks/pulsar_phase/pulsar_phase_computation.ipynb +++ b/docs/_build/html/_static/notebooks/pulsar_phase/pulsar_phase_computation.ipynb @@ -15,9 +15,9 @@ "source": [ "This notebook has been done for the following version of Gammapy and PINT:\n", "\n", - "Gammapy version : 1.0.1\n", + "Gammapy version : 1.2\n", "\n", - "PINT version : 0.9.5" + "PINT version : 1.0" ] }, { @@ -30,7 +30,7 @@ "1. The time of arrivals (TOAs). These times should have very high precision due to the common fast periods of pulsars. Usually these times are already stored in the EventList. For the computation of pulsar timing, times must be corrected in order to be referenced in the Solar System barycenter (SSB) because this system can nearly be regarded as an inertial reference frame with respect to the pulsar.\n", "\n", "\n", - "2. The model of rotation of the pulsar, also known as ephemeris, at the epoch of the observations. These ephemerides are stored in an specific format and saved as .par files and contain informations on the periods, derivatives of the periods, coordinates, glitches, etc.\n", + "2. The model of rotation of the pulsar, also known as ephemeris, at the epoch of the observations. These ephemerides are stored in a specific format and saved as .par files which contain the periods, derivatives of the periods, coordinates, glitches, etc.\n", "\n", "__For the following steps of this tutorial, we need the original EventLists from the DL3 files, and a model in .par format.__\n", "\n", @@ -51,10 +51,10 @@ "id": "a9c72d26", "metadata": {}, "source": [ - "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", + "To run this notebook, you must have Gammapy and PINT (see documentation above) installed in the same environment. We recommend installing Gammapy first and then installing PINT using your preferred 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", @@ -77,10 +77,10 @@ "id": "b68d2444", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:25.357930Z", - "iopub.status.busy": "2024-03-27T11:26:25.357759Z", - "iopub.status.idle": "2024-03-27T11:26:25.831345Z", - "shell.execute_reply": "2024-03-27T11:26:25.830742Z" + "iopub.execute_input": "2024-08-30T13:43:53.336099Z", + "iopub.status.busy": "2024-08-30T13:43:53.335935Z", + "iopub.status.idle": "2024-08-30T13:43:53.836216Z", + "shell.execute_reply": "2024-08-30T13:43:53.835669Z" } }, "outputs": [ @@ -88,8 +88,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "Gammapy version : 1.0.2\n", - "PINT version : 0.9.8\n" + "Gammapy version : 1.2\n", + "PINT version : 1.0.1\n" ] } ], @@ -107,10 +107,10 @@ "id": "e61b5e3e", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:25.833998Z", - "iopub.status.busy": "2024-03-27T11:26:25.833639Z", - "iopub.status.idle": "2024-03-27T11:26:26.506462Z", - "shell.execute_reply": "2024-03-27T11:26:26.505816Z" + "iopub.execute_input": "2024-08-30T13:43:53.838441Z", + "iopub.status.busy": "2024-08-30T13:43:53.838106Z", + "iopub.status.idle": "2024-08-30T13:43:54.626040Z", + "shell.execute_reply": "2024-08-30T13:43:54.625476Z" } }, "outputs": [], @@ -120,7 +120,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__)" ] }, { @@ -128,7 +131,7 @@ "id": "81ae3a58", "metadata": {}, "source": [ - "And we also need some imports from PINT:" + "We also need some imports from PINT:" ] }, { @@ -137,10 +140,10 @@ "id": "22ac4aea", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.509540Z", - "iopub.status.busy": "2024-03-27T11:26:26.509079Z", - "iopub.status.idle": "2024-03-27T11:26:26.624488Z", - "shell.execute_reply": "2024-03-27T11:26:26.623985Z" + "iopub.execute_input": "2024-08-30T13:43:54.628537Z", + "iopub.status.busy": "2024-08-30T13:43:54.628244Z", + "iopub.status.idle": "2024-08-30T13:43:54.656522Z", + "shell.execute_reply": "2024-08-30T13:43:54.655994Z" } }, "outputs": [], @@ -162,7 +165,7 @@ "id": "b486ec45", "metadata": {}, "source": [ - "First we neeed to define the data sample. In this notebook we will use two runs from the MAGIC gammapy data sample available in https://github.com/gammapy/gammapy-data" + "First we need to define the data sample. In this notebook we will use two runs from the MAGIC gammapy data sample available in https://github.com/gammapy/gammapy-data" ] }, { @@ -171,16 +174,16 @@ "id": "d0e182bb", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.627105Z", - "iopub.status.busy": "2024-03-27T11:26:26.626738Z", - "iopub.status.idle": "2024-03-27T11:26:26.629431Z", - "shell.execute_reply": "2024-03-27T11:26:26.628877Z" + "iopub.execute_input": "2024-08-30T13:43:54.658921Z", + "iopub.status.busy": "2024-08-30T13:43:54.658599Z", + "iopub.status.idle": "2024-08-30T13:43:54.660775Z", + "shell.execute_reply": "2024-08-30T13:43:54.660345Z" } }, "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\"" ] }, { @@ -189,16 +192,16 @@ "id": "b5019a42", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.631734Z", - "iopub.status.busy": "2024-03-27T11:26:26.631306Z", - "iopub.status.idle": "2024-03-27T11:26:26.646554Z", - "shell.execute_reply": "2024-03-27T11:26:26.646010Z" + "iopub.execute_input": "2024-08-30T13:43:54.662674Z", + "iopub.status.busy": "2024-08-30T13:43:54.662366Z", + "iopub.status.idle": "2024-08-30T13:43:54.676462Z", + "shell.execute_reply": "2024-08-30T13:43:54.675957Z" } }, "outputs": [], "source": [ "# Read DataStore from a directory\n", - "data_store = DataStore.from_dir(DL3_direc)" + "data_store = DataStore.from_dir(DL3_dir)" ] }, { @@ -215,17 +218,15 @@ "id": "9ba16fcc", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.648835Z", - "iopub.status.busy": "2024-03-27T11:26:26.648528Z", - "iopub.status.idle": "2024-03-27T11:26:26.651855Z", - "shell.execute_reply": "2024-03-27T11:26:26.651323Z" + "iopub.execute_input": "2024-08-30T13:43:54.678608Z", + "iopub.status.busy": "2024-08-30T13:43:54.678236Z", + "iopub.status.idle": "2024-08-30T13:43:54.681323Z", + "shell.execute_reply": "2024-08-30T13:43:54.680828Z" } }, "outputs": [], "source": [ - "target_pos = SkyCoord(\n", - " ra=083.6331144560900, dec=+22.0144871383400, unit=\"deg\", frame=\"icrs\"\n", - ")" + "target_pos = SkyCoord(ra=083.633, dec=+22.014, unit=\"deg\", frame=\"icrs\")" ] }, { @@ -234,10 +235,10 @@ "id": "06bda835", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.654049Z", - "iopub.status.busy": "2024-03-27T11:26:26.653646Z", - "iopub.status.idle": "2024-03-27T11:26:26.660513Z", - "shell.execute_reply": "2024-03-27T11:26:26.659953Z" + "iopub.execute_input": "2024-08-30T13:43:54.683221Z", + "iopub.status.busy": "2024-08-30T13:43:54.682910Z", + "iopub.status.idle": "2024-08-30T13:43:54.687923Z", + "shell.execute_reply": "2024-08-30T13:43:54.687497Z" } }, "outputs": [], @@ -258,10 +259,10 @@ "id": "f96ccf30", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.662615Z", - "iopub.status.busy": "2024-03-27T11:26:26.662199Z", - "iopub.status.idle": "2024-03-27T11:26:26.665420Z", - "shell.execute_reply": "2024-03-27T11:26:26.664873Z" + "iopub.execute_input": "2024-08-30T13:43:54.689878Z", + "iopub.status.busy": "2024-08-30T13:43:54.689440Z", + "iopub.status.idle": "2024-08-30T13:43:54.692452Z", + "shell.execute_reply": "2024-08-30T13:43:54.691937Z" } }, "outputs": [ @@ -295,10 +296,10 @@ "id": "fa6e36d5", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.667386Z", - "iopub.status.busy": "2024-03-27T11:26:26.667228Z", - "iopub.status.idle": "2024-03-27T11:26:26.670890Z", - "shell.execute_reply": "2024-03-27T11:26:26.670425Z" + "iopub.execute_input": "2024-08-30T13:43:54.694439Z", + "iopub.status.busy": "2024-08-30T13:43:54.694155Z", + "iopub.status.idle": "2024-08-30T13:43:54.699214Z", + "shell.execute_reply": "2024-08-30T13:43:54.698826Z" } }, "outputs": [], @@ -314,10 +315,10 @@ "id": "dec2c1a5", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.673075Z", - "iopub.status.busy": "2024-03-27T11:26:26.672669Z", - "iopub.status.idle": "2024-03-27T11:26:26.780999Z", - "shell.execute_reply": "2024-03-27T11:26:26.780438Z" + "iopub.execute_input": "2024-08-30T13:43:54.701143Z", + "iopub.status.busy": "2024-08-30T13:43:54.700820Z", + "iopub.status.idle": "2024-08-30T13:43:54.755258Z", + "shell.execute_reply": "2024-08-30T13:43:54.754750Z" } }, "outputs": [ @@ -366,10 +367,10 @@ "id": "2756e72d", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.783640Z", - "iopub.status.busy": "2024-03-27T11:26:26.783173Z", - "iopub.status.idle": "2024-03-27T11:26:26.799711Z", - "shell.execute_reply": "2024-03-27T11:26:26.799261Z" + "iopub.execute_input": "2024-08-30T13:43:54.757339Z", + "iopub.status.busy": "2024-08-30T13:43:54.757008Z", + "iopub.status.idle": "2024-08-30T13:43:54.770138Z", + "shell.execute_reply": "2024-08-30T13:43:54.769738Z" } }, "outputs": [], @@ -385,10 +386,10 @@ "id": "1ac8103a", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.801834Z", - "iopub.status.busy": "2024-03-27T11:26:26.801523Z", - "iopub.status.idle": "2024-03-27T11:26:26.804890Z", - "shell.execute_reply": "2024-03-27T11:26:26.804365Z" + "iopub.execute_input": "2024-08-30T13:43:54.772090Z", + "iopub.status.busy": "2024-08-30T13:43:54.771779Z", + "iopub.status.idle": "2024-08-30T13:43:54.774716Z", + "shell.execute_reply": "2024-08-30T13:43:54.774242Z" } }, "outputs": [ @@ -410,7 +411,7 @@ "id": "e93bfbeb", "metadata": {}, "source": [ - "Now we have the TOAs of the events in the system of the telescope. Please note that the actual precision of the times is higher than the diplayed output (and we really need this precision for the pulsar analysis!). In the next step, the timing in the SSB and the phase for each TOA has to be created. " + "Now we have the TOAs for the events in the system of the telescope. Please note: the actual precision of the times is higher than the displayed output (and we really need this precision for the pulsar analysis!). In the next step, the timing in the SSB and the phase for each TOA has to be created." ] }, { @@ -426,11 +427,11 @@ "id": "fb536b7e", "metadata": {}, "source": [ - "In order to compute the phases of a pulsar, one needs an ephemeris file, usually store as a .par file. \n", + "In order to compute the phases of a pulsar, one needs an ephemeris file, typically stored as a .par file.\n", "\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, it is important to note that many of the ephemeris files are not up-to-date. Therefore, they could give bad results on the phase computation. In particular, you should always check that the MJD of the observations one wants to phase lies between the `START` and `FINISH` entries of the ephemeris file (see next section)." ] }, { @@ -439,16 +440,16 @@ "id": "d4f89ba4", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.807135Z", - "iopub.status.busy": "2024-03-27T11:26:26.806833Z", - "iopub.status.idle": "2024-03-27T11:26:26.809301Z", - "shell.execute_reply": "2024-03-27T11:26:26.808783Z" + "iopub.execute_input": "2024-08-30T13:43:54.776686Z", + "iopub.status.busy": "2024-08-30T13:43:54.776389Z", + "iopub.status.idle": "2024-08-30T13:43:54.778777Z", + "shell.execute_reply": "2024-08-30T13:43:54.778358Z" } }, "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\"" ] }, { @@ -456,7 +457,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 files 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 features from Tempo2. \n", + "\n", + "In our case, an error occurs when using the ephemeris file with PINT. This is due to the `JUMP` line. To proceed, simply comment out the line (with #) or remove it. Note that this line is not important for the gamma-ray instruments, so it is acceptable to disregard it." ] }, { @@ -489,22 +492,21 @@ "id": "d24e1c92", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.811565Z", - "iopub.status.busy": "2024-03-27T11:26:26.811265Z", - "iopub.status.idle": "2024-03-27T11:26:26.907510Z", - "shell.execute_reply": "2024-03-27T11:26:26.906967Z" - }, - "scrolled": false + "iopub.execute_input": "2024-08-30T13:43:54.780756Z", + "iopub.status.busy": "2024-08-30T13:43:54.780435Z", + "iopub.status.idle": "2024-08-30T13:43:54.876016Z", + "shell.execute_reply": "2024-08-30T13:43:54.875575Z" + } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "\u001b[32m2024-03-27 11:26:26.901\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", - "/usr/share/miniconda3/envs/gammapy-recipes/lib/python3.9/site-packages/pint/models/model_builder.py:198: UserWarning: Unrecognized parfile line 'EPHVER 5'\n", + "\u001b[32m2024-08-30 13:43:54.870\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.models.absolute_phase\u001b[0m:\u001b[36mvalidate\u001b[0m:\u001b[36m77\u001b[0m - \u001b[1mTZRFRQ was 0.0 or None. Setting to infinite frequency.\u001b[0m\n", + "/home/runner/miniconda3/envs/gammapy-recipes/lib/python3.11/site-packages/pint/models/model_builder.py:230: UserWarning: Unrecognized parfile line 'EPHVER 5'\n", " warnings.warn(f\"Unrecognized parfile line '{p_line}'\", UserWarning)\n", - "\u001b[32m2024-03-27 11:26:26.903\u001b[0m | \u001b[33m\u001b[1mWARNING \u001b[0m | \u001b[36mpint.models.model_builder\u001b[0m:\u001b[36m__call__\u001b[0m:\u001b[36m202\u001b[0m - \u001b[33m\u001b[1mUNITS is not specified. Assuming TDB...\u001b[0m\n" + "\u001b[32m2024-08-30 13:43:54.872\u001b[0m | \u001b[33m\u001b[1mWARNING \u001b[0m | \u001b[36mpint.models.model_builder\u001b[0m:\u001b[36m__call__\u001b[0m:\u001b[36m234\u001b[0m - \u001b[33m\u001b[1mUNITS is not specified. Assuming TDB...\u001b[0m\n" ] }, { @@ -551,7 +553,111 @@ "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. Check the [PINT documentation](https://nanograv-pint.readthedocs.io) for a list of additional parameters. To obtain the complete set of parameters from the ephemeris file, one can simply print the model:\n", + "`print(model)`" + ] + }, + { + "cell_type": "markdown", + "id": "f02f0ca5-09f2-44d4-ad76-518f8964b6a1", + "metadata": {}, + "source": [ + "As mentioned previously, we should ensure 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": 15, + "id": "2584b571-93a9-4fb6-b8e2-60b8810190f6", + "metadata": { + "execution": { + "iopub.execute_input": "2024-08-30T13:43:54.878085Z", + "iopub.status.busy": "2024-08-30T13:43:54.877785Z", + "iopub.status.idle": "2024-08-30T13:43:54.881053Z", + "shell.execute_reply": "2024-08-30T13:43:54.880542Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Ephemeris time definition:\n", + "54686.1526259 - 56583.1591704\n", + "Observation time definition:\n", + "56569.18112772242 - 56569.19487901596\n" + ] + } + ], + "source": [ + "print(\n", + " f\"Ephemeris time definition:\\n{model.START.value} - {model.FINISH.value}\"\n", + ")\n", + "print(\n", + " f\"Observation time definition:\\n{observation.tstart} - {observation.tstop}\"\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "86041174-5ec4-43ba-9035-cf567b47a3bb", + "metadata": {}, + "source": [ + "If you have several observations that 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 create a small function like the following one:" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "8838ee6c-5b53-4d34-8fd7-94d32daa6bb3", + "metadata": { + "execution": { + "iopub.execute_input": "2024-08-30T13:43:54.882764Z", + "iopub.status.busy": "2024-08-30T13:43:54.882615Z", + "iopub.status.idle": "2024-08-30T13:43:54.886095Z", + "shell.execute_reply": "2024-08-30T13:43:54.885667Z" + } + }, + "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(\n", + " [model.START.value, model.FINISH.value], scale=\"tt\", format=\"mjd\"\n", + " )\n", + " if (model_time[0].value > observation.tstart.tt.mjd) or (\n", + " model_time[1].value < observation.tstop.tt.mjd\n", + " ):\n", + " log.warning(\n", + " f\"Warning: Observation time of observation {observation.obs_id} goes out of timing model validity time.\"\n", + " )" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "0d37e6cc-2cae-4192-87d9-88d52216e83f", + "metadata": { + "execution": { + "iopub.execute_input": "2024-08-30T13:43:54.887762Z", + "iopub.status.busy": "2024-08-30T13:43:54.887614Z", + "iopub.status.idle": "2024-08-30T13:43:54.890615Z", + "shell.execute_reply": "2024-08-30T13:43:54.890203Z" + } + }, + "outputs": [], + "source": [ + "check_time(observation, model)" ] }, { @@ -564,47 +670,53 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 18, "id": "a145cdde", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.909929Z", - "iopub.status.busy": "2024-03-27T11:26:26.909738Z", - "iopub.status.idle": "2024-03-27T11:26:44.597210Z", - "shell.execute_reply": "2024-03-27T11:26:44.596640Z" - }, - "scrolled": false + "iopub.execute_input": "2024-08-30T13:43:54.892323Z", + "iopub.status.busy": "2024-08-30T13:43:54.892174Z", + "iopub.status.idle": "2024-08-30T13:44:15.697802Z", + "shell.execute_reply": "2024-08-30T13:44:15.697299Z" + } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "\u001b[32m2024-03-27 11:26:27.247\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m1358\u001b[0m - \u001b[34m\u001b[1mNo pulse number flags found in the TOAs\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:27.263\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mapply_clock_corrections\u001b[0m:\u001b[36m2200\u001b[0m - \u001b[34m\u001b[1mApplying clock corrections (include_gps = False, include_bipm = False)\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:27.923\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-03-27 11:26:31.192\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2251\u001b[0m - \u001b[34m\u001b[1mComputing TDB columns.\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:31.193\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2272\u001b[0m - \u001b[34m\u001b[1mUsing EPHEM = DE421 for TDB calculation.\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:32.378\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2350\u001b[0m - \u001b[34m\u001b[1mComputing PosVels of observatories and Earth, using DE421\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:33.420\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-03-27 11:26:44.359\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2403\u001b[0m - \u001b[34m\u001b[1mSSB obs pos [1.47007462e+11 2.56889811e+10 1.11245045e+10] m\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.587\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-03-27 11:26:44.593\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2417\u001b[0m - \u001b[34m\u001b[1mAdding columns ssb_obs_pos ssb_obs_vel obs_sun_pos\u001b[0m\n" + "\u001b[32m2024-08-30 13:43:55.618\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m1377\u001b[0m - \u001b[34m\u001b[1mNo pulse number flags found in the TOAs\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:55.633\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mapply_clock_corrections\u001b[0m:\u001b[36m2224\u001b[0m - \u001b[34m\u001b[1mApplying clock corrections (include_bipm = False)\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.294\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.observatory\u001b[0m:\u001b[36mgps_correction\u001b[0m:\u001b[36m248\u001b[0m - \u001b[1mApplying GPS to UTC clock correction (~few nanoseconds)\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.294\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.observatory\u001b[0m:\u001b[36m_load_gps_clock\u001b[0m:\u001b[36m122\u001b[0m - \u001b[34m\u001b[1mLoading global GPS clock file\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.297\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.observatory.global_clock_corrections\u001b[0m:\u001b[36mget_file\u001b[0m:\u001b[36m128\u001b[0m - \u001b[1mFile index.txt to be downloaded due to download policy if_expired: https://raw.githubusercontent.com/ipta/pulsar-clock-corrections/main/index.txt\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.451\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.observatory.clock_file\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m812\u001b[0m - \u001b[34m\u001b[1mGlobal clock file gps2utc.clk saving kwargs={'bogus_last_correction': False, 'valid_beyond_ends': False}\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.452\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.observatory.global_clock_corrections\u001b[0m:\u001b[36mget_file\u001b[0m:\u001b[36m128\u001b[0m - \u001b[1mFile T2runtime/clock/gps2utc.clk to be downloaded due to download policy if_missing: https://raw.githubusercontent.com/ipta/pulsar-clock-corrections/main/T2runtime/clock/gps2utc.clk\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.668\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.observatory.clock_file\u001b[0m:\u001b[36mread_tempo2_clock_file\u001b[0m:\u001b[36m463\u001b[0m - \u001b[34m\u001b[1mLoading TEMPO2-format observatory clock correction file gps2utc.clk (/home/runner/.astropy/cache/download/url/d3c81b5766f4bfb84e65504c8a453085/contents) with bogus_last_correction=False\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.687\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.observatory\u001b[0m:\u001b[36mfind_clock_file\u001b[0m:\u001b[36m994\u001b[0m - \u001b[1mUsing global clock file for gps2utc.clk with bogus_last_correction=False\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.689\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.observatory.topo_obs\u001b[0m:\u001b[36mclock_corrections\u001b[0m:\u001b[36m354\u001b[0m - \u001b[1mObservatory magic requires no clock corrections.\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:59.900\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2270\u001b[0m - \u001b[34m\u001b[1mComputing TDB columns.\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:59.901\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2291\u001b[0m - \u001b[34m\u001b[1mUsing EPHEM = DE421 for TDB calculation.\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:00.968\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2371\u001b[0m - \u001b[34m\u001b[1mComputing PosVels of observatories and Earth, using DE421\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:02.516\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-08-30 13:44:15.633\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2424\u001b[0m - \u001b[34m\u001b[1mSSB obs pos [1.47007462e+11 2.56889811e+10 1.11245045e+10] m\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.688\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-08-30 13:44:15.694\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2438\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 7.02 s, sys: 188 ms, total: 7.21 s\n", - "Wall time: 17.7 s\n" + "CPU times: user 7.15 s, sys: 199 ms, total: 7.35 s\n", + "Wall time: 20.8 s\n" ] } ], "source": [ "%%time\n", "\n", - "# Put these to True is your observatory has clock correction files.\n", + "# Set these to True is your observatory has clock correction files.\n", "# If it is set to True but your observatory does not have clock correction files, it will be ignored.\n", "include_bipm = False\n", "include_gps = False\n", @@ -630,19 +742,19 @@ "id": "db97ea5b", "metadata": {}, "source": [ - "Once we have the TOAs object and the model, the phases are easily computed using the model.phase() method. Note that the phases are computed in the interval [-0.5,0.5]. Most of the times, we use the phases in the interval [0,1] so we have to shift the negative ones." + "Once we have the TOAs object and the model, the phases are easily computed using the model.phase() method. Note that the phases are computed in the interval [-0.5,0.5]. Most of the time, we use the phases in the interval [0,1] so we have to shift the negative ones." ] }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 19, "id": "6fbf3ad9", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:44.599538Z", - "iopub.status.busy": "2024-03-27T11:26:44.599353Z", - "iopub.status.idle": "2024-03-27T11:26:45.194277Z", - "shell.execute_reply": "2024-03-27T11:26:45.193696Z" + "iopub.execute_input": "2024-08-30T13:44:15.699970Z", + "iopub.status.busy": "2024-08-30T13:44:15.699584Z", + "iopub.status.idle": "2024-08-30T13:44:15.924450Z", + "shell.execute_reply": "2024-08-30T13:44:15.924037Z" } }, "outputs": [ @@ -650,19 +762,19 @@ "name": "stderr", "output_type": "stream", "text": [ - "\u001b[32m2024-03-27 11:26:44.636\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-03-27 11:26:44.640\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-03-27 11:26:44.646\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m1358\u001b[0m - \u001b[34m\u001b[1mNo pulse number flags found in the TOAs\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.646\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mapply_clock_corrections\u001b[0m:\u001b[36m2200\u001b[0m - \u001b[34m\u001b[1mApplying clock corrections (include_gps = False, include_bipm = False)\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.648\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2251\u001b[0m - \u001b[34m\u001b[1mComputing TDB columns.\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.648\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2272\u001b[0m - \u001b[34m\u001b[1mUsing EPHEM = DE421 for TDB calculation.\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.651\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2350\u001b[0m - \u001b[34m\u001b[1mComputing PosVels of observatories and Earth, using DE421\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.929\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-03-27 11:26:44.931\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2403\u001b[0m - \u001b[34m\u001b[1mSSB obs pos [-1.49278181e+08 7.07659442e+06 3.07113250e+06] km\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:45.150\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-03-27 11:26:45.176\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2417\u001b[0m - \u001b[34m\u001b[1mAdding columns ssb_obs_pos ssb_obs_vel obs_sun_pos\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:45.177\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-03-27 11:26:45.188\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-08-30 13:44:15.729\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.models.glitch\u001b[0m:\u001b[36mglitch_phase\u001b[0m:\u001b[36m221\u001b[0m - \u001b[34m\u001b[1mGlitch phase for glitch 1: 0.0 \u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.735\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.models.absolute_phase\u001b[0m:\u001b[36mget_TZR_toa\u001b[0m:\u001b[36m100\u001b[0m - \u001b[34m\u001b[1mCreating and dealing with the single TZR_toa for absolute phase\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.738\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m1377\u001b[0m - \u001b[34m\u001b[1mNo pulse number flags found in the TOAs\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.738\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mapply_clock_corrections\u001b[0m:\u001b[36m2224\u001b[0m - \u001b[34m\u001b[1mApplying clock corrections (include_bipm = False)\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.760\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2270\u001b[0m - \u001b[34m\u001b[1mComputing TDB columns.\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.761\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2291\u001b[0m - \u001b[34m\u001b[1mUsing EPHEM = DE421 for TDB calculation.\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.764\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2371\u001b[0m - \u001b[34m\u001b[1mComputing PosVels of observatories and Earth, using DE421\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.834\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-08-30 13:44:15.836\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2424\u001b[0m - \u001b[34m\u001b[1mSSB obs pos [-1.49278181e+08 7.07659442e+06 3.07113250e+06] km\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.907\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-08-30 13:44:15.908\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2438\u001b[0m - \u001b[34m\u001b[1mAdding columns ssb_obs_pos ssb_obs_vel obs_sun_pos\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.909\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-08-30 13:44:15.916\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.models.glitch\u001b[0m:\u001b[36mglitch_phase\u001b[0m:\u001b[36m221\u001b[0m - \u001b[34m\u001b[1mGlitch phase for glitch 1: 0.0 \u001b[0m\n" ] } ], @@ -692,14 +804,14 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 20, "id": "735ac718", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.196779Z", - "iopub.status.busy": "2024-03-27T11:26:45.196431Z", - "iopub.status.idle": "2024-03-27T11:26:45.206792Z", - "shell.execute_reply": "2024-03-27T11:26:45.206263Z" + "iopub.execute_input": "2024-08-30T13:44:15.926698Z", + "iopub.status.busy": "2024-08-30T13:44:15.926261Z", + "iopub.status.idle": "2024-08-30T13:44:15.935066Z", + "shell.execute_reply": "2024-08-30T13:44:15.934677Z" } }, "outputs": [], @@ -710,65 +822,93 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 21, "id": "f3269a2c", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.209126Z", - "iopub.status.busy": "2024-03-27T11:26:45.208686Z", - "iopub.status.idle": "2024-03-27T11:26:45.212621Z", - "shell.execute_reply": "2024-03-27T11:26:45.212125Z" - }, - "scrolled": false + "iopub.execute_input": "2024-08-30T13:44:15.936748Z", + "iopub.status.busy": "2024-08-30T13:44:15.936604Z", + "iopub.status.idle": "2024-08-30T13:44:15.942656Z", + "shell.execute_reply": "2024-08-30T13:44:15.942183Z" + } }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "EVENT_ID TIME RA DEC ENERGY \n", - " s deg deg TeV \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", - " 2561 333778853.0339344 84.84237 22.175398 0.118843034\n", - " ... ... ... ... ...\n", - " 356222 333780039.4520397 84.74482 20.894981 0.043312162\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", - "Length = 11189 rows\n" - ] + "data": { + "text/html": [ + "
Table length=11189\n", + "
\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
EVENT_IDTIMERADECENERGY
sdegdegTeV
int64float64float32float32float32
2402333778852.509924984.5945722.030880.18194601
2408333778852.526715384.2146223.449140.08397394
2434333778852.6131505483.52470422.7257920.10596932
2445333778852.669014283.7695722.4510060.19733498
2478333778852.762793983.47851623.4845940.08522219
2481333778852.777854983.7151721.9851151.0020943
2513333778852.864446782.42119622.5676520.14374068
2544333778852.982606483.6413622.0413150.10316629
2559333778853.026941484.06917622.973370.047184493
...............
356223333780039.460049284.1161522.5575050.08110082
356227333780039.4710536683.4153421.673440.2096362
356242333780039.517909583.5516522.7729850.17672835
356282333780039.6299751484.4613321.693570.05068718
356473333780040.338647984.4544121.1598280.1831569
356478333780040.354892683.6833623.4449880.06305169
356485333780040.374132284.3351721.283380.060539745
356486333780040.375515984.8588622.1162220.123453744
356526333780040.5247600784.8692921.2909160.13630114
" + ], + "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": 21, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ "# Show original table\n", - "print(table)" + "table" ] }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 22, "id": "6fc6024c", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.214559Z", - "iopub.status.busy": "2024-03-27T11:26:45.214389Z", - "iopub.status.idle": "2024-03-27T11:26:45.216994Z", - "shell.execute_reply": "2024-03-27T11:26:45.216564Z" + "iopub.execute_input": "2024-08-30T13:44:15.944440Z", + "iopub.status.busy": "2024-08-30T13:44:15.944274Z", + "iopub.status.idle": "2024-08-30T13:44:15.946972Z", + "shell.execute_reply": "2024-08-30T13:44:15.946502Z" } }, "outputs": [], @@ -787,46 +927,44 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 23, "id": "7f29187e", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.219230Z", - "iopub.status.busy": "2024-03-27T11:26:45.218856Z", - "iopub.status.idle": "2024-03-27T11:26:45.225134Z", - "shell.execute_reply": "2024-03-27T11:26:45.224604Z" - }, - "scrolled": false + "iopub.execute_input": "2024-08-30T13:44:15.948805Z", + "iopub.status.busy": "2024-08-30T13:44:15.948513Z", + "iopub.status.idle": "2024-08-30T13:44:15.952984Z", + "shell.execute_reply": "2024-08-30T13:44:15.952497Z" + } }, "outputs": [ { "data": { "text/html": [ "
Table length=11189\n", - "
\n", + "
\n", "\n", "\n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", "
EVENT_IDTIMERADECENERGYPHASE
sdegdegTeV
int64float64float32float32float32float64
2402333778852.509924984.5945722.030880.181946010.39349195931383935
2408333778852.526715384.2146223.449140.083973940.8919526790064667
2434333778852.6131505483.52470422.7257920.105969320.4579789031294724
2445333778852.669014283.7695722.4510060.197334980.11641860219368935
2478333778852.762793983.47851623.4845940.085222190.9004806857711186
2481333778852.777854983.7151721.9851151.00209430.3476011689926769
2513333778852.864446782.42119622.5676520.143740680.9182740999289545
2544333778852.982606483.6413622.0413150.103166290.42611249421537956
2559333778853.026941484.06917622.973370.0471844930.7422975122115125
2402333778852.509924984.5945722.030880.181946010.3934918682770723
2408333778852.526715384.2146223.449140.083973940.8919525879696997
2434333778852.6131505483.52470422.7257920.105969320.45797881185987477
2445333778852.669014283.7695722.4510060.197334980.11641851092409164
2478333778852.762793983.47851623.4845940.085222190.900480594501521
2481333778852.777854983.7151721.9851151.00209430.34760107795590983
2513333778852.864446782.42119622.5676520.143740680.9182740088921875
2544333778852.982606483.6413622.0413150.103166290.42611240294578184
2559333778853.026941484.06917622.973370.0471844930.7422974209419148
..................
356222333780039.452039784.7448220.8949810.0433121620.4537121484157113
356223333780039.460049284.1161522.5575050.081100820.6914920486374702
356227333780039.4710536683.4153421.673440.20963620.018183944316962984
356242333780039.517909583.5516522.7729850.176728350.40920620046641115
356282333780039.6299751484.4613321.693570.050687180.7361270955486778
356473333780040.338647984.4544121.1598280.18315690.7746789518818565
356478333780040.354892683.6833623.4449880.063051690.2569398572226654
356485333780040.374132284.3351721.283380.0605397450.8281109722104576
356486333780040.375515984.8588622.1162220.1234537440.8691881135544401
356526333780040.5247600784.8692921.2909160.136301140.29983901925054285
356223333780039.460049284.1161522.5575050.081100820.6914919573678725
356227333780039.4710536683.4153421.673440.20963620.018183853280195963
356242333780039.517909583.5516522.7729850.176728350.4092061182772071
356282333780039.6299751484.4613321.693570.050687180.7361270045119108
356473333780040.338647984.4544121.1598280.18315690.7746788606122589
356478333780040.354892683.6833623.4449880.063051690.25693976618589837
356485333780040.374132284.3351721.283380.0605397450.8281108809408599
356486333780040.375515984.8588622.1162220.1234537440.8691880225176731
356526333780040.5247600784.8692921.2909160.136301140.29983892821377583
" ], "text/plain": [ @@ -835,29 +973,28 @@ " 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", + " 2402 333778852.5099249 84.59457 22.03088 0.18194601 0.3934918682770723\n", + " 2408 333778852.5267153 84.21462 23.44914 0.08397394 0.8919525879696997\n", + " 2434 333778852.61315054 83.524704 22.725792 0.10596932 0.45797881185987477\n", + " 2445 333778852.6690142 83.76957 22.451006 0.19733498 0.11641851092409164\n", + " 2478 333778852.7627939 83.478516 23.484594 0.08522219 0.900480594501521\n", + " 2481 333778852.7778549 83.71517 21.985115 1.0020943 0.34760107795590983\n", + " 2513 333778852.8644467 82.421196 22.567652 0.14374068 0.9182740088921875\n", + " 2544 333778852.9826064 83.64136 22.041315 0.10316629 0.42611240294578184\n", + " 2559 333778853.0269414 84.069176 22.97337 0.047184493 0.7422974209419148\n", " ... ... ... ... ... ...\n", - " 356222 333780039.4520397 84.74482 20.894981 0.043312162 0.4537121484157113\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" + " 356223 333780039.4600492 84.11615 22.557505 0.08110082 0.6914919573678725\n", + " 356227 333780039.47105366 83.41534 21.67344 0.2096362 0.018183853280195963\n", + " 356242 333780039.5179095 83.55165 22.772985 0.17672835 0.4092061182772071\n", + " 356282 333780039.62997514 84.46133 21.69357 0.05068718 0.7361270045119108\n", + " 356473 333780040.3386479 84.45441 21.159828 0.1831569 0.7746788606122589\n", + " 356478 333780040.3548926 83.68336 23.444988 0.06305169 0.25693976618589837\n", + " 356485 333780040.3741322 84.33517 21.28338 0.060539745 0.8281108809408599\n", + " 356486 333780040.3755159 84.85886 22.116222 0.123453744 0.8691880225176731\n", + " 356526 333780040.52476007 84.86929 21.290916 0.13630114 0.29983892821377583" ] }, - "execution_count": 20, + "execution_count": 23, "metadata": {}, "output_type": "execute_result" } @@ -880,23 +1017,22 @@ "id": "ea9ba223", "metadata": {}, "source": [ - "At this point, we also want to add meta data to the table. It is very useful to keep track of what has been done to the file. For instance, if we have multiple pulsars in the same file, we want to be able to know quickly which column correspond to which pulsar. Moreover, experience shows that one often use different ephemeris file for the same pulsar. Therefore, it is very useful to have several phase columns in the same file and to be able to know which column correspond to which ephemeris file, parameters, etc.\n", + "At this point, we also want to add metadata to the table. It is very useful to keep track of what has been done to the file. For instance, if a file contains multiple pulsars, we want identify quickly which column corresponds to each pulsar. Moreover, experience has shown that it is common to have different ephemeris files for the same pulsar. Therefore, it is useful to have several phase columns in the same file to easily identify which column corresponds to each ephemeris file, parameters, etc.\n", "\n", - "Since there is not yet a \"standard\" format for such metadata, we propose a template for the essential informations that one wants to save in the header of the event file. First, we look at the present meta info on the table." + "Since there is currently no \"standard\" format for such metadata, we propose a template for the essential information that one wants to save in the header of the event file. First, we look at the present meta info on the table." ] }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 24, "id": "af220557", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.227594Z", - "iopub.status.busy": "2024-03-27T11:26:45.227257Z", - "iopub.status.idle": "2024-03-27T11:26:45.231629Z", - "shell.execute_reply": "2024-03-27T11:26:45.231108Z" - }, - "scrolled": false + "iopub.execute_input": "2024-08-30T13:44:15.955025Z", + "iopub.status.busy": "2024-08-30T13:44:15.954655Z", + "iopub.status.idle": "2024-08-30T13:44:15.958777Z", + "shell.execute_reply": "2024-08-30T13:44:15.958278Z" + } }, "outputs": [ { @@ -939,7 +1075,7 @@ " ('AZ_PNT', 103.8848)])" ] }, - "execution_count": 21, + "execution_count": 24, "metadata": {}, "output_type": "execute_result" } @@ -950,14 +1086,14 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 25, "id": "c2285fcd", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.233745Z", - "iopub.status.busy": "2024-03-27T11:26:45.233423Z", - "iopub.status.idle": "2024-03-27T11:26:45.237873Z", - "shell.execute_reply": "2024-03-27T11:26:45.237324Z" + "iopub.execute_input": "2024-08-30T13:44:15.960712Z", + "iopub.status.busy": "2024-08-30T13:44:15.960430Z", + "iopub.status.idle": "2024-08-30T13:44:15.964154Z", + "shell.execute_reply": "2024-08-30T13:44:15.963725Z" } }, "outputs": [], @@ -1000,14 +1136,14 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 26, "id": "8c866a5c", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.240180Z", - "iopub.status.busy": "2024-03-27T11:26:45.239749Z", - "iopub.status.idle": "2024-03-27T11:26:45.243507Z", - "shell.execute_reply": "2024-03-27T11:26:45.242970Z" + "iopub.execute_input": "2024-08-30T13:44:15.966078Z", + "iopub.status.busy": "2024-08-30T13:44:15.965699Z", + "iopub.status.idle": "2024-08-30T13:44:15.968960Z", + "shell.execute_reply": "2024-08-30T13:44:15.968447Z" } }, "outputs": [ @@ -1015,7 +1151,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "COLUMN_PHASE: PHASE; PINT_VERS: 0.9.8; GAMMAPY_VERS: 1.0.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: 60396.4769125122;\n" + "COLUMN_PHASE: PHASE; PINT_VERS: 1.0.1; 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: 60552.572407022526;\n" ] } ], @@ -1026,14 +1162,14 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 27, "id": "5a3e56d2", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.245447Z", - "iopub.status.busy": "2024-03-27T11:26:45.245279Z", - "iopub.status.idle": "2024-03-27T11:26:45.247890Z", - "shell.execute_reply": "2024-03-27T11:26:45.247345Z" + "iopub.execute_input": "2024-08-30T13:44:15.971018Z", + "iopub.status.busy": "2024-08-30T13:44:15.970621Z", + "iopub.status.idle": "2024-08-30T13:44:15.973109Z", + "shell.execute_reply": "2024-08-30T13:44:15.972658Z" } }, "outputs": [], @@ -1044,14 +1180,14 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 28, "id": "f6b44e25", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.250137Z", - "iopub.status.busy": "2024-03-27T11:26:45.249693Z", - "iopub.status.idle": "2024-03-27T11:26:45.254108Z", - "shell.execute_reply": "2024-03-27T11:26:45.253667Z" + "iopub.execute_input": "2024-08-30T13:44:15.974924Z", + "iopub.status.busy": "2024-08-30T13:44:15.974603Z", + "iopub.status.idle": "2024-08-30T13:44:15.978533Z", + "shell.execute_reply": "2024-08-30T13:44:15.978032Z" } }, "outputs": [ @@ -1094,10 +1230,10 @@ " ('ALT_PNT', 69.69974),\n", " ('AZ_PNT', 103.8848),\n", " ('PH_LOG',\n", - " 'COLUMN_PHASE: PHASE; PINT_VERS: 0.9.8; GAMMAPY_VERS: 1.0.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: 60396.4769125122;')])" + " 'COLUMN_PHASE: PHASE; PINT_VERS: 1.0.1; 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: 60552.572407022526;')])" ] }, - "execution_count": 25, + "execution_count": 28, "metadata": {}, "output_type": "execute_result" } @@ -1116,14 +1252,14 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 29, "id": "12545bff", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.256140Z", - "iopub.status.busy": "2024-03-27T11:26:45.255965Z", - "iopub.status.idle": "2024-03-27T11:26:45.306335Z", - "shell.execute_reply": "2024-03-27T11:26:45.305804Z" + "iopub.execute_input": "2024-08-30T13:44:15.980471Z", + "iopub.status.busy": "2024-08-30T13:44:15.980173Z", + "iopub.status.idle": "2024-08-30T13:44:16.013868Z", + "shell.execute_reply": "2024-08-30T13:44:16.013376Z" } }, "outputs": [ @@ -1131,7 +1267,6 @@ "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", "'THETA' axis is stored as a scalar -- converting to 1D array.\n" @@ -1146,14 +1281,14 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 30, "id": "1ac16c51", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.308633Z", - "iopub.status.busy": "2024-03-27T11:26:45.308216Z", - "iopub.status.idle": "2024-03-27T11:26:45.313310Z", - "shell.execute_reply": "2024-03-27T11:26:45.312737Z" + "iopub.execute_input": "2024-08-30T13:44:16.015882Z", + "iopub.status.busy": "2024-08-30T13:44:16.015596Z", + "iopub.status.idle": "2024-08-30T13:44:16.020193Z", + "shell.execute_reply": "2024-08-30T13:44:16.019715Z" } }, "outputs": [ @@ -1161,30 +1296,29 @@ "data": { "text/html": [ "
Table length=11189\n", - "\n", + "
\n", "\n", "\n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", "
EVENT_IDTIMERADECENERGYPHASE
sdegdegTeV
int64float64float32float32float32float64
2402333778852.509924984.5945722.030880.181946010.39349195931383935
2408333778852.526715384.2146223.449140.083973940.8919526790064667
2434333778852.6131505483.52470422.7257920.105969320.4579789031294724
2445333778852.669014283.7695722.4510060.197334980.11641860219368935
2478333778852.762793983.47851623.4845940.085222190.9004806857711186
2481333778852.777854983.7151721.9851151.00209430.3476011689926769
2513333778852.864446782.42119622.5676520.143740680.9182740999289545
2544333778852.982606483.6413622.0413150.103166290.42611249421537956
2559333778853.026941484.06917622.973370.0471844930.7422975122115125
2402333778852.509924984.5945722.030880.181946010.3934918682770723
2408333778852.526715384.2146223.449140.083973940.8919525879696997
2434333778852.6131505483.52470422.7257920.105969320.45797881185987477
2445333778852.669014283.7695722.4510060.197334980.11641851092409164
2478333778852.762793983.47851623.4845940.085222190.900480594501521
2481333778852.777854983.7151721.9851151.00209430.34760107795590983
2513333778852.864446782.42119622.5676520.143740680.9182740088921875
2544333778852.982606483.6413622.0413150.103166290.42611240294578184
2559333778853.026941484.06917622.973370.0471844930.7422974209419148
..................
356222333780039.452039784.7448220.8949810.0433121620.4537121484157113
356223333780039.460049284.1161522.5575050.081100820.6914920486374702
356227333780039.4710536683.4153421.673440.20963620.018183944316962984
356242333780039.517909583.5516522.7729850.176728350.40920620046641115
356282333780039.6299751484.4613321.693570.050687180.7361270955486778
356473333780040.338647984.4544121.1598280.18315690.7746789518818565
356478333780040.354892683.6833623.4449880.063051690.2569398572226654
356485333780040.374132284.3351721.283380.0605397450.8281109722104576
356486333780040.375515984.8588622.1162220.1234537440.8691881135544401
356526333780040.5247600784.8692921.2909160.136301140.29983901925054285
356223333780039.460049284.1161522.5575050.081100820.6914919573678725
356227333780039.4710536683.4153421.673440.20963620.018183853280195963
356242333780039.517909583.5516522.7729850.176728350.4092061182772071
356282333780039.6299751484.4613321.693570.050687180.7361270045119108
356473333780040.338647984.4544121.1598280.18315690.7746788606122589
356478333780040.354892683.6833623.4449880.063051690.25693976618589837
356485333780040.374132284.3351721.283380.0605397450.8281108809408599
356486333780040.375515984.8588622.1162220.1234537440.8691880225176731
356526333780040.5247600784.8692921.2909160.136301140.29983892821377583
" ], "text/plain": [ @@ -1193,29 +1327,28 @@ " 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", + " 2402 333778852.5099249 84.59457 22.03088 0.18194601 0.3934918682770723\n", + " 2408 333778852.5267153 84.21462 23.44914 0.08397394 0.8919525879696997\n", + " 2434 333778852.61315054 83.524704 22.725792 0.10596932 0.45797881185987477\n", + " 2445 333778852.6690142 83.76957 22.451006 0.19733498 0.11641851092409164\n", + " 2478 333778852.7627939 83.478516 23.484594 0.08522219 0.900480594501521\n", + " 2481 333778852.7778549 83.71517 21.985115 1.0020943 0.34760107795590983\n", + " 2513 333778852.8644467 82.421196 22.567652 0.14374068 0.9182740088921875\n", + " 2544 333778852.9826064 83.64136 22.041315 0.10316629 0.42611240294578184\n", + " 2559 333778853.0269414 84.069176 22.97337 0.047184493 0.7422974209419148\n", " ... ... ... ... ... ...\n", - " 356222 333780039.4520397 84.74482 20.894981 0.043312162 0.4537121484157113\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" + " 356223 333780039.4600492 84.11615 22.557505 0.08110082 0.6914919573678725\n", + " 356227 333780039.47105366 83.41534 21.67344 0.2096362 0.018183853280195963\n", + " 356242 333780039.5179095 83.55165 22.772985 0.17672835 0.4092061182772071\n", + " 356282 333780039.62997514 84.46133 21.69357 0.05068718 0.7361270045119108\n", + " 356473 333780040.3386479 84.45441 21.159828 0.1831569 0.7746788606122589\n", + " 356478 333780040.3548926 83.68336 23.444988 0.06305169 0.25693976618589837\n", + " 356485 333780040.3741322 84.33517 21.28338 0.060539745 0.8281108809408599\n", + " 356486 333780040.3755159 84.85886 22.116222 0.123453744 0.8691880225176731\n", + " 356526 333780040.52476007 84.86929 21.290916 0.13630114 0.29983892821377583" ] }, - "execution_count": 27, + "execution_count": 30, "metadata": {}, "output_type": "execute_result" } @@ -1237,31 +1370,31 @@ "id": "e369d2dc", "metadata": {}, "source": [ - "In the following, we show how to write the files in a directory contained in the original datastore directory. This follows the logic of DL3 data store and facilitate the manipulation of the HDU table.\n", + "In the following, we show how to write the files in a directory contained in the original datastore directory. This follows the logic of DL3 data store and facilitates the manipulation of the HDU table.\n", "\n", - "If one does not want to save the events files and directly perform the pulsar analysis, this step is not required as well as the step of the meta data handling. However, be aware that for large dataset, the computation of phases can take tens of minutes. " + "If you do not want to save the events files bur rather directly perform the pulsar analysis, you can skip both this step and the step of the handling metadata. However, be aware that for large datasets, the computation of the phases can take tens of minutes." ] }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 31, "id": "f3c8410c", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.315528Z", - "iopub.status.busy": "2024-03-27T11:26:45.315188Z", - "iopub.status.idle": "2024-03-27T11:26:45.318777Z", - "shell.execute_reply": "2024-03-27T11:26:45.318308Z" + "iopub.execute_input": "2024-08-30T13:44:16.022167Z", + "iopub.status.busy": "2024-08-30T13:44:16.021883Z", + "iopub.status.idle": "2024-08-30T13:44:16.025164Z", + "shell.execute_reply": "2024-08-30T13:44:16.024650Z" } }, "outputs": [ { "data": { "text/plain": [ - "PosixPath('/home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.0.2/magic/rad_max/data')" + "PosixPath('/home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.2/magic/rad_max/data')" ] }, - "execution_count": 28, + "execution_count": 31, "metadata": {}, "output_type": "execute_result" } @@ -1272,14 +1405,14 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 32, "id": "8fd2ce31", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.320738Z", - "iopub.status.busy": "2024-03-27T11:26:45.320560Z", - "iopub.status.idle": "2024-03-27T11:26:45.323746Z", - "shell.execute_reply": "2024-03-27T11:26:45.323305Z" + "iopub.execute_input": "2024-08-30T13:44:16.027018Z", + "iopub.status.busy": "2024-08-30T13:44:16.026717Z", + "iopub.status.idle": "2024-08-30T13:44:16.029663Z", + "shell.execute_reply": "2024-08-30T13:44:16.029226Z" } }, "outputs": [], @@ -1296,24 +1429,24 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 33, "id": "e6e38fc1", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.325950Z", - "iopub.status.busy": "2024-03-27T11:26:45.325616Z", - "iopub.status.idle": "2024-03-27T11:26:45.329021Z", - "shell.execute_reply": "2024-03-27T11:26:45.328467Z" + "iopub.execute_input": "2024-08-30T13:44:16.031501Z", + "iopub.status.busy": "2024-08-30T13:44:16.031183Z", + "iopub.status.idle": "2024-08-30T13:44:16.034289Z", + "shell.execute_reply": "2024-08-30T13:44:16.033820Z" } }, "outputs": [ { "data": { "text/plain": [ - "'/home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.0.2/magic/rad_max/data/pulsar_events_file/'" + "'/home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.2/magic/rad_max/data/pulsar_events_file/'" ] }, - "execution_count": 30, + "execution_count": 33, "metadata": {}, "output_type": "execute_result" } @@ -1324,32 +1457,29 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 34, "id": "f339c797", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.331194Z", - "iopub.status.busy": "2024-03-27T11:26:45.330781Z", - "iopub.status.idle": "2024-03-27T11:26:45.489597Z", - "shell.execute_reply": "2024-03-27T11:26:45.488969Z" - }, - "scrolled": true + "iopub.execute_input": "2024-08-30T13:44:16.036030Z", + "iopub.status.busy": "2024-08-30T13:44:16.035881Z", + "iopub.status.idle": "2024-08-30T13:44:16.168565Z", + "shell.execute_reply": "2024-08-30T13:44:16.168088Z" + } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Writing outputfile in /home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.0.2/magic/rad_max/data/pulsar_events_file/dl3_pulsar_5029747.fits.gz\n" + "Writing output file in /home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.2/magic/rad_max/data/pulsar_events_file/dl3_pulsar_5029747.fits.gz\n" ] } ], "source": [ "# Save the observation object in the specified file_path\n", - "print(\"Writing outputfile in \" + str(file_path))\n", - "observation.events.write(\n", - " filename=file_path, gti=observation.gti, overwrite=True\n", - ")" + "print(\"Writing output file in \" + str(file_path))\n", + "new_obs.write(path=file_path, include_irfs=False, overwrite=True)" ] }, { @@ -1362,14 +1492,14 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 35, "id": "4b8dd431", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.492294Z", - "iopub.status.busy": "2024-03-27T11:26:45.491941Z", - "iopub.status.idle": "2024-03-27T11:26:45.497464Z", - "shell.execute_reply": "2024-03-27T11:26:45.496931Z" + "iopub.execute_input": "2024-08-30T13:44:16.170679Z", + "iopub.status.busy": "2024-08-30T13:44:16.170369Z", + "iopub.status.idle": "2024-08-30T13:44:16.175339Z", + "shell.execute_reply": "2024-08-30T13:44:16.174869Z" } }, "outputs": [ @@ -1377,7 +1507,7 @@ "data": { "text/html": [ "
HDUIndexTable length=10\n", - "\n", + "
\n", "\n", "\n", "\n", @@ -1409,7 +1539,7 @@ "5029747 edisp ... ENERGY DISPERSION" ] }, - "execution_count": 32, + "execution_count": 35, "metadata": {}, "output_type": "execute_result" } @@ -1422,34 +1552,36 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 36, "id": "6f37e101", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.499587Z", - "iopub.status.busy": "2024-03-27T11:26:45.499179Z", - "iopub.status.idle": "2024-03-27T11:26:45.502364Z", - "shell.execute_reply": "2024-03-27T11:26:45.501887Z" + "iopub.execute_input": "2024-08-30T13:44:16.177243Z", + "iopub.status.busy": "2024-08-30T13:44:16.176916Z", + "iopub.status.idle": "2024-08-30T13:44:16.179856Z", + "shell.execute_reply": "2024-08-30T13:44:16.179447Z" } }, "outputs": [], "source": [ "for entry in new_hdu:\n", - " if entry[\"HDU_NAME\"] == \"EVENTS\" and entry[\"OBS_ID\"] == observation.obs_id:\n", + " if (entry[\"HDU_NAME\"] == \"EVENTS\") and (\n", + " entry[\"OBS_ID\"] == observation.obs_id\n", + " ):\n", " entry[\"FILE_DIR\"] = \"./\" + str(output_directory)\n", " entry[\"FILE_NAME\"] = filename" ] }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 37, "id": "d89a7739", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.504469Z", - "iopub.status.busy": "2024-03-27T11:26:45.504078Z", - "iopub.status.idle": "2024-03-27T11:26:45.508565Z", - "shell.execute_reply": "2024-03-27T11:26:45.507988Z" + "iopub.execute_input": "2024-08-30T13:44:16.181702Z", + "iopub.status.busy": "2024-08-30T13:44:16.181410Z", + "iopub.status.idle": "2024-08-30T13:44:16.185572Z", + "shell.execute_reply": "2024-08-30T13:44:16.185152Z" } }, "outputs": [ @@ -1457,7 +1589,7 @@ "data": { "text/html": [ "
HDUIndexTable length=10\n", - "
OBS_IDHDU_TYPEHDU_CLASSFILE_DIRFILE_NAMEHDU_NAME
int64bytes30bytes30bytes100bytes50bytes30
5029748eventsevents./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsEVENTS
\n", + "
\n", "\n", "\n", "\n", @@ -1489,7 +1621,7 @@ "5029747 edisp ... ENERGY DISPERSION" ] }, - "execution_count": 34, + "execution_count": 37, "metadata": {}, "output_type": "execute_result" } @@ -1511,19 +1643,19 @@ "id": "e08bf493", "metadata": {}, "source": [ - "Finally, we need to save the new HDU table in the origianl DL3 directory. Here one should be very careful to not name the new HDU file with the same name as the original HDU file of the data store. Otherwise, the original HDU file will be overwrited. " + "Finally, we need to save the new HDU table in the original DL3 directory. One must be very careful with naming the new HDU file, such that it does not have the same name as the original HDU file of the data store. Otherwise, the original HDU file will be overwritten." ] }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 38, "id": "b1633cd5", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.510689Z", - "iopub.status.busy": "2024-03-27T11:26:45.510412Z", - "iopub.status.idle": "2024-03-27T11:26:45.521520Z", - "shell.execute_reply": "2024-03-27T11:26:45.520994Z" + "iopub.execute_input": "2024-08-30T13:44:16.187343Z", + "iopub.status.busy": "2024-08-30T13:44:16.187186Z", + "iopub.status.idle": "2024-08-30T13:44:16.197275Z", + "shell.execute_reply": "2024-08-30T13:44:16.196738Z" } }, "outputs": [], @@ -1538,7 +1670,7 @@ "id": "e92cf68c", "metadata": {}, "source": [ - "**Note: Here we use only one approach that could be useful, showing the steps to save the new Event files in a random directory and generate a new modified HDU index table. However, the user is free to chose the absolute path of the EventList and DataStore. For instance, another approach could be making a full copy of the DataStore, or changing the location of the pulsar event files to one that could be more convinient for the user.**" + "**Note: Here we demonstrate only one approach that could be useful, showing the steps to save the new Event files in a directory and generate a new modified HDU index table. However, the user is free to choose the absolute path of the EventList and DataStore. Another approach, for instance, could be making a full copy of the DataStore, or changing the location of the pulsar event files to one that is more convenient for the user.**" ] }, { @@ -1554,38 +1686,38 @@ "id": "e1036448", "metadata": {}, "source": [ - "Once all of this is done, we just have to open the data store using `DataStore.from_dir()`and passing the pulsar HDU table to it :" + "Once all of this is done, we just have to open the data store using DataStore.from_dir() and pass the pulsar HDU table to it :" ] }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 39, "id": "88a0e9c1", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.523852Z", - "iopub.status.busy": "2024-03-27T11:26:45.523517Z", - "iopub.status.idle": "2024-03-27T11:26:45.537115Z", - "shell.execute_reply": "2024-03-27T11:26:45.536595Z" + "iopub.execute_input": "2024-08-30T13:44:16.199418Z", + "iopub.status.busy": "2024-08-30T13:44:16.199114Z", + "iopub.status.idle": "2024-08-30T13:44:16.210872Z", + "shell.execute_reply": "2024-08-30T13:44:16.210389Z" } }, "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": 37, + "execution_count": 40, "id": "f7c60c18", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.539197Z", - "iopub.status.busy": "2024-03-27T11:26:45.538882Z", - "iopub.status.idle": "2024-03-27T11:26:45.543864Z", - "shell.execute_reply": "2024-03-27T11:26:45.543346Z" + "iopub.execute_input": "2024-08-30T13:44:16.213029Z", + "iopub.status.busy": "2024-08-30T13:44:16.212605Z", + "iopub.status.idle": "2024-08-30T13:44:16.217590Z", + "shell.execute_reply": "2024-08-30T13:44:16.217079Z" } }, "outputs": [ @@ -1595,7 +1727,7 @@ "['events', 'gti', 'aeff', 'edisp', 'rad_max']" ] }, - "execution_count": 37, + "execution_count": 40, "metadata": {}, "output_type": "execute_result" } @@ -1609,14 +1741,14 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 41, "id": "4ae8ebd2", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.545837Z", - "iopub.status.busy": "2024-03-27T11:26:45.545678Z", - "iopub.status.idle": "2024-03-27T11:26:45.559836Z", - "shell.execute_reply": "2024-03-27T11:26:45.559308Z" + "iopub.execute_input": "2024-08-30T13:44:16.219467Z", + "iopub.status.busy": "2024-08-30T13:44:16.219161Z", + "iopub.status.idle": "2024-08-30T13:44:16.233657Z", + "shell.execute_reply": "2024-08-30T13:44:16.233153Z" } }, "outputs": [ @@ -1624,61 +1756,59 @@ "data": { "text/html": [ "
Table length=11189\n", - "
OBS_IDHDU_TYPEHDU_CLASSFILE_DIRFILE_NAMEHDU_NAME
int64bytes30bytes30bytes100bytes50bytes30
5029748eventsevents./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsEVENTS
\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "
EVENT_IDTIMERADECENERGY
sdegdegTeV
int64float64float32float32float32
2402333778852.509924984.5945722.030880.18194601
2408333778852.526715384.2146223.449140.08397394
2434333778852.6131505483.52470422.7257920.10596932
2445333778852.669014283.7695722.4510060.19733498
2478333778852.762793983.47851623.4845940.08522219
2481333778852.777854983.7151721.9851151.0020943
2513333778852.864446782.42119622.5676520.14374068
2544333778852.982606483.6413622.0413150.10316629
2559333778853.026941484.06917622.973370.047184493
...............
356222333780039.452039784.7448220.8949810.043312162
356223333780039.460049284.1161522.5575050.08110082
356227333780039.4710536683.4153421.673440.2096362
356242333780039.517909583.5516522.7729850.17672835
356282333780039.6299751484.4613321.693570.05068718
356473333780040.338647984.4544121.1598280.1831569
356478333780040.354892683.6833623.4449880.06305169
356485333780040.374132284.3351721.283380.060539745
356486333780040.375515984.8588622.1162220.123453744
356526333780040.5247600784.8692921.2909160.13630114
\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", "
EVENT_IDTIMERADECENERGYPHASE
sdegdegTeV
int64float64float32float32float32float64
2402333778852.509924984.5945722.030880.181946010.3934918682770723
2408333778852.526715384.2146223.449140.083973940.8919525879696997
2434333778852.6131505483.52470422.7257920.105969320.45797881185987477
2445333778852.669014283.7695722.4510060.197334980.11641851092409164
2478333778852.762793983.47851623.4845940.085222190.900480594501521
2481333778852.777854983.7151721.9851151.00209430.34760107795590983
2513333778852.864446782.42119622.5676520.143740680.9182740088921875
2544333778852.982606483.6413622.0413150.103166290.42611240294578184
2559333778853.026941484.06917622.973370.0471844930.7422974209419148
..................
356223333780039.460049284.1161522.5575050.081100820.6914919573678725
356227333780039.4710536683.4153421.673440.20963620.018183853280195963
356242333780039.517909583.5516522.7729850.176728350.4092061182772071
356282333780039.6299751484.4613321.693570.050687180.7361270045119108
356473333780040.338647984.4544121.1598280.18315690.7746788606122589
356478333780040.354892683.6833623.4449880.063051690.25693976618589837
356485333780040.374132284.3351721.283380.0605397450.8281108809408599
356486333780040.375515984.8588622.1162220.1234537440.8691880225176731
356526333780040.5247600784.8692921.2909160.136301140.29983892821377583
" ], "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", - " 356222 333780039.4520397 84.74482 20.894981 0.043312162\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" + "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.3934918682770723\n", + " 2408 333778852.5267153 84.21462 23.44914 0.08397394 0.8919525879696997\n", + " 2434 333778852.61315054 83.524704 22.725792 0.10596932 0.45797881185987477\n", + " 2445 333778852.6690142 83.76957 22.451006 0.19733498 0.11641851092409164\n", + " 2478 333778852.7627939 83.478516 23.484594 0.08522219 0.900480594501521\n", + " 2481 333778852.7778549 83.71517 21.985115 1.0020943 0.34760107795590983\n", + " 2513 333778852.8644467 82.421196 22.567652 0.14374068 0.9182740088921875\n", + " 2544 333778852.9826064 83.64136 22.041315 0.10316629 0.42611240294578184\n", + " 2559 333778853.0269414 84.069176 22.97337 0.047184493 0.7422974209419148\n", + " ... ... ... ... ... ...\n", + " 356223 333780039.4600492 84.11615 22.557505 0.08110082 0.6914919573678725\n", + " 356227 333780039.47105366 83.41534 21.67344 0.2096362 0.018183853280195963\n", + " 356242 333780039.5179095 83.55165 22.772985 0.17672835 0.4092061182772071\n", + " 356282 333780039.62997514 84.46133 21.69357 0.05068718 0.7361270045119108\n", + " 356473 333780040.3386479 84.45441 21.159828 0.1831569 0.7746788606122589\n", + " 356478 333780040.3548926 83.68336 23.444988 0.06305169 0.25693976618589837\n", + " 356485 333780040.3741322 84.33517 21.28338 0.060539745 0.8281108809408599\n", + " 356486 333780040.3755159 84.85886 22.116222 0.123453744 0.8691880225176731\n", + " 356526 333780040.52476007 84.86929 21.290916 0.13630114 0.29983892821377583" ] }, - "execution_count": 38, + "execution_count": 41, "metadata": {}, "output_type": "execute_result" } @@ -1708,7 +1838,7 @@ "id": "1fe89d60", "metadata": {}, "source": [ - "Once we have the corret DataStore and the modified EventList with the phase information, we can do the pulsar analysis using different tools for Gammapy to compute the phaseogram, maps, SED, lightcurve, etc... To do so, one can check the following [Gammapy tutorial](https://docs.gammapy.org/1.0/tutorials/analysis-time/pulsar_analysis.html#sphx-glr-tutorials-analysis-time-pulsar-analysis-py)." + "Once we have the correct DataStore and the modified EventList with the phase information, we can perform the pulsar analysis using different tools available in Gammapy. Allowing us to compute the phaseogram, maps, SED, lightcurve and more. To do so, please refer to the following [Gammapy tutorial](https://docs.gammapy.org/1.0/tutorials/analysis-time/pulsar_analysis.html#sphx-glr-tutorials-analysis-time-pulsar-analysis-py)." ] }, { @@ -1737,7 +1867,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.19" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/docs/_build/html/_static/notebooks/pulsar_phase/pulsar_phase_computation.py b/docs/_build/html/_static/notebooks/pulsar_phase/pulsar_phase_computation.py index 24d1b10..5baea3b 100644 --- a/docs/_build/html/_static/notebooks/pulsar_phase/pulsar_phase_computation.py +++ b/docs/_build/html/_static/notebooks/pulsar_phase/pulsar_phase_computation.py @@ -5,16 +5,16 @@ # This notebook has been done for the following version of Gammapy and PINT: # -# Gammapy version : 1.0.1 +# Gammapy version : 1.2 # -# PINT version : 0.9.5 +# PINT version : 1.0 # This notebook shows how to compute and add the phase information into the events files of pulsar observations. This step is needed to perform the pulsar analysis with Gammapy and should be the first step in the high level analysis. For the pulsar analysis we need two ingredients: # # 1. The time of arrivals (TOAs). These times should have very high precision due to the common fast periods of pulsars. Usually these times are already stored in the EventList. For the computation of pulsar timing, times must be corrected in order to be referenced in the Solar System barycenter (SSB) because this system can nearly be regarded as an inertial reference frame with respect to the pulsar. # # -# 2. The model of rotation of the pulsar, also known as ephemeris, at the epoch of the observations. These ephemerides are stored in an specific format and saved as .par files and contain informations on the periods, derivatives of the periods, coordinates, glitches, etc. +# 2. The model of rotation of the pulsar, also known as ephemeris, at the epoch of the observations. These ephemerides are stored in a specific format and saved as .par files which contain the periods, derivatives of the periods, coordinates, glitches, etc. # # __For the following steps of this tutorial, we need the original EventLists from the DL3 files, and a model in .par format.__ # @@ -23,10 +23,10 @@ # ## 0. Dependencies and imports -# 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. +# To run this notebook, you must have Gammapy and PINT (see documentation above) installed in the same environment. We recommend installing Gammapy first and then installing PINT using your preferred package manager. # # -# `$ conda env create -n gammapy-pint -f gammapy-1.0-environment.yml` +# `$ conda env create -n gammapy-pint -f gammapy-pint-environment.yml` # # `$ conda activate gammapy-pint` # @@ -56,9 +56,12 @@ import numpy as np from pathlib import Path from gammapy.data import DataStore, EventList, Observation +import logging + +log = logging.getLogger(__name__) -# And we also need some imports from PINT: +# We also need some imports from PINT: # In[3]: @@ -69,20 +72,20 @@ # ## 1. Reading DataStore -# First we neeed to define the data sample. In this notebook we will use two runs from the MAGIC gammapy data sample available in https://github.com/gammapy/gammapy-data +# First we need to define the data sample. In this notebook we will use two runs from the MAGIC gammapy data sample available in https://github.com/gammapy/gammapy-data # In[4]: # Define the directory containing the DL3 data -DL3_direc = "$GAMMAPY_DATA/magic/rad_max/data" +DL3_dir = "$GAMMAPY_DATA/magic/rad_max/data" # In[5]: # Read DataStore from a directory -data_store = DataStore.from_dir(DL3_direc) +data_store = DataStore.from_dir(DL3_dir) # Let's run this tutorial for the Crab pulsar : @@ -90,9 +93,7 @@ # In[6]: -target_pos = SkyCoord( - ra=083.6331144560900, dec=+22.0144871383400, unit="deg", frame="icrs" -) +target_pos = SkyCoord(ra=083.633, dec=+22.014, unit="deg", frame="icrs") # In[7]: @@ -149,24 +150,26 @@ print(times) -# Now we have the TOAs of the events in the system of the telescope. Please note that the actual precision of the times is higher than the diplayed output (and we really need this precision for the pulsar analysis!). In the next step, the timing in the SSB and the phase for each TOA has to be created. +# Now we have the TOAs for the events in the system of the telescope. Please note: the actual precision of the times is higher than the displayed output (and we really need this precision for the pulsar analysis!). In the next step, the timing in the SSB and the phase for each TOA has to be created. # ## 2.1 An ephemeris file from Fermi-LAT data. -# In order to compute the phases of a pulsar, one needs an ephemeris file, usually store as a .par file. +# In order to compute the phases of a pulsar, one needs an ephemeris file, typically stored as a .par file. # # 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). # -# 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, it is important to note that many of the ephemeris files are not up-to-date. Therefore, they could give bad results on the phase computation. In particular, you should always check that the MJD of the observations one wants to phase lies between the `START` and `FINISH` entries of the ephemeris file (see next section). # In[13]: # Path to the ephemeris file -ephemeris_file = "./0534+2200_ApJ_708_1254_2010.par" +ephemeris_file = "0534+2200_ApJ_708_1254_2010.par" -# 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 files 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 features from Tempo2. +# +# In our case, an error occurs when using the ephemeris file with PINT. This is due to the `JUMP` line. To proceed, simply comment out the line (with #) or remove it. Note that this line is not important for the gamma-ray instruments, so it is acceptable to disregard it. # ## 2.2 Computing pulsar phases @@ -185,21 +188,69 @@ print(model.components["Spindown"]) -# 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. Check the [PINT documentation](https://nanograv-pint.readthedocs.io) for a list of additional parameters. To obtain the complete set of parameters from the ephemeris file, one can simply print the model: +# `print(model)` -# Now we can compute the phases. For that, we define a list of TOA objects that are the main object of PINT. +# As mentioned previously, we should ensure 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: # In[15]: -get_ipython().run_cell_magic('time', '', '\n# Put these to True is your observatory has clock correction files.\n# If it is set to True but your observatory does not have clock correction files, it will be ignored.\ninclude_bipm = False\ninclude_gps = False\n\n# Set this to True or False depending on your ephemeris file.\n# Here we can see that the \'PLANET_SHAPIRO\' entry is \'N\' so we set it to True.\nplanets = False\n\n# Create a TOA object for each time\ntoas = toa.get_TOAs_array(\n times=times,\n obs="magic",\n errors=1 * u.microsecond,\n ephem="DE421",\n include_gps=include_gps,\n include_bipm=include_bipm,\n planets=planets,\n)') +print( + f"Ephemeris time definition:\n{model.START.value} - {model.FINISH.value}" +) +print( + f"Observation time definition:\n{observation.tstart} - {observation.tstop}" +) -# Once we have the TOAs object and the model, the phases are easily computed using the model.phase() method. Note that the phases are computed in the interval [-0.5,0.5]. Most of the times, we use the phases in the interval [0,1] so we have to shift the negative ones. +# If you have several observations that 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 create a small function like the following one: # In[16]: +def check_time(observation, timing_model): + """ + Check that the observation time lies within the time definition of the pulsar + timing model. + + Parameters + ---------- + observation: `gammapy.data.Observation` + Observation to check. + timing_model: `pint.models.TimingModel` + The timing model that will be used. + """ + model_time = Time( + [model.START.value, model.FINISH.value], scale="tt", format="mjd" + ) + if (model_time[0].value > observation.tstart.tt.mjd) or ( + model_time[1].value < observation.tstop.tt.mjd + ): + log.warning( + f"Warning: Observation time of observation {observation.obs_id} goes out of timing model validity time." + ) + + +# In[17]: + + +check_time(observation, model) + + +# Now we can compute the phases. For that, we define a list of TOA objects that are the main object of PINT. + +# In[18]: + + +get_ipython().run_cell_magic('time', '', '\n# Set these to True is your observatory has clock correction files.\n# If it is set to True but your observatory does not have clock correction files, it will be ignored.\ninclude_bipm = False\ninclude_gps = False\n\n# Set this to True or False depending on your ephemeris file.\n# Here we can see that the \'PLANET_SHAPIRO\' entry is \'N\' so we set it to True.\nplanets = False\n\n# Create a TOA object for each time\ntoas = toa.get_TOAs_array(\n times=times,\n obs="magic",\n errors=1 * u.microsecond,\n ephem="DE421",\n include_gps=include_gps,\n include_bipm=include_bipm,\n planets=planets,\n)') + + +# Once we have the TOAs object and the model, the phases are easily computed using the model.phase() method. Note that the phases are computed in the interval [-0.5,0.5]. Most of the time, we use the phases in the interval [0,1] so we have to shift the negative ones. + +# In[19]: + + # Compute phases phases = model.phase(toas, abs_phase=True)[1] @@ -211,21 +262,21 @@ # Once the phases are computed we need to create a new EventList table that includes both the original information of the events and the phase information in extra columns. This is necessary for Gammapy to read the phases and use them as an extra variable of each event. -# In[17]: +# In[20]: # Extract the table of the EventList table = observation.events.table -# In[18]: +# In[21]: # Show original table -print(table) +table -# In[19]: +# In[22]: # Add a column for the phases to the table @@ -234,7 +285,7 @@ # Note that you can add multiple columns to a same file, only the name of the column has to be unique, eg `table['PHASE_SRC1']`, `table['PHASE_SRC2']` etc" -# In[20]: +# In[23]: # Show table with phases @@ -243,17 +294,17 @@ # Now we can see that the 'PHASE' column has been added to the table -# At this point, we also want to add meta data to the table. It is very useful to keep track of what has been done to the file. For instance, if we have multiple pulsars in the same file, we want to be able to know quickly which column correspond to which pulsar. Moreover, experience shows that one often use different ephemeris file for the same pulsar. Therefore, it is very useful to have several phase columns in the same file and to be able to know which column correspond to which ephemeris file, parameters, etc. +# At this point, we also want to add metadata to the table. It is very useful to keep track of what has been done to the file. For instance, if a file contains multiple pulsars, we want identify quickly which column corresponds to each pulsar. Moreover, experience has shown that it is common to have different ephemeris files for the same pulsar. Therefore, it is useful to have several phase columns in the same file to easily identify which column corresponds to each ephemeris file, parameters, etc. # -# Since there is not yet a "standard" format for such metadata, we propose a template for the essential informations that one wants to save in the header of the event file. First, we look at the present meta info on the table. +# Since there is currently no "standard" format for such metadata, we propose a template for the essential information that one wants to save in the header of the event file. First, we look at the present meta info on the table. -# In[21]: +# In[24]: table.meta -# In[22]: +# In[25]: def get_log(ephemeris_file, phase_column_name="PHASE"): @@ -292,21 +343,21 @@ def get_log(ephemeris_file, phase_column_name="PHASE"): ) -# In[23]: +# In[26]: phase_log = get_log(ephemeris_file=ephemeris_file, phase_column_name="PHASE") print(phase_log) -# In[24]: +# In[27]: # Add the generated string to the meta data of the table table.meta["PH_LOG"] = phase_log -# In[25]: +# In[28]: table.meta @@ -314,7 +365,7 @@ def get_log(ephemeris_file, phase_column_name="PHASE"): # Once this is done, we can put back the table in a new `EventList` object and in a new `Observation` object. -# In[26]: +# In[29]: # Create new event list and add it to observation object @@ -322,7 +373,7 @@ def get_log(ephemeris_file, phase_column_name="PHASE"): new_obs = observation.copy(in_memory=True, events=new_event_list) -# In[27]: +# In[30]: new_obs.events.table @@ -330,17 +381,17 @@ def get_log(ephemeris_file, phase_column_name="PHASE"): # ## 4. Save new Event List and writing a modify HDU index table -# In the following, we show how to write the files in a directory contained in the original datastore directory. This follows the logic of DL3 data store and facilitate the manipulation of the HDU table. +# In the following, we show how to write the files in a directory contained in the original datastore directory. This follows the logic of DL3 data store and facilitates the manipulation of the HDU table. # -# If one does not want to save the events files and directly perform the pulsar analysis, this step is not required as well as the step of the meta data handling. However, be aware that for large dataset, the computation of phases can take tens of minutes. +# If you do not want to save the events files bur rather directly perform the pulsar analysis, you can skip both this step and the step of the handling metadata. However, be aware that for large datasets, the computation of the phases can take tens of minutes. -# In[28]: +# In[31]: data_store.hdu_table.base_dir -# In[29]: +# In[32]: # Define output directory and filename @@ -353,25 +404,23 @@ def get_log(ephemeris_file, phase_column_name="PHASE"): Path(output_path).mkdir(parents=True, exist_ok=True) -# In[30]: +# In[33]: output_path -# In[31]: +# In[34]: # Save the observation object in the specified file_path -print("Writing outputfile in " + str(file_path)) -observation.events.write( - filename=file_path, gti=observation.gti, overwrite=True -) +print("Writing output file in " + str(file_path)) +new_obs.write(path=file_path, include_irfs=False, overwrite=True) # Once the file has been written, we want to write a modified version of the HDU table. This is mandatory if we want to open the phased events file together with its associated IRFs. -# In[32]: +# In[35]: # Print the current data store HDU table. @@ -379,16 +428,18 @@ def get_log(ephemeris_file, phase_column_name="PHASE"): new_hdu -# In[33]: +# In[36]: for entry in new_hdu: - if entry["HDU_NAME"] == "EVENTS" and entry["OBS_ID"] == observation.obs_id: + if (entry["HDU_NAME"] == "EVENTS") and ( + entry["OBS_ID"] == observation.obs_id + ): entry["FILE_DIR"] = "./" + str(output_directory) entry["FILE_NAME"] = filename -# In[34]: +# In[37]: new_hdu @@ -396,9 +447,9 @@ def get_log(ephemeris_file, phase_column_name="PHASE"): # We see that the `FILE_DIR`and `FILE_NAME`entry have been modified for our phased events file. -# Finally, we need to save the new HDU table in the origianl DL3 directory. Here one should be very careful to not name the new HDU file with the same name as the original HDU file of the data store. Otherwise, the original HDU file will be overwrited. +# Finally, we need to save the new HDU table in the original DL3 directory. One must be very careful with naming the new HDU file, such that it does not have the same name as the original HDU file of the data store. Otherwise, the original HDU file will be overwritten. -# In[35]: +# In[38]: new_hdu.write( @@ -406,21 +457,21 @@ def get_log(ephemeris_file, phase_column_name="PHASE"): ) -# **Note: Here we use only one approach that could be useful, showing the steps to save the new Event files in a random directory and generate a new modified HDU index table. However, the user is free to chose the absolute path of the EventList and DataStore. For instance, another approach could be making a full copy of the DataStore, or changing the location of the pulsar event files to one that could be more convinient for the user.** +# **Note: Here we demonstrate only one approach that could be useful, showing the steps to save the new Event files in a directory and generate a new modified HDU index table. However, the user is free to choose the absolute path of the EventList and DataStore. Another approach, for instance, could be making a full copy of the DataStore, or changing the location of the pulsar event files to one that is more convenient for the user.** # ## 5. Opening the new DataStore -# Once all of this is done, we just have to open the data store using `DataStore.from_dir()`and passing the pulsar HDU table to it : +# Once all of this is done, we just have to open the data store using DataStore.from_dir() and pass the pulsar HDU table to it : -# In[36]: +# In[39]: pulsar_datastore = DataStore.from_dir( - DL3_direc, hdu_table_filename="hdu-index-pulsar.fits.gz" + DL3_dir, hdu_table_filename="hdu-index-pulsar.fits.gz" ) -# In[37]: +# In[40]: observations = pulsar_datastore.get_observations( @@ -429,7 +480,7 @@ def get_log(ephemeris_file, phase_column_name="PHASE"): observations[0].available_hdus -# In[38]: +# In[41]: observations[0].events.table @@ -439,7 +490,7 @@ def get_log(ephemeris_file, phase_column_name="PHASE"): # ## 6. Pulsar analysis tools with gammapy -# Once we have the corret DataStore and the modified EventList with the phase information, we can do the pulsar analysis using different tools for Gammapy to compute the phaseogram, maps, SED, lightcurve, etc... To do so, one can check the following [Gammapy tutorial](https://docs.gammapy.org/1.0/tutorials/analysis-time/pulsar_analysis.html#sphx-glr-tutorials-analysis-time-pulsar-analysis-py). +# Once we have the correct DataStore and the modified EventList with the phase information, we can perform the pulsar analysis using different tools available in Gammapy. Allowing us to compute the phaseogram, maps, SED, lightcurve and more. To do so, please refer to the following [Gammapy tutorial](https://docs.gammapy.org/1.0/tutorials/analysis-time/pulsar_analysis.html#sphx-glr-tutorials-analysis-time-pulsar-analysis-py). # # Recipe made by [Alvaros Mas](https://github.com/alvmas), [Maxime Regeard](https://github.com/MRegeard), [Jan Lukas Schubert](https://github.com/jalu98). diff --git a/docs/_build/html/_static/searchtools.js b/docs/_build/html/_static/searchtools.js index 92da3f8..b08d58c 100644 --- a/docs/_build/html/_static/searchtools.js +++ b/docs/_build/html/_static/searchtools.js @@ -178,7 +178,7 @@ const Search = { htmlToText: (htmlString, anchor) => { const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html'); - for (const removalQuery of [".headerlinks", "script", "style"]) { + for (const removalQuery of [".headerlink", "script", "style"]) { htmlElement.querySelectorAll(removalQuery).forEach((el) => { el.remove() }); } if (anchor) { @@ -328,13 +328,14 @@ const Search = { for (const [title, foundTitles] of Object.entries(allTitles)) { if (title.toLowerCase().trim().includes(queryLower) && (queryLower.length >= title.length/2)) { for (const [file, id] of foundTitles) { - let score = Math.round(100 * queryLower.length / title.length) + const score = Math.round(Scorer.title * queryLower.length / title.length); + const boost = titles[file] === title ? 1 : 0; // add a boost for document titles normalResults.push([ docNames[file], titles[file] !== title ? `${titles[file]} > ${title}` : title, id !== null ? "#" + id : "", null, - score, + score + boost, filenames[file], ]); } diff --git a/docs/_build/html/_static/sg_gallery.css b/docs/_build/html/_static/sg_gallery.css index 7222783..9bcd33c 100644 --- a/docs/_build/html/_static/sg_gallery.css +++ b/docs/_build/html/_static/sg_gallery.css @@ -178,23 +178,44 @@ thumbnail with its default link Background color */ max-height: 112px; max-width: 160px; } -.sphx-glr-thumbcontainer[tooltip]:hover:after { - background: var(--sg-tooltip-background); + +.sphx-glr-thumbcontainer[tooltip]::before { + content: ""; + position: absolute; + pointer-events: none; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 97; + background-color: var(--sg-tooltip-background); + backdrop-filter: blur(3px); + opacity: 0; + transition: opacity 0.3s; +} + +.sphx-glr-thumbcontainer[tooltip]:hover::before { + opacity: 1; +} + +.sphx-glr-thumbcontainer[tooltip]:hover::after { -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; color: var(--sg-tooltip-foreground); content: attr(tooltip); - padding: 10px; + padding: 10px 10px 5px; z-index: 98; width: 100%; - height: 100%; + max-height: 100%; position: absolute; pointer-events: none; top: 0; box-sizing: border-box; overflow: hidden; - backdrop-filter: blur(3px); + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 6; } .sphx-glr-script-out { @@ -283,6 +304,10 @@ div.sphx-glr-download a:hover { background-color: var(--sg-download-a-hover-background-color); } +div.sphx-glr-sidebar-item img { + max-height: 20px; +} + .sphx-glr-example-title:target::before { display: block; content: ""; diff --git a/docs/_build/html/contributing.html b/docs/_build/html/contributing.html index 4a363f8..fa1ad9e 100644 --- a/docs/_build/html/contributing.html +++ b/docs/_build/html/contributing.html @@ -8,7 +8,7 @@ - + diff --git a/docs/_build/html/genindex.html b/docs/_build/html/genindex.html index e9511f9..e502d1d 100644 --- a/docs/_build/html/genindex.html +++ b/docs/_build/html/genindex.html @@ -7,7 +7,7 @@ - + diff --git a/docs/_build/html/index.html b/docs/_build/html/index.html index de93125..4ce6290 100644 --- a/docs/_build/html/index.html +++ b/docs/_build/html/index.html @@ -8,8 +8,8 @@ - - + + diff --git a/docs/_build/html/notebooks/background-model/background_model.html b/docs/_build/html/notebooks/background-model/background_model.html index bcac921..ea8f11c 100644 --- a/docs/_build/html/notebooks/background-model/background_model.html +++ b/docs/_build/html/notebooks/background-model/background_model.html @@ -8,8 +8,8 @@ - - + + diff --git a/docs/_build/html/notebooks/dark-matter-utilities/astro_dark_matter.html b/docs/_build/html/notebooks/dark-matter-utilities/astro_dark_matter.html index 040c2d8..edfcb6d 100644 --- a/docs/_build/html/notebooks/dark-matter-utilities/astro_dark_matter.html +++ b/docs/_build/html/notebooks/dark-matter-utilities/astro_dark_matter.html @@ -8,8 +8,8 @@ - - + + diff --git a/docs/_build/html/notebooks/interactive-model-editing/interactive-model-editing.html b/docs/_build/html/notebooks/interactive-model-editing/interactive-model-editing.html index d4cf99a..1ca42dd 100644 --- a/docs/_build/html/notebooks/interactive-model-editing/interactive-model-editing.html +++ b/docs/_build/html/notebooks/interactive-model-editing/interactive-model-editing.html @@ -8,8 +8,8 @@ - - + + diff --git a/docs/_build/html/notebooks/mcmc-sampling-emcee/mcmc_sampling.html b/docs/_build/html/notebooks/mcmc-sampling-emcee/mcmc_sampling.html index 8c79ef3..c916ee5 100644 --- a/docs/_build/html/notebooks/mcmc-sampling-emcee/mcmc_sampling.html +++ b/docs/_build/html/notebooks/mcmc-sampling-emcee/mcmc_sampling.html @@ -8,8 +8,8 @@ - - + + @@ -171,7 +171,7 @@

How does it work ?\(Index=2.0\), \(Norm=5\times10^{-12}\) cm\(^{-2}\) s\(^{-1}\) TeV\(^{-1}\), \(Lambda =(1/Ecut) = 0.02\) TeV\(^{-1}\) (50 TeV) for 20 hours.

The results that you can get from a MCMC analysis will look like this :

-

e5dc3c781e14443faaf958883a411840

+

045380d242904313b552197ef947198b

On the first two top panels, we show the pseudo-random walk of one walker from an offset starting value to see it evolve to a better solution. In the bottom right panel, we show the trace of each 16 walkers for 500 runs (the chain described previsouly). For the first 100 runs, the parameter evolve towards a solution (can be viewed as a fitting step). Then they explore the local minimum for 400 runs which will be used to estimate the parameters correlations and errors. The choice of the Nburn value (when walkers have reached a stationary stage) can be done by eye but you can also look at the autocorrelation time.

diff --git a/docs/_build/html/notebooks/pulsar_phase/pulsar_phase_computation.html b/docs/_build/html/notebooks/pulsar_phase/pulsar_phase_computation.html index 1c7298b..e82ccf4 100644 --- a/docs/_build/html/notebooks/pulsar_phase/pulsar_phase_computation.html +++ b/docs/_build/html/notebooks/pulsar_phase/pulsar_phase_computation.html @@ -8,8 +8,8 @@ - - + + @@ -161,19 +161,19 @@

Phase computation for pulsar using PINT

This notebook has been done for the following version of Gammapy and PINT:

-

Gammapy version : 1.0.1

-

PINT version : 0.9.5

+

Gammapy version : 1.2

+

PINT version : 1.0

This notebook shows how to compute and add the phase information into the events files of pulsar observations. This step is needed to perform the pulsar analysis with Gammapy and should be the first step in the high level analysis. For the pulsar analysis we need two ingredients:

  1. The time of arrivals (TOAs). These times should have very high precision due to the common fast periods of pulsars. Usually these times are already stored in the EventList. For the computation of pulsar timing, times must be corrected in order to be referenced in the Solar System barycenter (SSB) because this system can nearly be regarded as an inertial reference frame with respect to the pulsar.

  2. -
  3. The model of rotation of the pulsar, also known as ephemeris, at the epoch of the observations. These ephemerides are stored in an specific format and saved as .par files and contain informations on the periods, derivatives of the periods, coordinates, glitches, etc.

  4. +
  5. The model of rotation of the pulsar, also known as ephemeris, at the epoch of the observations. These ephemerides are stored in a specific format and saved as .par files which contain the periods, derivatives of the periods, coordinates, glitches, etc.

For the following steps of this tutorial, we need the original EventLists from the DL3 files, and a model in .par format.

The main software that we will use to make the barycentric corrections and the phase-folding to the model is the PINT python library, Luo J., Ransom S. et al., 2021, ASCL. For more information about this package, see PINT documentation.

0. Dependencies and imports

-

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.

-

$ conda env create -n gammapy-pint -f gammapy-1.0-environment.yml

+

To run this notebook, you must have Gammapy and PINT (see documentation above) installed in the same environment. We recommend installing Gammapy first and then installing PINT using your preferred package manager.

+

$ conda env create -n gammapy-pint -f gammapy-pint-environment.yml

$ conda activate gammapy-pint

$ pip install pint-pulsar

Alternatively, one can also run the yaml environement file provided in the folder of this notebook:

@@ -195,8 +195,8 @@

0. Dependencies and imports
-Gammapy version : 1.0.2
-PINT version : 0.9.8
+Gammapy version : 1.2
+PINT version : 1.0.1
 
-

And we also need some imports from PINT:

+

We also need some imports from PINT:

[3]:
 
@@ -225,13 +228,13 @@

0. Dependencies and imports

1. Reading DataStore

-

First we neeed to define the data sample. In this notebook we will use two runs from the MAGIC gammapy data sample available in https://github.com/gammapy/gammapy-data

+

First we need to define the data sample. In this notebook we will use two runs from the MAGIC gammapy data sample available in https://github.com/gammapy/gammapy-data

[4]:
 
# Define the directory containing the DL3 data
-DL3_direc = "$GAMMAPY_DATA/magic/rad_max/data"
+DL3_dir = "$GAMMAPY_DATA/magic/rad_max/data"
 
@@ -240,7 +243,7 @@

1. Reading DataStore

# Read DataStore from a directory
-data_store = DataStore.from_dir(DL3_direc)
+data_store = DataStore.from_dir(DL3_dir)
 
@@ -249,9 +252,7 @@

1. Reading DataStore
[6]:
 
-
target_pos = SkyCoord(
-    ra=083.6331144560900, dec=+22.0144871383400, unit="deg", frame="icrs"
-)
+
target_pos = SkyCoord(ra=083.633, dec=+22.014, unit="deg", frame="icrs")
 
@@ -359,23 +360,24 @@

2. Phase-folding with PINT for one observation

2.1 An ephemeris file from Fermi-LAT data.

-

In order to compute the phases of a pulsar, one needs an ephemeris file, usually store as a .par file.

+

In order to compute the phases of a pulsar, one needs an ephemeris file, typically stored as a .par file.

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. This ephemeris file for the Crab pulsar can be found alongside other pulsar ephemeris files at this confluence page.

-

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 STARTand FINISHentry of the ephemeris file.

+

However, it is important to note that many of the ephemeris files are not up-to-date. Therefore, they could give bad results on the phase computation. In particular, you should always check that the MJD of the observations one wants to phase lies between the START and FINISH entries of the ephemeris file (see next section).

[13]:
 
# Path to the ephemeris file
-ephemeris_file = "./0534+2200_ApJ_708_1254_2010.par"
+ephemeris_file = "0534+2200_ApJ_708_1254_2010.par"
 
-

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 files are created primarily by and for 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 features from Tempo2.

+

In our case, an error occurs when using the ephemeris file with PINT. This is due to the JUMP line. To proceed, simply comment out the line (with #) or remove it. Note that this line is not important for the gamma-ray instruments, so it is acceptable to disregard it.

2.2 Computing pulsar phases

@@ -399,10 +401,10 @@

2.2 Computing pulsar phases
-2024-03-27 11:26:26.901 | INFO     | pint.models.absolute_phase:validate:74 - TZRFRQ was 0.0 or None. Setting to infinite frequency.
-/usr/share/miniconda3/envs/gammapy-recipes/lib/python3.9/site-packages/pint/models/model_builder.py:198: UserWarning: Unrecognized parfile line 'EPHVER 5'
+2024-08-30 13:43:54.870 | INFO     | pint.models.absolute_phase:validate:77 - TZRFRQ was 0.0 or None. Setting to infinite frequency.
+/home/runner/miniconda3/envs/gammapy-recipes/lib/python3.11/site-packages/pint/models/model_builder.py:230: UserWarning: Unrecognized parfile line 'EPHVER 5'
   warnings.warn(f"Unrecognized parfile line '{p_line}'", UserWarning)
-2024-03-27 11:26:26.903 | WARNING  | pint.models.model_builder:__call__:202 - UNITS is not specified. Assuming TDB...
+2024-08-30 13:43:54.872 | WARNING  | pint.models.model_builder:__call__:234 - UNITS is not specified. Assuming TDB...
 
@@ -435,15 +437,77 @@

2.2 Computing pulsar phasesPINT documentation

-

Now we can compute the phases. For that, we define a list of TOA objects that are the main object of PINT.

+

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. Check the PINT documentation for a list of additional parameters. To obtain the complete set of parameters from the ephemeris file, one can simply print the model: print(model)

+

As mentioned previously, we should ensure 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:

[15]:
 
+
print(
+    f"Ephemeris time definition:\n{model.START.value} - {model.FINISH.value}"
+)
+print(
+    f"Observation time definition:\n{observation.tstart} - {observation.tstop}"
+)
+
+
+
+
+
+
+
+
+Ephemeris time definition:
+54686.1526259 - 56583.1591704
+Observation time definition:
+56569.18112772242 - 56569.19487901596
+
+
+

If you have several observations that 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 create a small function like the following one:

+
+
[16]:
+
+
+
def check_time(observation, timing_model):
+    """
+    Check that the observation time lies within the time definition of the pulsar
+    timing model.
+
+    Parameters
+    ----------
+    observation: `gammapy.data.Observation`
+        Observation to check.
+    timing_model: `pint.models.TimingModel`
+        The timing model that will be used.
+    """
+    model_time = Time(
+        [model.START.value, model.FINISH.value], scale="tt", format="mjd"
+    )
+    if (model_time[0].value > observation.tstart.tt.mjd) or (
+        model_time[1].value < observation.tstop.tt.mjd
+    ):
+        log.warning(
+            f"Warning: Observation time of observation {observation.obs_id} goes out of timing model validity time."
+        )
+
+
+
+
+
[17]:
+
+
+
check_time(observation, model)
+
+
+
+

Now we can compute the phases. For that, we define a list of TOA objects that are the main object of PINT.

+
+
[18]:
+
+
%%time
 
-# Put these to True is your observatory has clock correction files.
+# Set these to True is your observatory has clock correction files.
 # If it is set to True but your observatory does not have clock correction files, it will be ignored.
 include_bipm = False
 include_gps = False
@@ -470,16 +534,23 @@ 

2.2 Computing pulsar phases
-2024-03-27 11:26:27.247 | DEBUG    | pint.toa:__init__:1358 - No pulse number flags found in the TOAs
-2024-03-27 11:26:27.263 | DEBUG    | pint.toa:apply_clock_corrections:2200 - Applying clock corrections (include_gps = False, include_bipm = False)
-2024-03-27 11:26:27.923 | INFO     | pint.observatory.topo_obs:clock_corrections:365 - Observatory magic requires no clock corrections.
-2024-03-27 11:26:31.192 | DEBUG    | pint.toa:compute_TDBs:2251 - Computing TDB columns.
-2024-03-27 11:26:31.193 | DEBUG    | pint.toa:compute_TDBs:2272 - Using EPHEM = DE421 for TDB calculation.
-2024-03-27 11:26:32.378 | DEBUG    | pint.toa:compute_posvels:2350 - Computing PosVels of observatories and Earth, using DE421
-2024-03-27 11:26:33.420 | INFO     | pint.solar_system_ephemerides:_load_kernel_link:55 - Set solar system ephemeris to de421 from download
-2024-03-27 11:26:44.359 | DEBUG    | pint.toa:compute_posvels:2403 - SSB obs pos [1.47007462e+11 2.56889811e+10 1.11245045e+10] m
-2024-03-27 11:26:44.587 | INFO     | pint.solar_system_ephemerides:_load_kernel_link:55 - Set solar system ephemeris to de421 from download
-2024-03-27 11:26:44.593 | DEBUG    | pint.toa:compute_posvels:2417 - Adding columns ssb_obs_pos ssb_obs_vel obs_sun_pos
+2024-08-30 13:43:55.618 | DEBUG    | pint.toa:__init__:1377 - No pulse number flags found in the TOAs
+2024-08-30 13:43:55.633 | DEBUG    | pint.toa:apply_clock_corrections:2224 - Applying clock corrections (include_bipm = False)
+2024-08-30 13:43:56.294 | INFO     | pint.observatory:gps_correction:248 - Applying GPS to UTC clock correction (~few nanoseconds)
+2024-08-30 13:43:56.294 | DEBUG    | pint.observatory:_load_gps_clock:122 - Loading global GPS clock file
+2024-08-30 13:43:56.297 | INFO     | pint.observatory.global_clock_corrections:get_file:128 - File index.txt to be downloaded due to download policy if_expired: https://raw.githubusercontent.com/ipta/pulsar-clock-corrections/main/index.txt
+2024-08-30 13:43:56.451 | DEBUG    | pint.observatory.clock_file:__init__:812 - Global clock file gps2utc.clk saving kwargs={'bogus_last_correction': False, 'valid_beyond_ends': False}
+2024-08-30 13:43:56.452 | INFO     | pint.observatory.global_clock_corrections:get_file:128 - File T2runtime/clock/gps2utc.clk to be downloaded due to download policy if_missing: https://raw.githubusercontent.com/ipta/pulsar-clock-corrections/main/T2runtime/clock/gps2utc.clk
+2024-08-30 13:43:56.668 | DEBUG    | pint.observatory.clock_file:read_tempo2_clock_file:463 - Loading TEMPO2-format observatory clock correction file gps2utc.clk (/home/runner/.astropy/cache/download/url/d3c81b5766f4bfb84e65504c8a453085/contents) with bogus_last_correction=False
+2024-08-30 13:43:56.687 | INFO     | pint.observatory:find_clock_file:994 - Using global clock file for gps2utc.clk with bogus_last_correction=False
+2024-08-30 13:43:56.689 | INFO     | pint.observatory.topo_obs:clock_corrections:354 - Observatory magic requires no clock corrections.
+2024-08-30 13:43:59.900 | DEBUG    | pint.toa:compute_TDBs:2270 - Computing TDB columns.
+2024-08-30 13:43:59.901 | DEBUG    | pint.toa:compute_TDBs:2291 - Using EPHEM = DE421 for TDB calculation.
+2024-08-30 13:44:00.968 | DEBUG    | pint.toa:compute_posvels:2371 - Computing PosVels of observatories and Earth, using DE421
+2024-08-30 13:44:02.516 | INFO     | pint.solar_system_ephemerides:_load_kernel_link:55 - Set solar system ephemeris to de421 from download
+2024-08-30 13:44:15.633 | DEBUG    | pint.toa:compute_posvels:2424 - SSB obs pos [1.47007462e+11 2.56889811e+10 1.11245045e+10] m
+2024-08-30 13:44:15.688 | INFO     | pint.solar_system_ephemerides:_load_kernel_link:55 - Set solar system ephemeris to de421 from download
+2024-08-30 13:44:15.694 | DEBUG    | pint.toa:compute_posvels:2438 - Adding columns ssb_obs_pos ssb_obs_vel obs_sun_pos
 

-

Once we have the TOAs object and the model, the phases are easily computed using the model.phase() method. Note that the phases are computed in the interval [-0.5,0.5]. Most of the times, we use the phases in the interval [0,1] so we have to shift the negative ones.

+

Once we have the TOAs object and the model, the phases are easily computed using the model.phase() method. Note that the phases are computed in the interval [-0.5,0.5]. Most of the time, we use the phases in the interval [0,1] so we have to shift the negative ones.

-
[16]:
+
[19]:
 
# Compute phases
@@ -509,19 +580,19 @@ 

2.2 Computing pulsar phases
-2024-03-27 11:26:44.636 | DEBUG    | pint.models.glitch:glitch_phase:213 - Glitch phase for glitch 1: 0.0 
-2024-03-27 11:26:44.640 | DEBUG    | pint.models.absolute_phase:get_TZR_toa:98 - Creating and dealing with the single TZR_toa for absolute phase
-2024-03-27 11:26:44.646 | DEBUG    | pint.toa:__init__:1358 - No pulse number flags found in the TOAs
-2024-03-27 11:26:44.646 | DEBUG    | pint.toa:apply_clock_corrections:2200 - Applying clock corrections (include_gps = False, include_bipm = False)
-2024-03-27 11:26:44.648 | DEBUG    | pint.toa:compute_TDBs:2251 - Computing TDB columns.
-2024-03-27 11:26:44.648 | DEBUG    | pint.toa:compute_TDBs:2272 - Using EPHEM = DE421 for TDB calculation.
-2024-03-27 11:26:44.651 | DEBUG    | pint.toa:compute_posvels:2350 - Computing PosVels of observatories and Earth, using DE421
-2024-03-27 11:26:44.929 | INFO     | pint.solar_system_ephemerides:_load_kernel_link:55 - Set solar system ephemeris to de421 from download
-2024-03-27 11:26:44.931 | DEBUG    | pint.toa:compute_posvels:2403 - SSB obs pos [-1.49278181e+08  7.07659442e+06  3.07113250e+06] km
-2024-03-27 11:26:45.150 | INFO     | pint.solar_system_ephemerides:_load_kernel_link:55 - Set solar system ephemeris to de421 from download
-2024-03-27 11:26:45.176 | DEBUG    | pint.toa:compute_posvels:2417 - Adding columns ssb_obs_pos ssb_obs_vel obs_sun_pos
-2024-03-27 11:26:45.177 | DEBUG    | pint.models.absolute_phase:get_TZR_toa:121 - Done with TZR_toa
-2024-03-27 11:26:45.188 | DEBUG    | pint.models.glitch:glitch_phase:213 - Glitch phase for glitch 1: 0.0 
+2024-08-30 13:44:15.729 | DEBUG    | pint.models.glitch:glitch_phase:221 - Glitch phase for glitch 1: 0.0 
+2024-08-30 13:44:15.735 | DEBUG    | pint.models.absolute_phase:get_TZR_toa:100 - Creating and dealing with the single TZR_toa for absolute phase
+2024-08-30 13:44:15.738 | DEBUG    | pint.toa:__init__:1377 - No pulse number flags found in the TOAs
+2024-08-30 13:44:15.738 | DEBUG    | pint.toa:apply_clock_corrections:2224 - Applying clock corrections (include_bipm = False)
+2024-08-30 13:44:15.760 | DEBUG    | pint.toa:compute_TDBs:2270 - Computing TDB columns.
+2024-08-30 13:44:15.761 | DEBUG    | pint.toa:compute_TDBs:2291 - Using EPHEM = DE421 for TDB calculation.
+2024-08-30 13:44:15.764 | DEBUG    | pint.toa:compute_posvels:2371 - Computing PosVels of observatories and Earth, using DE421
+2024-08-30 13:44:15.834 | INFO     | pint.solar_system_ephemerides:_load_kernel_link:55 - Set solar system ephemeris to de421 from download
+2024-08-30 13:44:15.836 | DEBUG    | pint.toa:compute_posvels:2424 - SSB obs pos [-1.49278181e+08  7.07659442e+06  3.07113250e+06] km
+2024-08-30 13:44:15.907 | INFO     | pint.solar_system_ephemerides:_load_kernel_link:55 - Set solar system ephemeris to de421 from download
+2024-08-30 13:44:15.908 | DEBUG    | pint.toa:compute_posvels:2438 - Adding columns ssb_obs_pos ssb_obs_vel obs_sun_pos
+2024-08-30 13:44:15.909 | DEBUG    | pint.models.absolute_phase:get_TZR_toa:121 - Done with TZR_toa
+2024-08-30 13:44:15.916 | DEBUG    | pint.models.glitch:glitch_phase:221 - Glitch phase for glitch 1: 0.0 
 

@@ -529,7 +600,7 @@

2.2 Computing pulsar phases

Once the phases are computed we need to create a new EventList table that includes both the original information of the events and the phase information in extra columns. This is necessary for Gammapy to read the phases and use them as an extra variable of each event.

-
[17]:
+
[20]:
 
# Extract the table of the EventList
@@ -538,48 +609,47 @@ 

3. Adding phases and metadata to an EventList and put it in a new Observatio

-
[18]:
+
[21]:
 
# Show original table
-print(table)
+table
 
-
+
[21]:
+
-
-
-EVENT_ID        TIME            RA       DEC       ENERGY
-                 s             deg       deg        TeV
--------- ------------------ --------- --------- -----------
-    2402  333778852.5099249  84.59457  22.03088  0.18194601
-    2408  333778852.5267153  84.21462  23.44914  0.08397394
-    2434 333778852.61315054 83.524704 22.725792  0.10596932
-    2445  333778852.6690142  83.76957 22.451006  0.19733498
-    2478  333778852.7627939 83.478516 23.484594  0.08522219
-    2481  333778852.7778549  83.71517 21.985115   1.0020943
-    2513  333778852.8644467 82.421196 22.567652  0.14374068
-    2544  333778852.9826064  83.64136 22.041315  0.10316629
-    2559  333778853.0269414 84.069176  22.97337 0.047184493
-    2561  333778853.0339344  84.84237 22.175398 0.118843034
-     ...                ...       ...       ...         ...
-  356222  333780039.4520397  84.74482 20.894981 0.043312162
-  356223  333780039.4600492  84.11615 22.557505  0.08110082
-  356227 333780039.47105366  83.41534  21.67344   0.2096362
-  356242  333780039.5179095  83.55165 22.772985  0.17672835
-  356282 333780039.62997514  84.46133  21.69357  0.05068718
-  356473  333780040.3386479  84.45441 21.159828   0.1831569
-  356478  333780040.3548926  83.68336 23.444988  0.06305169
-  356485  333780040.3741322  84.33517  21.28338 0.060539745
-  356486  333780040.3755159  84.85886 22.116222 0.123453744
-  356526 333780040.52476007  84.86929 21.290916  0.13630114
-Length = 11189 rows
-
+
+
Table length=11189 +

+ + + + + + + + + + + + + + + + + + + + + + +
EVENT_IDTIMERADECENERGY
sdegdegTeV
int64float64float32float32float32
2402333778852.509924984.5945722.030880.18194601
2408333778852.526715384.2146223.449140.08397394
2434333778852.6131505483.52470422.7257920.10596932
2445333778852.669014283.7695722.4510060.19733498
2478333778852.762793983.47851623.4845940.08522219
2481333778852.777854983.7151721.9851151.0020943
2513333778852.864446782.42119622.5676520.14374068
2544333778852.982606483.6413622.0413150.10316629
2559333778853.026941484.06917622.973370.047184493
...............
356223333780039.460049284.1161522.5575050.08110082
356227333780039.4710536683.4153421.673440.2096362
356242333780039.517909583.5516522.7729850.17672835
356282333780039.6299751484.4613321.693570.05068718
356473333780040.338647984.4544121.1598280.1831569
356478333780040.354892683.6833623.4449880.06305169
356485333780040.374132284.3351721.283380.060539745
356486333780040.375515984.8588622.1162220.123453744
356526333780040.5247600784.8692921.2909160.13630114
-
[19]:
+
[22]:
 
# Add a column for the phases to the table
@@ -589,7 +659,7 @@ 

3. Adding phases and metadata to an EventList and put it in a new Observatio

Note that you can add multiple columns to a same file, only the name of the column has to be unique, eg table['PHASE_SRC1'], table['PHASE_SRC2'] etc”

-
[20]:
+
[23]:
 
# Show table with phases
@@ -598,43 +668,42 @@ 

3. Adding phases and metadata to an EventList and put it in a new Observatio

-
[20]:
+
[23]:
 
Table length=11189 - +
- - - - - - - - - + + + + + + + + + - - - - - - - - - - + + + + + + + + +
EVENT_IDTIMERADECENERGYPHASE
sdegdegTeV
int64float64float32float32float32float64
2402333778852.509924984.5945722.030880.181946010.39349195931383935
2408333778852.526715384.2146223.449140.083973940.8919526790064667
2434333778852.6131505483.52470422.7257920.105969320.4579789031294724
2445333778852.669014283.7695722.4510060.197334980.11641860219368935
2478333778852.762793983.47851623.4845940.085222190.9004806857711186
2481333778852.777854983.7151721.9851151.00209430.3476011689926769
2513333778852.864446782.42119622.5676520.143740680.9182740999289545
2544333778852.982606483.6413622.0413150.103166290.42611249421537956
2559333778853.026941484.06917622.973370.0471844930.7422975122115125
2402333778852.509924984.5945722.030880.181946010.3934918682770723
2408333778852.526715384.2146223.449140.083973940.8919525879696997
2434333778852.6131505483.52470422.7257920.105969320.45797881185987477
2445333778852.669014283.7695722.4510060.197334980.11641851092409164
2478333778852.762793983.47851623.4845940.085222190.900480594501521
2481333778852.777854983.7151721.9851151.00209430.34760107795590983
2513333778852.864446782.42119622.5676520.143740680.9182740088921875
2544333778852.982606483.6413622.0413150.103166290.42611240294578184
2559333778853.026941484.06917622.973370.0471844930.7422974209419148
..................
356222333780039.452039784.7448220.8949810.0433121620.4537121484157113
356223333780039.460049284.1161522.5575050.081100820.6914920486374702
356227333780039.4710536683.4153421.673440.20963620.018183944316962984
356242333780039.517909583.5516522.7729850.176728350.40920620046641115
356282333780039.6299751484.4613321.693570.050687180.7361270955486778
356473333780040.338647984.4544121.1598280.18315690.7746789518818565
356478333780040.354892683.6833623.4449880.063051690.2569398572226654
356485333780040.374132284.3351721.283380.0605397450.8281109722104576
356486333780040.375515984.8588622.1162220.1234537440.8691881135544401
356526333780040.5247600784.8692921.2909160.136301140.29983901925054285
356223333780039.460049284.1161522.5575050.081100820.6914919573678725
356227333780039.4710536683.4153421.673440.20963620.018183853280195963
356242333780039.517909583.5516522.7729850.176728350.4092061182772071
356282333780039.6299751484.4613321.693570.050687180.7361270045119108
356473333780040.338647984.4544121.1598280.18315690.7746788606122589
356478333780040.354892683.6833623.4449880.063051690.25693976618589837
356485333780040.374132284.3351721.283380.0605397450.8281108809408599
356486333780040.375515984.8588622.1162220.1234537440.8691880225176731
356526333780040.5247600784.8692921.2909160.136301140.29983892821377583

Now we can see that the ‘PHASE’ column has been added to the table

-

At this point, we also want to add meta data to the table. It is very useful to keep track of what has been done to the file. For instance, if we have multiple pulsars in the same file, we want to be able to know quickly which column correspond to which pulsar. Moreover, experience shows that one often use different ephemeris file for the same pulsar. Therefore, it is very useful to have several phase columns in the same file and to be able to know which column correspond to which ephemeris -file, parameters, etc.

-

Since there is not yet a “standard” format for such metadata, we propose a template for the essential informations that one wants to save in the header of the event file. First, we look at the present meta info on the table.

+

At this point, we also want to add metadata to the table. It is very useful to keep track of what has been done to the file. For instance, if a file contains multiple pulsars, we want identify quickly which column corresponds to each pulsar. Moreover, experience has shown that it is common to have different ephemeris files for the same pulsar. Therefore, it is useful to have several phase columns in the same file to easily identify which column corresponds to each ephemeris file, parameters, +etc.

+

Since there is currently no “standard” format for such metadata, we propose a template for the essential information that one wants to save in the header of the event file. First, we look at the present meta info on the table.

-
[21]:
+
[24]:
 
table.meta
@@ -642,7 +711,7 @@ 

3. Adding phases and metadata to an EventList and put it in a new Observatio

-
[21]:
+
[24]:
 
@@ -685,7 +754,7 @@

3. Adding phases and metadata to an EventList and put it in a new Observatio

-
[22]:
+
[25]:
 
def get_log(ephemeris_file, phase_column_name="PHASE"):
@@ -726,7 +795,7 @@ 

3. Adding phases and metadata to an EventList and put it in a new Observatio

-
[23]:
+
[26]:
 
phase_log = get_log(ephemeris_file=ephemeris_file, phase_column_name="PHASE")
@@ -739,11 +808,11 @@ 

3. Adding phases and metadata to an EventList and put it in a new Observatio

-COLUMN_PHASE: PHASE; PINT_VERS: 0.9.8; GAMMAPY_VERS: 1.0.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: 60396.4769125122;
+COLUMN_PHASE: PHASE; PINT_VERS: 1.0.1; 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: 60552.572407022526;
 
-
[24]:
+
[27]:
 
# Add the generated string to the meta data of the table
@@ -752,7 +821,7 @@ 

3. Adding phases and metadata to an EventList and put it in a new Observatio

-
[25]:
+
[28]:
 
table.meta
@@ -760,7 +829,7 @@ 

3. Adding phases and metadata to an EventList and put it in a new Observatio

-
[25]:
+
[28]:
 
@@ -801,12 +870,12 @@

3. Adding phases and metadata to an EventList and put it in a new Observatio ('ALT_PNT', 69.69974), ('AZ_PNT', 103.8848), ('PH_LOG', - 'COLUMN_PHASE: PHASE; PINT_VERS: 0.9.8; GAMMAPY_VERS: 1.0.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: 60396.4769125122;')]) + 'COLUMN_PHASE: PHASE; PINT_VERS: 1.0.1; 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: 60552.572407022526;')])

Once this is done, we can put back the table in a new EventList object and in a new Observation object.

-
[26]:
+
[29]:
 
# Create new event list and add it to observation object
@@ -823,11 +892,10 @@ 

3. Adding phases and metadata to an EventList and put it in a new Observatio 'THETA' axis is stored as a scalar -- converting to 1D array. 'THETA' axis is stored as a scalar -- converting to 1D array. 'THETA' axis is stored as a scalar -- converting to 1D array. -'THETA' axis is stored as a scalar -- converting to 1D array.

-
[27]:
+
[30]:
 
new_obs.events.table
@@ -835,44 +903,43 @@ 

3. Adding phases and metadata to an EventList and put it in a new Observatio

-
[27]:
+
[30]:
 
Table length=11189 - +
- - - - - - - - - + + + + + + + + + - - - - - - - - - - + + + + + + + + +
EVENT_IDTIMERADECENERGYPHASE
sdegdegTeV
int64float64float32float32float32float64
2402333778852.509924984.5945722.030880.181946010.39349195931383935
2408333778852.526715384.2146223.449140.083973940.8919526790064667
2434333778852.6131505483.52470422.7257920.105969320.4579789031294724
2445333778852.669014283.7695722.4510060.197334980.11641860219368935
2478333778852.762793983.47851623.4845940.085222190.9004806857711186
2481333778852.777854983.7151721.9851151.00209430.3476011689926769
2513333778852.864446782.42119622.5676520.143740680.9182740999289545
2544333778852.982606483.6413622.0413150.103166290.42611249421537956
2559333778853.026941484.06917622.973370.0471844930.7422975122115125
2402333778852.509924984.5945722.030880.181946010.3934918682770723
2408333778852.526715384.2146223.449140.083973940.8919525879696997
2434333778852.6131505483.52470422.7257920.105969320.45797881185987477
2445333778852.669014283.7695722.4510060.197334980.11641851092409164
2478333778852.762793983.47851623.4845940.085222190.900480594501521
2481333778852.777854983.7151721.9851151.00209430.34760107795590983
2513333778852.864446782.42119622.5676520.143740680.9182740088921875
2544333778852.982606483.6413622.0413150.103166290.42611240294578184
2559333778853.026941484.06917622.973370.0471844930.7422974209419148
..................
356222333780039.452039784.7448220.8949810.0433121620.4537121484157113
356223333780039.460049284.1161522.5575050.081100820.6914920486374702
356227333780039.4710536683.4153421.673440.20963620.018183944316962984
356242333780039.517909583.5516522.7729850.176728350.40920620046641115
356282333780039.6299751484.4613321.693570.050687180.7361270955486778
356473333780040.338647984.4544121.1598280.18315690.7746789518818565
356478333780040.354892683.6833623.4449880.063051690.2569398572226654
356485333780040.374132284.3351721.283380.0605397450.8281109722104576
356486333780040.375515984.8588622.1162220.1234537440.8691881135544401
356526333780040.5247600784.8692921.2909160.136301140.29983901925054285
356223333780039.460049284.1161522.5575050.081100820.6914919573678725
356227333780039.4710536683.4153421.673440.20963620.018183853280195963
356242333780039.517909583.5516522.7729850.176728350.4092061182772071
356282333780039.6299751484.4613321.693570.050687180.7361270045119108
356473333780040.338647984.4544121.1598280.18315690.7746788606122589
356478333780040.354892683.6833623.4449880.063051690.25693976618589837
356485333780040.374132284.3351721.283380.0605397450.8281108809408599
356486333780040.375515984.8588622.1162220.1234537440.8691880225176731
356526333780040.5247600784.8692921.2909160.136301140.29983892821377583

4. Save new Event List and writing a modify HDU index table

-

In the following, we show how to write the files in a directory contained in the original datastore directory. This follows the logic of DL3 data store and facilitate the manipulation of the HDU table.

-

If one does not want to save the events files and directly perform the pulsar analysis, this step is not required as well as the step of the meta data handling. However, be aware that for large dataset, the computation of phases can take tens of minutes.

+

In the following, we show how to write the files in a directory contained in the original datastore directory. This follows the logic of DL3 data store and facilitates the manipulation of the HDU table.

+

If you do not want to save the events files bur rather directly perform the pulsar analysis, you can skip both this step and the step of the handling metadata. However, be aware that for large datasets, the computation of the phases can take tens of minutes.

-
[28]:
+
[31]:
 
data_store.hdu_table.base_dir
@@ -880,16 +947,16 @@ 

4. Save new Event List and writing a modify HDU index table -
[28]:
+
[31]:
 
-PosixPath('/home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.0.2/magic/rad_max/data')
+PosixPath('/home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.2/magic/rad_max/data')
 
-
[29]:
+
[32]:
 
# Define output directory and filename
@@ -904,7 +971,7 @@ 

4. Save new Event List and writing a modify HDU index table -
[30]:
+
[33]:
 
output_path
@@ -912,23 +979,21 @@ 

4. Save new Event List and writing a modify HDU index table -
[30]:
+
[33]:
 
-'/home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.0.2/magic/rad_max/data/pulsar_events_file/'
+'/home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.2/magic/rad_max/data/pulsar_events_file/'
 

Once the file has been written, we want to write a modified version of the HDU table. This is mandatory if we want to open the phased events file together with its associated IRFs.

-
[32]:
+
[35]:
 
# Print the current data store HDU table.
@@ -952,12 +1017,12 @@ 

4. Save new Event List and writing a modify HDU index table -
[32]:
+
[35]:
 
HDUIndexTable length=10 - +
@@ -973,18 +1038,20 @@

4. Save new Event List and writing a modify HDU index table -

OBS_IDHDU_TYPEHDU_CLASSFILE_DIRFILE_NAMEHDU_NAME
int64bytes30bytes30bytes100bytes50bytes30
5029748eventsevents./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsEVENTS
+
@@ -1013,9 +1080,9 @@

4. Save new Event List and writing a modify HDU index tableFILE_DIRand FILE_NAMEentry have been modified for our phased events file.

-

Finally, we need to save the new HDU table in the origianl DL3 directory. Here one should be very careful to not name the new HDU file with the same name as the original HDU file of the data store. Otherwise, the original HDU file will be overwrited.

+

Finally, we need to save the new HDU table in the original DL3 directory. One must be very careful with naming the new HDU file, such that it does not have the same name as the original HDU file of the data store. Otherwise, the original HDU file will be overwritten.

OBS_IDHDU_TYPEHDU_CLASSFILE_DIRFILE_NAMEHDU_NAME
int64bytes30bytes30bytes100bytes50bytes30
5029748eventsevents./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsEVENTS
- - - - - - - - - - - - - - - - - - - - - - - +
EVENT_IDTIMERADECENERGY
sdegdegTeV
int64float64float32float32float32
2402333778852.509924984.5945722.030880.18194601
2408333778852.526715384.2146223.449140.08397394
2434333778852.6131505483.52470422.7257920.10596932
2445333778852.669014283.7695722.4510060.19733498
2478333778852.762793983.47851623.4845940.08522219
2481333778852.777854983.7151721.9851151.0020943
2513333778852.864446782.42119622.5676520.14374068
2544333778852.982606483.6413622.0413150.10316629
2559333778853.026941484.06917622.973370.047184493
...............
356222333780039.452039784.7448220.8949810.043312162
356223333780039.460049284.1161522.5575050.08110082
356227333780039.4710536683.4153421.673440.2096362
356242333780039.517909583.5516522.7729850.17672835
356282333780039.6299751484.4613321.693570.05068718
356473333780040.338647984.4544121.1598280.1831569
356478333780040.354892683.6833623.4449880.06305169
356485333780040.374132284.3351721.283380.060539745
356486333780040.375515984.8588622.1162220.123453744
356526333780040.5247600784.8692921.2909160.13630114
+ + + + + + + + + + + + + + + + + + + + + +
EVENT_IDTIMERADECENERGYPHASE
sdegdegTeV
int64float64float32float32float32float64
2402333778852.509924984.5945722.030880.181946010.3934918682770723
2408333778852.526715384.2146223.449140.083973940.8919525879696997
2434333778852.6131505483.52470422.7257920.105969320.45797881185987477
2445333778852.669014283.7695722.4510060.197334980.11641851092409164
2478333778852.762793983.47851623.4845940.085222190.900480594501521
2481333778852.777854983.7151721.9851151.00209430.34760107795590983
2513333778852.864446782.42119622.5676520.143740680.9182740088921875
2544333778852.982606483.6413622.0413150.103166290.42611240294578184
2559333778853.026941484.06917622.973370.0471844930.7422974209419148
..................
356223333780039.460049284.1161522.5575050.081100820.6914919573678725
356227333780039.4710536683.4153421.673440.20963620.018183853280195963
356242333780039.517909583.5516522.7729850.176728350.4092061182772071
356282333780039.6299751484.4613321.693570.050687180.7361270045119108
356473333780040.338647984.4544121.1598280.18315690.7746788606122589
356478333780040.354892683.6833623.4449880.063051690.25693976618589837
356485333780040.374132284.3351721.283380.0605397450.8281108809408599
356486333780040.375515984.8588622.1162220.1234537440.8691880225176731
356526333780040.5247600784.8692921.2909160.136301140.29983892821377583

We can see that we recover both the IRFs and the events file with the phase column.

6. Pulsar analysis tools with gammapy

-

Once we have the corret DataStore and the modified EventList with the phase information, we can do the pulsar analysis using different tools for Gammapy to compute the phaseogram, maps, SED, lightcurve, etc… To do so, one can check the following Gammapy tutorial.

+

Once we have the correct DataStore and the modified EventList with the phase information, we can perform the pulsar analysis using different tools available in Gammapy. Allowing us to compute the phaseogram, maps, SED, lightcurve and more. To do so, please refer to the following Gammapy tutorial.

Recipe made by Alvaros Mas, Maxime Regeard, Jan Lukas Schubert.

diff --git a/docs/_build/html/notebooks/pulsar_phase/pulsar_phase_computation.ipynb b/docs/_build/html/notebooks/pulsar_phase/pulsar_phase_computation.ipynb index 1c6f2f9..c355b6c 100644 --- a/docs/_build/html/notebooks/pulsar_phase/pulsar_phase_computation.ipynb +++ b/docs/_build/html/notebooks/pulsar_phase/pulsar_phase_computation.ipynb @@ -33,9 +33,9 @@ "source": [ "This notebook has been done for the following version of Gammapy and PINT:\n", "\n", - "Gammapy version : 1.0.1\n", + "Gammapy version : 1.2\n", "\n", - "PINT version : 0.9.5" + "PINT version : 1.0" ] }, { @@ -48,7 +48,7 @@ "1. The time of arrivals (TOAs). These times should have very high precision due to the common fast periods of pulsars. Usually these times are already stored in the EventList. For the computation of pulsar timing, times must be corrected in order to be referenced in the Solar System barycenter (SSB) because this system can nearly be regarded as an inertial reference frame with respect to the pulsar.\n", "\n", "\n", - "2. The model of rotation of the pulsar, also known as ephemeris, at the epoch of the observations. These ephemerides are stored in an specific format and saved as .par files and contain informations on the periods, derivatives of the periods, coordinates, glitches, etc.\n", + "2. The model of rotation of the pulsar, also known as ephemeris, at the epoch of the observations. These ephemerides are stored in a specific format and saved as .par files which contain the periods, derivatives of the periods, coordinates, glitches, etc.\n", "\n", "__For the following steps of this tutorial, we need the original EventLists from the DL3 files, and a model in .par format.__\n", "\n", @@ -69,10 +69,10 @@ "id": "a9c72d26", "metadata": {}, "source": [ - "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", + "To run this notebook, you must have Gammapy and PINT (see documentation above) installed in the same environment. We recommend installing Gammapy first and then installing PINT using your preferred 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", @@ -95,10 +95,10 @@ "id": "b68d2444", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:25.357930Z", - "iopub.status.busy": "2024-03-27T11:26:25.357759Z", - "iopub.status.idle": "2024-03-27T11:26:25.831345Z", - "shell.execute_reply": "2024-03-27T11:26:25.830742Z" + "iopub.execute_input": "2024-08-30T13:43:53.336099Z", + "iopub.status.busy": "2024-08-30T13:43:53.335935Z", + "iopub.status.idle": "2024-08-30T13:43:53.836216Z", + "shell.execute_reply": "2024-08-30T13:43:53.835669Z" } }, "outputs": [ @@ -106,8 +106,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "Gammapy version : 1.0.2\n", - "PINT version : 0.9.8\n" + "Gammapy version : 1.2\n", + "PINT version : 1.0.1\n" ] } ], @@ -125,10 +125,10 @@ "id": "e61b5e3e", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:25.833998Z", - "iopub.status.busy": "2024-03-27T11:26:25.833639Z", - "iopub.status.idle": "2024-03-27T11:26:26.506462Z", - "shell.execute_reply": "2024-03-27T11:26:26.505816Z" + "iopub.execute_input": "2024-08-30T13:43:53.838441Z", + "iopub.status.busy": "2024-08-30T13:43:53.838106Z", + "iopub.status.idle": "2024-08-30T13:43:54.626040Z", + "shell.execute_reply": "2024-08-30T13:43:54.625476Z" } }, "outputs": [], @@ -138,7 +138,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__)" ] }, { @@ -146,7 +149,7 @@ "id": "81ae3a58", "metadata": {}, "source": [ - "And we also need some imports from PINT:" + "We also need some imports from PINT:" ] }, { @@ -155,10 +158,10 @@ "id": "22ac4aea", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.509540Z", - "iopub.status.busy": "2024-03-27T11:26:26.509079Z", - "iopub.status.idle": "2024-03-27T11:26:26.624488Z", - "shell.execute_reply": "2024-03-27T11:26:26.623985Z" + "iopub.execute_input": "2024-08-30T13:43:54.628537Z", + "iopub.status.busy": "2024-08-30T13:43:54.628244Z", + "iopub.status.idle": "2024-08-30T13:43:54.656522Z", + "shell.execute_reply": "2024-08-30T13:43:54.655994Z" } }, "outputs": [], @@ -180,7 +183,7 @@ "id": "b486ec45", "metadata": {}, "source": [ - "First we neeed to define the data sample. In this notebook we will use two runs from the MAGIC gammapy data sample available in https://github.com/gammapy/gammapy-data" + "First we need to define the data sample. In this notebook we will use two runs from the MAGIC gammapy data sample available in https://github.com/gammapy/gammapy-data" ] }, { @@ -189,16 +192,16 @@ "id": "d0e182bb", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.627105Z", - "iopub.status.busy": "2024-03-27T11:26:26.626738Z", - "iopub.status.idle": "2024-03-27T11:26:26.629431Z", - "shell.execute_reply": "2024-03-27T11:26:26.628877Z" + "iopub.execute_input": "2024-08-30T13:43:54.658921Z", + "iopub.status.busy": "2024-08-30T13:43:54.658599Z", + "iopub.status.idle": "2024-08-30T13:43:54.660775Z", + "shell.execute_reply": "2024-08-30T13:43:54.660345Z" } }, "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\"" ] }, { @@ -207,16 +210,16 @@ "id": "b5019a42", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.631734Z", - "iopub.status.busy": "2024-03-27T11:26:26.631306Z", - "iopub.status.idle": "2024-03-27T11:26:26.646554Z", - "shell.execute_reply": "2024-03-27T11:26:26.646010Z" + "iopub.execute_input": "2024-08-30T13:43:54.662674Z", + "iopub.status.busy": "2024-08-30T13:43:54.662366Z", + "iopub.status.idle": "2024-08-30T13:43:54.676462Z", + "shell.execute_reply": "2024-08-30T13:43:54.675957Z" } }, "outputs": [], "source": [ "# Read DataStore from a directory\n", - "data_store = DataStore.from_dir(DL3_direc)" + "data_store = DataStore.from_dir(DL3_dir)" ] }, { @@ -233,17 +236,15 @@ "id": "9ba16fcc", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.648835Z", - "iopub.status.busy": "2024-03-27T11:26:26.648528Z", - "iopub.status.idle": "2024-03-27T11:26:26.651855Z", - "shell.execute_reply": "2024-03-27T11:26:26.651323Z" + "iopub.execute_input": "2024-08-30T13:43:54.678608Z", + "iopub.status.busy": "2024-08-30T13:43:54.678236Z", + "iopub.status.idle": "2024-08-30T13:43:54.681323Z", + "shell.execute_reply": "2024-08-30T13:43:54.680828Z" } }, "outputs": [], "source": [ - "target_pos = SkyCoord(\n", - " ra=083.6331144560900, dec=+22.0144871383400, unit=\"deg\", frame=\"icrs\"\n", - ")" + "target_pos = SkyCoord(ra=083.633, dec=+22.014, unit=\"deg\", frame=\"icrs\")" ] }, { @@ -252,10 +253,10 @@ "id": "06bda835", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.654049Z", - "iopub.status.busy": "2024-03-27T11:26:26.653646Z", - "iopub.status.idle": "2024-03-27T11:26:26.660513Z", - "shell.execute_reply": "2024-03-27T11:26:26.659953Z" + "iopub.execute_input": "2024-08-30T13:43:54.683221Z", + "iopub.status.busy": "2024-08-30T13:43:54.682910Z", + "iopub.status.idle": "2024-08-30T13:43:54.687923Z", + "shell.execute_reply": "2024-08-30T13:43:54.687497Z" } }, "outputs": [], @@ -276,10 +277,10 @@ "id": "f96ccf30", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.662615Z", - "iopub.status.busy": "2024-03-27T11:26:26.662199Z", - "iopub.status.idle": "2024-03-27T11:26:26.665420Z", - "shell.execute_reply": "2024-03-27T11:26:26.664873Z" + "iopub.execute_input": "2024-08-30T13:43:54.689878Z", + "iopub.status.busy": "2024-08-30T13:43:54.689440Z", + "iopub.status.idle": "2024-08-30T13:43:54.692452Z", + "shell.execute_reply": "2024-08-30T13:43:54.691937Z" } }, "outputs": [ @@ -313,10 +314,10 @@ "id": "fa6e36d5", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.667386Z", - "iopub.status.busy": "2024-03-27T11:26:26.667228Z", - "iopub.status.idle": "2024-03-27T11:26:26.670890Z", - "shell.execute_reply": "2024-03-27T11:26:26.670425Z" + "iopub.execute_input": "2024-08-30T13:43:54.694439Z", + "iopub.status.busy": "2024-08-30T13:43:54.694155Z", + "iopub.status.idle": "2024-08-30T13:43:54.699214Z", + "shell.execute_reply": "2024-08-30T13:43:54.698826Z" } }, "outputs": [], @@ -332,10 +333,10 @@ "id": "dec2c1a5", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.673075Z", - "iopub.status.busy": "2024-03-27T11:26:26.672669Z", - "iopub.status.idle": "2024-03-27T11:26:26.780999Z", - "shell.execute_reply": "2024-03-27T11:26:26.780438Z" + "iopub.execute_input": "2024-08-30T13:43:54.701143Z", + "iopub.status.busy": "2024-08-30T13:43:54.700820Z", + "iopub.status.idle": "2024-08-30T13:43:54.755258Z", + "shell.execute_reply": "2024-08-30T13:43:54.754750Z" } }, "outputs": [ @@ -384,10 +385,10 @@ "id": "2756e72d", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.783640Z", - "iopub.status.busy": "2024-03-27T11:26:26.783173Z", - "iopub.status.idle": "2024-03-27T11:26:26.799711Z", - "shell.execute_reply": "2024-03-27T11:26:26.799261Z" + "iopub.execute_input": "2024-08-30T13:43:54.757339Z", + "iopub.status.busy": "2024-08-30T13:43:54.757008Z", + "iopub.status.idle": "2024-08-30T13:43:54.770138Z", + "shell.execute_reply": "2024-08-30T13:43:54.769738Z" } }, "outputs": [], @@ -403,10 +404,10 @@ "id": "1ac8103a", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.801834Z", - "iopub.status.busy": "2024-03-27T11:26:26.801523Z", - "iopub.status.idle": "2024-03-27T11:26:26.804890Z", - "shell.execute_reply": "2024-03-27T11:26:26.804365Z" + "iopub.execute_input": "2024-08-30T13:43:54.772090Z", + "iopub.status.busy": "2024-08-30T13:43:54.771779Z", + "iopub.status.idle": "2024-08-30T13:43:54.774716Z", + "shell.execute_reply": "2024-08-30T13:43:54.774242Z" } }, "outputs": [ @@ -428,7 +429,7 @@ "id": "e93bfbeb", "metadata": {}, "source": [ - "Now we have the TOAs of the events in the system of the telescope. Please note that the actual precision of the times is higher than the diplayed output (and we really need this precision for the pulsar analysis!). In the next step, the timing in the SSB and the phase for each TOA has to be created. " + "Now we have the TOAs for the events in the system of the telescope. Please note: the actual precision of the times is higher than the displayed output (and we really need this precision for the pulsar analysis!). In the next step, the timing in the SSB and the phase for each TOA has to be created." ] }, { @@ -444,11 +445,11 @@ "id": "fb536b7e", "metadata": {}, "source": [ - "In order to compute the phases of a pulsar, one needs an ephemeris file, usually store as a .par file. \n", + "In order to compute the phases of a pulsar, one needs an ephemeris file, typically stored as a .par file.\n", "\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, it is important to note that many of the ephemeris files are not up-to-date. Therefore, they could give bad results on the phase computation. In particular, you should always check that the MJD of the observations one wants to phase lies between the `START` and `FINISH` entries of the ephemeris file (see next section)." ] }, { @@ -457,16 +458,16 @@ "id": "d4f89ba4", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.807135Z", - "iopub.status.busy": "2024-03-27T11:26:26.806833Z", - "iopub.status.idle": "2024-03-27T11:26:26.809301Z", - "shell.execute_reply": "2024-03-27T11:26:26.808783Z" + "iopub.execute_input": "2024-08-30T13:43:54.776686Z", + "iopub.status.busy": "2024-08-30T13:43:54.776389Z", + "iopub.status.idle": "2024-08-30T13:43:54.778777Z", + "shell.execute_reply": "2024-08-30T13:43:54.778358Z" } }, "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\"" ] }, { @@ -474,7 +475,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 files 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 features from Tempo2. \n", + "\n", + "In our case, an error occurs when using the ephemeris file with PINT. This is due to the `JUMP` line. To proceed, simply comment out the line (with #) or remove it. Note that this line is not important for the gamma-ray instruments, so it is acceptable to disregard it." ] }, { @@ -507,22 +510,21 @@ "id": "d24e1c92", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.811565Z", - "iopub.status.busy": "2024-03-27T11:26:26.811265Z", - "iopub.status.idle": "2024-03-27T11:26:26.907510Z", - "shell.execute_reply": "2024-03-27T11:26:26.906967Z" - }, - "scrolled": false + "iopub.execute_input": "2024-08-30T13:43:54.780756Z", + "iopub.status.busy": "2024-08-30T13:43:54.780435Z", + "iopub.status.idle": "2024-08-30T13:43:54.876016Z", + "shell.execute_reply": "2024-08-30T13:43:54.875575Z" + } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "\u001b[32m2024-03-27 11:26:26.901\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", - "/usr/share/miniconda3/envs/gammapy-recipes/lib/python3.9/site-packages/pint/models/model_builder.py:198: UserWarning: Unrecognized parfile line 'EPHVER 5'\n", + "\u001b[32m2024-08-30 13:43:54.870\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.models.absolute_phase\u001b[0m:\u001b[36mvalidate\u001b[0m:\u001b[36m77\u001b[0m - \u001b[1mTZRFRQ was 0.0 or None. Setting to infinite frequency.\u001b[0m\n", + "/home/runner/miniconda3/envs/gammapy-recipes/lib/python3.11/site-packages/pint/models/model_builder.py:230: UserWarning: Unrecognized parfile line 'EPHVER 5'\n", " warnings.warn(f\"Unrecognized parfile line '{p_line}'\", UserWarning)\n", - "\u001b[32m2024-03-27 11:26:26.903\u001b[0m | \u001b[33m\u001b[1mWARNING \u001b[0m | \u001b[36mpint.models.model_builder\u001b[0m:\u001b[36m__call__\u001b[0m:\u001b[36m202\u001b[0m - \u001b[33m\u001b[1mUNITS is not specified. Assuming TDB...\u001b[0m\n" + "\u001b[32m2024-08-30 13:43:54.872\u001b[0m | \u001b[33m\u001b[1mWARNING \u001b[0m | \u001b[36mpint.models.model_builder\u001b[0m:\u001b[36m__call__\u001b[0m:\u001b[36m234\u001b[0m - \u001b[33m\u001b[1mUNITS is not specified. Assuming TDB...\u001b[0m\n" ] }, { @@ -569,7 +571,111 @@ "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. Check the [PINT documentation](https://nanograv-pint.readthedocs.io) for a list of additional parameters. To obtain the complete set of parameters from the ephemeris file, one can simply print the model:\n", + "`print(model)`" + ] + }, + { + "cell_type": "markdown", + "id": "f02f0ca5-09f2-44d4-ad76-518f8964b6a1", + "metadata": {}, + "source": [ + "As mentioned previously, we should ensure 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": 15, + "id": "2584b571-93a9-4fb6-b8e2-60b8810190f6", + "metadata": { + "execution": { + "iopub.execute_input": "2024-08-30T13:43:54.878085Z", + "iopub.status.busy": "2024-08-30T13:43:54.877785Z", + "iopub.status.idle": "2024-08-30T13:43:54.881053Z", + "shell.execute_reply": "2024-08-30T13:43:54.880542Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Ephemeris time definition:\n", + "54686.1526259 - 56583.1591704\n", + "Observation time definition:\n", + "56569.18112772242 - 56569.19487901596\n" + ] + } + ], + "source": [ + "print(\n", + " f\"Ephemeris time definition:\\n{model.START.value} - {model.FINISH.value}\"\n", + ")\n", + "print(\n", + " f\"Observation time definition:\\n{observation.tstart} - {observation.tstop}\"\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "86041174-5ec4-43ba-9035-cf567b47a3bb", + "metadata": {}, + "source": [ + "If you have several observations that 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 create a small function like the following one:" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "8838ee6c-5b53-4d34-8fd7-94d32daa6bb3", + "metadata": { + "execution": { + "iopub.execute_input": "2024-08-30T13:43:54.882764Z", + "iopub.status.busy": "2024-08-30T13:43:54.882615Z", + "iopub.status.idle": "2024-08-30T13:43:54.886095Z", + "shell.execute_reply": "2024-08-30T13:43:54.885667Z" + } + }, + "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(\n", + " [model.START.value, model.FINISH.value], scale=\"tt\", format=\"mjd\"\n", + " )\n", + " if (model_time[0].value > observation.tstart.tt.mjd) or (\n", + " model_time[1].value < observation.tstop.tt.mjd\n", + " ):\n", + " log.warning(\n", + " f\"Warning: Observation time of observation {observation.obs_id} goes out of timing model validity time.\"\n", + " )" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "0d37e6cc-2cae-4192-87d9-88d52216e83f", + "metadata": { + "execution": { + "iopub.execute_input": "2024-08-30T13:43:54.887762Z", + "iopub.status.busy": "2024-08-30T13:43:54.887614Z", + "iopub.status.idle": "2024-08-30T13:43:54.890615Z", + "shell.execute_reply": "2024-08-30T13:43:54.890203Z" + } + }, + "outputs": [], + "source": [ + "check_time(observation, model)" ] }, { @@ -582,47 +688,53 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 18, "id": "a145cdde", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.909929Z", - "iopub.status.busy": "2024-03-27T11:26:26.909738Z", - "iopub.status.idle": "2024-03-27T11:26:44.597210Z", - "shell.execute_reply": "2024-03-27T11:26:44.596640Z" - }, - "scrolled": false + "iopub.execute_input": "2024-08-30T13:43:54.892323Z", + "iopub.status.busy": "2024-08-30T13:43:54.892174Z", + "iopub.status.idle": "2024-08-30T13:44:15.697802Z", + "shell.execute_reply": "2024-08-30T13:44:15.697299Z" + } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "\u001b[32m2024-03-27 11:26:27.247\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m1358\u001b[0m - \u001b[34m\u001b[1mNo pulse number flags found in the TOAs\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:27.263\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mapply_clock_corrections\u001b[0m:\u001b[36m2200\u001b[0m - \u001b[34m\u001b[1mApplying clock corrections (include_gps = False, include_bipm = False)\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:27.923\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-03-27 11:26:31.192\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2251\u001b[0m - \u001b[34m\u001b[1mComputing TDB columns.\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:31.193\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2272\u001b[0m - \u001b[34m\u001b[1mUsing EPHEM = DE421 for TDB calculation.\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:32.378\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2350\u001b[0m - \u001b[34m\u001b[1mComputing PosVels of observatories and Earth, using DE421\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:33.420\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-03-27 11:26:44.359\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2403\u001b[0m - \u001b[34m\u001b[1mSSB obs pos [1.47007462e+11 2.56889811e+10 1.11245045e+10] m\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.587\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-03-27 11:26:44.593\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2417\u001b[0m - \u001b[34m\u001b[1mAdding columns ssb_obs_pos ssb_obs_vel obs_sun_pos\u001b[0m\n" + "\u001b[32m2024-08-30 13:43:55.618\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m1377\u001b[0m - \u001b[34m\u001b[1mNo pulse number flags found in the TOAs\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:55.633\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mapply_clock_corrections\u001b[0m:\u001b[36m2224\u001b[0m - \u001b[34m\u001b[1mApplying clock corrections (include_bipm = False)\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.294\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.observatory\u001b[0m:\u001b[36mgps_correction\u001b[0m:\u001b[36m248\u001b[0m - \u001b[1mApplying GPS to UTC clock correction (~few nanoseconds)\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.294\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.observatory\u001b[0m:\u001b[36m_load_gps_clock\u001b[0m:\u001b[36m122\u001b[0m - \u001b[34m\u001b[1mLoading global GPS clock file\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.297\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.observatory.global_clock_corrections\u001b[0m:\u001b[36mget_file\u001b[0m:\u001b[36m128\u001b[0m - \u001b[1mFile index.txt to be downloaded due to download policy if_expired: https://raw.githubusercontent.com/ipta/pulsar-clock-corrections/main/index.txt\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.451\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.observatory.clock_file\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m812\u001b[0m - \u001b[34m\u001b[1mGlobal clock file gps2utc.clk saving kwargs={'bogus_last_correction': False, 'valid_beyond_ends': False}\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.452\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.observatory.global_clock_corrections\u001b[0m:\u001b[36mget_file\u001b[0m:\u001b[36m128\u001b[0m - \u001b[1mFile T2runtime/clock/gps2utc.clk to be downloaded due to download policy if_missing: https://raw.githubusercontent.com/ipta/pulsar-clock-corrections/main/T2runtime/clock/gps2utc.clk\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.668\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.observatory.clock_file\u001b[0m:\u001b[36mread_tempo2_clock_file\u001b[0m:\u001b[36m463\u001b[0m - \u001b[34m\u001b[1mLoading TEMPO2-format observatory clock correction file gps2utc.clk (/home/runner/.astropy/cache/download/url/d3c81b5766f4bfb84e65504c8a453085/contents) with bogus_last_correction=False\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.687\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.observatory\u001b[0m:\u001b[36mfind_clock_file\u001b[0m:\u001b[36m994\u001b[0m - \u001b[1mUsing global clock file for gps2utc.clk with bogus_last_correction=False\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.689\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.observatory.topo_obs\u001b[0m:\u001b[36mclock_corrections\u001b[0m:\u001b[36m354\u001b[0m - \u001b[1mObservatory magic requires no clock corrections.\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:59.900\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2270\u001b[0m - \u001b[34m\u001b[1mComputing TDB columns.\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:59.901\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2291\u001b[0m - \u001b[34m\u001b[1mUsing EPHEM = DE421 for TDB calculation.\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:00.968\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2371\u001b[0m - \u001b[34m\u001b[1mComputing PosVels of observatories and Earth, using DE421\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:02.516\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-08-30 13:44:15.633\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2424\u001b[0m - \u001b[34m\u001b[1mSSB obs pos [1.47007462e+11 2.56889811e+10 1.11245045e+10] m\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.688\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-08-30 13:44:15.694\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2438\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 7.02 s, sys: 188 ms, total: 7.21 s\n", - "Wall time: 17.7 s\n" + "CPU times: user 7.15 s, sys: 199 ms, total: 7.35 s\n", + "Wall time: 20.8 s\n" ] } ], "source": [ "%%time\n", "\n", - "# Put these to True is your observatory has clock correction files.\n", + "# Set these to True is your observatory has clock correction files.\n", "# If it is set to True but your observatory does not have clock correction files, it will be ignored.\n", "include_bipm = False\n", "include_gps = False\n", @@ -648,19 +760,19 @@ "id": "db97ea5b", "metadata": {}, "source": [ - "Once we have the TOAs object and the model, the phases are easily computed using the model.phase() method. Note that the phases are computed in the interval [-0.5,0.5]. Most of the times, we use the phases in the interval [0,1] so we have to shift the negative ones." + "Once we have the TOAs object and the model, the phases are easily computed using the model.phase() method. Note that the phases are computed in the interval [-0.5,0.5]. Most of the time, we use the phases in the interval [0,1] so we have to shift the negative ones." ] }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 19, "id": "6fbf3ad9", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:44.599538Z", - "iopub.status.busy": "2024-03-27T11:26:44.599353Z", - "iopub.status.idle": "2024-03-27T11:26:45.194277Z", - "shell.execute_reply": "2024-03-27T11:26:45.193696Z" + "iopub.execute_input": "2024-08-30T13:44:15.699970Z", + "iopub.status.busy": "2024-08-30T13:44:15.699584Z", + "iopub.status.idle": "2024-08-30T13:44:15.924450Z", + "shell.execute_reply": "2024-08-30T13:44:15.924037Z" } }, "outputs": [ @@ -668,19 +780,19 @@ "name": "stderr", "output_type": "stream", "text": [ - "\u001b[32m2024-03-27 11:26:44.636\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-03-27 11:26:44.640\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-03-27 11:26:44.646\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m1358\u001b[0m - \u001b[34m\u001b[1mNo pulse number flags found in the TOAs\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.646\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mapply_clock_corrections\u001b[0m:\u001b[36m2200\u001b[0m - \u001b[34m\u001b[1mApplying clock corrections (include_gps = False, include_bipm = False)\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.648\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2251\u001b[0m - \u001b[34m\u001b[1mComputing TDB columns.\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.648\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2272\u001b[0m - \u001b[34m\u001b[1mUsing EPHEM = DE421 for TDB calculation.\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.651\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2350\u001b[0m - \u001b[34m\u001b[1mComputing PosVels of observatories and Earth, using DE421\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.929\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-03-27 11:26:44.931\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2403\u001b[0m - \u001b[34m\u001b[1mSSB obs pos [-1.49278181e+08 7.07659442e+06 3.07113250e+06] km\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:45.150\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-03-27 11:26:45.176\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2417\u001b[0m - \u001b[34m\u001b[1mAdding columns ssb_obs_pos ssb_obs_vel obs_sun_pos\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:45.177\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-03-27 11:26:45.188\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-08-30 13:44:15.729\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.models.glitch\u001b[0m:\u001b[36mglitch_phase\u001b[0m:\u001b[36m221\u001b[0m - \u001b[34m\u001b[1mGlitch phase for glitch 1: 0.0 \u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.735\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.models.absolute_phase\u001b[0m:\u001b[36mget_TZR_toa\u001b[0m:\u001b[36m100\u001b[0m - \u001b[34m\u001b[1mCreating and dealing with the single TZR_toa for absolute phase\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.738\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m1377\u001b[0m - \u001b[34m\u001b[1mNo pulse number flags found in the TOAs\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.738\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mapply_clock_corrections\u001b[0m:\u001b[36m2224\u001b[0m - \u001b[34m\u001b[1mApplying clock corrections (include_bipm = False)\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.760\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2270\u001b[0m - \u001b[34m\u001b[1mComputing TDB columns.\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.761\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2291\u001b[0m - \u001b[34m\u001b[1mUsing EPHEM = DE421 for TDB calculation.\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.764\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2371\u001b[0m - \u001b[34m\u001b[1mComputing PosVels of observatories and Earth, using DE421\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.834\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-08-30 13:44:15.836\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2424\u001b[0m - \u001b[34m\u001b[1mSSB obs pos [-1.49278181e+08 7.07659442e+06 3.07113250e+06] km\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.907\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-08-30 13:44:15.908\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2438\u001b[0m - \u001b[34m\u001b[1mAdding columns ssb_obs_pos ssb_obs_vel obs_sun_pos\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.909\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-08-30 13:44:15.916\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.models.glitch\u001b[0m:\u001b[36mglitch_phase\u001b[0m:\u001b[36m221\u001b[0m - \u001b[34m\u001b[1mGlitch phase for glitch 1: 0.0 \u001b[0m\n" ] } ], @@ -710,14 +822,14 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 20, "id": "735ac718", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.196779Z", - "iopub.status.busy": "2024-03-27T11:26:45.196431Z", - "iopub.status.idle": "2024-03-27T11:26:45.206792Z", - "shell.execute_reply": "2024-03-27T11:26:45.206263Z" + "iopub.execute_input": "2024-08-30T13:44:15.926698Z", + "iopub.status.busy": "2024-08-30T13:44:15.926261Z", + "iopub.status.idle": "2024-08-30T13:44:15.935066Z", + "shell.execute_reply": "2024-08-30T13:44:15.934677Z" } }, "outputs": [], @@ -728,65 +840,93 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 21, "id": "f3269a2c", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.209126Z", - "iopub.status.busy": "2024-03-27T11:26:45.208686Z", - "iopub.status.idle": "2024-03-27T11:26:45.212621Z", - "shell.execute_reply": "2024-03-27T11:26:45.212125Z" - }, - "scrolled": false + "iopub.execute_input": "2024-08-30T13:44:15.936748Z", + "iopub.status.busy": "2024-08-30T13:44:15.936604Z", + "iopub.status.idle": "2024-08-30T13:44:15.942656Z", + "shell.execute_reply": "2024-08-30T13:44:15.942183Z" + } }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "EVENT_ID TIME RA DEC ENERGY \n", - " s deg deg TeV \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", - " 2561 333778853.0339344 84.84237 22.175398 0.118843034\n", - " ... ... ... ... ...\n", - " 356222 333780039.4520397 84.74482 20.894981 0.043312162\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", - "Length = 11189 rows\n" - ] + "data": { + "text/html": [ + "
Table length=11189\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
EVENT_IDTIMERADECENERGY
sdegdegTeV
int64float64float32float32float32
2402333778852.509924984.5945722.030880.18194601
2408333778852.526715384.2146223.449140.08397394
2434333778852.6131505483.52470422.7257920.10596932
2445333778852.669014283.7695722.4510060.19733498
2478333778852.762793983.47851623.4845940.08522219
2481333778852.777854983.7151721.9851151.0020943
2513333778852.864446782.42119622.5676520.14374068
2544333778852.982606483.6413622.0413150.10316629
2559333778853.026941484.06917622.973370.047184493
...............
356223333780039.460049284.1161522.5575050.08110082
356227333780039.4710536683.4153421.673440.2096362
356242333780039.517909583.5516522.7729850.17672835
356282333780039.6299751484.4613321.693570.05068718
356473333780040.338647984.4544121.1598280.1831569
356478333780040.354892683.6833623.4449880.06305169
356485333780040.374132284.3351721.283380.060539745
356486333780040.375515984.8588622.1162220.123453744
356526333780040.5247600784.8692921.2909160.13630114
" + ], + "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": 21, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ "# Show original table\n", - "print(table)" + "table" ] }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 22, "id": "6fc6024c", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.214559Z", - "iopub.status.busy": "2024-03-27T11:26:45.214389Z", - "iopub.status.idle": "2024-03-27T11:26:45.216994Z", - "shell.execute_reply": "2024-03-27T11:26:45.216564Z" + "iopub.execute_input": "2024-08-30T13:44:15.944440Z", + "iopub.status.busy": "2024-08-30T13:44:15.944274Z", + "iopub.status.idle": "2024-08-30T13:44:15.946972Z", + "shell.execute_reply": "2024-08-30T13:44:15.946502Z" } }, "outputs": [], @@ -805,46 +945,44 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 23, "id": "7f29187e", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.219230Z", - "iopub.status.busy": "2024-03-27T11:26:45.218856Z", - "iopub.status.idle": "2024-03-27T11:26:45.225134Z", - "shell.execute_reply": "2024-03-27T11:26:45.224604Z" - }, - "scrolled": false + "iopub.execute_input": "2024-08-30T13:44:15.948805Z", + "iopub.status.busy": "2024-08-30T13:44:15.948513Z", + "iopub.status.idle": "2024-08-30T13:44:15.952984Z", + "shell.execute_reply": "2024-08-30T13:44:15.952497Z" + } }, "outputs": [ { "data": { "text/html": [ "
Table length=11189\n", - "
\n", + "
\n", "\n", "\n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", "
EVENT_IDTIMERADECENERGYPHASE
sdegdegTeV
int64float64float32float32float32float64
2402333778852.509924984.5945722.030880.181946010.39349195931383935
2408333778852.526715384.2146223.449140.083973940.8919526790064667
2434333778852.6131505483.52470422.7257920.105969320.4579789031294724
2445333778852.669014283.7695722.4510060.197334980.11641860219368935
2478333778852.762793983.47851623.4845940.085222190.9004806857711186
2481333778852.777854983.7151721.9851151.00209430.3476011689926769
2513333778852.864446782.42119622.5676520.143740680.9182740999289545
2544333778852.982606483.6413622.0413150.103166290.42611249421537956
2559333778853.026941484.06917622.973370.0471844930.7422975122115125
2402333778852.509924984.5945722.030880.181946010.3934918682770723
2408333778852.526715384.2146223.449140.083973940.8919525879696997
2434333778852.6131505483.52470422.7257920.105969320.45797881185987477
2445333778852.669014283.7695722.4510060.197334980.11641851092409164
2478333778852.762793983.47851623.4845940.085222190.900480594501521
2481333778852.777854983.7151721.9851151.00209430.34760107795590983
2513333778852.864446782.42119622.5676520.143740680.9182740088921875
2544333778852.982606483.6413622.0413150.103166290.42611240294578184
2559333778853.026941484.06917622.973370.0471844930.7422974209419148
..................
356222333780039.452039784.7448220.8949810.0433121620.4537121484157113
356223333780039.460049284.1161522.5575050.081100820.6914920486374702
356227333780039.4710536683.4153421.673440.20963620.018183944316962984
356242333780039.517909583.5516522.7729850.176728350.40920620046641115
356282333780039.6299751484.4613321.693570.050687180.7361270955486778
356473333780040.338647984.4544121.1598280.18315690.7746789518818565
356478333780040.354892683.6833623.4449880.063051690.2569398572226654
356485333780040.374132284.3351721.283380.0605397450.8281109722104576
356486333780040.375515984.8588622.1162220.1234537440.8691881135544401
356526333780040.5247600784.8692921.2909160.136301140.29983901925054285
356223333780039.460049284.1161522.5575050.081100820.6914919573678725
356227333780039.4710536683.4153421.673440.20963620.018183853280195963
356242333780039.517909583.5516522.7729850.176728350.4092061182772071
356282333780039.6299751484.4613321.693570.050687180.7361270045119108
356473333780040.338647984.4544121.1598280.18315690.7746788606122589
356478333780040.354892683.6833623.4449880.063051690.25693976618589837
356485333780040.374132284.3351721.283380.0605397450.8281108809408599
356486333780040.375515984.8588622.1162220.1234537440.8691880225176731
356526333780040.5247600784.8692921.2909160.136301140.29983892821377583
" ], "text/plain": [ @@ -853,29 +991,28 @@ " 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", + " 2402 333778852.5099249 84.59457 22.03088 0.18194601 0.3934918682770723\n", + " 2408 333778852.5267153 84.21462 23.44914 0.08397394 0.8919525879696997\n", + " 2434 333778852.61315054 83.524704 22.725792 0.10596932 0.45797881185987477\n", + " 2445 333778852.6690142 83.76957 22.451006 0.19733498 0.11641851092409164\n", + " 2478 333778852.7627939 83.478516 23.484594 0.08522219 0.900480594501521\n", + " 2481 333778852.7778549 83.71517 21.985115 1.0020943 0.34760107795590983\n", + " 2513 333778852.8644467 82.421196 22.567652 0.14374068 0.9182740088921875\n", + " 2544 333778852.9826064 83.64136 22.041315 0.10316629 0.42611240294578184\n", + " 2559 333778853.0269414 84.069176 22.97337 0.047184493 0.7422974209419148\n", " ... ... ... ... ... ...\n", - " 356222 333780039.4520397 84.74482 20.894981 0.043312162 0.4537121484157113\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" + " 356223 333780039.4600492 84.11615 22.557505 0.08110082 0.6914919573678725\n", + " 356227 333780039.47105366 83.41534 21.67344 0.2096362 0.018183853280195963\n", + " 356242 333780039.5179095 83.55165 22.772985 0.17672835 0.4092061182772071\n", + " 356282 333780039.62997514 84.46133 21.69357 0.05068718 0.7361270045119108\n", + " 356473 333780040.3386479 84.45441 21.159828 0.1831569 0.7746788606122589\n", + " 356478 333780040.3548926 83.68336 23.444988 0.06305169 0.25693976618589837\n", + " 356485 333780040.3741322 84.33517 21.28338 0.060539745 0.8281108809408599\n", + " 356486 333780040.3755159 84.85886 22.116222 0.123453744 0.8691880225176731\n", + " 356526 333780040.52476007 84.86929 21.290916 0.13630114 0.29983892821377583" ] }, - "execution_count": 20, + "execution_count": 23, "metadata": {}, "output_type": "execute_result" } @@ -898,23 +1035,22 @@ "id": "ea9ba223", "metadata": {}, "source": [ - "At this point, we also want to add meta data to the table. It is very useful to keep track of what has been done to the file. For instance, if we have multiple pulsars in the same file, we want to be able to know quickly which column correspond to which pulsar. Moreover, experience shows that one often use different ephemeris file for the same pulsar. Therefore, it is very useful to have several phase columns in the same file and to be able to know which column correspond to which ephemeris file, parameters, etc.\n", + "At this point, we also want to add metadata to the table. It is very useful to keep track of what has been done to the file. For instance, if a file contains multiple pulsars, we want identify quickly which column corresponds to each pulsar. Moreover, experience has shown that it is common to have different ephemeris files for the same pulsar. Therefore, it is useful to have several phase columns in the same file to easily identify which column corresponds to each ephemeris file, parameters, etc.\n", "\n", - "Since there is not yet a \"standard\" format for such metadata, we propose a template for the essential informations that one wants to save in the header of the event file. First, we look at the present meta info on the table." + "Since there is currently no \"standard\" format for such metadata, we propose a template for the essential information that one wants to save in the header of the event file. First, we look at the present meta info on the table." ] }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 24, "id": "af220557", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.227594Z", - "iopub.status.busy": "2024-03-27T11:26:45.227257Z", - "iopub.status.idle": "2024-03-27T11:26:45.231629Z", - "shell.execute_reply": "2024-03-27T11:26:45.231108Z" - }, - "scrolled": false + "iopub.execute_input": "2024-08-30T13:44:15.955025Z", + "iopub.status.busy": "2024-08-30T13:44:15.954655Z", + "iopub.status.idle": "2024-08-30T13:44:15.958777Z", + "shell.execute_reply": "2024-08-30T13:44:15.958278Z" + } }, "outputs": [ { @@ -957,7 +1093,7 @@ " ('AZ_PNT', 103.8848)])" ] }, - "execution_count": 21, + "execution_count": 24, "metadata": {}, "output_type": "execute_result" } @@ -968,14 +1104,14 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 25, "id": "c2285fcd", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.233745Z", - "iopub.status.busy": "2024-03-27T11:26:45.233423Z", - "iopub.status.idle": "2024-03-27T11:26:45.237873Z", - "shell.execute_reply": "2024-03-27T11:26:45.237324Z" + "iopub.execute_input": "2024-08-30T13:44:15.960712Z", + "iopub.status.busy": "2024-08-30T13:44:15.960430Z", + "iopub.status.idle": "2024-08-30T13:44:15.964154Z", + "shell.execute_reply": "2024-08-30T13:44:15.963725Z" } }, "outputs": [], @@ -1018,14 +1154,14 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 26, "id": "8c866a5c", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.240180Z", - "iopub.status.busy": "2024-03-27T11:26:45.239749Z", - "iopub.status.idle": "2024-03-27T11:26:45.243507Z", - "shell.execute_reply": "2024-03-27T11:26:45.242970Z" + "iopub.execute_input": "2024-08-30T13:44:15.966078Z", + "iopub.status.busy": "2024-08-30T13:44:15.965699Z", + "iopub.status.idle": "2024-08-30T13:44:15.968960Z", + "shell.execute_reply": "2024-08-30T13:44:15.968447Z" } }, "outputs": [ @@ -1033,7 +1169,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "COLUMN_PHASE: PHASE; PINT_VERS: 0.9.8; GAMMAPY_VERS: 1.0.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: 60396.4769125122;\n" + "COLUMN_PHASE: PHASE; PINT_VERS: 1.0.1; 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: 60552.572407022526;\n" ] } ], @@ -1044,14 +1180,14 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 27, "id": "5a3e56d2", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.245447Z", - "iopub.status.busy": "2024-03-27T11:26:45.245279Z", - "iopub.status.idle": "2024-03-27T11:26:45.247890Z", - "shell.execute_reply": "2024-03-27T11:26:45.247345Z" + "iopub.execute_input": "2024-08-30T13:44:15.971018Z", + "iopub.status.busy": "2024-08-30T13:44:15.970621Z", + "iopub.status.idle": "2024-08-30T13:44:15.973109Z", + "shell.execute_reply": "2024-08-30T13:44:15.972658Z" } }, "outputs": [], @@ -1062,14 +1198,14 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 28, "id": "f6b44e25", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.250137Z", - "iopub.status.busy": "2024-03-27T11:26:45.249693Z", - "iopub.status.idle": "2024-03-27T11:26:45.254108Z", - "shell.execute_reply": "2024-03-27T11:26:45.253667Z" + "iopub.execute_input": "2024-08-30T13:44:15.974924Z", + "iopub.status.busy": "2024-08-30T13:44:15.974603Z", + "iopub.status.idle": "2024-08-30T13:44:15.978533Z", + "shell.execute_reply": "2024-08-30T13:44:15.978032Z" } }, "outputs": [ @@ -1112,10 +1248,10 @@ " ('ALT_PNT', 69.69974),\n", " ('AZ_PNT', 103.8848),\n", " ('PH_LOG',\n", - " 'COLUMN_PHASE: PHASE; PINT_VERS: 0.9.8; GAMMAPY_VERS: 1.0.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: 60396.4769125122;')])" + " 'COLUMN_PHASE: PHASE; PINT_VERS: 1.0.1; 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: 60552.572407022526;')])" ] }, - "execution_count": 25, + "execution_count": 28, "metadata": {}, "output_type": "execute_result" } @@ -1134,14 +1270,14 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 29, "id": "12545bff", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.256140Z", - "iopub.status.busy": "2024-03-27T11:26:45.255965Z", - "iopub.status.idle": "2024-03-27T11:26:45.306335Z", - "shell.execute_reply": "2024-03-27T11:26:45.305804Z" + "iopub.execute_input": "2024-08-30T13:44:15.980471Z", + "iopub.status.busy": "2024-08-30T13:44:15.980173Z", + "iopub.status.idle": "2024-08-30T13:44:16.013868Z", + "shell.execute_reply": "2024-08-30T13:44:16.013376Z" } }, "outputs": [ @@ -1149,7 +1285,6 @@ "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", "'THETA' axis is stored as a scalar -- converting to 1D array.\n" @@ -1164,14 +1299,14 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 30, "id": "1ac16c51", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.308633Z", - "iopub.status.busy": "2024-03-27T11:26:45.308216Z", - "iopub.status.idle": "2024-03-27T11:26:45.313310Z", - "shell.execute_reply": "2024-03-27T11:26:45.312737Z" + "iopub.execute_input": "2024-08-30T13:44:16.015882Z", + "iopub.status.busy": "2024-08-30T13:44:16.015596Z", + "iopub.status.idle": "2024-08-30T13:44:16.020193Z", + "shell.execute_reply": "2024-08-30T13:44:16.019715Z" } }, "outputs": [ @@ -1179,30 +1314,29 @@ "data": { "text/html": [ "
Table length=11189\n", - "\n", + "
\n", "\n", "\n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", "
EVENT_IDTIMERADECENERGYPHASE
sdegdegTeV
int64float64float32float32float32float64
2402333778852.509924984.5945722.030880.181946010.39349195931383935
2408333778852.526715384.2146223.449140.083973940.8919526790064667
2434333778852.6131505483.52470422.7257920.105969320.4579789031294724
2445333778852.669014283.7695722.4510060.197334980.11641860219368935
2478333778852.762793983.47851623.4845940.085222190.9004806857711186
2481333778852.777854983.7151721.9851151.00209430.3476011689926769
2513333778852.864446782.42119622.5676520.143740680.9182740999289545
2544333778852.982606483.6413622.0413150.103166290.42611249421537956
2559333778853.026941484.06917622.973370.0471844930.7422975122115125
2402333778852.509924984.5945722.030880.181946010.3934918682770723
2408333778852.526715384.2146223.449140.083973940.8919525879696997
2434333778852.6131505483.52470422.7257920.105969320.45797881185987477
2445333778852.669014283.7695722.4510060.197334980.11641851092409164
2478333778852.762793983.47851623.4845940.085222190.900480594501521
2481333778852.777854983.7151721.9851151.00209430.34760107795590983
2513333778852.864446782.42119622.5676520.143740680.9182740088921875
2544333778852.982606483.6413622.0413150.103166290.42611240294578184
2559333778853.026941484.06917622.973370.0471844930.7422974209419148
..................
356222333780039.452039784.7448220.8949810.0433121620.4537121484157113
356223333780039.460049284.1161522.5575050.081100820.6914920486374702
356227333780039.4710536683.4153421.673440.20963620.018183944316962984
356242333780039.517909583.5516522.7729850.176728350.40920620046641115
356282333780039.6299751484.4613321.693570.050687180.7361270955486778
356473333780040.338647984.4544121.1598280.18315690.7746789518818565
356478333780040.354892683.6833623.4449880.063051690.2569398572226654
356485333780040.374132284.3351721.283380.0605397450.8281109722104576
356486333780040.375515984.8588622.1162220.1234537440.8691881135544401
356526333780040.5247600784.8692921.2909160.136301140.29983901925054285
356223333780039.460049284.1161522.5575050.081100820.6914919573678725
356227333780039.4710536683.4153421.673440.20963620.018183853280195963
356242333780039.517909583.5516522.7729850.176728350.4092061182772071
356282333780039.6299751484.4613321.693570.050687180.7361270045119108
356473333780040.338647984.4544121.1598280.18315690.7746788606122589
356478333780040.354892683.6833623.4449880.063051690.25693976618589837
356485333780040.374132284.3351721.283380.0605397450.8281108809408599
356486333780040.375515984.8588622.1162220.1234537440.8691880225176731
356526333780040.5247600784.8692921.2909160.136301140.29983892821377583
" ], "text/plain": [ @@ -1211,29 +1345,28 @@ " 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", + " 2402 333778852.5099249 84.59457 22.03088 0.18194601 0.3934918682770723\n", + " 2408 333778852.5267153 84.21462 23.44914 0.08397394 0.8919525879696997\n", + " 2434 333778852.61315054 83.524704 22.725792 0.10596932 0.45797881185987477\n", + " 2445 333778852.6690142 83.76957 22.451006 0.19733498 0.11641851092409164\n", + " 2478 333778852.7627939 83.478516 23.484594 0.08522219 0.900480594501521\n", + " 2481 333778852.7778549 83.71517 21.985115 1.0020943 0.34760107795590983\n", + " 2513 333778852.8644467 82.421196 22.567652 0.14374068 0.9182740088921875\n", + " 2544 333778852.9826064 83.64136 22.041315 0.10316629 0.42611240294578184\n", + " 2559 333778853.0269414 84.069176 22.97337 0.047184493 0.7422974209419148\n", " ... ... ... ... ... ...\n", - " 356222 333780039.4520397 84.74482 20.894981 0.043312162 0.4537121484157113\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" + " 356223 333780039.4600492 84.11615 22.557505 0.08110082 0.6914919573678725\n", + " 356227 333780039.47105366 83.41534 21.67344 0.2096362 0.018183853280195963\n", + " 356242 333780039.5179095 83.55165 22.772985 0.17672835 0.4092061182772071\n", + " 356282 333780039.62997514 84.46133 21.69357 0.05068718 0.7361270045119108\n", + " 356473 333780040.3386479 84.45441 21.159828 0.1831569 0.7746788606122589\n", + " 356478 333780040.3548926 83.68336 23.444988 0.06305169 0.25693976618589837\n", + " 356485 333780040.3741322 84.33517 21.28338 0.060539745 0.8281108809408599\n", + " 356486 333780040.3755159 84.85886 22.116222 0.123453744 0.8691880225176731\n", + " 356526 333780040.52476007 84.86929 21.290916 0.13630114 0.29983892821377583" ] }, - "execution_count": 27, + "execution_count": 30, "metadata": {}, "output_type": "execute_result" } @@ -1255,31 +1388,31 @@ "id": "e369d2dc", "metadata": {}, "source": [ - "In the following, we show how to write the files in a directory contained in the original datastore directory. This follows the logic of DL3 data store and facilitate the manipulation of the HDU table.\n", + "In the following, we show how to write the files in a directory contained in the original datastore directory. This follows the logic of DL3 data store and facilitates the manipulation of the HDU table.\n", "\n", - "If one does not want to save the events files and directly perform the pulsar analysis, this step is not required as well as the step of the meta data handling. However, be aware that for large dataset, the computation of phases can take tens of minutes. " + "If you do not want to save the events files bur rather directly perform the pulsar analysis, you can skip both this step and the step of the handling metadata. However, be aware that for large datasets, the computation of the phases can take tens of minutes." ] }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 31, "id": "f3c8410c", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.315528Z", - "iopub.status.busy": "2024-03-27T11:26:45.315188Z", - "iopub.status.idle": "2024-03-27T11:26:45.318777Z", - "shell.execute_reply": "2024-03-27T11:26:45.318308Z" + "iopub.execute_input": "2024-08-30T13:44:16.022167Z", + "iopub.status.busy": "2024-08-30T13:44:16.021883Z", + "iopub.status.idle": "2024-08-30T13:44:16.025164Z", + "shell.execute_reply": "2024-08-30T13:44:16.024650Z" } }, "outputs": [ { "data": { "text/plain": [ - "PosixPath('/home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.0.2/magic/rad_max/data')" + "PosixPath('/home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.2/magic/rad_max/data')" ] }, - "execution_count": 28, + "execution_count": 31, "metadata": {}, "output_type": "execute_result" } @@ -1290,14 +1423,14 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 32, "id": "8fd2ce31", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.320738Z", - "iopub.status.busy": "2024-03-27T11:26:45.320560Z", - "iopub.status.idle": "2024-03-27T11:26:45.323746Z", - "shell.execute_reply": "2024-03-27T11:26:45.323305Z" + "iopub.execute_input": "2024-08-30T13:44:16.027018Z", + "iopub.status.busy": "2024-08-30T13:44:16.026717Z", + "iopub.status.idle": "2024-08-30T13:44:16.029663Z", + "shell.execute_reply": "2024-08-30T13:44:16.029226Z" } }, "outputs": [], @@ -1314,24 +1447,24 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 33, "id": "e6e38fc1", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.325950Z", - "iopub.status.busy": "2024-03-27T11:26:45.325616Z", - "iopub.status.idle": "2024-03-27T11:26:45.329021Z", - "shell.execute_reply": "2024-03-27T11:26:45.328467Z" + "iopub.execute_input": "2024-08-30T13:44:16.031501Z", + "iopub.status.busy": "2024-08-30T13:44:16.031183Z", + "iopub.status.idle": "2024-08-30T13:44:16.034289Z", + "shell.execute_reply": "2024-08-30T13:44:16.033820Z" } }, "outputs": [ { "data": { "text/plain": [ - "'/home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.0.2/magic/rad_max/data/pulsar_events_file/'" + "'/home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.2/magic/rad_max/data/pulsar_events_file/'" ] }, - "execution_count": 30, + "execution_count": 33, "metadata": {}, "output_type": "execute_result" } @@ -1342,32 +1475,29 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 34, "id": "f339c797", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.331194Z", - "iopub.status.busy": "2024-03-27T11:26:45.330781Z", - "iopub.status.idle": "2024-03-27T11:26:45.489597Z", - "shell.execute_reply": "2024-03-27T11:26:45.488969Z" - }, - "scrolled": true + "iopub.execute_input": "2024-08-30T13:44:16.036030Z", + "iopub.status.busy": "2024-08-30T13:44:16.035881Z", + "iopub.status.idle": "2024-08-30T13:44:16.168565Z", + "shell.execute_reply": "2024-08-30T13:44:16.168088Z" + } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Writing outputfile in /home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.0.2/magic/rad_max/data/pulsar_events_file/dl3_pulsar_5029747.fits.gz\n" + "Writing output file in /home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.2/magic/rad_max/data/pulsar_events_file/dl3_pulsar_5029747.fits.gz\n" ] } ], "source": [ "# Save the observation object in the specified file_path\n", - "print(\"Writing outputfile in \" + str(file_path))\n", - "observation.events.write(\n", - " filename=file_path, gti=observation.gti, overwrite=True\n", - ")" + "print(\"Writing output file in \" + str(file_path))\n", + "new_obs.write(path=file_path, include_irfs=False, overwrite=True)" ] }, { @@ -1380,14 +1510,14 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 35, "id": "4b8dd431", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.492294Z", - "iopub.status.busy": "2024-03-27T11:26:45.491941Z", - "iopub.status.idle": "2024-03-27T11:26:45.497464Z", - "shell.execute_reply": "2024-03-27T11:26:45.496931Z" + "iopub.execute_input": "2024-08-30T13:44:16.170679Z", + "iopub.status.busy": "2024-08-30T13:44:16.170369Z", + "iopub.status.idle": "2024-08-30T13:44:16.175339Z", + "shell.execute_reply": "2024-08-30T13:44:16.174869Z" } }, "outputs": [ @@ -1395,7 +1525,7 @@ "data": { "text/html": [ "
HDUIndexTable length=10\n", - "\n", + "
\n", "\n", "\n", "\n", @@ -1427,7 +1557,7 @@ "5029747 edisp ... ENERGY DISPERSION" ] }, - "execution_count": 32, + "execution_count": 35, "metadata": {}, "output_type": "execute_result" } @@ -1440,34 +1570,36 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 36, "id": "6f37e101", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.499587Z", - "iopub.status.busy": "2024-03-27T11:26:45.499179Z", - "iopub.status.idle": "2024-03-27T11:26:45.502364Z", - "shell.execute_reply": "2024-03-27T11:26:45.501887Z" + "iopub.execute_input": "2024-08-30T13:44:16.177243Z", + "iopub.status.busy": "2024-08-30T13:44:16.176916Z", + "iopub.status.idle": "2024-08-30T13:44:16.179856Z", + "shell.execute_reply": "2024-08-30T13:44:16.179447Z" } }, "outputs": [], "source": [ "for entry in new_hdu:\n", - " if entry[\"HDU_NAME\"] == \"EVENTS\" and entry[\"OBS_ID\"] == observation.obs_id:\n", + " if (entry[\"HDU_NAME\"] == \"EVENTS\") and (\n", + " entry[\"OBS_ID\"] == observation.obs_id\n", + " ):\n", " entry[\"FILE_DIR\"] = \"./\" + str(output_directory)\n", " entry[\"FILE_NAME\"] = filename" ] }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 37, "id": "d89a7739", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.504469Z", - "iopub.status.busy": "2024-03-27T11:26:45.504078Z", - "iopub.status.idle": "2024-03-27T11:26:45.508565Z", - "shell.execute_reply": "2024-03-27T11:26:45.507988Z" + "iopub.execute_input": "2024-08-30T13:44:16.181702Z", + "iopub.status.busy": "2024-08-30T13:44:16.181410Z", + "iopub.status.idle": "2024-08-30T13:44:16.185572Z", + "shell.execute_reply": "2024-08-30T13:44:16.185152Z" } }, "outputs": [ @@ -1475,7 +1607,7 @@ "data": { "text/html": [ "
HDUIndexTable length=10\n", - "
OBS_IDHDU_TYPEHDU_CLASSFILE_DIRFILE_NAMEHDU_NAME
int64bytes30bytes30bytes100bytes50bytes30
5029748eventsevents./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsEVENTS
\n", + "
\n", "\n", "\n", "\n", @@ -1507,7 +1639,7 @@ "5029747 edisp ... ENERGY DISPERSION" ] }, - "execution_count": 34, + "execution_count": 37, "metadata": {}, "output_type": "execute_result" } @@ -1529,19 +1661,19 @@ "id": "e08bf493", "metadata": {}, "source": [ - "Finally, we need to save the new HDU table in the origianl DL3 directory. Here one should be very careful to not name the new HDU file with the same name as the original HDU file of the data store. Otherwise, the original HDU file will be overwrited. " + "Finally, we need to save the new HDU table in the original DL3 directory. One must be very careful with naming the new HDU file, such that it does not have the same name as the original HDU file of the data store. Otherwise, the original HDU file will be overwritten." ] }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 38, "id": "b1633cd5", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.510689Z", - "iopub.status.busy": "2024-03-27T11:26:45.510412Z", - "iopub.status.idle": "2024-03-27T11:26:45.521520Z", - "shell.execute_reply": "2024-03-27T11:26:45.520994Z" + "iopub.execute_input": "2024-08-30T13:44:16.187343Z", + "iopub.status.busy": "2024-08-30T13:44:16.187186Z", + "iopub.status.idle": "2024-08-30T13:44:16.197275Z", + "shell.execute_reply": "2024-08-30T13:44:16.196738Z" } }, "outputs": [], @@ -1556,7 +1688,7 @@ "id": "e92cf68c", "metadata": {}, "source": [ - "**Note: Here we use only one approach that could be useful, showing the steps to save the new Event files in a random directory and generate a new modified HDU index table. However, the user is free to chose the absolute path of the EventList and DataStore. For instance, another approach could be making a full copy of the DataStore, or changing the location of the pulsar event files to one that could be more convinient for the user.**" + "**Note: Here we demonstrate only one approach that could be useful, showing the steps to save the new Event files in a directory and generate a new modified HDU index table. However, the user is free to choose the absolute path of the EventList and DataStore. Another approach, for instance, could be making a full copy of the DataStore, or changing the location of the pulsar event files to one that is more convenient for the user.**" ] }, { @@ -1572,38 +1704,38 @@ "id": "e1036448", "metadata": {}, "source": [ - "Once all of this is done, we just have to open the data store using `DataStore.from_dir()`and passing the pulsar HDU table to it :" + "Once all of this is done, we just have to open the data store using DataStore.from_dir() and pass the pulsar HDU table to it :" ] }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 39, "id": "88a0e9c1", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.523852Z", - "iopub.status.busy": "2024-03-27T11:26:45.523517Z", - "iopub.status.idle": "2024-03-27T11:26:45.537115Z", - "shell.execute_reply": "2024-03-27T11:26:45.536595Z" + "iopub.execute_input": "2024-08-30T13:44:16.199418Z", + "iopub.status.busy": "2024-08-30T13:44:16.199114Z", + "iopub.status.idle": "2024-08-30T13:44:16.210872Z", + "shell.execute_reply": "2024-08-30T13:44:16.210389Z" } }, "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": 37, + "execution_count": 40, "id": "f7c60c18", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.539197Z", - "iopub.status.busy": "2024-03-27T11:26:45.538882Z", - "iopub.status.idle": "2024-03-27T11:26:45.543864Z", - "shell.execute_reply": "2024-03-27T11:26:45.543346Z" + "iopub.execute_input": "2024-08-30T13:44:16.213029Z", + "iopub.status.busy": "2024-08-30T13:44:16.212605Z", + "iopub.status.idle": "2024-08-30T13:44:16.217590Z", + "shell.execute_reply": "2024-08-30T13:44:16.217079Z" } }, "outputs": [ @@ -1613,7 +1745,7 @@ "['events', 'gti', 'aeff', 'edisp', 'rad_max']" ] }, - "execution_count": 37, + "execution_count": 40, "metadata": {}, "output_type": "execute_result" } @@ -1627,14 +1759,14 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 41, "id": "4ae8ebd2", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.545837Z", - "iopub.status.busy": "2024-03-27T11:26:45.545678Z", - "iopub.status.idle": "2024-03-27T11:26:45.559836Z", - "shell.execute_reply": "2024-03-27T11:26:45.559308Z" + "iopub.execute_input": "2024-08-30T13:44:16.219467Z", + "iopub.status.busy": "2024-08-30T13:44:16.219161Z", + "iopub.status.idle": "2024-08-30T13:44:16.233657Z", + "shell.execute_reply": "2024-08-30T13:44:16.233153Z" } }, "outputs": [ @@ -1642,61 +1774,59 @@ "data": { "text/html": [ "
Table length=11189\n", - "
OBS_IDHDU_TYPEHDU_CLASSFILE_DIRFILE_NAMEHDU_NAME
int64bytes30bytes30bytes100bytes50bytes30
5029748eventsevents./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsEVENTS
\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "
EVENT_IDTIMERADECENERGY
sdegdegTeV
int64float64float32float32float32
2402333778852.509924984.5945722.030880.18194601
2408333778852.526715384.2146223.449140.08397394
2434333778852.6131505483.52470422.7257920.10596932
2445333778852.669014283.7695722.4510060.19733498
2478333778852.762793983.47851623.4845940.08522219
2481333778852.777854983.7151721.9851151.0020943
2513333778852.864446782.42119622.5676520.14374068
2544333778852.982606483.6413622.0413150.10316629
2559333778853.026941484.06917622.973370.047184493
...............
356222333780039.452039784.7448220.8949810.043312162
356223333780039.460049284.1161522.5575050.08110082
356227333780039.4710536683.4153421.673440.2096362
356242333780039.517909583.5516522.7729850.17672835
356282333780039.6299751484.4613321.693570.05068718
356473333780040.338647984.4544121.1598280.1831569
356478333780040.354892683.6833623.4449880.06305169
356485333780040.374132284.3351721.283380.060539745
356486333780040.375515984.8588622.1162220.123453744
356526333780040.5247600784.8692921.2909160.13630114
\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", "
EVENT_IDTIMERADECENERGYPHASE
sdegdegTeV
int64float64float32float32float32float64
2402333778852.509924984.5945722.030880.181946010.3934918682770723
2408333778852.526715384.2146223.449140.083973940.8919525879696997
2434333778852.6131505483.52470422.7257920.105969320.45797881185987477
2445333778852.669014283.7695722.4510060.197334980.11641851092409164
2478333778852.762793983.47851623.4845940.085222190.900480594501521
2481333778852.777854983.7151721.9851151.00209430.34760107795590983
2513333778852.864446782.42119622.5676520.143740680.9182740088921875
2544333778852.982606483.6413622.0413150.103166290.42611240294578184
2559333778853.026941484.06917622.973370.0471844930.7422974209419148
..................
356223333780039.460049284.1161522.5575050.081100820.6914919573678725
356227333780039.4710536683.4153421.673440.20963620.018183853280195963
356242333780039.517909583.5516522.7729850.176728350.4092061182772071
356282333780039.6299751484.4613321.693570.050687180.7361270045119108
356473333780040.338647984.4544121.1598280.18315690.7746788606122589
356478333780040.354892683.6833623.4449880.063051690.25693976618589837
356485333780040.374132284.3351721.283380.0605397450.8281108809408599
356486333780040.375515984.8588622.1162220.1234537440.8691880225176731
356526333780040.5247600784.8692921.2909160.136301140.29983892821377583
" ], "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", - " 356222 333780039.4520397 84.74482 20.894981 0.043312162\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" + "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.3934918682770723\n", + " 2408 333778852.5267153 84.21462 23.44914 0.08397394 0.8919525879696997\n", + " 2434 333778852.61315054 83.524704 22.725792 0.10596932 0.45797881185987477\n", + " 2445 333778852.6690142 83.76957 22.451006 0.19733498 0.11641851092409164\n", + " 2478 333778852.7627939 83.478516 23.484594 0.08522219 0.900480594501521\n", + " 2481 333778852.7778549 83.71517 21.985115 1.0020943 0.34760107795590983\n", + " 2513 333778852.8644467 82.421196 22.567652 0.14374068 0.9182740088921875\n", + " 2544 333778852.9826064 83.64136 22.041315 0.10316629 0.42611240294578184\n", + " 2559 333778853.0269414 84.069176 22.97337 0.047184493 0.7422974209419148\n", + " ... ... ... ... ... ...\n", + " 356223 333780039.4600492 84.11615 22.557505 0.08110082 0.6914919573678725\n", + " 356227 333780039.47105366 83.41534 21.67344 0.2096362 0.018183853280195963\n", + " 356242 333780039.5179095 83.55165 22.772985 0.17672835 0.4092061182772071\n", + " 356282 333780039.62997514 84.46133 21.69357 0.05068718 0.7361270045119108\n", + " 356473 333780040.3386479 84.45441 21.159828 0.1831569 0.7746788606122589\n", + " 356478 333780040.3548926 83.68336 23.444988 0.06305169 0.25693976618589837\n", + " 356485 333780040.3741322 84.33517 21.28338 0.060539745 0.8281108809408599\n", + " 356486 333780040.3755159 84.85886 22.116222 0.123453744 0.8691880225176731\n", + " 356526 333780040.52476007 84.86929 21.290916 0.13630114 0.29983892821377583" ] }, - "execution_count": 38, + "execution_count": 41, "metadata": {}, "output_type": "execute_result" } @@ -1726,7 +1856,7 @@ "id": "1fe89d60", "metadata": {}, "source": [ - "Once we have the corret DataStore and the modified EventList with the phase information, we can do the pulsar analysis using different tools for Gammapy to compute the phaseogram, maps, SED, lightcurve, etc... To do so, one can check the following [Gammapy tutorial](https://docs.gammapy.org/1.0/tutorials/analysis-time/pulsar_analysis.html#sphx-glr-tutorials-analysis-time-pulsar-analysis-py)." + "Once we have the correct DataStore and the modified EventList with the phase information, we can perform the pulsar analysis using different tools available in Gammapy. Allowing us to compute the phaseogram, maps, SED, lightcurve and more. To do so, please refer to the following [Gammapy tutorial](https://docs.gammapy.org/1.0/tutorials/analysis-time/pulsar_analysis.html#sphx-glr-tutorials-analysis-time-pulsar-analysis-py)." ] }, { @@ -1755,7 +1885,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.19" + "version": "3.11.9" }, "nbsphinx": { "orphan": true diff --git a/docs/_build/html/notebooks/ts-vs-excess-map-estimator/ts-vs-exess-map-estimator.html b/docs/_build/html/notebooks/ts-vs-excess-map-estimator/ts-vs-exess-map-estimator.html index c043be8..395bfc0 100644 --- a/docs/_build/html/notebooks/ts-vs-excess-map-estimator/ts-vs-exess-map-estimator.html +++ b/docs/_build/html/notebooks/ts-vs-excess-map-estimator/ts-vs-exess-map-estimator.html @@ -8,8 +8,8 @@ - - + + diff --git a/docs/_build/html/search.html b/docs/_build/html/search.html index 1abb904..d3b9294 100644 --- a/docs/_build/html/search.html +++ b/docs/_build/html/search.html @@ -7,7 +7,7 @@ - + diff --git a/docs/_build/html/searchindex.js b/docs/_build/html/searchindex.js index bb9bb30..b8dc93c 100644 --- a/docs/_build/html/searchindex.js +++ b/docs/_build/html/searchindex.js @@ -1 +1 @@ -Search.setIndex({"alltitles": {"0. Dependencies and imports": [[6, "0.-Dependencies-and-imports"]], "1. Reading DataStore": [[6, "1.-Reading-DataStore"]], "2. Phase-folding with PINT for one observation": [[6, "2.-Phase-folding-with-PINT-for-one-observation"]], "2.1 An ephemeris file from Fermi-LAT data.": [[6, "2.1-An-ephemeris-file-from-Fermi-LAT-data."]], "2.2 Computing pulsar phases": [[6, "2.2-Computing-pulsar-phases"]], "3. Adding phases and metadata to an EventList and put it in a new Observation.": [[6, "3.-Adding-phases-and-metadata-to-an-EventList-and-put-it-in-a-new-Observation."]], "4. Save new Event List and writing a modify HDU index table": [[6, "4.-Save-new-Event-List-and-writing-a-modify-HDU-index-table"]], "5. Opening the new DataStore": [[6, "5.-Opening-the-new-DataStore"]], "6. Pulsar analysis tools with gammapy": [[6, "6.-Pulsar-analysis-tools-with-gammapy"]], "Background model": [[2, "Background-model"]], "Context": [[2, "Context"]], "Contributing": [[0, "contributing"]], "Create a template background model": [[2, "Create-a-template-background-model"]], "Dark matter spatial and spectral models": [[3, "Dark-matter-spatial-and-spectral-models"]], "Define priors": [[5, "Define-priors"]], "Estimate parameter correlations with MCMC": [[5, "Estimate-parameter-correlations-with-MCMC"]], "Exercises": [[2, "Exercises"]], "Flux": [[7, "Flux"]], "Flux Error": [[7, "Flux-Error"]], "Flux Error Neg.": [[7, "Flux-Error-Neg."]], "Flux Error Pos.": [[7, "Flux-Error-Pos."]], "Flux UL": [[7, "Flux-UL"]], "Flux maps": [[3, "Flux-maps"]], "Fun Zone": [[5, "Fun-Zone"]], "Gamma-ray spectra at production": [[3, "Gamma-ray-spectra-at-production"]], "Gammapy": [[1, "gammapy"]], "How does it work ?": [[5, "How-does-it-work-?"]], "Index tables": [[2, "Index-tables"]], "Introduction": [[3, "Introduction"], [5, "Introduction"]], "J Factors": [[3, "J-Factors"]], "Load the changed parameters and verify that the model has been updated": [[4, "Load-the-changed-parameters-and-verify-that-the-model-has-been-updated"]], "MCMC sampling using the emcee package": [[5, "MCMC-sampling-using-the-emcee-package"]], "NPred Err": [[7, "NPred-Err"]], "NPred Error Neg.": [[7, "NPred-Error-Neg."]], "NPred Error Pos.": [[7, "NPred-Error-Pos."]], "NPred Excess": [[7, "NPred-Excess"]], "NPred Ref.": [[7, "NPred-Ref."]], "NPred UL": [[7, "NPred-UL"]], "PeVatrons in CTA ?": [[5, "PeVatrons-in-CTA-?"]], "Phase computation for pulsar using PINT": [[6, "Phase-computation-for-pulsar-using-PINT"]], "Plot the model dispersion": [[5, "Plot-the-model-dispersion"]], "Plot the results": [[5, "Plot-the-results"]], "Profiles": [[3, "Profiles"]], "Proposed approach": [[2, "Proposed-approach"]], "Recipe to show the interactively edit the Sky model on the notebook": [[4, "Recipe-to-show-the-interactively-edit-the-Sky-model-on-the-notebook"]], "Recipes": [[1, null]], "Select off data": [[2, "Select-off-data"]], "Setup": [[2, "Setup"], [3, "Setup"]], "Simulate an observation": [[5, "Simulate-an-observation"]], "Sqrt(TS)": [[7, "Sqrt(TS)"]], "TSMapEstimator vs. ExcessMapEstimator": [[7, "TSMapEstimator-vs.-ExcessMapEstimator"]], "Why should I use it ?": [[5, "Why-should-I-use-it-?"]], "Zenith dependence": [[2, "Zenith-dependence"]]}, "docnames": ["contributing", "index", "notebooks/background-model/background_model", "notebooks/dark-matter-utilities/astro_dark_matter", "notebooks/interactive-model-editing/interactive-model-editing", "notebooks/mcmc-sampling-emcee/mcmc_sampling", "notebooks/pulsar_phase/pulsar_phase_computation", "notebooks/ts-vs-excess-map-estimator/ts-vs-exess-map-estimator"], "envversion": {"nbsphinx": 4, "sphinx": 61, "sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2}, "filenames": ["contributing.rst", "index.rst", "notebooks/background-model/background_model.ipynb", "notebooks/dark-matter-utilities/astro_dark_matter.ipynb", "notebooks/interactive-model-editing/interactive-model-editing.ipynb", "notebooks/mcmc-sampling-emcee/mcmc_sampling.ipynb", "notebooks/pulsar_phase/pulsar_phase_computation.ipynb", "notebooks/ts-vs-excess-map-estimator/ts-vs-exess-map-estimator.ipynb"], "indexentries": {}, "objects": {}, "objnames": {}, "objtypes": {}, "terms": {"": [2, 3, 4, 5, 6, 7], "0": [2, 3, 4, 5, 7], "00": [4, 6], "000": [4, 5], "0000000000000000": 6, "0000e": 4, "000e": 4, "0020943": 6, "00209430": 6, "00deg0": 4, "00e": 5, "00nannanfals": 4, "00nannantru": 4, "00nannantruerefer": 4, "00tev0": 4, "01": [3, 5], "01444": 6, "01447222222222": 6, "0144871383400": 6, "018183944316962984": 6, "019": 4, "01deg0": 4, "01fals": 4, "01tev": 4, "02": [5, 6], "0269414": 6, "026941484": 6, "03": 6, "03088": 6, "030880": 6, "031279168349770640344": 6, "0339344": 6, "035": 6, "041315": 6, "0413150": 6, "043312162": 6, "0433121620": 6, "047184493": 6, "0471844930": 6, "04d": 6, "05": [3, 5, 7], "050": 5, "05068718": 6, "050687180": 6, "0534": 6, "06": [5, 6], "060539745": 6, "0605397450": 6, "06305169": 6, "063051690": 6, "06621791733": 6, "069176": 6, "06917622": 6, "07": 5, "07113250e": 6, "07659442e": 6, "08": 6, "08110082": 6, "081100820": 6, "08142": 3, "083": 6, "08397394": 6, "083973940": 6, "08522219": 6, "085222190": 6, "09": 5, "0x7f671cdc3dd0": 3, "0x7fe28f5feb90": 5, "1": [2, 3, 4, 5, 7], "10": [2, 3, 4, 5, 6, 7], "100": [2, 3, 5, 7], "1000": [2, 5], "10000000": 6, "1012": 3, "103": 6, "10316629": 6, "103166290": 6, "105": 2, "10596932": 6, "105969320": 6, "11": [2, 3, 5, 6, 7], "111761868": 6, "11189": 6, "112": 7, "11245045e": 6, "11615": 6, "1161522": 6, "116222": 6, "1162220": 6, "11641860219368935": 6, "1178": 6, "1188": 6, "118843034": 6, "12": [2, 3, 5, 6, 7], "121": 6, "123453744": 6, "1234537440": 6, "1296269": 5, "1296274": 5, "12cm": 4, "13": [2, 5, 6, 7], "133": 7, "1358": 6, "13630114": 6, "136301140": 6, "138": 7, "14": [2, 5, 6, 7], "14374068": 6, "143740680": 6, "14e": 5, "15": [2, 5, 6, 7], "150": [5, 6], "1526259": 6, "1552775999516551": 6, "155277599951656": 6, "1591704": 6, "159828": 6, "1598280": 6, "16": [2, 3, 5, 6, 7], "1607": 3, "1633675551229037574e": 6, "17": [2, 5, 6, 7], "175398": 6, "176": 6, "17672835": 6, "176728350": 6, "177": 6, "18": [2, 5, 6, 7], "18112859": 6, "18112878": 6, "18112978": 6, "18194601": 6, "181946010": 6, "182646367277094e": 6, "1831569": 6, "18315690": 6, "188": 6, "19": [2, 6, 7], "192": 6, "193": 6, "19487702": 6, "19487703": 6, "19487876": 6, "19733498": 6, "197334980": 6, "198": 6, "1d": 6, "1dc": [5, 7], "1e": 5, "2": [2, 3, 4, 5, 7], "20": [2, 5, 6, 7], "200": 5, "2000": [5, 6], "2012": 5, "20131004_05029747_dl3_crabnebula": 6, "20131004_05029748_dl3_crabnebula": 6, "20136": 2, "20137": 2, "20137bkgbkg_2dhess": 2, "20137bkgbkg_3ddatahess_dl3_dr1_obs_id_020137": 2, "20137edispedisp_2ddatahess_dl3_dr1_obs_id_020137": 2, "20137eventseventsdatahess_dl3_dr1_obs_id_020137": 2, "20137gtigtidatahess_dl3_dr1_obs_id_020137": 2, "20137psfpsf_tabledatahess_dl3_dr1_obs_id_020137": 2, "2014aph": 2, "2015": 6, "202": 6, "2021": 6, "2024": 6, "20275": 2, "20339": 2, "20561": 2, "20734": 2, "20915": 2, "2096362": 6, "20963620": 6, "20e": 5, "21": [2, 3, 6, 7], "211": 7, "213": 6, "21462": 6, "2146223": 6, "215": 6, "21613": 2, "21753": 2, "21807": 2, "21824": 2, "21851": 2, "22": [2, 6], "2200": 6, "2200_apj_708_1254_2010": 6, "22022": 2, "221": 7, "222": 7, "223": 7, "2231": 6, "224": 7, "22400": 5, "2251": 6, "22593": 2, "2272": 6, "22997": 2, "23": [2, 4, 6], "23040": 2, "23077": 2, "23143": 2, "23246": 2, "2350": 6, "23573": 2, "23635": 2, "23651": 2, "23736": 2, "238923": 5, "24": 6, "2402": 6, "2402333778852": 6, "2403": 6, "2408": 6, "2408333778852": 6, "2417": 6, "2434": 6, "2434333778852": 6, "24389": 6, "2445": 6, "2445333778852": 6, "247": 6, "2478": 6, "2478333778852": 6, "248096": 5, "2481": 6, "248102": 5, "2481333778852": 6, "25": 6, "2513": 6, "2513333778852": 6, "253": 7, "25345": 2, "2544": 6, "25443": 2, "2544333778852": 6, "25511": 2, "2559": 6, "2559333778853": 6, "2561": 6, "2569398572226654": 6, "25h": 2, "26": 6, "26077": 2, "263": 6, "26791": 2, "26827": 2, "26850": 2, "26964": 2, "27": 6, "27044": 2, "27121": 2, "27939": 2, "27987": 2, "28": 6, "28338": 6, "283380": 6, "28341": 2, "28967": 2, "28981": 2, "29": [2, 6], "29024": 2, "29072": 2, "290916": 6, "2909160": 6, "29118": 2, "29177": 2, "29433": 2, "29487": 2, "29526": 2, "29556": 2, "29683": 2, "29983901925054285": 6, "2d": 5, "2e": [5, 7], "3": [2, 3, 4, 5, 7], "30": [6, 7], "31": 6, "32": 6, "33": [3, 6], "333778852": 6, "333778853": 6, "333780039": 6, "333780040": 6, "33517": 6, "3351721": 6, "3386479": 6, "338647984": 6, "34": 6, "3476011689926769": 6, "35": 6, "3548926": 6, "354892683": 6, "356222": 6, "356222333780039": 6, "356223": 6, "356223333780039": 6, "356227": 6, "356227333780039": 6, "356242": 6, "356242333780039": 6, "356282": 6, "356282333780039": 6, "356473": 6, "356473333780040": 6, "356478": 6, "356478333780040": 6, "356485": 6, "356485333780040": 6, "356486": 6, "356486333780040": 6, "356526": 6, "356526333780040": 6, "359": 6, "35e": 3, "36": 6, "365": 6, "37": [6, 7], "3741322": 6, "374132284": 6, "3755159": 6, "375515984": 6, "378": 6, "38": [6, 7], "39": [2, 3, 5, 6], "39349195931383935": 6, "3d": 2, "3e": [5, 7], "3g": 3, "3min": 7, "4": [2, 3, 5, 7], "40": [2, 6, 7], "400": 5, "40920620046641115": 6, "41534": 6, "4153421": 6, "420": 6, "421196": 6, "42119622": 6, "42611249421537956": 6, "432x288": 5, "435217": 6, "44": 6, "440760185772888e": 6, "444988": 6, "4449880": 6, "44914": 6, "449140": 6, "45": [2, 6], "451006": 6, "4510060": 6, "4515": 3, "4520397": 6, "452039784": 6, "4537121484157113": 6, "45441": 6, "4544121": 6, "4579789031294724": 6, "45e": 5, "4600492": 6, "460049284": 6, "46133": 6, "4613321": 6, "47007462e": 6, "47105366": 6, "4710536683": 6, "4769125122": 6, "47829": 2, "478516": 6, "47851623": 6, "484594": 6, "4845940": 6, "486": 2, "487306981530037e": 6, "49278181e": 6, "4e": 7, "5": [2, 3, 5, 7], "50": [5, 7], "500": [5, 7], "5029747": 6, "5029747aeffaeff_2d": 6, "5029747edispedisp_2d": 6, "5029747eventsev": 6, "5029747gtigti": 6, "5029747rad_maxrad_max_2d": 6, "5029748": 6, "5029748aeffaeff_2d": 6, "5029748edispedisp_2d": 6, "5029748eventsev": 6, "5029748gtigti": 6, "5029748rad_maxrad_max_2d": 6, "50739": 6, "5099249": 6, "509924984": 6, "51": 7, "5179095": 6, "517909583": 6, "52": 6, "524704": 6, "52470422": 6, "52476007": 6, "5247600784": 6, "5267153": 6, "526715384": 6, "52706": 6, "54": 2, "54686": 6, "546979": 6, "55": 6, "55107": 6, "55165": 6, "5516522": 6, "55555": 6, "55638": 6, "557505": 6, "5575050": 6, "56": 6, "56569": 6, "56583": 6, "567652": 6, "5676520": 6, "56889811e": 6, "575538888888889": 6, "587": 6, "593": 6, "59457": 6, "5945722": 6, "5e": 7, "5h": 5, "6": [2, 3, 5, 7], "60396": 6, "61315054": 6, "6131505483": 6, "62997514": 6, "6299751484": 6, "6331144560900": 6, "63333": 6, "636": 6, "640": 6, "64136": 6, "6413622": 6, "646": 6, "648": 6, "651": 6, "66": 7, "6690142": 6, "669014283": 6, "6724769747827286635e": 6, "67344": 6, "673440": 6, "67e21": 3, "68336": 6, "6833623": 6, "69": 6, "6914920486374702": 6, "69357": 6, "693570": 6, "69974": 6, "7": [2, 3, 5, 6, 7], "7105744257791078768e": 6, "71517": 6, "7151721": 6, "716913767510206412": 6, "725792": 6, "7257920": 6, "735": 2, "7361270955486778": 6, "74": [5, 6], "7422975122115125": 6, "74482": 6, "7448220": 6, "761944": 6, "7627939": 6, "762793983": 6, "76957": 6, "7695722": 6, "77": 7, "772985": 6, "7729850": 6, "7746789518818565": 6, "7778549": 6, "777854983": 6, "785579397589822356": 6, "8": [2, 3, 5, 6, 7], "80": 5, "8071585532816240": 6, "82": [2, 6, 7], "8281109722104576": 6, "83": 6, "84": 6, "84237": 6, "85886": 6, "8588622": 6, "8644467": 6, "864446782": 6, "8691881135544401": 6, "86929": 6, "8692921": 6, "8848": 6, "89": 6, "8919526790064667": 6, "894981": 6, "8949810": 6, "9": [2, 3, 4, 5, 6, 7], "90": 2, "9004806857711186": 6, "901": 6, "903": 6, "91": 5, "9173": 5, "9178": 5, "9182740999289545": 6, "923": 6, "929": 6, "9292261866": 5, "931": 6, "94000000": 6, "97337": 6, "973370": 6, "98": 6, "9826064": 6, "982606483": 6, "98333": 6, "985115": 6, "9851151": 6, "991545": 6, "A": [2, 3, 5], "And": [2, 6], "As": [2, 3], "At": [2, 6], "For": [3, 5, 6], "If": [2, 5, 6], "In": [0, 1, 2, 3, 5, 6], "It": [2, 6], "No": [2, 3, 6], "On": [5, 7], "That": 2, "The": [2, 3, 5, 6, 7], "Then": 5, "There": [3, 4, 5, 6], "These": [1, 3, 6], "To": [2, 5, 6], "With": 5, "_": [2, 3], "__array_ufunc__": 2, "__call__": 6, "__class__": 3, "__init__": [2, 6], "__name__": 3, "__subclasses__": 3, "__version__": 6, "_build": 0, "_data": 7, "_load_kernel_link": 6, "_make_bkg2d": 2, "_static": 0, "ab": 3, "abl": [2, 6], "about": [5, 6], "abov": [2, 5, 6], "abs_phas": 6, "absolut": 6, "absolute_phas": 6, "absphas": 6, "accept": 0, "access": 2, "account": [2, 7], "accumul": 2, "accur": 5, "action": 0, "activ": 6, "actual": [2, 6], "add": [0, 2, 6], "add_cbar": [3, 5, 7], "addit": [0, 6], "adonath": 2, "adopt": 3, "aeff": [2, 6], "aeff_2d": 2, "after": 5, "again": 5, "against": 7, "agn": 2, "aim": 3, "al": 6, "algorithm": [2, 5], "all": [2, 4, 5, 6, 7], "allow": 4, "allowed_channel": 3, "alongsid": 6, "alpha": [5, 7], "alreadi": [3, 5, 6], "also": [2, 5, 6], "alt_pnt": 6, "altern": [4, 6], "altitud": 6, "alvaro": 6, "alwai": [2, 3, 6], "amplitud": 5, "an": [2, 7], "analys": [3, 5], "analysi": [2, 3, 5], "angl": 2, "angleparamet": 6, "ani": [0, 5, 6], "annihil": 3, "anoth": [2, 6], "api": 5, "append": 2, "appli": 6, "apply_clock_correct": 6, "approach": [5, 6, 7], "approxim": [5, 7], "ar": [2, 3, 4, 5, 6, 7], "area": [2, 6], "arg": 7, "around": 3, "arrai": [1, 2, 5, 6], "arriv": 6, "arxiv": 3, "ascl": 6, "aspect": 2, "associ": 6, "assum": [3, 5, 6], "assymetr": 7, "astro": [3, 6], "astro_dark_matt": 3, "astrometryequatori": 6, "astronomi": [1, 6], "astropi": [2, 3, 4, 5, 6, 7], "astyp": 6, "atmospher": 2, "attribut": 5, "autocorrel": 5, "avail": [2, 6], "available_hdu": 6, "averag": 7, "awai": 5, "awar": 6, "ax": [2, 3, 5, 7], "ax1": 7, "ax2": 7, "ax3": 7, "ax4": 7, "axessubplot": 5, "axi": [5, 6], "axvlin": 3, "az_pnt": 6, "azimuth": 2, "b": [0, 3], "back": 6, "background": 5, "background2d": 2, "background_model": 2, "background_r": 2, "backgroundmodelestim": 2, "backward": 7, "bad": 6, "band": 3, "barycent": 6, "barycentr": 6, "base": 7, "base_dir": [2, 6], "basi": [0, 3], "basic": [2, 3], "basicconfig": 5, "bcf": 5, "becaus": [2, 6, 7], "becom": 7, "been": 6, "befor": [0, 2, 5], "below": [0, 2], "better": [5, 7], "between": [5, 6], "bin": [2, 5], "bin_volum": 2, "binsz": [3, 5], "bintablehdu": 2, "bit": [2, 5], "bkg": [2, 5], "bkg0": 2, "bkg1": 2, "bkg2": 2, "bkg_2d": 2, "bkg_3d": 2, "bkg_model": 5, "bkgspectralnorm1": 4, "bkgspectralreference1": 4, "bkgspectraltilt0": 4, "black": 3, "boolparamet": 6, "both": 6, "bottom": 5, "build": [0, 2], "bundl": 2, "burkertprofil": 3, "burn": 5, "burnin": 5, "c": [3, 4], "calcul": [3, 6], "caldb": 5, "call": 2, "can": [2, 3, 4, 5, 6], "care": 6, "carefulli": 1, "carlo": 5, "carri": 5, "case": [0, 1, 2, 6, 7], "cash": 5, "cd": 0, "cell": [0, 4], "center": [2, 3], "centr": 3, "certain": 3, "chain": 5, "chang": [0, 2, 6], "channel": 3, "chapter": 3, "charg": 2, "check": 6, "cherenkov": 1, "choic": [2, 5], "chose": 6, "ci": 0, "circl": 3, "circleskyregion": 3, "class": 2, "clearli": 5, "click": 4, "clock": 6, "clock_correct": 6, "close": 5, "closer": 2, "cm": [3, 5], "cm2": [3, 5], "cm3": [3, 6], "cm5": 3, "cmap": [3, 7], "code": [0, 1, 2], "coe": 6, "collabor": 6, "collect": [0, 1], "color": [3, 5, 7], "colorbar": 5, "column": 6, "column_phas": 6, "com": 6, "come": [0, 5], "command": 0, "common": 6, "commun": 1, "compar": [5, 7], "comparison": 5, "complet": 5, "complex": 2, "compon": [5, 6], "comput": [2, 3, 5, 7], "compute_jfactor": 3, "compute_posvel": 6, "compute_tdb": 6, "concept": 3, "concern": 2, "conda": [4, 6], "configur": 2, "confluenc": 6, "consid": 2, "contain": [2, 5, 6], "content": 0, "contour": 5, "contribut": 1, "control": [3, 4], "conveni": 3, "converg": 5, "convert": 6, "convini": 6, "coordin": [3, 5, 6], "copi": [0, 2, 6], "core": [1, 7], "correct": 6, "correl": 7, "correlation_radiu": 7, "correspond": 6, "corret": 6, "cosmic": 2, "could": [2, 6], "count": [2, 5, 7], "cours": 2, "cover": 1, "cpu": [2, 5, 6, 7], "crab": 6, "crabnebula": 6, "creat": [0, 3, 5, 6, 7], "creator": 6, "cta": [1, 7], "cta_dataset": 7, "cube": 5, "current": [3, 4, 6], "curv": 2, "cut": 2, "cutoff": 5, "d": 6, "darkmatt": 3, "darkmatterannihilationspectralmodel": 3, "dash": 3, "data": [0, 3, 5, 7], "data_stor": [2, 6], "datafram": 4, "dataset": [2, 5, 6, 7], "dataset_nam": 5, "datasetmodel": 5, "datastor": 2, "datastore_dir": 6, "date": 6, "de": 3, "de405": 6, "de421": 6, "deadc": 6, "deadtim": 6, "deal": 6, "debug": 6, "dec": 6, "dec_obj": 6, "dec_pnt": 6, "decid": 2, "decj": 6, "declar": 2, "decreas": 2, "deepcopi": 2, "def": [2, 6, 7], "default": 6, "defin": [2, 6], "deg": [2, 3, 5, 6, 7], "demo": 4, "densiti": 3, "depend": [0, 5], "deploi": 0, "deprec": 7, "deriv": 6, "describ": [5, 6], "descript": 5, "design": 0, "detail": 5, "dev": [2, 7], "develop": 1, "df": 4, "dict": 6, "did": 2, "diff": 7, "diff_flux": 3, "differ": [2, 5, 6, 7], "differenti": 2, "dimension": 5, "diplai": 6, "directli": [6, 7], "directori": 6, "disk": 7, "diskspatialmodel": 7, "dispers": 6, "dispersiondm": 6, "displai": 4, "distanc": 3, "distance_gc": 3, "distribut": [2, 5], "divid": 2, "dl3": [2, 6], "dl3_direc": 6, "dl3_pulsar_": 6, "dl3_pulsar_5029747": 6, "dm": [3, 6], "dm1": 6, "dmepoch": 6, "dmprofil": 3, "dn": 3, "do": [2, 3, 5, 6], "doc": 0, "document": [0, 1, 6], "doe": [2, 6], "doesn": [2, 4, 5], "done": [2, 5, 6], "doubl": 4, "download": 6, "dr1": 2, "dr3": 2, "ds2": 2, "due": [2, 6], "durat": 6, "e": [2, 3, 4, 5], "e2": 5, "each": [2, 3, 5, 6], "earth": 6, "easili": 6, "ecosystem": 5, "ecut": 5, "edg": 2, "edgecolor": 3, "edisp": [2, 5, 6], "edisp_2d": 2, "effect": [2, 6, 7], "effici": 2, "effort": 0, "eg": 6, "einastoprofil": 3, "either": 2, "el": 3, "element": 5, "emax": 5, "emin": 5, "emiss": 2, "empti": 2, "empty_dataset": 5, "encount": 2, "end": 2, "energi": [2, 5, 6], "energy_bin": 2, "energy_max": 3, "energy_min": 3, "energy_pow": 5, "energy_rang": [3, 5], "entir": 5, "entri": [2, 6], "enumer": 2, "env": [0, 2, 3, 4, 5, 6, 7], "environ": [2, 3, 4, 5, 6, 7], "ephem": 6, "ephem_dec": 6, "ephem_fil": 6, "ephem_ra": 6, "ephemerid": 6, "ephemeris_fil": 6, "ephver": 6, "epoch": 6, "equal": 7, "equinox": 6, "equival": 7, "er": 3, "error": [5, 6], "essenti": 6, "est": 7, "est_al": 7, "estim": [2, 7], "et": 6, "etc": [4, 6], "evalu": [2, 5], "even": 7, "event": 2, "event_count": 2, "event_id": 6, "event_idtimeradecenergi": 6, "event_idtimeradecenergyphas": 6, "everyth": 5, "evolut": 5, "evolv": 5, "exampl": [2, 3, 4, 5], "excess": 5, "excessmap": 7, "exess": 7, "exist": [0, 2], "exist_ok": 6, "expcutoffpowerlawspectralmodel": 5, "expect": [2, 3, 7], "experi": 6, "explain": 3, "explor": [4, 5, 6], "exposur": [2, 5, 7], "extnam": 6, "extra": 6, "extract": 6, "ey": 5, "f": [2, 3, 6], "f0": 6, "f1": 6, "f2": 6, "f3": 6, "face": 2, "facecolor": 3, "facilit": 6, "factor": 7, "fake": 5, "fall": 2, "fals": [5, 6], "far": 5, "fast": 6, "faster": 7, "fewer": 2, "field": 2, "fiew": 2, "fig": [3, 5, 7], "figsiz": [3, 5, 7], "figur": [2, 5, 7], "file": [0, 2, 3, 4, 5, 7], "file_dir": [2, 6], "file_nam": [2, 6], "file_path": 6, "filenam": [2, 4, 6], "fill": 2, "fill_count": 2, "fill_exposur": 2, "filter": 4, "filterwarn": [3, 5], "final": [2, 3, 6], "find": [1, 5, 7], "fine": 2, "finish": 6, "first": [2, 5, 6], "fit": [2, 5, 6, 7], "fitseffect": 6, "fitsenergi": 6, "fitsev": 6, "fitsgti": 6, "fitsrad_max": 6, "fix": [2, 3, 4, 5, 6, 7], "fk5": 6, "flag": 6, "flat": 7, "float64": 6, "floatparamet": 6, "fluctuat": 7, "flux": 5, "flux_err": 7, "flux_errn": 7, "flux_errp": 7, "flux_map": 3, "flux_ul": 7, "flux_unit": 3, "focu": 5, "fold": 7, "folder": [0, 6], "follow": [0, 1, 2, 3, 5, 6], "foreman": 5, "forg": 4, "format": [2, 3, 4, 5, 6, 7], "forward": 7, "found": [2, 3, 5, 6], "fovbackgroundmodel": 5, "fraction": 6, "frame": [3, 5, 6], "free": [5, 6], "freez": 4, "frequenc": 6, "from": [0, 2, 3, 4, 5, 7], "from_bound": 2, "from_dir": [2, 6], "from_edg": 5, "from_energy_bound": 2, "from_fil": 2, "from_panda": 4, "frozen": [5, 6], "full": [6, 7], "function": [2, 5], "further": 3, "futher": 2, "g": [2, 3, 4, 5], "g09": 4, "g09spatiallat_01": 4, "g09spatiallon_09": 4, "g09spectralalpha1": 4, "g09spectralamplitude3": 4, "g09spectralindex2": 4, "g09spectrallambda_1": 4, "g09spectralreference1": 4, "gadf": 6, "galact": [3, 5], "gamma": [1, 2, 6], "gammapi": [0, 2, 3, 4, 5, 7], "gammapy_data": [0, 2, 4, 5, 6, 7], "gammapy_v": 6, "gaussianspatialmodel": 5, "gc": [3, 4, 7], "gc_example_model": 4, "gcspatiallat_00": 4, "gcspatiallon_00": 4, "gcspectralalpha1": 4, "gcspectralamplitude3": 4, "gcspectralindex2": 4, "gcspectrallambda_1": 4, "gcspectralreference1": 4, "gener": 6, "geolat": 6, "geolon": 6, "geom": [3, 5, 7], "geometri": 5, "get": [2, 4, 5], "get_changed_df": 4, "get_log": 6, "get_model": 6, "get_observ": [2, 6], "get_toas_arrai": 6, "get_tzr_toa": 6, "gev": 3, "gev2": 3, "gif": 4, "github": [0, 2, 4, 6], "give": [2, 6], "given": [2, 3, 4, 5], "glitch": 6, "glitch_phas": 6, "gll_iem_v06_cutoutspectralnorm1": 4, "gll_iem_v06_cutoutspectralreference1": 4, "gll_iem_v06_cutoutspectraltilt0": 4, "goal": 5, "good": [2, 3], "goodman": 5, "grei": 5, "grid": 5, "grid_opt": 4, "gt": [3, 5], "gti": [2, 6], "gz": [2, 6, 7], "gzbkg0": 2, "gzbkg207360": 2, "gzedisp377280": 2, "gzevent": 6, "gzevents216000": 2, "gzgti5760": 2, "gzpsf118080": 2, "h": [2, 3, 5], "ha": [2, 3, 5, 6], "had": 5, "hand": [5, 6], "handl": [3, 6], "harder": 2, "hardest": 2, "have": [2, 5, 6], "hdu": 2, "hdu_class": 2, "hdu_index": 2, "hdu_list": 2, "hdu_nam": [2, 6], "hdu_tabl": [2, 6], "hdu_table_bkg": 2, "hdu_table_filenam": 6, "hdu_typ": 2, "hduclas1": 6, "hduclass": 6, "hdudoc": 6, "hduindext": [2, 6], "hdulist": 2, "hduver": 6, "header": 6, "help": 5, "here": [2, 4, 5, 6], "hess": [2, 3], "high": [2, 5, 6], "higher": [6, 7], "hilla": 2, "histogram": [2, 5], "histogram2d": 2, "histori": 5, "hogg": 5, "home": 6, "hour": 5, "hourangl": 6, "how": [2, 4, 6], "howev": [2, 3, 6], "hspace": 3, "html": 0, "http": [3, 6], "hz": 6, "i": [0, 1, 2, 3, 4, 6, 7], "iact": 2, "icr": 6, "id": 6, "idea": 5, "idx": 2, "ignor": [3, 5, 6], "im": 3, "imag": [0, 4], "implement": [2, 3], "impli": 5, "import": [2, 3, 4, 5, 7], "imshow": 7, "in_memori": 6, "includ": [3, 6], "include_bipm": 6, "include_gp": 6, "increas": 2, "inde": 7, "index": 5, "indic": 4, "indirect": 3, "individu": 5, "inerti": 6, "inf": 6, "infinit": 6, "info": [2, 3, 5, 6], "inform": [1, 2, 6, 7], "ingredi": [3, 6], "init": 5, "inlin": [2, 3, 5], "instal": [4, 6], "instanc": 6, "instruct": 1, "instrum": 6, "int64bytes30bytes30bytes100bytes50bytes30": 6, "int64float64float32float32float32": 6, "int64float64float32float32float32float64": 6, "int64str6str9str4str36str6int64": 2, "int_flux": 3, "integr": [0, 3], "interest": 2, "interp": [2, 5], "interv": 6, "introduct": 6, "intuit": 4, "invalid": [2, 5], "investig": 5, "io": 2, "ipyaggrid": 4, "ipynb": [2, 3, 4, 5, 6, 7], "ipysheet": 4, "ipython": 4, "irf": [2, 5, 6], "irf_fil": 5, "isn": 2, "isothermalprofil": 3, "its": 6, "j": 6, "j0534": 6, "jan": 6, "jfact": 3, "jfact_map": 3, "jfactori": 3, "jump": 6, "jupyt": [1, 2, 3, 4, 5, 6, 7], "just": [0, 2, 5, 6], "k": 7, "keep": 6, "kernel": 7, "kerr": 6, "kinda": 2, "km": 6, "know": [3, 6], "known": 6, "ko": 5, "kpc": 3, "kwarg": [2, 7], "l": 5, "lab": 4, "label": [2, 3], "lambda": 5, "lambda_": 5, "lang": 5, "larg": 6, "lat_0": 5, "later": [5, 7], "latitud": 5, "law": 2, "lead": 2, "legend": [2, 3], "len": 2, "length": [2, 4, 6], "less": 2, "let": [2, 5, 6], "level": [2, 5, 6], "li": [6, 7], "lib": [2, 6, 7], "librari": [1, 6], "life": 2, "lightcurv": 6, "lightweight": 5, "like": [1, 2, 3, 4, 5, 6], "likelihood": [5, 7], "line": 6, "linear": 7, "linestyl": 3, "link": 1, "linspac": 7, "list": [2, 5], "livetim": [5, 6], "ll": [2, 5], "load": 2, "load_cta_irf": 5, "local": [3, 5, 6], "local_dens": 3, "locat": [2, 6], "log": [3, 5], "logic": 6, "loglog": [2, 3], "lognorm": 3, "logspac": [3, 5], "lon": 6, "lon_0": 5, "longitud": 5, "look": [2, 5, 6], "lqo8tidg": 4, "lt": [3, 5], "luck": 2, "luckili": 5, "luka": 6, "luo": 6, "m": [0, 2, 3, 5, 6, 7], "m2": 5, "m_1": 7, "m_2": 7, "ma": [6, 7], "mackei": 5, "made": [0, 6], "magic": 6, "magic_dl3": 6, "mai": 1, "main": 6, "mainli": 2, "maintain": 0, "make": [0, 2, 6], "make_model": 2, "maker": 5, "mambaforg": 2, "manag": 6, "mandatori": 6, "mani": 5, "manipul": 6, "manual": 5, "map": [2, 5, 6, 7], "mapaxi": [2, 5], "mapdataset": [5, 7], "mapdatasetmak": 5, "mapmak": 2, "markov": 5, "mask": 2, "mass": 3, "massdm": 3, "match": 2, "mathch": 2, "mathemat": 5, "mathrm": 3, "matplotlib": [2, 3, 5, 7], "matplotlibdeprecationwarn": 7, "max": [2, 5], "maxim": 6, "maxvisiblerow": 4, "mcmc_sampl": 5, "mdm": 3, "mean": [5, 7], "measur": [2, 5], "merg": 0, "meta": [2, 6], "metadata": 0, "method": [2, 3, 5, 6], "mev": [2, 5], "mhz": 6, "microsecond": 6, "min": [2, 5], "miniconda3": [6, 7], "minim": 0, "minimum": 5, "minor": 7, "minut": [5, 6], "mjd": 6, "mjdparamet": 6, "mjdreff": 6, "mjdrefi": 6, "mkdir": 6, "model": [6, 7], "model_build": 6, "modeltypenamevalueuniterrorminmaxfrozenlink": 4, "modifi": [0, 4], "moment": 5, "mont": 5, "mooreprofil": 3, "more": [1, 2, 3, 5, 6], "moreov": 6, "most": [0, 2, 5, 6], "movi": 4, "mu": 3, "mul": 3, "multi": 2, "multipl": [2, 6], "multipli": 3, "multiprocess": 7, "mur": 3, "must": 6, "n": [2, 3, 5, 6], "n_job": 7, "name": [2, 5, 6, 7], "nbin": 2, "nbsphinx": [0, 4], "nburn": 5, "nearli": 6, "necessari": [2, 6], "neclect": 7, "need": [0, 2, 4, 5, 6], "neeed": 6, "neg": [5, 6], "new": [2, 5], "new_event_list": 6, "new_hdu": 6, "new_ob": 6, "next": 6, "nfreeparam": 5, "nfwprofil": 3, "nois": 2, "noisi": 2, "non": 2, "none": [2, 3, 5, 6, 7], "norm": [3, 5, 7], "norm_errn": 7, "note": [2, 3, 5, 6], "notebook": [0, 1, 2, 3, 5, 6, 7], "now": [2, 5, 6], "np": [2, 3, 5, 6, 7], "npred_excess": 7, "npred_excess_err": 7, "npred_excess_errn": 7, "npred_excess_errp": 7, "npred_excess_ref": 7, "npred_excess_ul": 7, "nrun": 5, "nu_e": 3, "nu_mu": 3, "nu_tau": 3, "number": [2, 3, 5, 6], "numpi": [2, 3, 5, 6, 7], "nwalk": 5, "nwalker": 5, "o": 2, "ob": [2, 6], "object": [5, 6], "obs_id": [2, 6], "obs_idhdu_typehdu_classfile_dirfile_namehdu_nam": 6, "obs_idhdu_typehdu_classfile_dirfile_namehdu_names": 2, "obs_index": 2, "obs_mod": 6, "obs_row": 2, "obs_sun_po": 6, "obs_tabl": [2, 6], "observ": 2, "observation_time_dur": 2, "observatori": [2, 6], "obtain": 5, "offset": [2, 5], "offset_bin": 2, "often": 6, "old": 0, "onc": [5, 6, 7], "one": [2, 5], "ones": 6, "onli": [2, 4, 6], "ontim": [2, 6], "open": 1, "opt": 7, "optic": 2, "optimis": 2, "optimize_opt": 5, "order": 6, "ordereddict": 6, "ordinari": 7, "org": 3, "origianl": 6, "origin": [2, 6, 7], "other": [0, 2, 6], "otherwis": [5, 6], "our": 6, "out": [2, 5], "outlier": 2, "output": 6, "output_directori": 6, "output_path": 6, "outputfil": 6, "overal": 2, "overwrit": [2, 6], "own": [0, 1], "p": [3, 6], "p_line": 6, "packag": [1, 2, 6, 7], "page": 6, "panda": 4, "panel": 5, "par": [5, 6], "par_to_model": 5, "paramet": [2, 3, 6, 7], "parent": 6, "parfil": 6, "pari": 5, "part": [2, 5], "particular": 6, "parx": 5, "pass": [0, 6, 7], "past": 0, "path": [2, 6], "pathlib": [2, 6], "pc": 6, "pdf": 3, "peek": 2, "peopl": 3, "pepoch": 6, "per": [2, 3, 7], "perform": [5, 6, 7], "period": [5, 6], "ph_log": 6, "phase_column_nam": 6, "phase_log": 6, "phase_offset": 6, "phase_src1": 6, "phase_src2": 6, "phaseogram": 6, "phi": 5, "pi": 2, "pictur": 5, "pint_ver": 6, "pip": 6, "pix_reg": 3, "pixel": 7, "place": 0, "plai": [2, 5], "plain": 4, "plan": 2, "plane": 3, "planet": 6, "planet_shapiro": 6, "pleas": [0, 1, 6, 7], "plot": [2, 3, 7], "plot_corn": 5, "plot_side_by_sid": 7, "plot_trac": 5, "plt": [2, 3, 5, 7], "pmdec": 6, "pmodel": 6, "pmra": 6, "png": [0, 4], "po": 6, "point": [2, 5, 6], "pop": 2, "posepoch": 6, "posit": 3, "posixpath": 6, "possibl": 2, "posterior": 5, "posvel": 6, "power": 2, "powerlawnormspectralmodel": [5, 7], "powerlawspectralmodel": 7, "precis": 6, "predict": 5, "prefer": 6, "present": [0, 1, 3, 6], "previsouli": 5, "primari": 2, "primaryflux": 3, "print": [2, 3, 4, 5, 6], "print_level": 5, "probabilist": 5, "probabl": 5, "problem": [2, 7], "procedur": 5, "process": [0, 2], "produc": [3, 5], "product": 2, "profil": 5, "project": [5, 7], "properti": 2, "propos": [4, 6], "provid": [5, 6], "pseudo": 5, "psf": [2, 5, 7], "psf_tabl": 2, "psr": 6, "psrj": 6, "public": 2, "pull": 0, "puls": 6, "pulsar_datastor": 6, "pulsar_events_fil": 6, "pulsar_phase_comput": 6, "put": [2, 3, 5], "px": 6, "py": [0, 2, 3, 4, 5, 6, 7], "pyplot": [2, 3, 5, 7], "python": [0, 1, 5, 6], "python3": [2, 6, 7], "q": 3, "qgrid": 4, "qgrid_df": 4, "qgrid_widget": 4, "quantiti": [2, 6], "question": 2, "quick": 2, "quickli": 6, "quot": 3, "r_0": 7, "ra": 6, "ra_obj": 6, "ra_pnt": 6, "rad_max": [2, 6], "radecsi": 6, "radial": 2, "radii": 3, "radiu": [3, 6], "rai": [1, 2, 6], "rais": 6, "raj": 6, "random": [5, 6], "rang": 5, "ransom": 6, "rate": 2, "rdbu": 7, "re": [2, 5], "reach": 5, "read": [1, 4, 5, 7], "reader": 5, "real": [2, 5], "realli": 6, "rebuild": 0, "recip": [0, 6], "recommend": 6, "reconstruct": 2, "record": 4, "recov": 6, "red": [3, 5], "reduc": 2, "refer": [2, 5, 6], "referenc": 6, "regard": 6, "regeard": 6, "region": [3, 7], "relat": 2, "releas": [2, 7], "relev": 6, "remain": [2, 7], "remov": [0, 6], "renam": 0, "render": 4, "repositori": [0, 1], "repres": 2, "request": 0, "requir": [2, 6], "required_irf": 6, "respect": 6, "rest": 0, "result": [2, 6, 7], "result_t": 7, "return": [2, 5, 6, 7], "rf": 3, "right": 5, "rotat": 6, "row": [2, 6], "rule": 0, "run": [2, 5, 6, 7], "run_mcmc": 5, "runner": 6, "runtimewarn": 2, "s2": 6, "s3": 6, "safe_energy_lo": 2, "sai": [2, 5], "same": [5, 6, 7], "sampl": 6, "sampler": 5, "save": 2, "scalar": 6, "scale": [2, 3, 5], "scale_to_local_dens": 3, "scatter": [2, 7], "schubert": 6, "scienc": [1, 2], "scratch": 2, "script": 0, "scroll": 4, "sdegdegtev": 6, "search": [3, 5], "sec": 2, "sed": 6, "see": [2, 3, 4, 5, 6], "select": [5, 6], "select_observ": 6, "select_offset": 2, "selected_obs_t": 6, "selection_opt": 7, "self": 2, "sens": 2, "sentenc": 5, "separ": 4, "serv": 3, "set": [2, 5, 6], "set_aspect": 7, "set_titl": [3, 7], "set_xlabel": 7, "set_xlim": 7, "set_ylabel": [3, 7], "set_ylim": 7, "set_yscal": 3, "sever": 6, "shape": [2, 5], "share": 6, "shift": 6, "ship": 2, "should": [0, 2, 6], "show": [2, 5, 6, 7], "show_grid": 4, "shown": 2, "sigma": 5, "signific": 2, "simpl": [2, 5], "simpli": 5, "simplifi": 2, "simulate_dataset": 5, "simultan": 7, "sinc": [2, 6, 7], "singl": [2, 6], "site": [2, 6, 7], "size": [2, 5], "sky": 5, "sky_circl": 6, "sky_model_simu": 5, "sky_reg": 3, "skycoord": [3, 5, 6], "skydir": [3, 5], "skymodel": [5, 7], "slickgrid": 4, "slightli": [2, 7], "smooth": 2, "so": [2, 3, 5, 6], "softwar": [2, 6], "solar": 6, "solar_system_ephemerid": 6, "solarsystemshapiro": 6, "solid": 2, "solut": [5, 7], "some": [2, 3, 5, 6], "someth": 2, "sometim": [2, 6], "sophist": 2, "sort": [2, 4], "sound": 2, "sourc": [1, 2, 3, 4, 5, 6, 7], "south_z20_50h": 5, "space": 5, "spatial": [4, 5], "spatial_model": [5, 7], "spec": 2, "special": 0, "specif": [0, 1, 6], "specifi": [0, 6], "spectral": [4, 5], "spectral_model": [5, 7], "spectrum": [2, 3], "speedup": 5, "sphinx": 0, "spindown": 6, "sqrt": 2, "sqrt_t": 7, "sr": [2, 5], "src": 0, "ssb": 6, "ssb_obs_po": 6, "ssb_obs_vel": 6, "stage": 5, "standard": [2, 3, 6], "start": [2, 3, 5, 6], "stat": 5, "stat_sum": 5, "state": 5, "staticmethod": 2, "stationari": 5, "statist": [2, 5], "steepli": 2, "step": [2, 5, 6], "stereo": 6, "store": [2, 6], "str": 6, "str18str8str9float64str14int64float64float64boolstr18": 4, "straight": 5, "strategi": [2, 5], "stretch": 7, "string": 6, "strparamet": 6, "subplot": [3, 5, 7], "subplots_adjust": 3, "success": 5, "sum": [3, 7], "sum_over_ax": 5, "sum_over_energy_group": 7, "super": [2, 7], "suppli": 2, "support": 3, "surpris": 2, "sy": [2, 5, 6, 7], "symmetr": 2, "symmetri": 2, "system": 6, "t": [2, 3, 4, 5], "tabl": [4, 5], "table_model": 3, "tabular": 4, "tag": 0, "take": [2, 5, 6, 7], "taken": 2, "talk": 5, "target": 5, "target_nam": 2, "target_po": 6, "tau": 3, "taul": 3, "taur": 3, "tdb": 6, "telescop": [1, 2, 6], "templat": 6, "tempor": 5, "ten": 6, "territori": 5, "test": [0, 2, 4, 5], "tev": [2, 3, 4, 5, 6], "text": [2, 3, 4, 5, 6, 7], "than": [0, 2, 6], "thaw": 4, "thei": [3, 5, 6], "them": 6, "therefor": 6, "theta": [5, 6], "thi": [0, 1, 2, 3, 4, 5, 6, 7], "thing": 2, "those": [2, 5], "though": 2, "three": 2, "threshold": 2, "thu": 2, "thumbnail": [0, 4], "tilt": 5, "time": [2, 5, 6, 7], "timeref": 6, "times10": 5, "timesi": 6, "timeunit": 6, "titl": 3, "to_fit": 2, "to_mask": 3, "to_panda": 4, "to_parameters_t": 4, "to_pixel": 3, "to_table_hdu": 2, "toa": 6, "togeth": 6, "tool": 1, "top": 5, "topo_ob": 6, "total": [2, 5, 6, 7], "total_jfact": 3, "toward": 5, "trace": 5, "track": 6, "transform": 4, "treat": 2, "tricki": 2, "true": [2, 3, 5, 6, 7], "true_divid": 2, "truth": 5, "try": [2, 5], "ts_est": 7, "ts_est_al": 7, "tsmap": 7, "tstart": 6, "tstop": 6, "turn": 5, "tutori": [1, 6], "two": [2, 5, 6, 7], "type": [5, 6], "typic": 5, "tzr_toa": 6, "tzrfreq": 6, "tzrfrq": 6, "tzrmjd": 6, "tzrsite": 6, "u": [2, 3, 5, 6, 7], "unchart": 5, "uniform": 5, "uniqu": 6, "unit": [2, 3, 5, 6, 7], "unrecogn": 6, "until": 5, "up": [2, 6], "update_parameters_from_t": 4, "us": [0, 1, 2, 3, 4, 7], "user": [1, 2, 5, 6, 7], "userwarn": 6, "usr": 6, "usual": [2, 3, 6], "utc": 6, "util": 3, "v": [2, 3], "valid": 6, "valu": [2, 3, 4, 5, 6], "variabl": 6, "varieti": 1, "vector": 5, "veri": [2, 5, 6], "version": [2, 3, 4, 5, 6, 7], "via": 4, "view": [2, 5], "viridi": 3, "visual": 7, "vmax": 7, "vmin": 7, "vstack": 2, "w": 3, "w0": 6, "wa": [5, 6], "wai": 2, "wait": 0, "walk": 5, "walker": 5, "wall": [2, 5, 6, 7], "want": [2, 3, 5, 6], "warn": [3, 5, 6], "wc": [3, 7], "wcsax": 7, "wcsaxessubplot": 5, "wcsgeom": [3, 5], "wcsndmap": 3, "we": [2, 3, 4, 5, 6], "webpag": 1, "well": [4, 5, 6], "were": 4, "what": [2, 3, 6], "when": [0, 2, 5, 7], "where": [2, 5, 6], "whether": 2, "which": [2, 4, 5, 6], "while": [5, 7], "who": 3, "whole": [0, 2], "why": 2, "wide": [1, 4], "widget": 4, "width": [3, 5], "within": [2, 4], "without": [2, 3], "wl": 3, "work": [4, 6], "would": [1, 5], "write": 2, "writeto": 2, "written": 6, "wt": 3, "x": [2, 7], "xlabel": [2, 5], "xml": 4, "y": 2, "yaml": [4, 6], "yet": 6, "yield": 2, "ylabel": [2, 5], "ylim": 2, "yml": [0, 2, 3, 4, 5, 6, 7], "you": [1, 2, 4, 5, 6], "your": [0, 1, 4, 5, 6], "yr": 6, "z": 3, "zen": 2, "zen_pnt": 2, "zenith_bin": 2, "zip": 3, "zl": 3, "zt": 3}, "titles": ["Contributing", "Gammapy", "Create a template background model", "Dark matter spatial and spectral models", "Recipe to show the interactively edit the Sky model on the notebook", "MCMC sampling using the emcee package", "Phase computation for pulsar using PINT", "TSMapEstimator vs. ExcessMapEstimator"], "titleterms": {"0": 6, "1": 6, "2": 6, "3": 6, "4": 6, "5": 6, "6": 6, "ad": 6, "an": [5, 6], "analysi": 6, "approach": 2, "background": 2, "been": 4, "chang": 4, "comput": 6, "context": 2, "contribut": 0, "correl": 5, "creat": 2, "cta": 5, "dark": 3, "data": [2, 6], "datastor": 6, "defin": 5, "depend": [2, 6], "dispers": 5, "doe": 5, "edit": 4, "emce": 5, "ephemeri": 6, "err": 7, "error": 7, "estim": 5, "event": 6, "eventlist": 6, "excess": 7, "excessmapestim": 7, "exercis": 2, "factor": 3, "fermi": 6, "file": 6, "flux": [3, 7], "fold": 6, "from": 6, "fun": 5, "gamma": 3, "gammapi": [1, 6], "ha": 4, "hdu": 6, "how": 5, "i": 5, "import": 6, "index": [2, 6], "interact": 4, "introduct": [3, 5], "j": 3, "lat": 6, "list": 6, "load": 4, "map": 3, "matter": 3, "mcmc": 5, "metadata": 6, "model": [2, 3, 4, 5], "modifi": 6, "neg": 7, "new": 6, "notebook": 4, "npred": 7, "observ": [5, 6], "off": 2, "one": 6, "open": 6, "packag": 5, "paramet": [4, 5], "pevatron": 5, "phase": 6, "pint": 6, "plot": 5, "po": 7, "prior": 5, "product": 3, "profil": 3, "propos": 2, "pulsar": 6, "put": 6, "rai": 3, "read": 6, "recip": [1, 4], "ref": 7, "result": 5, "sampl": 5, "save": 6, "select": 2, "setup": [2, 3], "should": 5, "show": 4, "simul": 5, "sky": 4, "spatial": 3, "spectra": 3, "spectral": 3, "sqrt": 7, "t": 7, "tabl": [2, 6], "templat": 2, "tool": 6, "tsmapestim": 7, "ul": 7, "updat": 4, "us": [5, 6], "v": 7, "verifi": 4, "why": 5, "work": 5, "write": 6, "zenith": 2, "zone": 5}}) \ No newline at end of file +Search.setIndex({"alltitles": {"0. Dependencies and imports": [[6, "0.-Dependencies-and-imports"]], "1. Reading DataStore": [[6, "1.-Reading-DataStore"]], "2. Phase-folding with PINT for one observation": [[6, "2.-Phase-folding-with-PINT-for-one-observation"]], "2.1 An ephemeris file from Fermi-LAT data.": [[6, "2.1-An-ephemeris-file-from-Fermi-LAT-data."]], "2.2 Computing pulsar phases": [[6, "2.2-Computing-pulsar-phases"]], "3. Adding phases and metadata to an EventList and put it in a new Observation.": [[6, "3.-Adding-phases-and-metadata-to-an-EventList-and-put-it-in-a-new-Observation."]], "4. Save new Event List and writing a modify HDU index table": [[6, "4.-Save-new-Event-List-and-writing-a-modify-HDU-index-table"]], "5. Opening the new DataStore": [[6, "5.-Opening-the-new-DataStore"]], "6. Pulsar analysis tools with gammapy": [[6, "6.-Pulsar-analysis-tools-with-gammapy"]], "Background model": [[2, "Background-model"]], "Context": [[2, "Context"]], "Contributing": [[0, null]], "Create a template background model": [[2, null]], "Dark matter spatial and spectral models": [[3, null]], "Define priors": [[5, "Define-priors"]], "Estimate parameter correlations with MCMC": [[5, "Estimate-parameter-correlations-with-MCMC"]], "Exercises": [[2, "Exercises"]], "Flux": [[7, "Flux"]], "Flux Error": [[7, "Flux-Error"]], "Flux Error Neg.": [[7, "Flux-Error-Neg."]], "Flux Error Pos.": [[7, "Flux-Error-Pos."]], "Flux UL": [[7, "Flux-UL"]], "Flux maps": [[3, "Flux-maps"]], "Fun Zone": [[5, "Fun-Zone"]], "Gamma-ray spectra at production": [[3, "Gamma-ray-spectra-at-production"]], "Gammapy": [[1, null]], "How does it work ?": [[5, "How-does-it-work-?"]], "Index tables": [[2, "Index-tables"]], "Introduction": [[3, "Introduction"], [5, "Introduction"]], "J Factors": [[3, "J-Factors"]], "Load the changed parameters and verify that the model has been updated": [[4, "Load-the-changed-parameters-and-verify-that-the-model-has-been-updated"]], "MCMC sampling using the emcee package": [[5, null]], "NPred Err": [[7, "NPred-Err"]], "NPred Error Neg.": [[7, "NPred-Error-Neg."]], "NPred Error Pos.": [[7, "NPred-Error-Pos."]], "NPred Excess": [[7, "NPred-Excess"]], "NPred Ref.": [[7, "NPred-Ref."]], "NPred UL": [[7, "NPred-UL"]], "PeVatrons in CTA ?": [[5, "PeVatrons-in-CTA-?"]], "Phase computation for pulsar using PINT": [[6, null]], "Plot the model dispersion": [[5, "Plot-the-model-dispersion"]], "Plot the results": [[5, "Plot-the-results"]], "Profiles": [[3, "Profiles"]], "Proposed approach": [[2, "Proposed-approach"]], "Recipe to show the interactively edit the Sky model on the notebook": [[4, null]], "Recipes": [[1, null]], "Select off data": [[2, "Select-off-data"]], "Setup": [[2, "Setup"], [3, "Setup"]], "Simulate an observation": [[5, "Simulate-an-observation"]], "Sqrt(TS)": [[7, "Sqrt(TS)"]], "TSMapEstimator vs. ExcessMapEstimator": [[7, null]], "Why should I use it ?": [[5, "Why-should-I-use-it-?"]], "Zenith dependence": [[2, "Zenith-dependence"]]}, "docnames": ["contributing", "index", "notebooks/background-model/background_model", "notebooks/dark-matter-utilities/astro_dark_matter", "notebooks/interactive-model-editing/interactive-model-editing", "notebooks/mcmc-sampling-emcee/mcmc_sampling", "notebooks/pulsar_phase/pulsar_phase_computation", "notebooks/ts-vs-excess-map-estimator/ts-vs-exess-map-estimator"], "envversion": {"nbsphinx": 4, "sphinx": 62, "sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2}, "filenames": ["contributing.rst", "index.rst", "notebooks/background-model/background_model.ipynb", "notebooks/dark-matter-utilities/astro_dark_matter.ipynb", "notebooks/interactive-model-editing/interactive-model-editing.ipynb", "notebooks/mcmc-sampling-emcee/mcmc_sampling.ipynb", "notebooks/pulsar_phase/pulsar_phase_computation.ipynb", "notebooks/ts-vs-excess-map-estimator/ts-vs-exess-map-estimator.ipynb"], "indexentries": {}, "objects": {}, "objnames": {}, "objtypes": {}, "terms": {"": [2, 3, 4, 5, 6, 7], "0": [2, 3, 4, 5, 7], "00": [4, 6], "000": [4, 5], "0000000000000000": 6, "0000e": 4, "000e": 4, "0020943": 6, "00209430": 6, "00deg0": 4, "00e": 5, "00nannanfals": 4, "00nannantru": 4, "00nannantruerefer": 4, "00tev0": 4, "01": [3, 5], "014": 6, "01444": 6, "01447222222222": 6, "018183853280195963": 6, "019": 4, "01deg0": 4, "01fals": 4, "01tev": 4, "02": [5, 6], "026941484": 6, "030880": 6, "031279168349770640344": 6, "035": 6, "0413150": 6, "047184493": 6, "0471844930": 6, "04d": 6, "05": [3, 5, 7], "050": 5, "05068718": 6, "050687180": 6, "0534": 6, "06": [5, 6], "060539745": 6, "0605397450": 6, "06305169": 6, "063051690": 6, "06621791733": 6, "06917622": 6, "07": 5, "07113250e": 6, "07659442e": 6, "08": 6, "08110082": 6, "081100820": 6, "08142": 3, "083": 6, "08397394": 6, "083973940": 6, "08522219": 6, "085222190": 6, "09": 5, "0x7f671cdc3dd0": 3, "0x7fe28f5feb90": 5, "1": [2, 3, 4, 5, 7], "10": [2, 3, 4, 5, 6, 7], "100": [2, 3, 5, 6, 7], "1000": [2, 5], "10000000": 6, "1012": 3, "103": 6, "10316629": 6, "103166290": 6, "105": 2, "10596932": 6, "105969320": 6, "11": [2, 3, 5, 6, 7], "111761868": 6, "11189": 6, "112": 7, "11245045e": 6, "1161522": 6, "1162220": 6, "11641851092409164": 6, "1178": 6, "1188": 6, "12": [2, 3, 5, 6, 7], "121": 6, "122": 6, "123453744": 6, "1234537440": 6, "128": 6, "1296269": 5, "1296274": 5, "12cm": 4, "13": [2, 5, 6, 7], "133": 7, "13630114": 6, "136301140": 6, "1377": 6, "138": 7, "14": [2, 5, 6, 7], "14374068": 6, "143740680": 6, "14e": 5, "15": [2, 5, 6, 7], "150": 5, "1526259": 6, "1552775999516551": 6, "155277599951656": 6, "1591704": 6, "1598280": 6, "16": [2, 3, 5, 6, 7], "1607": 3, "1633675551229037574e": 6, "17": [2, 5, 6, 7], "17672835": 6, "176728350": 6, "18": [2, 5, 6, 7], "18112772242": 6, "18112859": 6, "18112878": 6, "18112978": 6, "18194601": 6, "181946010": 6, "182646367277094e": 6, "1831569": 6, "18315690": 6, "19": [2, 6, 7], "19487702": 6, "19487703": 6, "19487876": 6, "19487901596": 6, "19733498": 6, "197334980": 6, "199": 6, "1d": 6, "1dc": [5, 7], "1e": 5, "2": [2, 3, 4, 5, 7], "20": [2, 5, 6, 7], "200": 5, "2000": [5, 6], "2012": 5, "20131004_05029747_dl3_crabnebula": 6, "20131004_05029748_dl3_crabnebula": 6, "20136": 2, "20137": 2, "20137bkgbkg_2dhess": 2, "20137bkgbkg_3ddatahess_dl3_dr1_obs_id_020137": 2, "20137edispedisp_2ddatahess_dl3_dr1_obs_id_020137": 2, "20137eventseventsdatahess_dl3_dr1_obs_id_020137": 2, "20137gtigtidatahess_dl3_dr1_obs_id_020137": 2, "20137psfpsf_tabledatahess_dl3_dr1_obs_id_020137": 2, "2014aph": 2, "2015": 6, "2021": 6, "2024": 6, "20275": 2, "20339": 2, "20561": 2, "20734": 2, "20915": 2, "2096362": 6, "20963620": 6, "20e": 5, "21": [2, 3, 6, 7], "211": 7, "2146223": 6, "215": 6, "21613": 2, "21753": 2, "21807": 2, "21824": 2, "21851": 2, "22": [2, 6], "2200": 6, "2200_apj_708_1254_2010": 6, "22022": 2, "221": [6, 7], "222": 7, "2224": 6, "223": 7, "2231": 6, "224": 7, "22400": 5, "22593": 2, "2270": 6, "2291": 6, "22997": 2, "23": [2, 4, 6], "230": 6, "23040": 2, "23077": 2, "23143": 2, "23246": 2, "234": 6, "23573": 2, "23635": 2, "23651": 2, "2371": 6, "23736": 2, "238923": 5, "24": 6, "2402333778852": 6, "2408333778852": 6, "2424": 6, "2434333778852": 6, "2438": 6, "24389": 6, "2445333778852": 6, "2478333778852": 6, "248": 6, "248096": 5, "248102": 5, "2481333778852": 6, "25": 6, "2513333778852": 6, "253": 7, "25345": 2, "25443": 2, "2544333778852": 6, "25511": 2, "2559333778853": 6, "25693976618589837": 6, "25h": 2, "26": 6, "26077": 2, "26791": 2, "26827": 2, "26850": 2, "26964": 2, "27": 6, "27044": 2, "27121": 2, "27939": 2, "27987": 2, "28": 6, "283380": 6, "28341": 2, "28967": 2, "28981": 2, "29": [2, 6], "29024": 2, "29072": 2, "2909160": 6, "29118": 2, "29177": 2, "294": 6, "29433": 2, "29487": 2, "29526": 2, "29556": 2, "29683": 2, "297": 6, "29983892821377583": 6, "2d": 5, "2e": [5, 7], "3": [2, 3, 4, 5, 7], "30": [6, 7], "31": 6, "32": 6, "33": [3, 6], "333778852": 6, "333780040": 6, "3351721": 6, "338647984": 6, "34": 6, "34760107795590983": 6, "35": 6, "354": 6, "354892683": 6, "356223333780039": 6, "356227333780039": 6, "356242333780039": 6, "356282333780039": 6, "356473333780040": 6, "356478333780040": 6, "356485333780040": 6, "356486333780040": 6, "356526333780040": 6, "35e": 3, "36": 6, "37": [6, 7], "374132284": 6, "375515984": 6, "38": [6, 7], "39": [2, 3, 5, 6], "3934918682770723": 6, "3d": 2, "3e": [5, 7], "3g": 3, "3min": 7, "4": [2, 3, 5, 7], "40": [2, 6, 7], "400": 5, "4092061182772071": 6, "41": 6, "4153421": 6, "42119622": 6, "42611240294578184": 6, "43": 6, "432x288": 5, "435217": 6, "44": 6, "440760185772888e": 6, "4449880": 6, "449140": 6, "45": 2, "451": 6, "4510060": 6, "4515": 3, "452": 6, "4544121": 6, "45797881185987477": 6, "45e": 5, "460049284": 6, "4613321": 6, "463": 6, "47007462e": 6, "4710536683": 6, "47829": 2, "47851623": 6, "4845940": 6, "486": 2, "487306981530037e": 6, "49278181e": 6, "4e": 7, "5": [2, 3, 5, 7], "50": [5, 7], "500": [5, 7], "5029747": 6, "5029747aeffaeff_2d": 6, "5029747edispedisp_2d": 6, "5029747eventsev": 6, "5029747gtigti": 6, "5029747rad_maxrad_max_2d": 6, "5029748": 6, "5029748aeffaeff_2d": 6, "5029748edispedisp_2d": 6, "5029748eventsev": 6, "5029748gtigti": 6, "5029748rad_maxrad_max_2d": 6, "50739": 6, "509924984": 6, "51": 7, "516": 6, "517909583": 6, "52": 6, "52470422": 6, "5247600784": 6, "526715384": 6, "52706": 6, "54": [2, 6], "54686": 6, "546979": 6, "55": 6, "55107": 6, "5516522": 6, "55555": 6, "55638": 6, "5575050": 6, "56": 6, "56569": 6, "56583": 6, "5676520": 6, "56889811e": 6, "572407022526": 6, "575538888888889": 6, "59": 6, "5945722": 6, "5e": 7, "5h": 5, "6": [2, 3, 5, 7], "60552": 6, "6131505483": 6, "618": 6, "6299751484": 6, "633": 6, "63333": 6, "6413622": 6, "66": 7, "668": 6, "669014283": 6, "6724769747827286635e": 6, "673440": 6, "67e21": 3, "6833623": 6, "687": 6, "688": 6, "689": 6, "69": 6, "6914919573678725": 6, "693570": 6, "694": 6, "69974": 6, "7": [2, 3, 5, 6, 7], "7105744257791078768e": 6, "7151721": 6, "716913767510206412": 6, "7257920": 6, "729": 6, "735": [2, 6], "7361270045119108": 6, "738": 6, "74": 5, "7422974209419148": 6, "760": 6, "761": 6, "761944": 6, "762793983": 6, "764": 6, "7695722": 6, "77": [6, 7], "7729850": 6, "7746788606122589": 6, "777854983": 6, "785579397589822356": 6, "8": [2, 3, 5, 6, 7], "80": 5, "8071585532816240": 6, "812": 6, "82": [2, 7], "8281108809408599": 6, "83": 6, "834": 6, "836": 6, "84": 6, "8588622": 6, "864446782": 6, "8691880225176731": 6, "8692921": 6, "870": 6, "872": 6, "8848": 6, "89": 6, "8919525879696997": 6, "9": [2, 3, 4, 5, 6, 7], "90": 2, "900": 6, "900480594501521": 6, "901": 6, "907": 6, "908": 6, "909": 6, "91": 5, "916": 6, "9173": 5, "9178": 5, "9182740088921875": 6, "9292261866": 5, "94000000": 6, "968": 6, "973370": 6, "982606483": 6, "98333": 6, "9851151": 6, "991545": 6, "994": 6, "A": [2, 3, 5], "And": 2, "As": [2, 3, 6], "At": [2, 6], "For": [3, 5, 6], "If": [2, 5, 6], "In": [0, 1, 2, 3, 5, 6], "It": [2, 6], "No": [2, 3, 6], "On": [5, 7], "One": 6, "That": 2, "The": [2, 3, 5, 6, 7], "Then": 5, "There": [3, 4, 5, 6], "These": [1, 3, 6], "To": [2, 5, 6], "With": 5, "_": [2, 3], "__array_ufunc__": 2, "__call__": 6, "__class__": 3, "__init__": [2, 6], "__name__": [3, 6], "__subclasses__": 3, "__version__": 6, "_build": 0, "_data": 7, "_load_gps_clock": 6, "_load_kernel_link": 6, "_make_bkg2d": 2, "_static": 0, "ab": 3, "abl": 2, "about": [5, 6], "abov": [2, 5, 6], "abs_phas": 6, "absolut": 6, "absolute_phas": 6, "absphas": 6, "accept": [0, 6], "access": 2, "account": [2, 7], "accumul": 2, "accur": 5, "action": 0, "activ": 6, "actual": [2, 6], "add": [0, 2, 6], "add_cbar": [3, 5, 7], "addit": [0, 6], "adonath": 2, "adopt": 3, "aeff": [2, 6], "aeff_2d": 2, "after": 5, "again": 5, "against": 7, "agn": 2, "aim": 3, "al": 6, "algorithm": [2, 5], "all": [2, 4, 5, 6, 7], "allow": [4, 6], "allowed_channel": 3, "alongsid": 6, "alpha": [5, 7], "alreadi": [3, 5, 6], "also": [2, 5, 6], "alt_pnt": 6, "altern": [4, 6], "altitud": 6, "alvaro": 6, "alwai": [2, 3, 6], "amplitud": 5, "an": [2, 7], "analys": [3, 5], "analysi": [2, 3, 5], "angl": 2, "angleparamet": 6, "ani": [0, 5, 6], "annihil": 3, "anoth": [2, 6], "api": 5, "append": 2, "appli": 6, "apply_clock_correct": 6, "approach": [5, 6, 7], "approxim": [5, 7], "ar": [2, 3, 4, 5, 6, 7], "area": [2, 6], "arg": 7, "around": 3, "arrai": [1, 2, 5, 6], "arriv": 6, "arxiv": 3, "ascl": 6, "aspect": 2, "associ": 6, "assum": [3, 5, 6], "assymetr": 7, "astro": [3, 6], "astro_dark_matt": 3, "astrometryequatori": 6, "astronomi": 1, "astropi": [2, 3, 4, 5, 6, 7], "astyp": 6, "atmospher": 2, "attribut": 5, "autocorrel": 5, "avail": [2, 6], "available_hdu": 6, "averag": 7, "awai": 5, "awar": 6, "ax": [2, 3, 5, 7], "ax1": 7, "ax2": 7, "ax3": 7, "ax4": 7, "axessubplot": 5, "axi": [5, 6], "axvlin": 3, "az_pnt": 6, "azimuth": 2, "b": [0, 3], "back": 6, "background": 5, "background2d": 2, "background_model": 2, "background_r": 2, "backgroundmodelestim": 2, "backward": 7, "bad": 6, "band": 3, "barycent": 6, "barycentr": 6, "base": 7, "base_dir": [2, 6], "basi": [0, 3], "basic": [2, 3], "basicconfig": 5, "bcf": 5, "becaus": [2, 6, 7], "becom": 7, "been": 6, "befor": [0, 2, 5], "below": [0, 2], "better": [5, 7], "between": [5, 6], "bin": [2, 5], "bin_volum": 2, "binsz": [3, 5], "bintablehdu": 2, "bit": [2, 5], "bkg": [2, 5], "bkg0": 2, "bkg1": 2, "bkg2": 2, "bkg_2d": 2, "bkg_3d": 2, "bkg_model": 5, "bkgspectralnorm1": 4, "bkgspectralreference1": 4, "bkgspectraltilt0": 4, "black": 3, "bogus_last_correct": 6, "boolparamet": 6, "both": 6, "bottom": 5, "build": [0, 2], "bundl": 2, "bur": 6, "burkertprofil": 3, "burn": 5, "burnin": 5, "c": [3, 4], "cach": 6, "calcul": [3, 6], "caldb": 5, "call": 2, "can": [2, 3, 4, 5, 6], "care": 6, "carefulli": 1, "carlo": 5, "carri": 5, "case": [0, 1, 2, 6, 7], "cash": 5, "cd": 0, "cell": [0, 4], "center": [2, 3], "centr": 3, "certain": 3, "chain": 5, "chang": [0, 2, 6], "channel": 3, "chapter": 3, "charg": 2, "check": 6, "check_tim": 6, "cherenkov": 1, "choic": [2, 5], "choos": 6, "ci": 0, "circl": 3, "circleskyregion": 3, "class": 2, "clearli": 5, "click": 4, "clk": 6, "clock": 6, "clock_correct": 6, "clock_fil": 6, "close": 5, "closer": 2, "cm": [3, 5], "cm2": [3, 5], "cm3": [3, 6], "cm5": 3, "cmap": [3, 7], "code": [0, 1, 2], "coe": 6, "collabor": 6, "collect": [0, 1], "color": [3, 5, 7], "colorbar": 5, "column": 6, "column_phas": 6, "com": 6, "come": [0, 5], "command": 0, "comment": 6, "common": 6, "commun": 1, "compar": [5, 7], "comparison": 5, "complet": [5, 6], "complex": 2, "compon": [5, 6], "comput": [2, 3, 5, 7], "compute_jfactor": 3, "compute_posvel": 6, "compute_tdb": 6, "concept": 3, "concern": 2, "conda": [4, 6], "configur": 2, "confluenc": 6, "consid": 2, "contain": [2, 5, 6], "content": [0, 6], "contour": 5, "contribut": 1, "control": [3, 4], "conveni": [3, 6], "converg": 5, "convert": 6, "coordin": [3, 5, 6], "copi": [0, 2, 6], "core": [1, 7], "correct": 6, "correl": 7, "correlation_radiu": 7, "correspond": 6, "cosmic": 2, "could": [2, 6], "count": [2, 5, 7], "cours": 2, "cover": 1, "cpu": [2, 5, 6, 7], "crab": 6, "crabnebula": 6, "creat": [0, 3, 5, 6, 7], "creator": 6, "cta": [1, 7], "cta_dataset": 7, "cube": 5, "current": [3, 4, 6], "curv": 2, "cut": 2, "cutoff": 5, "d": 6, "d3c81b5766f4bfb84e65504c8a453085": 6, "darkmatt": 3, "darkmatterannihilationspectralmodel": 3, "dash": 3, "data": [0, 3, 5, 7], "data_stor": [2, 6], "datafram": 4, "dataset": [2, 5, 6, 7], "dataset_nam": 5, "datasetmodel": 5, "datastor": 2, "datastore_dir": 6, "date": 6, "de": 3, "de405": 6, "de421": 6, "deadc": 6, "deadtim": 6, "deal": 6, "debug": 6, "dec": 6, "dec_obj": 6, "dec_pnt": 6, "decid": 2, "decj": 6, "declar": 2, "decreas": 2, "deepcopi": 2, "def": [2, 6, 7], "default": 6, "defin": [2, 6], "definit": 6, "deg": [2, 3, 5, 6, 7], "demo": 4, "demonstr": 6, "densiti": 3, "depend": [0, 5], "deploi": 0, "deprec": 7, "deriv": 6, "describ": [5, 6], "descript": 5, "design": 0, "detail": 5, "dev": [2, 7], "develop": 1, "df": 4, "dict": 6, "did": 2, "diff": 7, "diff_flux": 3, "differ": [2, 5, 6, 7], "differenti": 2, "dimension": 5, "directli": [6, 7], "directori": 6, "disk": 7, "diskspatialmodel": 7, "dispers": 6, "dispersiondm": 6, "displai": [4, 6], "disregard": 6, "distanc": 3, "distance_gc": 3, "distribut": [2, 5], "divid": 2, "dl3": [2, 6], "dl3_dir": 6, "dl3_pulsar_": 6, "dl3_pulsar_5029747": 6, "dm": [3, 6], "dm1": 6, "dmepoch": 6, "dmprofil": 3, "dn": 3, "do": [2, 3, 5, 6], "doc": 0, "document": [0, 1, 6], "doe": [2, 6], "doesn": [2, 4, 5], "done": [2, 5, 6], "doubl": 4, "download": 6, "dr1": 2, "dr3": 2, "ds2": 2, "due": [2, 6], "durat": 6, "e": [2, 3, 4, 5], "e2": 5, "each": [2, 3, 5, 6], "earth": 6, "easili": 6, "ecosystem": 5, "ecut": 5, "edg": 2, "edgecolor": 3, "edisp": [2, 5, 6], "edisp_2d": 2, "effect": [2, 7], "effici": 2, "effort": 0, "eg": 6, "einastoprofil": 3, "either": 2, "el": 3, "element": 5, "emax": 5, "emin": 5, "emiss": 2, "empti": 2, "empty_dataset": 5, "encount": 2, "end": 2, "energi": [2, 5], "energy_bin": 2, "energy_max": 3, "energy_min": 3, "energy_pow": 5, "energy_rang": [3, 5], "ensur": 6, "entir": 5, "entri": [2, 6], "enumer": 2, "env": [0, 2, 3, 4, 5, 6, 7], "environ": [2, 3, 4, 5, 6, 7], "ephem": 6, "ephem_dec": 6, "ephem_fil": 6, "ephem_ra": 6, "ephemerid": 6, "ephemeris_fil": 6, "ephver": 6, "epoch": 6, "equal": 7, "equinox": 6, "equival": 7, "er": 3, "error": [5, 6], "essenti": 6, "est": 7, "est_al": 7, "estim": [2, 7], "et": 6, "etc": [4, 6], "evalu": [2, 5], "even": 7, "event": 2, "event_count": 2, "event_idtimeradecenergi": 6, "event_idtimeradecenergyphas": 6, "everyth": 5, "evolut": 5, "evolv": 5, "exampl": [2, 3, 4, 5, 6], "excess": 5, "excessmap": 7, "exess": 7, "exist": [0, 2], "exist_ok": 6, "expcutoffpowerlawspectralmodel": 5, "expect": [2, 3, 7], "experi": 6, "explain": 3, "explor": [4, 5, 6], "exposur": [2, 5, 7], "extnam": 6, "extra": 6, "extract": 6, "ey": 5, "f": [2, 3, 6], "f0": 6, "f1": 6, "f2": 6, "f3": 6, "face": 2, "facecolor": 3, "facilit": 6, "factor": 7, "fake": 5, "fall": 2, "fals": [5, 6], "far": 5, "fast": 6, "faster": 7, "featur": 6, "few": 6, "fewer": 2, "field": 2, "fiew": 2, "fig": [3, 5, 7], "figsiz": [3, 5, 7], "figur": [2, 5, 7], "file": [0, 2, 3, 4, 5, 7], "file_dir": [2, 6], "file_nam": [2, 6], "file_path": 6, "filenam": [2, 4, 6], "fill": 2, "fill_count": 2, "fill_exposur": 2, "filter": 4, "filterwarn": [3, 5], "final": [2, 3, 6], "find": [1, 5, 7], "find_clock_fil": 6, "fine": 2, "finish": 6, "first": [2, 5, 6], "fit": [2, 5, 6, 7], "fitseffect": 6, "fitsenergi": 6, "fitsev": 6, "fitsgti": 6, "fitsrad_max": 6, "fix": [2, 3, 4, 5, 6, 7], "fk5": 6, "flag": 6, "flat": 7, "float64": 6, "floatparamet": 6, "fluctuat": 7, "flux": 5, "flux_err": 7, "flux_errn": 7, "flux_errp": 7, "flux_map": 3, "flux_ul": 7, "flux_unit": 3, "focu": 5, "fold": 7, "folder": [0, 6], "follow": [0, 1, 2, 3, 5, 6], "foreman": 5, "forg": 4, "format": [2, 3, 4, 5, 6, 7], "forward": 7, "found": [2, 3, 5, 6], "fovbackgroundmodel": 5, "fraction": 6, "frame": [3, 5, 6], "free": [5, 6], "freez": 4, "frequenc": 6, "from": [0, 2, 3, 4, 5, 7], "from_bound": 2, "from_dir": [2, 6], "from_edg": 5, "from_energy_bound": 2, "from_fil": 2, "from_panda": 4, "frozen": [5, 6], "full": [6, 7], "function": [2, 5, 6], "further": 3, "futher": 2, "g": [2, 3, 4, 5], "g09": 4, "g09spatiallat_01": 4, "g09spatiallon_09": 4, "g09spectralalpha1": 4, "g09spectralamplitude3": 4, "g09spectralindex2": 4, "g09spectrallambda_1": 4, "g09spectralreference1": 4, "gadf": 6, "galact": [3, 5], "gamma": [1, 2, 6], "gammapi": [0, 2, 3, 4, 5, 7], "gammapy_data": [0, 2, 4, 5, 6, 7], "gammapy_v": 6, "gaussianspatialmodel": 5, "gc": [3, 4, 7], "gc_example_model": 4, "gcspatiallat_00": 4, "gcspatiallon_00": 4, "gcspectralalpha1": 4, "gcspectralamplitude3": 4, "gcspectralindex2": 4, "gcspectrallambda_1": 4, "gcspectralreference1": 4, "gener": 6, "geolat": 6, "geolon": 6, "geom": [3, 5, 7], "geometri": 5, "get": [2, 4, 5], "get_changed_df": 4, "get_fil": 6, "get_log": 6, "get_model": 6, "get_observ": [2, 6], "get_toas_arrai": 6, "get_tzr_toa": 6, "getlogg": 6, "gev": 3, "gev2": 3, "gif": 4, "github": [0, 2, 4, 6], "githubusercont": 6, "give": [2, 6], "given": [2, 3, 4, 5], "glitch": 6, "glitch_phas": 6, "gll_iem_v06_cutoutspectralnorm1": 4, "gll_iem_v06_cutoutspectralreference1": 4, "gll_iem_v06_cutoutspectraltilt0": 4, "global": 6, "global_clock_correct": 6, "goal": 5, "goe": 6, "good": [2, 3], "goodman": 5, "gp": 6, "gps2utc": 6, "gps_correct": 6, "grei": 5, "grid": 5, "grid_opt": 4, "gt": [3, 5], "gti": [2, 6], "gz": [2, 6, 7], "gzbkg0": 2, "gzbkg207360": 2, "gzedisp377280": 2, "gzevent": 6, "gzevents216000": 2, "gzgti5760": 2, "gzpsf118080": 2, "h": [2, 3, 5], "ha": [2, 3, 5, 6], "had": 5, "hand": 5, "handl": [3, 6], "harder": 2, "hardest": 2, "have": [2, 5, 6], "hdu": 2, "hdu_class": 2, "hdu_index": 2, "hdu_list": 2, "hdu_nam": [2, 6], "hdu_tabl": [2, 6], "hdu_table_bkg": 2, "hdu_table_filenam": 6, "hdu_typ": 2, "hduclas1": 6, "hduclass": 6, "hdudoc": 6, "hduindext": [2, 6], "hdulist": 2, "hduver": 6, "header": 6, "help": 5, "here": [2, 4, 5, 6], "hess": [2, 3], "high": [2, 5, 6], "higher": [6, 7], "hilla": 2, "histogram": [2, 5], "histogram2d": 2, "histori": 5, "hogg": 5, "home": 6, "hour": 5, "hourangl": 6, "how": [2, 4, 6], "howev": [2, 3, 6], "hspace": 3, "html": 0, "http": [3, 6], "hz": 6, "i": [0, 1, 2, 3, 4, 6, 7], "iact": 2, "icr": 6, "id": 6, "idea": 5, "identifi": 6, "idx": 2, "if_expir": 6, "if_miss": 6, "ignor": [3, 5, 6], "im": 3, "imag": [0, 4], "implement": [2, 3], "impli": 5, "import": [2, 3, 4, 5, 7], "imshow": 7, "in_memori": 6, "includ": [3, 6], "include_bipm": 6, "include_gp": 6, "include_irf": 6, "increas": 2, "inde": 7, "index": 5, "indic": 4, "indirect": 3, "individu": 5, "inerti": 6, "inf": 6, "infinit": 6, "info": [2, 3, 5, 6], "inform": [1, 2, 6, 7], "ingredi": [3, 6], "init": 5, "inlin": [2, 3, 5], "instal": [4, 6], "instanc": 6, "instruct": 1, "instrum": 6, "instrument": 6, "int64bytes30bytes30bytes100bytes50bytes30": 6, "int64float64float32float32float32": 6, "int64float64float32float32float32float64": 6, "int64str6str9str4str36str6int64": 2, "int_flux": 3, "integr": [0, 3], "interest": 2, "interp": [2, 5], "interv": 6, "introduct": 6, "intuit": 4, "invalid": [2, 5], "investig": 5, "io": 2, "ipta": 6, "ipyaggrid": 4, "ipynb": [2, 3, 4, 5, 6, 7], "ipysheet": 4, "ipython": 4, "irf": [2, 5, 6], "irf_fil": 5, "isn": 2, "isothermalprofil": 3, "issu": 6, "its": 6, "j": 6, "j0534": 6, "jan": 6, "jfact": 3, "jfact_map": 3, "jfactori": 3, "jump": 6, "jupyt": [1, 2, 3, 4, 5, 6, 7], "just": [0, 2, 5, 6], "k": 7, "keep": 6, "kernel": 7, "kerr": 6, "kinda": 2, "km": 6, "know": 3, "known": 6, "ko": 5, "kpc": 3, "kwarg": [2, 6, 7], "l": 5, "lab": 4, "label": [2, 3], "lambda": 5, "lambda_": 5, "lang": 5, "larg": 6, "last": 6, "lat_0": 5, "later": [5, 7], "latitud": 5, "law": 2, "lead": 2, "legend": [2, 3], "len": 2, "length": [2, 4, 6], "less": 2, "let": [2, 5, 6], "level": [2, 5, 6], "li": [6, 7], "lib": [2, 6, 7], "librari": [1, 6], "life": 2, "lightcurv": 6, "lightweight": 5, "like": [1, 2, 3, 4, 5, 6], "likelihood": [5, 7], "line": 6, "linear": 7, "linestyl": 3, "link": 1, "linspac": 7, "list": [2, 5], "livetim": [5, 6], "ll": [2, 5], "load": [2, 6], "load_cta_irf": 5, "local": [3, 5, 6], "local_dens": 3, "locat": [2, 6], "log": [3, 5, 6], "logic": 6, "loglog": [2, 3], "lognorm": 3, "logspac": [3, 5], "lon": 6, "lon_0": 5, "longitud": 5, "look": [2, 5, 6], "lqo8tidg": 4, "lt": [3, 5], "luck": 2, "luckili": 5, "luka": 6, "luo": 6, "m": [0, 2, 3, 5, 6, 7], "m2": 5, "m_1": 7, "m_2": 7, "ma": [6, 7], "mackei": 5, "made": [0, 6], "magic": 6, "magic_dl3": 6, "mai": 1, "main": 6, "mainli": 2, "maintain": 0, "make": [0, 2, 6], "make_model": 2, "maker": 5, "mambaforg": 2, "manag": 6, "mandatori": 6, "mani": [5, 6], "manipul": 6, "manual": [5, 6], "map": [2, 5, 6, 7], "mapaxi": [2, 5], "mapdataset": [5, 7], "mapdatasetmak": 5, "mapmak": 2, "markov": 5, "mask": 2, "mass": 3, "massdm": 3, "match": 2, "mathch": 2, "mathemat": 5, "mathrm": 3, "matplotlib": [2, 3, 5, 7], "matplotlibdeprecationwarn": 7, "max": [2, 5], "maxim": 6, "maxvisiblerow": 4, "mcmc_sampl": 5, "mdm": 3, "mean": [5, 7], "measur": [2, 5, 6], "mention": 6, "merg": 0, "meta": [2, 6], "metadata": 0, "method": [2, 3, 5, 6], "mev": [2, 5], "mhz": 6, "microsecond": 6, "min": [2, 5], "miniconda3": [6, 7], "minim": 0, "minimum": 5, "minor": 7, "minut": [5, 6], "mjd": 6, "mjdparamet": 6, "mjdreff": 6, "mjdrefi": 6, "mkdir": 6, "model": [6, 7], "model_build": 6, "model_tim": 6, "modeltypenamevalueuniterrorminmaxfrozenlink": 4, "modifi": [0, 4], "moment": 5, "mont": 5, "mooreprofil": 3, "more": [1, 2, 3, 5, 6], "moreov": 6, "most": [0, 2, 5, 6], "movi": 4, "mu": 3, "mul": 3, "multi": 2, "multipl": [2, 6], "multipli": 3, "multiprocess": 7, "mur": 3, "must": 6, "n": [2, 3, 5, 6], "n_job": 7, "name": [2, 5, 6, 7], "nanosecond": 6, "nbin": 2, "nbsphinx": [0, 4], "nburn": 5, "nearli": 6, "necessari": [2, 6], "neclect": 7, "need": [0, 2, 4, 5, 6], "neg": [5, 6], "new": [2, 5], "new_event_list": 6, "new_hdu": 6, "new_ob": 6, "next": 6, "nfreeparam": 5, "nfwprofil": 3, "nois": 2, "noisi": 2, "non": 2, "none": [2, 3, 5, 6, 7], "norm": [3, 5, 7], "norm_errn": 7, "note": [2, 3, 5, 6], "notebook": [0, 1, 2, 3, 5, 6, 7], "now": [2, 5, 6], "np": [2, 3, 5, 6, 7], "npred_excess": 7, "npred_excess_err": 7, "npred_excess_errn": 7, "npred_excess_errp": 7, "npred_excess_ref": 7, "npred_excess_ul": 7, "nrun": 5, "nu_e": 3, "nu_mu": 3, "nu_tau": 3, "number": [2, 3, 5, 6], "numpi": [2, 3, 5, 6, 7], "nwalk": 5, "nwalker": 5, "o": 2, "ob": [2, 6], "object": [5, 6], "obs_id": [2, 6], "obs_idhdu_typehdu_classfile_dirfile_namehdu_nam": 6, "obs_idhdu_typehdu_classfile_dirfile_namehdu_names": 2, "obs_index": 2, "obs_mod": 6, "obs_row": 2, "obs_sun_po": 6, "obs_tabl": [2, 6], "observ": 2, "observation_time_dur": 2, "observatori": [2, 6], "obtain": [5, 6], "occur": 6, "offset": [2, 5], "offset_bin": 2, "old": 0, "onc": [5, 6, 7], "one": [2, 5], "ones": 6, "onli": [2, 4, 6], "ontim": [2, 6], "open": 1, "opt": 7, "optic": 2, "optimis": 2, "optimize_opt": 5, "order": 6, "ordereddict": 6, "ordinari": 7, "org": 3, "origin": [2, 6, 7], "other": [0, 2, 6], "otherwis": [5, 6], "our": 6, "out": [2, 5, 6], "outlier": 2, "output": 6, "output_directori": 6, "output_path": 6, "overal": 2, "overwrit": [2, 6], "overwritten": 6, "own": [0, 1], "p": [3, 6], "p_line": 6, "packag": [1, 2, 6, 7], "page": 6, "panda": 4, "panel": 5, "par": [5, 6], "par_to_model": 5, "paramet": [2, 3, 6, 7], "parent": 6, "parfil": 6, "pari": 5, "part": [2, 5], "particular": 6, "parx": 5, "pass": [0, 6, 7], "past": 0, "path": [2, 6], "pathlib": [2, 6], "pc": 6, "pdf": 3, "peek": 2, "peopl": 3, "pepoch": 6, "per": [2, 3, 7], "perform": [5, 6, 7], "period": [5, 6], "ph_log": 6, "phase_column_nam": 6, "phase_log": 6, "phase_offset": 6, "phase_src1": 6, "phase_src2": 6, "phaseogram": 6, "phi": 5, "pi": 2, "pictur": 5, "pint_ver": 6, "pip": 6, "pix_reg": 3, "pixel": 7, "place": 0, "plai": [2, 5], "plain": 4, "plan": 2, "plane": 3, "planet": 6, "planet_shapiro": 6, "pleas": [0, 1, 6, 7], "plot": [2, 3, 7], "plot_corn": 5, "plot_side_by_sid": 7, "plot_trac": 5, "plt": [2, 3, 5, 7], "pmdec": 6, "pmodel": 6, "pmra": 6, "png": [0, 4], "po": 6, "point": [2, 5, 6], "polici": 6, "pop": 2, "posepoch": 6, "posit": 3, "posixpath": 6, "possibl": 2, "posterior": 5, "posvel": 6, "power": 2, "powerlawnormspectralmodel": [5, 7], "powerlawspectralmodel": 7, "precis": 6, "predict": 5, "prefer": 6, "present": [0, 1, 3, 6], "previous": 6, "previsouli": 5, "primari": 2, "primarili": 6, "primaryflux": 3, "print": [2, 3, 4, 5, 6], "print_level": 5, "probabilist": 5, "probabl": 5, "problem": [2, 7], "proce": 6, "procedur": 5, "process": [0, 2], "produc": [3, 5], "product": 2, "profil": 5, "project": [5, 7], "properti": 2, "propos": [4, 6], "provid": [5, 6], "pseudo": 5, "psf": [2, 5, 7], "psf_tabl": 2, "psr": 6, "psrj": 6, "public": 2, "pull": 0, "puls": 6, "pulsar_datastor": 6, "pulsar_events_fil": 6, "pulsar_phase_comput": 6, "put": [2, 3, 5], "px": 6, "py": [0, 2, 3, 4, 5, 6, 7], "pyplot": [2, 3, 5, 7], "python": [0, 1, 5, 6], "python3": [2, 6, 7], "q": 3, "qgrid": 4, "qgrid_df": 4, "qgrid_widget": 4, "quantiti": [2, 6], "question": 2, "quick": 2, "quickli": 6, "quot": 3, "r_0": 7, "ra": 6, "ra_obj": 6, "ra_pnt": 6, "rad_max": [2, 6], "radecsi": 6, "radial": 2, "radii": 3, "radiu": [3, 6], "rai": [1, 2, 6], "rais": 6, "raj": 6, "random": 5, "rang": 5, "ransom": 6, "rate": 2, "rather": 6, "raw": 6, "rdbu": 7, "re": [2, 5], "reach": 5, "read": [1, 4, 5, 7], "read_tempo2_clock_fil": 6, "reader": 5, "real": [2, 5], "realli": 6, "rebuild": 0, "recip": [0, 6], "recommend": 6, "reconstruct": 2, "record": 4, "recov": 6, "red": [3, 5], "reduc": 2, "refer": [2, 5, 6], "referenc": 6, "regard": 6, "regeard": 6, "region": [3, 7], "relat": 2, "releas": [2, 7], "relev": 6, "remain": [2, 7], "remov": [0, 6], "renam": 0, "render": 4, "repositori": [0, 1], "repres": 2, "request": 0, "requir": [2, 6], "required_irf": 6, "respect": 6, "rest": 0, "result": [2, 6, 7], "result_t": 7, "return": [2, 5, 6, 7], "rf": 3, "right": 5, "rotat": 6, "row": 2, "rule": 0, "run": [2, 5, 6, 7], "run_mcmc": 5, "runner": 6, "runtimewarn": 2, "s2": 6, "s3": 6, "safe_energy_lo": 2, "sai": [2, 5], "same": [5, 6, 7], "sampl": 6, "sampler": 5, "save": 2, "scalar": 6, "scale": [2, 3, 5, 6], "scale_to_local_dens": 3, "scatter": [2, 7], "schubert": 6, "scienc": [1, 2], "scratch": 2, "script": 0, "scroll": 4, "sdegdegtev": 6, "search": [3, 5], "sec": 2, "section": 6, "sed": 6, "see": [2, 3, 4, 5, 6], "select": [5, 6], "select_observ": 6, "select_offset": 2, "selected_obs_t": 6, "selection_opt": 7, "self": 2, "sens": 2, "sentenc": 5, "separ": 4, "serv": 3, "set": [2, 5, 6], "set_aspect": 7, "set_titl": [3, 7], "set_xlabel": 7, "set_xlim": 7, "set_ylabel": [3, 7], "set_ylim": 7, "set_yscal": 3, "sever": 6, "shape": [2, 5], "shift": 6, "ship": 2, "should": [0, 2, 6], "show": [2, 5, 6, 7], "show_grid": 4, "shown": [2, 6], "sigma": 5, "signific": 2, "simpl": [2, 5], "simpli": [5, 6], "simplifi": 2, "simulate_dataset": 5, "simultan": 7, "sinc": [2, 6, 7], "singl": [2, 6], "site": [2, 6, 7], "size": [2, 5], "skip": 6, "sky": 5, "sky_circl": 6, "sky_model_simu": 5, "sky_reg": 3, "skycoord": [3, 5, 6], "skydir": [3, 5], "skymodel": [5, 7], "slickgrid": 4, "slightli": [2, 7], "small": 6, "smooth": 2, "so": [2, 3, 5, 6], "softwar": [2, 6], "solar": 6, "solar_system_ephemerid": 6, "solarsystemshapiro": 6, "solid": 2, "solut": [5, 7], "some": [2, 3, 5, 6], "someth": 2, "sometim": 2, "sophist": 2, "sort": [2, 4, 6], "sound": 2, "sourc": [1, 2, 3, 4, 5, 6, 7], "south_z20_50h": 5, "space": 5, "spatial": [4, 5], "spatial_model": [5, 7], "spec": 2, "special": 0, "specif": [0, 1, 6], "specifi": [0, 6], "spectral": [4, 5], "spectral_model": [5, 7], "spectrum": [2, 3], "speedup": 5, "sphinx": 0, "spindown": 6, "sqrt": 2, "sqrt_t": 7, "sr": [2, 5], "src": 0, "ssb": 6, "ssb_obs_po": 6, "ssb_obs_vel": 6, "stage": 5, "standard": [2, 3, 6], "start": [2, 3, 5, 6], "stat": 5, "stat_sum": 5, "state": 5, "staticmethod": 2, "stationari": 5, "statist": [2, 5], "steepli": 2, "step": [2, 5, 6], "stereo": 6, "stop": 6, "store": [2, 6], "str": 6, "str18str8str9float64str14int64float64float64boolstr18": 4, "straight": 5, "strategi": [2, 5], "stretch": 7, "string": 6, "strparamet": 6, "subplot": [3, 5, 7], "subplots_adjust": 3, "success": 5, "sum": [3, 7], "sum_over_ax": 5, "sum_over_energy_group": 7, "super": [2, 7], "suppli": 2, "support": [3, 6], "surpris": 2, "sy": [2, 5, 6, 7], "symmetr": 2, "symmetri": 2, "system": 6, "t": [2, 3, 4, 5], "t2runtim": 6, "tabl": [4, 5], "table_model": 3, "tabular": 4, "tag": 0, "take": [2, 5, 6, 7], "taken": 2, "talk": 5, "target": 5, "target_nam": 2, "target_po": 6, "tau": 3, "taul": 3, "taur": 3, "tdb": 6, "telescop": [1, 2, 6], "templat": 6, "tempo2": 6, "tempor": 5, "ten": 6, "territori": 5, "test": [0, 2, 4, 5], "tev": [2, 3, 4, 5], "text": [2, 3, 4, 5, 6, 7], "than": [0, 2, 6], "thaw": 4, "thei": [3, 5, 6], "them": 6, "therefor": 6, "theta": [5, 6], "thi": [0, 1, 2, 3, 4, 5, 6, 7], "thing": 2, "those": [2, 5], "though": 2, "three": 2, "threshold": 2, "thu": 2, "thumbnail": [0, 4], "tilt": 5, "time": [2, 5, 6, 7], "timeref": 6, "times10": 5, "timesi": 6, "timeunit": 6, "timing_model": 6, "timingmodel": 6, "titl": 3, "to_fit": 2, "to_mask": 3, "to_panda": 4, "to_parameters_t": 4, "to_pixel": 3, "to_table_hdu": 2, "toa": 6, "togeth": 6, "tool": 1, "top": 5, "topo_ob": 6, "total": [2, 5, 6, 7], "total_jfact": 3, "toward": 5, "trace": 5, "track": 6, "transform": 4, "treat": 2, "tricki": 2, "true": [2, 3, 5, 6, 7], "true_divid": 2, "truth": 5, "try": [2, 5], "ts_est": 7, "ts_est_al": 7, "tsmap": 7, "tstart": 6, "tstop": 6, "tt": 6, "turn": 5, "tutori": [1, 6], "two": [2, 5, 6, 7], "txt": 6, "type": [5, 6], "typic": [5, 6], "tzr_toa": 6, "tzrfreq": 6, "tzrfrq": 6, "tzrmjd": 6, "tzrsite": 6, "u": [2, 3, 5, 6, 7], "unchart": 5, "uniform": 5, "uniqu": 6, "unit": [2, 3, 5, 6, 7], "unrecogn": 6, "until": 5, "up": [2, 6], "update_parameters_from_t": 4, "url": 6, "us": [0, 1, 2, 3, 4, 7], "user": [1, 2, 5, 6, 7], "userwarn": 6, "usual": [2, 3, 6], "utc": 6, "util": 3, "v": [2, 3], "valid": 6, "valid_beyond_end": 6, "valu": [2, 3, 4, 5, 6], "variabl": 6, "varieti": 1, "vector": 5, "veri": [2, 5, 6], "version": [2, 3, 4, 5, 6, 7], "via": 4, "view": [2, 5], "viridi": 3, "visual": 7, "vmax": 7, "vmin": 7, "vstack": 2, "w": 3, "w0": 6, "wa": [5, 6], "wai": 2, "wait": 0, "walk": 5, "walker": 5, "wall": [2, 5, 6, 7], "want": [2, 3, 5, 6], "warn": [3, 5, 6], "wc": [3, 7], "wcsax": 7, "wcsaxessubplot": 5, "wcsgeom": [3, 5], "wcsndmap": 3, "we": [2, 3, 4, 5, 6], "webpag": 1, "well": [4, 5], "were": 4, "what": [2, 3, 6], "when": [0, 2, 5, 6, 7], "where": [2, 5, 6], "whether": 2, "which": [2, 4, 5, 6], "while": [5, 7], "who": 3, "whole": [0, 2], "why": 2, "wide": [1, 4], "widget": 4, "width": [3, 5], "within": [2, 4, 6], "without": [2, 3], "wl": 3, "work": [4, 6], "would": [1, 5], "write": 2, "writeto": 2, "written": 6, "wt": 3, "x": [2, 7], "xlabel": [2, 5], "xml": 4, "y": 2, "yaml": [4, 6], "yield": 2, "ylabel": [2, 5], "ylim": 2, "yml": [0, 2, 3, 4, 5, 6, 7], "you": [1, 2, 4, 5, 6], "your": [0, 1, 4, 5, 6], "yr": 6, "z": 3, "zen": 2, "zen_pnt": 2, "zenith_bin": 2, "zip": 3, "zl": 3, "zt": 3}, "titles": ["Contributing", "Gammapy", "Create a template background model", "Dark matter spatial and spectral models", "Recipe to show the interactively edit the Sky model on the notebook", "MCMC sampling using the emcee package", "Phase computation for pulsar using PINT", "TSMapEstimator vs. ExcessMapEstimator"], "titleterms": {"0": 6, "1": 6, "2": 6, "3": 6, "4": 6, "5": 6, "6": 6, "ad": 6, "an": [5, 6], "analysi": 6, "approach": 2, "background": 2, "been": 4, "chang": 4, "comput": 6, "context": 2, "contribut": 0, "correl": 5, "creat": 2, "cta": 5, "dark": 3, "data": [2, 6], "datastor": 6, "defin": 5, "depend": [2, 6], "dispers": 5, "doe": 5, "edit": 4, "emce": 5, "ephemeri": 6, "err": 7, "error": 7, "estim": 5, "event": 6, "eventlist": 6, "excess": 7, "excessmapestim": 7, "exercis": 2, "factor": 3, "fermi": 6, "file": 6, "flux": [3, 7], "fold": 6, "from": 6, "fun": 5, "gamma": 3, "gammapi": [1, 6], "ha": 4, "hdu": 6, "how": 5, "i": 5, "import": 6, "index": [2, 6], "interact": 4, "introduct": [3, 5], "j": 3, "lat": 6, "list": 6, "load": 4, "map": 3, "matter": 3, "mcmc": 5, "metadata": 6, "model": [2, 3, 4, 5], "modifi": 6, "neg": 7, "new": 6, "notebook": 4, "npred": 7, "observ": [5, 6], "off": 2, "one": 6, "open": 6, "packag": 5, "paramet": [4, 5], "pevatron": 5, "phase": 6, "pint": 6, "plot": 5, "po": 7, "prior": 5, "product": 3, "profil": 3, "propos": 2, "pulsar": 6, "put": 6, "rai": 3, "read": 6, "recip": [1, 4], "ref": 7, "result": 5, "sampl": 5, "save": 6, "select": 2, "setup": [2, 3], "should": 5, "show": 4, "simul": 5, "sky": 4, "spatial": 3, "spectra": 3, "spectral": 3, "sqrt": 7, "t": 7, "tabl": [2, 6], "templat": 2, "tool": 6, "tsmapestim": 7, "ul": 7, "updat": 4, "us": [5, 6], "v": 7, "verifi": 4, "why": 5, "work": 5, "write": 6, "zenith": 2, "zone": 5}}) \ No newline at end of file diff --git a/docs/_static/notebooks/pulsar_phase/env.yml b/docs/_static/notebooks/pulsar_phase/env.yml index 4d44158..a3d6b11 100644 --- a/docs/_static/notebooks/pulsar_phase/env.yml +++ b/docs/_static/notebooks/pulsar_phase/env.yml @@ -5,10 +5,11 @@ channels: - conda-forge dependencies: - - gammapy=1.0.2 - - python=3.9 + - gammapy=1.2 + - python=3.11 - scipy<1.12 - jupyter - pip - pip: - - pint-pulsar~=0.9.3 + - pint-pulsar~=1.0 + diff --git a/docs/_static/notebooks/pulsar_phase/pulsar_phase_computation.ipynb b/docs/_static/notebooks/pulsar_phase/pulsar_phase_computation.ipynb index a5f36ac..73c9079 100644 --- a/docs/_static/notebooks/pulsar_phase/pulsar_phase_computation.ipynb +++ b/docs/_static/notebooks/pulsar_phase/pulsar_phase_computation.ipynb @@ -15,9 +15,9 @@ "source": [ "This notebook has been done for the following version of Gammapy and PINT:\n", "\n", - "Gammapy version : 1.0.1\n", + "Gammapy version : 1.2\n", "\n", - "PINT version : 0.9.5" + "PINT version : 1.0" ] }, { @@ -30,7 +30,7 @@ "1. The time of arrivals (TOAs). These times should have very high precision due to the common fast periods of pulsars. Usually these times are already stored in the EventList. For the computation of pulsar timing, times must be corrected in order to be referenced in the Solar System barycenter (SSB) because this system can nearly be regarded as an inertial reference frame with respect to the pulsar.\n", "\n", "\n", - "2. The model of rotation of the pulsar, also known as ephemeris, at the epoch of the observations. These ephemerides are stored in an specific format and saved as .par files and contain informations on the periods, derivatives of the periods, coordinates, glitches, etc.\n", + "2. The model of rotation of the pulsar, also known as ephemeris, at the epoch of the observations. These ephemerides are stored in a specific format and saved as .par files which contain the periods, derivatives of the periods, coordinates, glitches, etc.\n", "\n", "__For the following steps of this tutorial, we need the original EventLists from the DL3 files, and a model in .par format.__\n", "\n", @@ -51,10 +51,10 @@ "id": "a9c72d26", "metadata": {}, "source": [ - "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", + "To run this notebook, you must have Gammapy and PINT (see documentation above) installed in the same environment. We recommend installing Gammapy first and then installing PINT using your preferred 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", @@ -77,10 +77,10 @@ "id": "b68d2444", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:25.357930Z", - "iopub.status.busy": "2024-03-27T11:26:25.357759Z", - "iopub.status.idle": "2024-03-27T11:26:25.831345Z", - "shell.execute_reply": "2024-03-27T11:26:25.830742Z" + "iopub.execute_input": "2024-08-30T13:43:53.336099Z", + "iopub.status.busy": "2024-08-30T13:43:53.335935Z", + "iopub.status.idle": "2024-08-30T13:43:53.836216Z", + "shell.execute_reply": "2024-08-30T13:43:53.835669Z" } }, "outputs": [ @@ -88,8 +88,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "Gammapy version : 1.0.2\n", - "PINT version : 0.9.8\n" + "Gammapy version : 1.2\n", + "PINT version : 1.0.1\n" ] } ], @@ -107,10 +107,10 @@ "id": "e61b5e3e", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:25.833998Z", - "iopub.status.busy": "2024-03-27T11:26:25.833639Z", - "iopub.status.idle": "2024-03-27T11:26:26.506462Z", - "shell.execute_reply": "2024-03-27T11:26:26.505816Z" + "iopub.execute_input": "2024-08-30T13:43:53.838441Z", + "iopub.status.busy": "2024-08-30T13:43:53.838106Z", + "iopub.status.idle": "2024-08-30T13:43:54.626040Z", + "shell.execute_reply": "2024-08-30T13:43:54.625476Z" } }, "outputs": [], @@ -120,7 +120,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__)" ] }, { @@ -128,7 +131,7 @@ "id": "81ae3a58", "metadata": {}, "source": [ - "And we also need some imports from PINT:" + "We also need some imports from PINT:" ] }, { @@ -137,10 +140,10 @@ "id": "22ac4aea", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.509540Z", - "iopub.status.busy": "2024-03-27T11:26:26.509079Z", - "iopub.status.idle": "2024-03-27T11:26:26.624488Z", - "shell.execute_reply": "2024-03-27T11:26:26.623985Z" + "iopub.execute_input": "2024-08-30T13:43:54.628537Z", + "iopub.status.busy": "2024-08-30T13:43:54.628244Z", + "iopub.status.idle": "2024-08-30T13:43:54.656522Z", + "shell.execute_reply": "2024-08-30T13:43:54.655994Z" } }, "outputs": [], @@ -162,7 +165,7 @@ "id": "b486ec45", "metadata": {}, "source": [ - "First we neeed to define the data sample. In this notebook we will use two runs from the MAGIC gammapy data sample available in https://github.com/gammapy/gammapy-data" + "First we need to define the data sample. In this notebook we will use two runs from the MAGIC gammapy data sample available in https://github.com/gammapy/gammapy-data" ] }, { @@ -171,16 +174,16 @@ "id": "d0e182bb", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.627105Z", - "iopub.status.busy": "2024-03-27T11:26:26.626738Z", - "iopub.status.idle": "2024-03-27T11:26:26.629431Z", - "shell.execute_reply": "2024-03-27T11:26:26.628877Z" + "iopub.execute_input": "2024-08-30T13:43:54.658921Z", + "iopub.status.busy": "2024-08-30T13:43:54.658599Z", + "iopub.status.idle": "2024-08-30T13:43:54.660775Z", + "shell.execute_reply": "2024-08-30T13:43:54.660345Z" } }, "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\"" ] }, { @@ -189,16 +192,16 @@ "id": "b5019a42", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.631734Z", - "iopub.status.busy": "2024-03-27T11:26:26.631306Z", - "iopub.status.idle": "2024-03-27T11:26:26.646554Z", - "shell.execute_reply": "2024-03-27T11:26:26.646010Z" + "iopub.execute_input": "2024-08-30T13:43:54.662674Z", + "iopub.status.busy": "2024-08-30T13:43:54.662366Z", + "iopub.status.idle": "2024-08-30T13:43:54.676462Z", + "shell.execute_reply": "2024-08-30T13:43:54.675957Z" } }, "outputs": [], "source": [ "# Read DataStore from a directory\n", - "data_store = DataStore.from_dir(DL3_direc)" + "data_store = DataStore.from_dir(DL3_dir)" ] }, { @@ -215,17 +218,15 @@ "id": "9ba16fcc", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.648835Z", - "iopub.status.busy": "2024-03-27T11:26:26.648528Z", - "iopub.status.idle": "2024-03-27T11:26:26.651855Z", - "shell.execute_reply": "2024-03-27T11:26:26.651323Z" + "iopub.execute_input": "2024-08-30T13:43:54.678608Z", + "iopub.status.busy": "2024-08-30T13:43:54.678236Z", + "iopub.status.idle": "2024-08-30T13:43:54.681323Z", + "shell.execute_reply": "2024-08-30T13:43:54.680828Z" } }, "outputs": [], "source": [ - "target_pos = SkyCoord(\n", - " ra=083.6331144560900, dec=+22.0144871383400, unit=\"deg\", frame=\"icrs\"\n", - ")" + "target_pos = SkyCoord(ra=083.633, dec=+22.014, unit=\"deg\", frame=\"icrs\")" ] }, { @@ -234,10 +235,10 @@ "id": "06bda835", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.654049Z", - "iopub.status.busy": "2024-03-27T11:26:26.653646Z", - "iopub.status.idle": "2024-03-27T11:26:26.660513Z", - "shell.execute_reply": "2024-03-27T11:26:26.659953Z" + "iopub.execute_input": "2024-08-30T13:43:54.683221Z", + "iopub.status.busy": "2024-08-30T13:43:54.682910Z", + "iopub.status.idle": "2024-08-30T13:43:54.687923Z", + "shell.execute_reply": "2024-08-30T13:43:54.687497Z" } }, "outputs": [], @@ -258,10 +259,10 @@ "id": "f96ccf30", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.662615Z", - "iopub.status.busy": "2024-03-27T11:26:26.662199Z", - "iopub.status.idle": "2024-03-27T11:26:26.665420Z", - "shell.execute_reply": "2024-03-27T11:26:26.664873Z" + "iopub.execute_input": "2024-08-30T13:43:54.689878Z", + "iopub.status.busy": "2024-08-30T13:43:54.689440Z", + "iopub.status.idle": "2024-08-30T13:43:54.692452Z", + "shell.execute_reply": "2024-08-30T13:43:54.691937Z" } }, "outputs": [ @@ -295,10 +296,10 @@ "id": "fa6e36d5", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.667386Z", - "iopub.status.busy": "2024-03-27T11:26:26.667228Z", - "iopub.status.idle": "2024-03-27T11:26:26.670890Z", - "shell.execute_reply": "2024-03-27T11:26:26.670425Z" + "iopub.execute_input": "2024-08-30T13:43:54.694439Z", + "iopub.status.busy": "2024-08-30T13:43:54.694155Z", + "iopub.status.idle": "2024-08-30T13:43:54.699214Z", + "shell.execute_reply": "2024-08-30T13:43:54.698826Z" } }, "outputs": [], @@ -314,10 +315,10 @@ "id": "dec2c1a5", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.673075Z", - "iopub.status.busy": "2024-03-27T11:26:26.672669Z", - "iopub.status.idle": "2024-03-27T11:26:26.780999Z", - "shell.execute_reply": "2024-03-27T11:26:26.780438Z" + "iopub.execute_input": "2024-08-30T13:43:54.701143Z", + "iopub.status.busy": "2024-08-30T13:43:54.700820Z", + "iopub.status.idle": "2024-08-30T13:43:54.755258Z", + "shell.execute_reply": "2024-08-30T13:43:54.754750Z" } }, "outputs": [ @@ -366,10 +367,10 @@ "id": "2756e72d", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.783640Z", - "iopub.status.busy": "2024-03-27T11:26:26.783173Z", - "iopub.status.idle": "2024-03-27T11:26:26.799711Z", - "shell.execute_reply": "2024-03-27T11:26:26.799261Z" + "iopub.execute_input": "2024-08-30T13:43:54.757339Z", + "iopub.status.busy": "2024-08-30T13:43:54.757008Z", + "iopub.status.idle": "2024-08-30T13:43:54.770138Z", + "shell.execute_reply": "2024-08-30T13:43:54.769738Z" } }, "outputs": [], @@ -385,10 +386,10 @@ "id": "1ac8103a", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.801834Z", - "iopub.status.busy": "2024-03-27T11:26:26.801523Z", - "iopub.status.idle": "2024-03-27T11:26:26.804890Z", - "shell.execute_reply": "2024-03-27T11:26:26.804365Z" + "iopub.execute_input": "2024-08-30T13:43:54.772090Z", + "iopub.status.busy": "2024-08-30T13:43:54.771779Z", + "iopub.status.idle": "2024-08-30T13:43:54.774716Z", + "shell.execute_reply": "2024-08-30T13:43:54.774242Z" } }, "outputs": [ @@ -410,7 +411,7 @@ "id": "e93bfbeb", "metadata": {}, "source": [ - "Now we have the TOAs of the events in the system of the telescope. Please note that the actual precision of the times is higher than the diplayed output (and we really need this precision for the pulsar analysis!). In the next step, the timing in the SSB and the phase for each TOA has to be created. " + "Now we have the TOAs for the events in the system of the telescope. Please note: the actual precision of the times is higher than the displayed output (and we really need this precision for the pulsar analysis!). In the next step, the timing in the SSB and the phase for each TOA has to be created." ] }, { @@ -426,11 +427,11 @@ "id": "fb536b7e", "metadata": {}, "source": [ - "In order to compute the phases of a pulsar, one needs an ephemeris file, usually store as a .par file. \n", + "In order to compute the phases of a pulsar, one needs an ephemeris file, typically stored as a .par file.\n", "\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, it is important to note that many of the ephemeris files are not up-to-date. Therefore, they could give bad results on the phase computation. In particular, you should always check that the MJD of the observations one wants to phase lies between the `START` and `FINISH` entries of the ephemeris file (see next section)." ] }, { @@ -439,16 +440,16 @@ "id": "d4f89ba4", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.807135Z", - "iopub.status.busy": "2024-03-27T11:26:26.806833Z", - "iopub.status.idle": "2024-03-27T11:26:26.809301Z", - "shell.execute_reply": "2024-03-27T11:26:26.808783Z" + "iopub.execute_input": "2024-08-30T13:43:54.776686Z", + "iopub.status.busy": "2024-08-30T13:43:54.776389Z", + "iopub.status.idle": "2024-08-30T13:43:54.778777Z", + "shell.execute_reply": "2024-08-30T13:43:54.778358Z" } }, "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\"" ] }, { @@ -456,7 +457,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 files 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 features from Tempo2. \n", + "\n", + "In our case, an error occurs when using the ephemeris file with PINT. This is due to the `JUMP` line. To proceed, simply comment out the line (with #) or remove it. Note that this line is not important for the gamma-ray instruments, so it is acceptable to disregard it." ] }, { @@ -489,22 +492,21 @@ "id": "d24e1c92", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.811565Z", - "iopub.status.busy": "2024-03-27T11:26:26.811265Z", - "iopub.status.idle": "2024-03-27T11:26:26.907510Z", - "shell.execute_reply": "2024-03-27T11:26:26.906967Z" - }, - "scrolled": false + "iopub.execute_input": "2024-08-30T13:43:54.780756Z", + "iopub.status.busy": "2024-08-30T13:43:54.780435Z", + "iopub.status.idle": "2024-08-30T13:43:54.876016Z", + "shell.execute_reply": "2024-08-30T13:43:54.875575Z" + } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "\u001b[32m2024-03-27 11:26:26.901\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", - "/usr/share/miniconda3/envs/gammapy-recipes/lib/python3.9/site-packages/pint/models/model_builder.py:198: UserWarning: Unrecognized parfile line 'EPHVER 5'\n", + "\u001b[32m2024-08-30 13:43:54.870\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.models.absolute_phase\u001b[0m:\u001b[36mvalidate\u001b[0m:\u001b[36m77\u001b[0m - \u001b[1mTZRFRQ was 0.0 or None. Setting to infinite frequency.\u001b[0m\n", + "/home/runner/miniconda3/envs/gammapy-recipes/lib/python3.11/site-packages/pint/models/model_builder.py:230: UserWarning: Unrecognized parfile line 'EPHVER 5'\n", " warnings.warn(f\"Unrecognized parfile line '{p_line}'\", UserWarning)\n", - "\u001b[32m2024-03-27 11:26:26.903\u001b[0m | \u001b[33m\u001b[1mWARNING \u001b[0m | \u001b[36mpint.models.model_builder\u001b[0m:\u001b[36m__call__\u001b[0m:\u001b[36m202\u001b[0m - \u001b[33m\u001b[1mUNITS is not specified. Assuming TDB...\u001b[0m\n" + "\u001b[32m2024-08-30 13:43:54.872\u001b[0m | \u001b[33m\u001b[1mWARNING \u001b[0m | \u001b[36mpint.models.model_builder\u001b[0m:\u001b[36m__call__\u001b[0m:\u001b[36m234\u001b[0m - \u001b[33m\u001b[1mUNITS is not specified. Assuming TDB...\u001b[0m\n" ] }, { @@ -551,7 +553,111 @@ "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. Check the [PINT documentation](https://nanograv-pint.readthedocs.io) for a list of additional parameters. To obtain the complete set of parameters from the ephemeris file, one can simply print the model:\n", + "`print(model)`" + ] + }, + { + "cell_type": "markdown", + "id": "f02f0ca5-09f2-44d4-ad76-518f8964b6a1", + "metadata": {}, + "source": [ + "As mentioned previously, we should ensure 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": 15, + "id": "2584b571-93a9-4fb6-b8e2-60b8810190f6", + "metadata": { + "execution": { + "iopub.execute_input": "2024-08-30T13:43:54.878085Z", + "iopub.status.busy": "2024-08-30T13:43:54.877785Z", + "iopub.status.idle": "2024-08-30T13:43:54.881053Z", + "shell.execute_reply": "2024-08-30T13:43:54.880542Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Ephemeris time definition:\n", + "54686.1526259 - 56583.1591704\n", + "Observation time definition:\n", + "56569.18112772242 - 56569.19487901596\n" + ] + } + ], + "source": [ + "print(\n", + " f\"Ephemeris time definition:\\n{model.START.value} - {model.FINISH.value}\"\n", + ")\n", + "print(\n", + " f\"Observation time definition:\\n{observation.tstart} - {observation.tstop}\"\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "86041174-5ec4-43ba-9035-cf567b47a3bb", + "metadata": {}, + "source": [ + "If you have several observations that 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 create a small function like the following one:" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "8838ee6c-5b53-4d34-8fd7-94d32daa6bb3", + "metadata": { + "execution": { + "iopub.execute_input": "2024-08-30T13:43:54.882764Z", + "iopub.status.busy": "2024-08-30T13:43:54.882615Z", + "iopub.status.idle": "2024-08-30T13:43:54.886095Z", + "shell.execute_reply": "2024-08-30T13:43:54.885667Z" + } + }, + "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(\n", + " [model.START.value, model.FINISH.value], scale=\"tt\", format=\"mjd\"\n", + " )\n", + " if (model_time[0].value > observation.tstart.tt.mjd) or (\n", + " model_time[1].value < observation.tstop.tt.mjd\n", + " ):\n", + " log.warning(\n", + " f\"Warning: Observation time of observation {observation.obs_id} goes out of timing model validity time.\"\n", + " )" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "0d37e6cc-2cae-4192-87d9-88d52216e83f", + "metadata": { + "execution": { + "iopub.execute_input": "2024-08-30T13:43:54.887762Z", + "iopub.status.busy": "2024-08-30T13:43:54.887614Z", + "iopub.status.idle": "2024-08-30T13:43:54.890615Z", + "shell.execute_reply": "2024-08-30T13:43:54.890203Z" + } + }, + "outputs": [], + "source": [ + "check_time(observation, model)" ] }, { @@ -564,47 +670,53 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 18, "id": "a145cdde", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.909929Z", - "iopub.status.busy": "2024-03-27T11:26:26.909738Z", - "iopub.status.idle": "2024-03-27T11:26:44.597210Z", - "shell.execute_reply": "2024-03-27T11:26:44.596640Z" - }, - "scrolled": false + "iopub.execute_input": "2024-08-30T13:43:54.892323Z", + "iopub.status.busy": "2024-08-30T13:43:54.892174Z", + "iopub.status.idle": "2024-08-30T13:44:15.697802Z", + "shell.execute_reply": "2024-08-30T13:44:15.697299Z" + } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "\u001b[32m2024-03-27 11:26:27.247\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m1358\u001b[0m - \u001b[34m\u001b[1mNo pulse number flags found in the TOAs\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:27.263\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mapply_clock_corrections\u001b[0m:\u001b[36m2200\u001b[0m - \u001b[34m\u001b[1mApplying clock corrections (include_gps = False, include_bipm = False)\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:27.923\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-03-27 11:26:31.192\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2251\u001b[0m - \u001b[34m\u001b[1mComputing TDB columns.\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:31.193\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2272\u001b[0m - \u001b[34m\u001b[1mUsing EPHEM = DE421 for TDB calculation.\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:32.378\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2350\u001b[0m - \u001b[34m\u001b[1mComputing PosVels of observatories and Earth, using DE421\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:33.420\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-03-27 11:26:44.359\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2403\u001b[0m - \u001b[34m\u001b[1mSSB obs pos [1.47007462e+11 2.56889811e+10 1.11245045e+10] m\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.587\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-03-27 11:26:44.593\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2417\u001b[0m - \u001b[34m\u001b[1mAdding columns ssb_obs_pos ssb_obs_vel obs_sun_pos\u001b[0m\n" + "\u001b[32m2024-08-30 13:43:55.618\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m1377\u001b[0m - \u001b[34m\u001b[1mNo pulse number flags found in the TOAs\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:55.633\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mapply_clock_corrections\u001b[0m:\u001b[36m2224\u001b[0m - \u001b[34m\u001b[1mApplying clock corrections (include_bipm = False)\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.294\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.observatory\u001b[0m:\u001b[36mgps_correction\u001b[0m:\u001b[36m248\u001b[0m - \u001b[1mApplying GPS to UTC clock correction (~few nanoseconds)\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.294\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.observatory\u001b[0m:\u001b[36m_load_gps_clock\u001b[0m:\u001b[36m122\u001b[0m - \u001b[34m\u001b[1mLoading global GPS clock file\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.297\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.observatory.global_clock_corrections\u001b[0m:\u001b[36mget_file\u001b[0m:\u001b[36m128\u001b[0m - \u001b[1mFile index.txt to be downloaded due to download policy if_expired: https://raw.githubusercontent.com/ipta/pulsar-clock-corrections/main/index.txt\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.451\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.observatory.clock_file\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m812\u001b[0m - \u001b[34m\u001b[1mGlobal clock file gps2utc.clk saving kwargs={'bogus_last_correction': False, 'valid_beyond_ends': False}\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.452\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.observatory.global_clock_corrections\u001b[0m:\u001b[36mget_file\u001b[0m:\u001b[36m128\u001b[0m - \u001b[1mFile T2runtime/clock/gps2utc.clk to be downloaded due to download policy if_missing: https://raw.githubusercontent.com/ipta/pulsar-clock-corrections/main/T2runtime/clock/gps2utc.clk\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.668\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.observatory.clock_file\u001b[0m:\u001b[36mread_tempo2_clock_file\u001b[0m:\u001b[36m463\u001b[0m - \u001b[34m\u001b[1mLoading TEMPO2-format observatory clock correction file gps2utc.clk (/home/runner/.astropy/cache/download/url/d3c81b5766f4bfb84e65504c8a453085/contents) with bogus_last_correction=False\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.687\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.observatory\u001b[0m:\u001b[36mfind_clock_file\u001b[0m:\u001b[36m994\u001b[0m - \u001b[1mUsing global clock file for gps2utc.clk with bogus_last_correction=False\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.689\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.observatory.topo_obs\u001b[0m:\u001b[36mclock_corrections\u001b[0m:\u001b[36m354\u001b[0m - \u001b[1mObservatory magic requires no clock corrections.\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:59.900\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2270\u001b[0m - \u001b[34m\u001b[1mComputing TDB columns.\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:59.901\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2291\u001b[0m - \u001b[34m\u001b[1mUsing EPHEM = DE421 for TDB calculation.\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:00.968\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2371\u001b[0m - \u001b[34m\u001b[1mComputing PosVels of observatories and Earth, using DE421\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:02.516\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-08-30 13:44:15.633\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2424\u001b[0m - \u001b[34m\u001b[1mSSB obs pos [1.47007462e+11 2.56889811e+10 1.11245045e+10] m\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.688\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-08-30 13:44:15.694\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2438\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 7.02 s, sys: 188 ms, total: 7.21 s\n", - "Wall time: 17.7 s\n" + "CPU times: user 7.15 s, sys: 199 ms, total: 7.35 s\n", + "Wall time: 20.8 s\n" ] } ], "source": [ "%%time\n", "\n", - "# Put these to True is your observatory has clock correction files.\n", + "# Set these to True is your observatory has clock correction files.\n", "# If it is set to True but your observatory does not have clock correction files, it will be ignored.\n", "include_bipm = False\n", "include_gps = False\n", @@ -630,19 +742,19 @@ "id": "db97ea5b", "metadata": {}, "source": [ - "Once we have the TOAs object and the model, the phases are easily computed using the model.phase() method. Note that the phases are computed in the interval [-0.5,0.5]. Most of the times, we use the phases in the interval [0,1] so we have to shift the negative ones." + "Once we have the TOAs object and the model, the phases are easily computed using the model.phase() method. Note that the phases are computed in the interval [-0.5,0.5]. Most of the time, we use the phases in the interval [0,1] so we have to shift the negative ones." ] }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 19, "id": "6fbf3ad9", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:44.599538Z", - "iopub.status.busy": "2024-03-27T11:26:44.599353Z", - "iopub.status.idle": "2024-03-27T11:26:45.194277Z", - "shell.execute_reply": "2024-03-27T11:26:45.193696Z" + "iopub.execute_input": "2024-08-30T13:44:15.699970Z", + "iopub.status.busy": "2024-08-30T13:44:15.699584Z", + "iopub.status.idle": "2024-08-30T13:44:15.924450Z", + "shell.execute_reply": "2024-08-30T13:44:15.924037Z" } }, "outputs": [ @@ -650,19 +762,19 @@ "name": "stderr", "output_type": "stream", "text": [ - "\u001b[32m2024-03-27 11:26:44.636\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-03-27 11:26:44.640\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-03-27 11:26:44.646\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m1358\u001b[0m - \u001b[34m\u001b[1mNo pulse number flags found in the TOAs\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.646\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mapply_clock_corrections\u001b[0m:\u001b[36m2200\u001b[0m - \u001b[34m\u001b[1mApplying clock corrections (include_gps = False, include_bipm = False)\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.648\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2251\u001b[0m - \u001b[34m\u001b[1mComputing TDB columns.\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.648\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2272\u001b[0m - \u001b[34m\u001b[1mUsing EPHEM = DE421 for TDB calculation.\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.651\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2350\u001b[0m - \u001b[34m\u001b[1mComputing PosVels of observatories and Earth, using DE421\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.929\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-03-27 11:26:44.931\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2403\u001b[0m - \u001b[34m\u001b[1mSSB obs pos [-1.49278181e+08 7.07659442e+06 3.07113250e+06] km\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:45.150\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-03-27 11:26:45.176\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2417\u001b[0m - \u001b[34m\u001b[1mAdding columns ssb_obs_pos ssb_obs_vel obs_sun_pos\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:45.177\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-03-27 11:26:45.188\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-08-30 13:44:15.729\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.models.glitch\u001b[0m:\u001b[36mglitch_phase\u001b[0m:\u001b[36m221\u001b[0m - \u001b[34m\u001b[1mGlitch phase for glitch 1: 0.0 \u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.735\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.models.absolute_phase\u001b[0m:\u001b[36mget_TZR_toa\u001b[0m:\u001b[36m100\u001b[0m - \u001b[34m\u001b[1mCreating and dealing with the single TZR_toa for absolute phase\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.738\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m1377\u001b[0m - \u001b[34m\u001b[1mNo pulse number flags found in the TOAs\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.738\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mapply_clock_corrections\u001b[0m:\u001b[36m2224\u001b[0m - \u001b[34m\u001b[1mApplying clock corrections (include_bipm = False)\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.760\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2270\u001b[0m - \u001b[34m\u001b[1mComputing TDB columns.\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.761\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2291\u001b[0m - \u001b[34m\u001b[1mUsing EPHEM = DE421 for TDB calculation.\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.764\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2371\u001b[0m - \u001b[34m\u001b[1mComputing PosVels of observatories and Earth, using DE421\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.834\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-08-30 13:44:15.836\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2424\u001b[0m - \u001b[34m\u001b[1mSSB obs pos [-1.49278181e+08 7.07659442e+06 3.07113250e+06] km\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.907\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-08-30 13:44:15.908\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2438\u001b[0m - \u001b[34m\u001b[1mAdding columns ssb_obs_pos ssb_obs_vel obs_sun_pos\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.909\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-08-30 13:44:15.916\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.models.glitch\u001b[0m:\u001b[36mglitch_phase\u001b[0m:\u001b[36m221\u001b[0m - \u001b[34m\u001b[1mGlitch phase for glitch 1: 0.0 \u001b[0m\n" ] } ], @@ -692,14 +804,14 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 20, "id": "735ac718", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.196779Z", - "iopub.status.busy": "2024-03-27T11:26:45.196431Z", - "iopub.status.idle": "2024-03-27T11:26:45.206792Z", - "shell.execute_reply": "2024-03-27T11:26:45.206263Z" + "iopub.execute_input": "2024-08-30T13:44:15.926698Z", + "iopub.status.busy": "2024-08-30T13:44:15.926261Z", + "iopub.status.idle": "2024-08-30T13:44:15.935066Z", + "shell.execute_reply": "2024-08-30T13:44:15.934677Z" } }, "outputs": [], @@ -710,65 +822,93 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 21, "id": "f3269a2c", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.209126Z", - "iopub.status.busy": "2024-03-27T11:26:45.208686Z", - "iopub.status.idle": "2024-03-27T11:26:45.212621Z", - "shell.execute_reply": "2024-03-27T11:26:45.212125Z" - }, - "scrolled": false + "iopub.execute_input": "2024-08-30T13:44:15.936748Z", + "iopub.status.busy": "2024-08-30T13:44:15.936604Z", + "iopub.status.idle": "2024-08-30T13:44:15.942656Z", + "shell.execute_reply": "2024-08-30T13:44:15.942183Z" + } }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "EVENT_ID TIME RA DEC ENERGY \n", - " s deg deg TeV \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", - " 2561 333778853.0339344 84.84237 22.175398 0.118843034\n", - " ... ... ... ... ...\n", - " 356222 333780039.4520397 84.74482 20.894981 0.043312162\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", - "Length = 11189 rows\n" - ] + "data": { + "text/html": [ + "
Table length=11189\n", + "
\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
EVENT_IDTIMERADECENERGY
sdegdegTeV
int64float64float32float32float32
2402333778852.509924984.5945722.030880.18194601
2408333778852.526715384.2146223.449140.08397394
2434333778852.6131505483.52470422.7257920.10596932
2445333778852.669014283.7695722.4510060.19733498
2478333778852.762793983.47851623.4845940.08522219
2481333778852.777854983.7151721.9851151.0020943
2513333778852.864446782.42119622.5676520.14374068
2544333778852.982606483.6413622.0413150.10316629
2559333778853.026941484.06917622.973370.047184493
...............
356223333780039.460049284.1161522.5575050.08110082
356227333780039.4710536683.4153421.673440.2096362
356242333780039.517909583.5516522.7729850.17672835
356282333780039.6299751484.4613321.693570.05068718
356473333780040.338647984.4544121.1598280.1831569
356478333780040.354892683.6833623.4449880.06305169
356485333780040.374132284.3351721.283380.060539745
356486333780040.375515984.8588622.1162220.123453744
356526333780040.5247600784.8692921.2909160.13630114
" + ], + "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": 21, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ "# Show original table\n", - "print(table)" + "table" ] }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 22, "id": "6fc6024c", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.214559Z", - "iopub.status.busy": "2024-03-27T11:26:45.214389Z", - "iopub.status.idle": "2024-03-27T11:26:45.216994Z", - "shell.execute_reply": "2024-03-27T11:26:45.216564Z" + "iopub.execute_input": "2024-08-30T13:44:15.944440Z", + "iopub.status.busy": "2024-08-30T13:44:15.944274Z", + "iopub.status.idle": "2024-08-30T13:44:15.946972Z", + "shell.execute_reply": "2024-08-30T13:44:15.946502Z" } }, "outputs": [], @@ -787,46 +927,44 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 23, "id": "7f29187e", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.219230Z", - "iopub.status.busy": "2024-03-27T11:26:45.218856Z", - "iopub.status.idle": "2024-03-27T11:26:45.225134Z", - "shell.execute_reply": "2024-03-27T11:26:45.224604Z" - }, - "scrolled": false + "iopub.execute_input": "2024-08-30T13:44:15.948805Z", + "iopub.status.busy": "2024-08-30T13:44:15.948513Z", + "iopub.status.idle": "2024-08-30T13:44:15.952984Z", + "shell.execute_reply": "2024-08-30T13:44:15.952497Z" + } }, "outputs": [ { "data": { "text/html": [ "
Table length=11189\n", - "
\n", + "
\n", "\n", "\n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", "
EVENT_IDTIMERADECENERGYPHASE
sdegdegTeV
int64float64float32float32float32float64
2402333778852.509924984.5945722.030880.181946010.39349195931383935
2408333778852.526715384.2146223.449140.083973940.8919526790064667
2434333778852.6131505483.52470422.7257920.105969320.4579789031294724
2445333778852.669014283.7695722.4510060.197334980.11641860219368935
2478333778852.762793983.47851623.4845940.085222190.9004806857711186
2481333778852.777854983.7151721.9851151.00209430.3476011689926769
2513333778852.864446782.42119622.5676520.143740680.9182740999289545
2544333778852.982606483.6413622.0413150.103166290.42611249421537956
2559333778853.026941484.06917622.973370.0471844930.7422975122115125
2402333778852.509924984.5945722.030880.181946010.3934918682770723
2408333778852.526715384.2146223.449140.083973940.8919525879696997
2434333778852.6131505483.52470422.7257920.105969320.45797881185987477
2445333778852.669014283.7695722.4510060.197334980.11641851092409164
2478333778852.762793983.47851623.4845940.085222190.900480594501521
2481333778852.777854983.7151721.9851151.00209430.34760107795590983
2513333778852.864446782.42119622.5676520.143740680.9182740088921875
2544333778852.982606483.6413622.0413150.103166290.42611240294578184
2559333778853.026941484.06917622.973370.0471844930.7422974209419148
..................
356222333780039.452039784.7448220.8949810.0433121620.4537121484157113
356223333780039.460049284.1161522.5575050.081100820.6914920486374702
356227333780039.4710536683.4153421.673440.20963620.018183944316962984
356242333780039.517909583.5516522.7729850.176728350.40920620046641115
356282333780039.6299751484.4613321.693570.050687180.7361270955486778
356473333780040.338647984.4544121.1598280.18315690.7746789518818565
356478333780040.354892683.6833623.4449880.063051690.2569398572226654
356485333780040.374132284.3351721.283380.0605397450.8281109722104576
356486333780040.375515984.8588622.1162220.1234537440.8691881135544401
356526333780040.5247600784.8692921.2909160.136301140.29983901925054285
356223333780039.460049284.1161522.5575050.081100820.6914919573678725
356227333780039.4710536683.4153421.673440.20963620.018183853280195963
356242333780039.517909583.5516522.7729850.176728350.4092061182772071
356282333780039.6299751484.4613321.693570.050687180.7361270045119108
356473333780040.338647984.4544121.1598280.18315690.7746788606122589
356478333780040.354892683.6833623.4449880.063051690.25693976618589837
356485333780040.374132284.3351721.283380.0605397450.8281108809408599
356486333780040.375515984.8588622.1162220.1234537440.8691880225176731
356526333780040.5247600784.8692921.2909160.136301140.29983892821377583
" ], "text/plain": [ @@ -835,29 +973,28 @@ " 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", + " 2402 333778852.5099249 84.59457 22.03088 0.18194601 0.3934918682770723\n", + " 2408 333778852.5267153 84.21462 23.44914 0.08397394 0.8919525879696997\n", + " 2434 333778852.61315054 83.524704 22.725792 0.10596932 0.45797881185987477\n", + " 2445 333778852.6690142 83.76957 22.451006 0.19733498 0.11641851092409164\n", + " 2478 333778852.7627939 83.478516 23.484594 0.08522219 0.900480594501521\n", + " 2481 333778852.7778549 83.71517 21.985115 1.0020943 0.34760107795590983\n", + " 2513 333778852.8644467 82.421196 22.567652 0.14374068 0.9182740088921875\n", + " 2544 333778852.9826064 83.64136 22.041315 0.10316629 0.42611240294578184\n", + " 2559 333778853.0269414 84.069176 22.97337 0.047184493 0.7422974209419148\n", " ... ... ... ... ... ...\n", - " 356222 333780039.4520397 84.74482 20.894981 0.043312162 0.4537121484157113\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" + " 356223 333780039.4600492 84.11615 22.557505 0.08110082 0.6914919573678725\n", + " 356227 333780039.47105366 83.41534 21.67344 0.2096362 0.018183853280195963\n", + " 356242 333780039.5179095 83.55165 22.772985 0.17672835 0.4092061182772071\n", + " 356282 333780039.62997514 84.46133 21.69357 0.05068718 0.7361270045119108\n", + " 356473 333780040.3386479 84.45441 21.159828 0.1831569 0.7746788606122589\n", + " 356478 333780040.3548926 83.68336 23.444988 0.06305169 0.25693976618589837\n", + " 356485 333780040.3741322 84.33517 21.28338 0.060539745 0.8281108809408599\n", + " 356486 333780040.3755159 84.85886 22.116222 0.123453744 0.8691880225176731\n", + " 356526 333780040.52476007 84.86929 21.290916 0.13630114 0.29983892821377583" ] }, - "execution_count": 20, + "execution_count": 23, "metadata": {}, "output_type": "execute_result" } @@ -880,23 +1017,22 @@ "id": "ea9ba223", "metadata": {}, "source": [ - "At this point, we also want to add meta data to the table. It is very useful to keep track of what has been done to the file. For instance, if we have multiple pulsars in the same file, we want to be able to know quickly which column correspond to which pulsar. Moreover, experience shows that one often use different ephemeris file for the same pulsar. Therefore, it is very useful to have several phase columns in the same file and to be able to know which column correspond to which ephemeris file, parameters, etc.\n", + "At this point, we also want to add metadata to the table. It is very useful to keep track of what has been done to the file. For instance, if a file contains multiple pulsars, we want identify quickly which column corresponds to each pulsar. Moreover, experience has shown that it is common to have different ephemeris files for the same pulsar. Therefore, it is useful to have several phase columns in the same file to easily identify which column corresponds to each ephemeris file, parameters, etc.\n", "\n", - "Since there is not yet a \"standard\" format for such metadata, we propose a template for the essential informations that one wants to save in the header of the event file. First, we look at the present meta info on the table." + "Since there is currently no \"standard\" format for such metadata, we propose a template for the essential information that one wants to save in the header of the event file. First, we look at the present meta info on the table." ] }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 24, "id": "af220557", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.227594Z", - "iopub.status.busy": "2024-03-27T11:26:45.227257Z", - "iopub.status.idle": "2024-03-27T11:26:45.231629Z", - "shell.execute_reply": "2024-03-27T11:26:45.231108Z" - }, - "scrolled": false + "iopub.execute_input": "2024-08-30T13:44:15.955025Z", + "iopub.status.busy": "2024-08-30T13:44:15.954655Z", + "iopub.status.idle": "2024-08-30T13:44:15.958777Z", + "shell.execute_reply": "2024-08-30T13:44:15.958278Z" + } }, "outputs": [ { @@ -939,7 +1075,7 @@ " ('AZ_PNT', 103.8848)])" ] }, - "execution_count": 21, + "execution_count": 24, "metadata": {}, "output_type": "execute_result" } @@ -950,14 +1086,14 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 25, "id": "c2285fcd", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.233745Z", - "iopub.status.busy": "2024-03-27T11:26:45.233423Z", - "iopub.status.idle": "2024-03-27T11:26:45.237873Z", - "shell.execute_reply": "2024-03-27T11:26:45.237324Z" + "iopub.execute_input": "2024-08-30T13:44:15.960712Z", + "iopub.status.busy": "2024-08-30T13:44:15.960430Z", + "iopub.status.idle": "2024-08-30T13:44:15.964154Z", + "shell.execute_reply": "2024-08-30T13:44:15.963725Z" } }, "outputs": [], @@ -1000,14 +1136,14 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 26, "id": "8c866a5c", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.240180Z", - "iopub.status.busy": "2024-03-27T11:26:45.239749Z", - "iopub.status.idle": "2024-03-27T11:26:45.243507Z", - "shell.execute_reply": "2024-03-27T11:26:45.242970Z" + "iopub.execute_input": "2024-08-30T13:44:15.966078Z", + "iopub.status.busy": "2024-08-30T13:44:15.965699Z", + "iopub.status.idle": "2024-08-30T13:44:15.968960Z", + "shell.execute_reply": "2024-08-30T13:44:15.968447Z" } }, "outputs": [ @@ -1015,7 +1151,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "COLUMN_PHASE: PHASE; PINT_VERS: 0.9.8; GAMMAPY_VERS: 1.0.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: 60396.4769125122;\n" + "COLUMN_PHASE: PHASE; PINT_VERS: 1.0.1; 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: 60552.572407022526;\n" ] } ], @@ -1026,14 +1162,14 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 27, "id": "5a3e56d2", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.245447Z", - "iopub.status.busy": "2024-03-27T11:26:45.245279Z", - "iopub.status.idle": "2024-03-27T11:26:45.247890Z", - "shell.execute_reply": "2024-03-27T11:26:45.247345Z" + "iopub.execute_input": "2024-08-30T13:44:15.971018Z", + "iopub.status.busy": "2024-08-30T13:44:15.970621Z", + "iopub.status.idle": "2024-08-30T13:44:15.973109Z", + "shell.execute_reply": "2024-08-30T13:44:15.972658Z" } }, "outputs": [], @@ -1044,14 +1180,14 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 28, "id": "f6b44e25", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.250137Z", - "iopub.status.busy": "2024-03-27T11:26:45.249693Z", - "iopub.status.idle": "2024-03-27T11:26:45.254108Z", - "shell.execute_reply": "2024-03-27T11:26:45.253667Z" + "iopub.execute_input": "2024-08-30T13:44:15.974924Z", + "iopub.status.busy": "2024-08-30T13:44:15.974603Z", + "iopub.status.idle": "2024-08-30T13:44:15.978533Z", + "shell.execute_reply": "2024-08-30T13:44:15.978032Z" } }, "outputs": [ @@ -1094,10 +1230,10 @@ " ('ALT_PNT', 69.69974),\n", " ('AZ_PNT', 103.8848),\n", " ('PH_LOG',\n", - " 'COLUMN_PHASE: PHASE; PINT_VERS: 0.9.8; GAMMAPY_VERS: 1.0.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: 60396.4769125122;')])" + " 'COLUMN_PHASE: PHASE; PINT_VERS: 1.0.1; 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: 60552.572407022526;')])" ] }, - "execution_count": 25, + "execution_count": 28, "metadata": {}, "output_type": "execute_result" } @@ -1116,14 +1252,14 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 29, "id": "12545bff", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.256140Z", - "iopub.status.busy": "2024-03-27T11:26:45.255965Z", - "iopub.status.idle": "2024-03-27T11:26:45.306335Z", - "shell.execute_reply": "2024-03-27T11:26:45.305804Z" + "iopub.execute_input": "2024-08-30T13:44:15.980471Z", + "iopub.status.busy": "2024-08-30T13:44:15.980173Z", + "iopub.status.idle": "2024-08-30T13:44:16.013868Z", + "shell.execute_reply": "2024-08-30T13:44:16.013376Z" } }, "outputs": [ @@ -1131,7 +1267,6 @@ "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", "'THETA' axis is stored as a scalar -- converting to 1D array.\n" @@ -1146,14 +1281,14 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 30, "id": "1ac16c51", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.308633Z", - "iopub.status.busy": "2024-03-27T11:26:45.308216Z", - "iopub.status.idle": "2024-03-27T11:26:45.313310Z", - "shell.execute_reply": "2024-03-27T11:26:45.312737Z" + "iopub.execute_input": "2024-08-30T13:44:16.015882Z", + "iopub.status.busy": "2024-08-30T13:44:16.015596Z", + "iopub.status.idle": "2024-08-30T13:44:16.020193Z", + "shell.execute_reply": "2024-08-30T13:44:16.019715Z" } }, "outputs": [ @@ -1161,30 +1296,29 @@ "data": { "text/html": [ "
Table length=11189\n", - "\n", + "
\n", "\n", "\n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", "
EVENT_IDTIMERADECENERGYPHASE
sdegdegTeV
int64float64float32float32float32float64
2402333778852.509924984.5945722.030880.181946010.39349195931383935
2408333778852.526715384.2146223.449140.083973940.8919526790064667
2434333778852.6131505483.52470422.7257920.105969320.4579789031294724
2445333778852.669014283.7695722.4510060.197334980.11641860219368935
2478333778852.762793983.47851623.4845940.085222190.9004806857711186
2481333778852.777854983.7151721.9851151.00209430.3476011689926769
2513333778852.864446782.42119622.5676520.143740680.9182740999289545
2544333778852.982606483.6413622.0413150.103166290.42611249421537956
2559333778853.026941484.06917622.973370.0471844930.7422975122115125
2402333778852.509924984.5945722.030880.181946010.3934918682770723
2408333778852.526715384.2146223.449140.083973940.8919525879696997
2434333778852.6131505483.52470422.7257920.105969320.45797881185987477
2445333778852.669014283.7695722.4510060.197334980.11641851092409164
2478333778852.762793983.47851623.4845940.085222190.900480594501521
2481333778852.777854983.7151721.9851151.00209430.34760107795590983
2513333778852.864446782.42119622.5676520.143740680.9182740088921875
2544333778852.982606483.6413622.0413150.103166290.42611240294578184
2559333778853.026941484.06917622.973370.0471844930.7422974209419148
..................
356222333780039.452039784.7448220.8949810.0433121620.4537121484157113
356223333780039.460049284.1161522.5575050.081100820.6914920486374702
356227333780039.4710536683.4153421.673440.20963620.018183944316962984
356242333780039.517909583.5516522.7729850.176728350.40920620046641115
356282333780039.6299751484.4613321.693570.050687180.7361270955486778
356473333780040.338647984.4544121.1598280.18315690.7746789518818565
356478333780040.354892683.6833623.4449880.063051690.2569398572226654
356485333780040.374132284.3351721.283380.0605397450.8281109722104576
356486333780040.375515984.8588622.1162220.1234537440.8691881135544401
356526333780040.5247600784.8692921.2909160.136301140.29983901925054285
356223333780039.460049284.1161522.5575050.081100820.6914919573678725
356227333780039.4710536683.4153421.673440.20963620.018183853280195963
356242333780039.517909583.5516522.7729850.176728350.4092061182772071
356282333780039.6299751484.4613321.693570.050687180.7361270045119108
356473333780040.338647984.4544121.1598280.18315690.7746788606122589
356478333780040.354892683.6833623.4449880.063051690.25693976618589837
356485333780040.374132284.3351721.283380.0605397450.8281108809408599
356486333780040.375515984.8588622.1162220.1234537440.8691880225176731
356526333780040.5247600784.8692921.2909160.136301140.29983892821377583
" ], "text/plain": [ @@ -1193,29 +1327,28 @@ " 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", + " 2402 333778852.5099249 84.59457 22.03088 0.18194601 0.3934918682770723\n", + " 2408 333778852.5267153 84.21462 23.44914 0.08397394 0.8919525879696997\n", + " 2434 333778852.61315054 83.524704 22.725792 0.10596932 0.45797881185987477\n", + " 2445 333778852.6690142 83.76957 22.451006 0.19733498 0.11641851092409164\n", + " 2478 333778852.7627939 83.478516 23.484594 0.08522219 0.900480594501521\n", + " 2481 333778852.7778549 83.71517 21.985115 1.0020943 0.34760107795590983\n", + " 2513 333778852.8644467 82.421196 22.567652 0.14374068 0.9182740088921875\n", + " 2544 333778852.9826064 83.64136 22.041315 0.10316629 0.42611240294578184\n", + " 2559 333778853.0269414 84.069176 22.97337 0.047184493 0.7422974209419148\n", " ... ... ... ... ... ...\n", - " 356222 333780039.4520397 84.74482 20.894981 0.043312162 0.4537121484157113\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" + " 356223 333780039.4600492 84.11615 22.557505 0.08110082 0.6914919573678725\n", + " 356227 333780039.47105366 83.41534 21.67344 0.2096362 0.018183853280195963\n", + " 356242 333780039.5179095 83.55165 22.772985 0.17672835 0.4092061182772071\n", + " 356282 333780039.62997514 84.46133 21.69357 0.05068718 0.7361270045119108\n", + " 356473 333780040.3386479 84.45441 21.159828 0.1831569 0.7746788606122589\n", + " 356478 333780040.3548926 83.68336 23.444988 0.06305169 0.25693976618589837\n", + " 356485 333780040.3741322 84.33517 21.28338 0.060539745 0.8281108809408599\n", + " 356486 333780040.3755159 84.85886 22.116222 0.123453744 0.8691880225176731\n", + " 356526 333780040.52476007 84.86929 21.290916 0.13630114 0.29983892821377583" ] }, - "execution_count": 27, + "execution_count": 30, "metadata": {}, "output_type": "execute_result" } @@ -1237,31 +1370,31 @@ "id": "e369d2dc", "metadata": {}, "source": [ - "In the following, we show how to write the files in a directory contained in the original datastore directory. This follows the logic of DL3 data store and facilitate the manipulation of the HDU table.\n", + "In the following, we show how to write the files in a directory contained in the original datastore directory. This follows the logic of DL3 data store and facilitates the manipulation of the HDU table.\n", "\n", - "If one does not want to save the events files and directly perform the pulsar analysis, this step is not required as well as the step of the meta data handling. However, be aware that for large dataset, the computation of phases can take tens of minutes. " + "If you do not want to save the events files bur rather directly perform the pulsar analysis, you can skip both this step and the step of the handling metadata. However, be aware that for large datasets, the computation of the phases can take tens of minutes." ] }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 31, "id": "f3c8410c", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.315528Z", - "iopub.status.busy": "2024-03-27T11:26:45.315188Z", - "iopub.status.idle": "2024-03-27T11:26:45.318777Z", - "shell.execute_reply": "2024-03-27T11:26:45.318308Z" + "iopub.execute_input": "2024-08-30T13:44:16.022167Z", + "iopub.status.busy": "2024-08-30T13:44:16.021883Z", + "iopub.status.idle": "2024-08-30T13:44:16.025164Z", + "shell.execute_reply": "2024-08-30T13:44:16.024650Z" } }, "outputs": [ { "data": { "text/plain": [ - "PosixPath('/home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.0.2/magic/rad_max/data')" + "PosixPath('/home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.2/magic/rad_max/data')" ] }, - "execution_count": 28, + "execution_count": 31, "metadata": {}, "output_type": "execute_result" } @@ -1272,14 +1405,14 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 32, "id": "8fd2ce31", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.320738Z", - "iopub.status.busy": "2024-03-27T11:26:45.320560Z", - "iopub.status.idle": "2024-03-27T11:26:45.323746Z", - "shell.execute_reply": "2024-03-27T11:26:45.323305Z" + "iopub.execute_input": "2024-08-30T13:44:16.027018Z", + "iopub.status.busy": "2024-08-30T13:44:16.026717Z", + "iopub.status.idle": "2024-08-30T13:44:16.029663Z", + "shell.execute_reply": "2024-08-30T13:44:16.029226Z" } }, "outputs": [], @@ -1296,24 +1429,24 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 33, "id": "e6e38fc1", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.325950Z", - "iopub.status.busy": "2024-03-27T11:26:45.325616Z", - "iopub.status.idle": "2024-03-27T11:26:45.329021Z", - "shell.execute_reply": "2024-03-27T11:26:45.328467Z" + "iopub.execute_input": "2024-08-30T13:44:16.031501Z", + "iopub.status.busy": "2024-08-30T13:44:16.031183Z", + "iopub.status.idle": "2024-08-30T13:44:16.034289Z", + "shell.execute_reply": "2024-08-30T13:44:16.033820Z" } }, "outputs": [ { "data": { "text/plain": [ - "'/home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.0.2/magic/rad_max/data/pulsar_events_file/'" + "'/home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.2/magic/rad_max/data/pulsar_events_file/'" ] }, - "execution_count": 30, + "execution_count": 33, "metadata": {}, "output_type": "execute_result" } @@ -1324,32 +1457,29 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 34, "id": "f339c797", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.331194Z", - "iopub.status.busy": "2024-03-27T11:26:45.330781Z", - "iopub.status.idle": "2024-03-27T11:26:45.489597Z", - "shell.execute_reply": "2024-03-27T11:26:45.488969Z" - }, - "scrolled": true + "iopub.execute_input": "2024-08-30T13:44:16.036030Z", + "iopub.status.busy": "2024-08-30T13:44:16.035881Z", + "iopub.status.idle": "2024-08-30T13:44:16.168565Z", + "shell.execute_reply": "2024-08-30T13:44:16.168088Z" + } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Writing outputfile in /home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.0.2/magic/rad_max/data/pulsar_events_file/dl3_pulsar_5029747.fits.gz\n" + "Writing output file in /home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.2/magic/rad_max/data/pulsar_events_file/dl3_pulsar_5029747.fits.gz\n" ] } ], "source": [ "# Save the observation object in the specified file_path\n", - "print(\"Writing outputfile in \" + str(file_path))\n", - "observation.events.write(\n", - " filename=file_path, gti=observation.gti, overwrite=True\n", - ")" + "print(\"Writing output file in \" + str(file_path))\n", + "new_obs.write(path=file_path, include_irfs=False, overwrite=True)" ] }, { @@ -1362,14 +1492,14 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 35, "id": "4b8dd431", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.492294Z", - "iopub.status.busy": "2024-03-27T11:26:45.491941Z", - "iopub.status.idle": "2024-03-27T11:26:45.497464Z", - "shell.execute_reply": "2024-03-27T11:26:45.496931Z" + "iopub.execute_input": "2024-08-30T13:44:16.170679Z", + "iopub.status.busy": "2024-08-30T13:44:16.170369Z", + "iopub.status.idle": "2024-08-30T13:44:16.175339Z", + "shell.execute_reply": "2024-08-30T13:44:16.174869Z" } }, "outputs": [ @@ -1377,7 +1507,7 @@ "data": { "text/html": [ "
HDUIndexTable length=10\n", - "\n", + "
\n", "\n", "\n", "\n", @@ -1409,7 +1539,7 @@ "5029747 edisp ... ENERGY DISPERSION" ] }, - "execution_count": 32, + "execution_count": 35, "metadata": {}, "output_type": "execute_result" } @@ -1422,34 +1552,36 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 36, "id": "6f37e101", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.499587Z", - "iopub.status.busy": "2024-03-27T11:26:45.499179Z", - "iopub.status.idle": "2024-03-27T11:26:45.502364Z", - "shell.execute_reply": "2024-03-27T11:26:45.501887Z" + "iopub.execute_input": "2024-08-30T13:44:16.177243Z", + "iopub.status.busy": "2024-08-30T13:44:16.176916Z", + "iopub.status.idle": "2024-08-30T13:44:16.179856Z", + "shell.execute_reply": "2024-08-30T13:44:16.179447Z" } }, "outputs": [], "source": [ "for entry in new_hdu:\n", - " if entry[\"HDU_NAME\"] == \"EVENTS\" and entry[\"OBS_ID\"] == observation.obs_id:\n", + " if (entry[\"HDU_NAME\"] == \"EVENTS\") and (\n", + " entry[\"OBS_ID\"] == observation.obs_id\n", + " ):\n", " entry[\"FILE_DIR\"] = \"./\" + str(output_directory)\n", " entry[\"FILE_NAME\"] = filename" ] }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 37, "id": "d89a7739", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.504469Z", - "iopub.status.busy": "2024-03-27T11:26:45.504078Z", - "iopub.status.idle": "2024-03-27T11:26:45.508565Z", - "shell.execute_reply": "2024-03-27T11:26:45.507988Z" + "iopub.execute_input": "2024-08-30T13:44:16.181702Z", + "iopub.status.busy": "2024-08-30T13:44:16.181410Z", + "iopub.status.idle": "2024-08-30T13:44:16.185572Z", + "shell.execute_reply": "2024-08-30T13:44:16.185152Z" } }, "outputs": [ @@ -1457,7 +1589,7 @@ "data": { "text/html": [ "
HDUIndexTable length=10\n", - "
OBS_IDHDU_TYPEHDU_CLASSFILE_DIRFILE_NAMEHDU_NAME
int64bytes30bytes30bytes100bytes50bytes30
5029748eventsevents./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsEVENTS
\n", + "
\n", "\n", "\n", "\n", @@ -1489,7 +1621,7 @@ "5029747 edisp ... ENERGY DISPERSION" ] }, - "execution_count": 34, + "execution_count": 37, "metadata": {}, "output_type": "execute_result" } @@ -1511,19 +1643,19 @@ "id": "e08bf493", "metadata": {}, "source": [ - "Finally, we need to save the new HDU table in the origianl DL3 directory. Here one should be very careful to not name the new HDU file with the same name as the original HDU file of the data store. Otherwise, the original HDU file will be overwrited. " + "Finally, we need to save the new HDU table in the original DL3 directory. One must be very careful with naming the new HDU file, such that it does not have the same name as the original HDU file of the data store. Otherwise, the original HDU file will be overwritten." ] }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 38, "id": "b1633cd5", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.510689Z", - "iopub.status.busy": "2024-03-27T11:26:45.510412Z", - "iopub.status.idle": "2024-03-27T11:26:45.521520Z", - "shell.execute_reply": "2024-03-27T11:26:45.520994Z" + "iopub.execute_input": "2024-08-30T13:44:16.187343Z", + "iopub.status.busy": "2024-08-30T13:44:16.187186Z", + "iopub.status.idle": "2024-08-30T13:44:16.197275Z", + "shell.execute_reply": "2024-08-30T13:44:16.196738Z" } }, "outputs": [], @@ -1538,7 +1670,7 @@ "id": "e92cf68c", "metadata": {}, "source": [ - "**Note: Here we use only one approach that could be useful, showing the steps to save the new Event files in a random directory and generate a new modified HDU index table. However, the user is free to chose the absolute path of the EventList and DataStore. For instance, another approach could be making a full copy of the DataStore, or changing the location of the pulsar event files to one that could be more convinient for the user.**" + "**Note: Here we demonstrate only one approach that could be useful, showing the steps to save the new Event files in a directory and generate a new modified HDU index table. However, the user is free to choose the absolute path of the EventList and DataStore. Another approach, for instance, could be making a full copy of the DataStore, or changing the location of the pulsar event files to one that is more convenient for the user.**" ] }, { @@ -1554,38 +1686,38 @@ "id": "e1036448", "metadata": {}, "source": [ - "Once all of this is done, we just have to open the data store using `DataStore.from_dir()`and passing the pulsar HDU table to it :" + "Once all of this is done, we just have to open the data store using DataStore.from_dir() and pass the pulsar HDU table to it :" ] }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 39, "id": "88a0e9c1", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.523852Z", - "iopub.status.busy": "2024-03-27T11:26:45.523517Z", - "iopub.status.idle": "2024-03-27T11:26:45.537115Z", - "shell.execute_reply": "2024-03-27T11:26:45.536595Z" + "iopub.execute_input": "2024-08-30T13:44:16.199418Z", + "iopub.status.busy": "2024-08-30T13:44:16.199114Z", + "iopub.status.idle": "2024-08-30T13:44:16.210872Z", + "shell.execute_reply": "2024-08-30T13:44:16.210389Z" } }, "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": 37, + "execution_count": 40, "id": "f7c60c18", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.539197Z", - "iopub.status.busy": "2024-03-27T11:26:45.538882Z", - "iopub.status.idle": "2024-03-27T11:26:45.543864Z", - "shell.execute_reply": "2024-03-27T11:26:45.543346Z" + "iopub.execute_input": "2024-08-30T13:44:16.213029Z", + "iopub.status.busy": "2024-08-30T13:44:16.212605Z", + "iopub.status.idle": "2024-08-30T13:44:16.217590Z", + "shell.execute_reply": "2024-08-30T13:44:16.217079Z" } }, "outputs": [ @@ -1595,7 +1727,7 @@ "['events', 'gti', 'aeff', 'edisp', 'rad_max']" ] }, - "execution_count": 37, + "execution_count": 40, "metadata": {}, "output_type": "execute_result" } @@ -1609,14 +1741,14 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 41, "id": "4ae8ebd2", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.545837Z", - "iopub.status.busy": "2024-03-27T11:26:45.545678Z", - "iopub.status.idle": "2024-03-27T11:26:45.559836Z", - "shell.execute_reply": "2024-03-27T11:26:45.559308Z" + "iopub.execute_input": "2024-08-30T13:44:16.219467Z", + "iopub.status.busy": "2024-08-30T13:44:16.219161Z", + "iopub.status.idle": "2024-08-30T13:44:16.233657Z", + "shell.execute_reply": "2024-08-30T13:44:16.233153Z" } }, "outputs": [ @@ -1624,61 +1756,59 @@ "data": { "text/html": [ "
Table length=11189\n", - "
OBS_IDHDU_TYPEHDU_CLASSFILE_DIRFILE_NAMEHDU_NAME
int64bytes30bytes30bytes100bytes50bytes30
5029748eventsevents./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsEVENTS
\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "
EVENT_IDTIMERADECENERGY
sdegdegTeV
int64float64float32float32float32
2402333778852.509924984.5945722.030880.18194601
2408333778852.526715384.2146223.449140.08397394
2434333778852.6131505483.52470422.7257920.10596932
2445333778852.669014283.7695722.4510060.19733498
2478333778852.762793983.47851623.4845940.08522219
2481333778852.777854983.7151721.9851151.0020943
2513333778852.864446782.42119622.5676520.14374068
2544333778852.982606483.6413622.0413150.10316629
2559333778853.026941484.06917622.973370.047184493
...............
356222333780039.452039784.7448220.8949810.043312162
356223333780039.460049284.1161522.5575050.08110082
356227333780039.4710536683.4153421.673440.2096362
356242333780039.517909583.5516522.7729850.17672835
356282333780039.6299751484.4613321.693570.05068718
356473333780040.338647984.4544121.1598280.1831569
356478333780040.354892683.6833623.4449880.06305169
356485333780040.374132284.3351721.283380.060539745
356486333780040.375515984.8588622.1162220.123453744
356526333780040.5247600784.8692921.2909160.13630114
\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", "
EVENT_IDTIMERADECENERGYPHASE
sdegdegTeV
int64float64float32float32float32float64
2402333778852.509924984.5945722.030880.181946010.3934918682770723
2408333778852.526715384.2146223.449140.083973940.8919525879696997
2434333778852.6131505483.52470422.7257920.105969320.45797881185987477
2445333778852.669014283.7695722.4510060.197334980.11641851092409164
2478333778852.762793983.47851623.4845940.085222190.900480594501521
2481333778852.777854983.7151721.9851151.00209430.34760107795590983
2513333778852.864446782.42119622.5676520.143740680.9182740088921875
2544333778852.982606483.6413622.0413150.103166290.42611240294578184
2559333778853.026941484.06917622.973370.0471844930.7422974209419148
..................
356223333780039.460049284.1161522.5575050.081100820.6914919573678725
356227333780039.4710536683.4153421.673440.20963620.018183853280195963
356242333780039.517909583.5516522.7729850.176728350.4092061182772071
356282333780039.6299751484.4613321.693570.050687180.7361270045119108
356473333780040.338647984.4544121.1598280.18315690.7746788606122589
356478333780040.354892683.6833623.4449880.063051690.25693976618589837
356485333780040.374132284.3351721.283380.0605397450.8281108809408599
356486333780040.375515984.8588622.1162220.1234537440.8691880225176731
356526333780040.5247600784.8692921.2909160.136301140.29983892821377583
" ], "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", - " 356222 333780039.4520397 84.74482 20.894981 0.043312162\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" + "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.3934918682770723\n", + " 2408 333778852.5267153 84.21462 23.44914 0.08397394 0.8919525879696997\n", + " 2434 333778852.61315054 83.524704 22.725792 0.10596932 0.45797881185987477\n", + " 2445 333778852.6690142 83.76957 22.451006 0.19733498 0.11641851092409164\n", + " 2478 333778852.7627939 83.478516 23.484594 0.08522219 0.900480594501521\n", + " 2481 333778852.7778549 83.71517 21.985115 1.0020943 0.34760107795590983\n", + " 2513 333778852.8644467 82.421196 22.567652 0.14374068 0.9182740088921875\n", + " 2544 333778852.9826064 83.64136 22.041315 0.10316629 0.42611240294578184\n", + " 2559 333778853.0269414 84.069176 22.97337 0.047184493 0.7422974209419148\n", + " ... ... ... ... ... ...\n", + " 356223 333780039.4600492 84.11615 22.557505 0.08110082 0.6914919573678725\n", + " 356227 333780039.47105366 83.41534 21.67344 0.2096362 0.018183853280195963\n", + " 356242 333780039.5179095 83.55165 22.772985 0.17672835 0.4092061182772071\n", + " 356282 333780039.62997514 84.46133 21.69357 0.05068718 0.7361270045119108\n", + " 356473 333780040.3386479 84.45441 21.159828 0.1831569 0.7746788606122589\n", + " 356478 333780040.3548926 83.68336 23.444988 0.06305169 0.25693976618589837\n", + " 356485 333780040.3741322 84.33517 21.28338 0.060539745 0.8281108809408599\n", + " 356486 333780040.3755159 84.85886 22.116222 0.123453744 0.8691880225176731\n", + " 356526 333780040.52476007 84.86929 21.290916 0.13630114 0.29983892821377583" ] }, - "execution_count": 38, + "execution_count": 41, "metadata": {}, "output_type": "execute_result" } @@ -1708,7 +1838,7 @@ "id": "1fe89d60", "metadata": {}, "source": [ - "Once we have the corret DataStore and the modified EventList with the phase information, we can do the pulsar analysis using different tools for Gammapy to compute the phaseogram, maps, SED, lightcurve, etc... To do so, one can check the following [Gammapy tutorial](https://docs.gammapy.org/1.0/tutorials/analysis-time/pulsar_analysis.html#sphx-glr-tutorials-analysis-time-pulsar-analysis-py)." + "Once we have the correct DataStore and the modified EventList with the phase information, we can perform the pulsar analysis using different tools available in Gammapy. Allowing us to compute the phaseogram, maps, SED, lightcurve and more. To do so, please refer to the following [Gammapy tutorial](https://docs.gammapy.org/1.0/tutorials/analysis-time/pulsar_analysis.html#sphx-glr-tutorials-analysis-time-pulsar-analysis-py)." ] }, { @@ -1737,7 +1867,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.19" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/docs/_static/notebooks/pulsar_phase/pulsar_phase_computation.py b/docs/_static/notebooks/pulsar_phase/pulsar_phase_computation.py index 24d1b10..5baea3b 100644 --- a/docs/_static/notebooks/pulsar_phase/pulsar_phase_computation.py +++ b/docs/_static/notebooks/pulsar_phase/pulsar_phase_computation.py @@ -5,16 +5,16 @@ # This notebook has been done for the following version of Gammapy and PINT: # -# Gammapy version : 1.0.1 +# Gammapy version : 1.2 # -# PINT version : 0.9.5 +# PINT version : 1.0 # This notebook shows how to compute and add the phase information into the events files of pulsar observations. This step is needed to perform the pulsar analysis with Gammapy and should be the first step in the high level analysis. For the pulsar analysis we need two ingredients: # # 1. The time of arrivals (TOAs). These times should have very high precision due to the common fast periods of pulsars. Usually these times are already stored in the EventList. For the computation of pulsar timing, times must be corrected in order to be referenced in the Solar System barycenter (SSB) because this system can nearly be regarded as an inertial reference frame with respect to the pulsar. # # -# 2. The model of rotation of the pulsar, also known as ephemeris, at the epoch of the observations. These ephemerides are stored in an specific format and saved as .par files and contain informations on the periods, derivatives of the periods, coordinates, glitches, etc. +# 2. The model of rotation of the pulsar, also known as ephemeris, at the epoch of the observations. These ephemerides are stored in a specific format and saved as .par files which contain the periods, derivatives of the periods, coordinates, glitches, etc. # # __For the following steps of this tutorial, we need the original EventLists from the DL3 files, and a model in .par format.__ # @@ -23,10 +23,10 @@ # ## 0. Dependencies and imports -# 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. +# To run this notebook, you must have Gammapy and PINT (see documentation above) installed in the same environment. We recommend installing Gammapy first and then installing PINT using your preferred package manager. # # -# `$ conda env create -n gammapy-pint -f gammapy-1.0-environment.yml` +# `$ conda env create -n gammapy-pint -f gammapy-pint-environment.yml` # # `$ conda activate gammapy-pint` # @@ -56,9 +56,12 @@ import numpy as np from pathlib import Path from gammapy.data import DataStore, EventList, Observation +import logging + +log = logging.getLogger(__name__) -# And we also need some imports from PINT: +# We also need some imports from PINT: # In[3]: @@ -69,20 +72,20 @@ # ## 1. Reading DataStore -# First we neeed to define the data sample. In this notebook we will use two runs from the MAGIC gammapy data sample available in https://github.com/gammapy/gammapy-data +# First we need to define the data sample. In this notebook we will use two runs from the MAGIC gammapy data sample available in https://github.com/gammapy/gammapy-data # In[4]: # Define the directory containing the DL3 data -DL3_direc = "$GAMMAPY_DATA/magic/rad_max/data" +DL3_dir = "$GAMMAPY_DATA/magic/rad_max/data" # In[5]: # Read DataStore from a directory -data_store = DataStore.from_dir(DL3_direc) +data_store = DataStore.from_dir(DL3_dir) # Let's run this tutorial for the Crab pulsar : @@ -90,9 +93,7 @@ # In[6]: -target_pos = SkyCoord( - ra=083.6331144560900, dec=+22.0144871383400, unit="deg", frame="icrs" -) +target_pos = SkyCoord(ra=083.633, dec=+22.014, unit="deg", frame="icrs") # In[7]: @@ -149,24 +150,26 @@ print(times) -# Now we have the TOAs of the events in the system of the telescope. Please note that the actual precision of the times is higher than the diplayed output (and we really need this precision for the pulsar analysis!). In the next step, the timing in the SSB and the phase for each TOA has to be created. +# Now we have the TOAs for the events in the system of the telescope. Please note: the actual precision of the times is higher than the displayed output (and we really need this precision for the pulsar analysis!). In the next step, the timing in the SSB and the phase for each TOA has to be created. # ## 2.1 An ephemeris file from Fermi-LAT data. -# In order to compute the phases of a pulsar, one needs an ephemeris file, usually store as a .par file. +# In order to compute the phases of a pulsar, one needs an ephemeris file, typically stored as a .par file. # # 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). # -# 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, it is important to note that many of the ephemeris files are not up-to-date. Therefore, they could give bad results on the phase computation. In particular, you should always check that the MJD of the observations one wants to phase lies between the `START` and `FINISH` entries of the ephemeris file (see next section). # In[13]: # Path to the ephemeris file -ephemeris_file = "./0534+2200_ApJ_708_1254_2010.par" +ephemeris_file = "0534+2200_ApJ_708_1254_2010.par" -# 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 files 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 features from Tempo2. +# +# In our case, an error occurs when using the ephemeris file with PINT. This is due to the `JUMP` line. To proceed, simply comment out the line (with #) or remove it. Note that this line is not important for the gamma-ray instruments, so it is acceptable to disregard it. # ## 2.2 Computing pulsar phases @@ -185,21 +188,69 @@ print(model.components["Spindown"]) -# 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. Check the [PINT documentation](https://nanograv-pint.readthedocs.io) for a list of additional parameters. To obtain the complete set of parameters from the ephemeris file, one can simply print the model: +# `print(model)` -# Now we can compute the phases. For that, we define a list of TOA objects that are the main object of PINT. +# As mentioned previously, we should ensure 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: # In[15]: -get_ipython().run_cell_magic('time', '', '\n# Put these to True is your observatory has clock correction files.\n# If it is set to True but your observatory does not have clock correction files, it will be ignored.\ninclude_bipm = False\ninclude_gps = False\n\n# Set this to True or False depending on your ephemeris file.\n# Here we can see that the \'PLANET_SHAPIRO\' entry is \'N\' so we set it to True.\nplanets = False\n\n# Create a TOA object for each time\ntoas = toa.get_TOAs_array(\n times=times,\n obs="magic",\n errors=1 * u.microsecond,\n ephem="DE421",\n include_gps=include_gps,\n include_bipm=include_bipm,\n planets=planets,\n)') +print( + f"Ephemeris time definition:\n{model.START.value} - {model.FINISH.value}" +) +print( + f"Observation time definition:\n{observation.tstart} - {observation.tstop}" +) -# Once we have the TOAs object and the model, the phases are easily computed using the model.phase() method. Note that the phases are computed in the interval [-0.5,0.5]. Most of the times, we use the phases in the interval [0,1] so we have to shift the negative ones. +# If you have several observations that 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 create a small function like the following one: # In[16]: +def check_time(observation, timing_model): + """ + Check that the observation time lies within the time definition of the pulsar + timing model. + + Parameters + ---------- + observation: `gammapy.data.Observation` + Observation to check. + timing_model: `pint.models.TimingModel` + The timing model that will be used. + """ + model_time = Time( + [model.START.value, model.FINISH.value], scale="tt", format="mjd" + ) + if (model_time[0].value > observation.tstart.tt.mjd) or ( + model_time[1].value < observation.tstop.tt.mjd + ): + log.warning( + f"Warning: Observation time of observation {observation.obs_id} goes out of timing model validity time." + ) + + +# In[17]: + + +check_time(observation, model) + + +# Now we can compute the phases. For that, we define a list of TOA objects that are the main object of PINT. + +# In[18]: + + +get_ipython().run_cell_magic('time', '', '\n# Set these to True is your observatory has clock correction files.\n# If it is set to True but your observatory does not have clock correction files, it will be ignored.\ninclude_bipm = False\ninclude_gps = False\n\n# Set this to True or False depending on your ephemeris file.\n# Here we can see that the \'PLANET_SHAPIRO\' entry is \'N\' so we set it to True.\nplanets = False\n\n# Create a TOA object for each time\ntoas = toa.get_TOAs_array(\n times=times,\n obs="magic",\n errors=1 * u.microsecond,\n ephem="DE421",\n include_gps=include_gps,\n include_bipm=include_bipm,\n planets=planets,\n)') + + +# Once we have the TOAs object and the model, the phases are easily computed using the model.phase() method. Note that the phases are computed in the interval [-0.5,0.5]. Most of the time, we use the phases in the interval [0,1] so we have to shift the negative ones. + +# In[19]: + + # Compute phases phases = model.phase(toas, abs_phase=True)[1] @@ -211,21 +262,21 @@ # Once the phases are computed we need to create a new EventList table that includes both the original information of the events and the phase information in extra columns. This is necessary for Gammapy to read the phases and use them as an extra variable of each event. -# In[17]: +# In[20]: # Extract the table of the EventList table = observation.events.table -# In[18]: +# In[21]: # Show original table -print(table) +table -# In[19]: +# In[22]: # Add a column for the phases to the table @@ -234,7 +285,7 @@ # Note that you can add multiple columns to a same file, only the name of the column has to be unique, eg `table['PHASE_SRC1']`, `table['PHASE_SRC2']` etc" -# In[20]: +# In[23]: # Show table with phases @@ -243,17 +294,17 @@ # Now we can see that the 'PHASE' column has been added to the table -# At this point, we also want to add meta data to the table. It is very useful to keep track of what has been done to the file. For instance, if we have multiple pulsars in the same file, we want to be able to know quickly which column correspond to which pulsar. Moreover, experience shows that one often use different ephemeris file for the same pulsar. Therefore, it is very useful to have several phase columns in the same file and to be able to know which column correspond to which ephemeris file, parameters, etc. +# At this point, we also want to add metadata to the table. It is very useful to keep track of what has been done to the file. For instance, if a file contains multiple pulsars, we want identify quickly which column corresponds to each pulsar. Moreover, experience has shown that it is common to have different ephemeris files for the same pulsar. Therefore, it is useful to have several phase columns in the same file to easily identify which column corresponds to each ephemeris file, parameters, etc. # -# Since there is not yet a "standard" format for such metadata, we propose a template for the essential informations that one wants to save in the header of the event file. First, we look at the present meta info on the table. +# Since there is currently no "standard" format for such metadata, we propose a template for the essential information that one wants to save in the header of the event file. First, we look at the present meta info on the table. -# In[21]: +# In[24]: table.meta -# In[22]: +# In[25]: def get_log(ephemeris_file, phase_column_name="PHASE"): @@ -292,21 +343,21 @@ def get_log(ephemeris_file, phase_column_name="PHASE"): ) -# In[23]: +# In[26]: phase_log = get_log(ephemeris_file=ephemeris_file, phase_column_name="PHASE") print(phase_log) -# In[24]: +# In[27]: # Add the generated string to the meta data of the table table.meta["PH_LOG"] = phase_log -# In[25]: +# In[28]: table.meta @@ -314,7 +365,7 @@ def get_log(ephemeris_file, phase_column_name="PHASE"): # Once this is done, we can put back the table in a new `EventList` object and in a new `Observation` object. -# In[26]: +# In[29]: # Create new event list and add it to observation object @@ -322,7 +373,7 @@ def get_log(ephemeris_file, phase_column_name="PHASE"): new_obs = observation.copy(in_memory=True, events=new_event_list) -# In[27]: +# In[30]: new_obs.events.table @@ -330,17 +381,17 @@ def get_log(ephemeris_file, phase_column_name="PHASE"): # ## 4. Save new Event List and writing a modify HDU index table -# In the following, we show how to write the files in a directory contained in the original datastore directory. This follows the logic of DL3 data store and facilitate the manipulation of the HDU table. +# In the following, we show how to write the files in a directory contained in the original datastore directory. This follows the logic of DL3 data store and facilitates the manipulation of the HDU table. # -# If one does not want to save the events files and directly perform the pulsar analysis, this step is not required as well as the step of the meta data handling. However, be aware that for large dataset, the computation of phases can take tens of minutes. +# If you do not want to save the events files bur rather directly perform the pulsar analysis, you can skip both this step and the step of the handling metadata. However, be aware that for large datasets, the computation of the phases can take tens of minutes. -# In[28]: +# In[31]: data_store.hdu_table.base_dir -# In[29]: +# In[32]: # Define output directory and filename @@ -353,25 +404,23 @@ def get_log(ephemeris_file, phase_column_name="PHASE"): Path(output_path).mkdir(parents=True, exist_ok=True) -# In[30]: +# In[33]: output_path -# In[31]: +# In[34]: # Save the observation object in the specified file_path -print("Writing outputfile in " + str(file_path)) -observation.events.write( - filename=file_path, gti=observation.gti, overwrite=True -) +print("Writing output file in " + str(file_path)) +new_obs.write(path=file_path, include_irfs=False, overwrite=True) # Once the file has been written, we want to write a modified version of the HDU table. This is mandatory if we want to open the phased events file together with its associated IRFs. -# In[32]: +# In[35]: # Print the current data store HDU table. @@ -379,16 +428,18 @@ def get_log(ephemeris_file, phase_column_name="PHASE"): new_hdu -# In[33]: +# In[36]: for entry in new_hdu: - if entry["HDU_NAME"] == "EVENTS" and entry["OBS_ID"] == observation.obs_id: + if (entry["HDU_NAME"] == "EVENTS") and ( + entry["OBS_ID"] == observation.obs_id + ): entry["FILE_DIR"] = "./" + str(output_directory) entry["FILE_NAME"] = filename -# In[34]: +# In[37]: new_hdu @@ -396,9 +447,9 @@ def get_log(ephemeris_file, phase_column_name="PHASE"): # We see that the `FILE_DIR`and `FILE_NAME`entry have been modified for our phased events file. -# Finally, we need to save the new HDU table in the origianl DL3 directory. Here one should be very careful to not name the new HDU file with the same name as the original HDU file of the data store. Otherwise, the original HDU file will be overwrited. +# Finally, we need to save the new HDU table in the original DL3 directory. One must be very careful with naming the new HDU file, such that it does not have the same name as the original HDU file of the data store. Otherwise, the original HDU file will be overwritten. -# In[35]: +# In[38]: new_hdu.write( @@ -406,21 +457,21 @@ def get_log(ephemeris_file, phase_column_name="PHASE"): ) -# **Note: Here we use only one approach that could be useful, showing the steps to save the new Event files in a random directory and generate a new modified HDU index table. However, the user is free to chose the absolute path of the EventList and DataStore. For instance, another approach could be making a full copy of the DataStore, or changing the location of the pulsar event files to one that could be more convinient for the user.** +# **Note: Here we demonstrate only one approach that could be useful, showing the steps to save the new Event files in a directory and generate a new modified HDU index table. However, the user is free to choose the absolute path of the EventList and DataStore. Another approach, for instance, could be making a full copy of the DataStore, or changing the location of the pulsar event files to one that is more convenient for the user.** # ## 5. Opening the new DataStore -# Once all of this is done, we just have to open the data store using `DataStore.from_dir()`and passing the pulsar HDU table to it : +# Once all of this is done, we just have to open the data store using DataStore.from_dir() and pass the pulsar HDU table to it : -# In[36]: +# In[39]: pulsar_datastore = DataStore.from_dir( - DL3_direc, hdu_table_filename="hdu-index-pulsar.fits.gz" + DL3_dir, hdu_table_filename="hdu-index-pulsar.fits.gz" ) -# In[37]: +# In[40]: observations = pulsar_datastore.get_observations( @@ -429,7 +480,7 @@ def get_log(ephemeris_file, phase_column_name="PHASE"): observations[0].available_hdus -# In[38]: +# In[41]: observations[0].events.table @@ -439,7 +490,7 @@ def get_log(ephemeris_file, phase_column_name="PHASE"): # ## 6. Pulsar analysis tools with gammapy -# Once we have the corret DataStore and the modified EventList with the phase information, we can do the pulsar analysis using different tools for Gammapy to compute the phaseogram, maps, SED, lightcurve, etc... To do so, one can check the following [Gammapy tutorial](https://docs.gammapy.org/1.0/tutorials/analysis-time/pulsar_analysis.html#sphx-glr-tutorials-analysis-time-pulsar-analysis-py). +# Once we have the correct DataStore and the modified EventList with the phase information, we can perform the pulsar analysis using different tools available in Gammapy. Allowing us to compute the phaseogram, maps, SED, lightcurve and more. To do so, please refer to the following [Gammapy tutorial](https://docs.gammapy.org/1.0/tutorials/analysis-time/pulsar_analysis.html#sphx-glr-tutorials-analysis-time-pulsar-analysis-py). # # Recipe made by [Alvaros Mas](https://github.com/alvmas), [Maxime Regeard](https://github.com/MRegeard), [Jan Lukas Schubert](https://github.com/jalu98). diff --git a/docs/notebooks/pulsar_phase/pulsar_phase_computation.ipynb b/docs/notebooks/pulsar_phase/pulsar_phase_computation.ipynb index 1c6f2f9..c355b6c 100644 --- a/docs/notebooks/pulsar_phase/pulsar_phase_computation.ipynb +++ b/docs/notebooks/pulsar_phase/pulsar_phase_computation.ipynb @@ -33,9 +33,9 @@ "source": [ "This notebook has been done for the following version of Gammapy and PINT:\n", "\n", - "Gammapy version : 1.0.1\n", + "Gammapy version : 1.2\n", "\n", - "PINT version : 0.9.5" + "PINT version : 1.0" ] }, { @@ -48,7 +48,7 @@ "1. The time of arrivals (TOAs). These times should have very high precision due to the common fast periods of pulsars. Usually these times are already stored in the EventList. For the computation of pulsar timing, times must be corrected in order to be referenced in the Solar System barycenter (SSB) because this system can nearly be regarded as an inertial reference frame with respect to the pulsar.\n", "\n", "\n", - "2. The model of rotation of the pulsar, also known as ephemeris, at the epoch of the observations. These ephemerides are stored in an specific format and saved as .par files and contain informations on the periods, derivatives of the periods, coordinates, glitches, etc.\n", + "2. The model of rotation of the pulsar, also known as ephemeris, at the epoch of the observations. These ephemerides are stored in a specific format and saved as .par files which contain the periods, derivatives of the periods, coordinates, glitches, etc.\n", "\n", "__For the following steps of this tutorial, we need the original EventLists from the DL3 files, and a model in .par format.__\n", "\n", @@ -69,10 +69,10 @@ "id": "a9c72d26", "metadata": {}, "source": [ - "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", + "To run this notebook, you must have Gammapy and PINT (see documentation above) installed in the same environment. We recommend installing Gammapy first and then installing PINT using your preferred 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", @@ -95,10 +95,10 @@ "id": "b68d2444", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:25.357930Z", - "iopub.status.busy": "2024-03-27T11:26:25.357759Z", - "iopub.status.idle": "2024-03-27T11:26:25.831345Z", - "shell.execute_reply": "2024-03-27T11:26:25.830742Z" + "iopub.execute_input": "2024-08-30T13:43:53.336099Z", + "iopub.status.busy": "2024-08-30T13:43:53.335935Z", + "iopub.status.idle": "2024-08-30T13:43:53.836216Z", + "shell.execute_reply": "2024-08-30T13:43:53.835669Z" } }, "outputs": [ @@ -106,8 +106,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "Gammapy version : 1.0.2\n", - "PINT version : 0.9.8\n" + "Gammapy version : 1.2\n", + "PINT version : 1.0.1\n" ] } ], @@ -125,10 +125,10 @@ "id": "e61b5e3e", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:25.833998Z", - "iopub.status.busy": "2024-03-27T11:26:25.833639Z", - "iopub.status.idle": "2024-03-27T11:26:26.506462Z", - "shell.execute_reply": "2024-03-27T11:26:26.505816Z" + "iopub.execute_input": "2024-08-30T13:43:53.838441Z", + "iopub.status.busy": "2024-08-30T13:43:53.838106Z", + "iopub.status.idle": "2024-08-30T13:43:54.626040Z", + "shell.execute_reply": "2024-08-30T13:43:54.625476Z" } }, "outputs": [], @@ -138,7 +138,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__)" ] }, { @@ -146,7 +149,7 @@ "id": "81ae3a58", "metadata": {}, "source": [ - "And we also need some imports from PINT:" + "We also need some imports from PINT:" ] }, { @@ -155,10 +158,10 @@ "id": "22ac4aea", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.509540Z", - "iopub.status.busy": "2024-03-27T11:26:26.509079Z", - "iopub.status.idle": "2024-03-27T11:26:26.624488Z", - "shell.execute_reply": "2024-03-27T11:26:26.623985Z" + "iopub.execute_input": "2024-08-30T13:43:54.628537Z", + "iopub.status.busy": "2024-08-30T13:43:54.628244Z", + "iopub.status.idle": "2024-08-30T13:43:54.656522Z", + "shell.execute_reply": "2024-08-30T13:43:54.655994Z" } }, "outputs": [], @@ -180,7 +183,7 @@ "id": "b486ec45", "metadata": {}, "source": [ - "First we neeed to define the data sample. In this notebook we will use two runs from the MAGIC gammapy data sample available in https://github.com/gammapy/gammapy-data" + "First we need to define the data sample. In this notebook we will use two runs from the MAGIC gammapy data sample available in https://github.com/gammapy/gammapy-data" ] }, { @@ -189,16 +192,16 @@ "id": "d0e182bb", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.627105Z", - "iopub.status.busy": "2024-03-27T11:26:26.626738Z", - "iopub.status.idle": "2024-03-27T11:26:26.629431Z", - "shell.execute_reply": "2024-03-27T11:26:26.628877Z" + "iopub.execute_input": "2024-08-30T13:43:54.658921Z", + "iopub.status.busy": "2024-08-30T13:43:54.658599Z", + "iopub.status.idle": "2024-08-30T13:43:54.660775Z", + "shell.execute_reply": "2024-08-30T13:43:54.660345Z" } }, "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\"" ] }, { @@ -207,16 +210,16 @@ "id": "b5019a42", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.631734Z", - "iopub.status.busy": "2024-03-27T11:26:26.631306Z", - "iopub.status.idle": "2024-03-27T11:26:26.646554Z", - "shell.execute_reply": "2024-03-27T11:26:26.646010Z" + "iopub.execute_input": "2024-08-30T13:43:54.662674Z", + "iopub.status.busy": "2024-08-30T13:43:54.662366Z", + "iopub.status.idle": "2024-08-30T13:43:54.676462Z", + "shell.execute_reply": "2024-08-30T13:43:54.675957Z" } }, "outputs": [], "source": [ "# Read DataStore from a directory\n", - "data_store = DataStore.from_dir(DL3_direc)" + "data_store = DataStore.from_dir(DL3_dir)" ] }, { @@ -233,17 +236,15 @@ "id": "9ba16fcc", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.648835Z", - "iopub.status.busy": "2024-03-27T11:26:26.648528Z", - "iopub.status.idle": "2024-03-27T11:26:26.651855Z", - "shell.execute_reply": "2024-03-27T11:26:26.651323Z" + "iopub.execute_input": "2024-08-30T13:43:54.678608Z", + "iopub.status.busy": "2024-08-30T13:43:54.678236Z", + "iopub.status.idle": "2024-08-30T13:43:54.681323Z", + "shell.execute_reply": "2024-08-30T13:43:54.680828Z" } }, "outputs": [], "source": [ - "target_pos = SkyCoord(\n", - " ra=083.6331144560900, dec=+22.0144871383400, unit=\"deg\", frame=\"icrs\"\n", - ")" + "target_pos = SkyCoord(ra=083.633, dec=+22.014, unit=\"deg\", frame=\"icrs\")" ] }, { @@ -252,10 +253,10 @@ "id": "06bda835", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.654049Z", - "iopub.status.busy": "2024-03-27T11:26:26.653646Z", - "iopub.status.idle": "2024-03-27T11:26:26.660513Z", - "shell.execute_reply": "2024-03-27T11:26:26.659953Z" + "iopub.execute_input": "2024-08-30T13:43:54.683221Z", + "iopub.status.busy": "2024-08-30T13:43:54.682910Z", + "iopub.status.idle": "2024-08-30T13:43:54.687923Z", + "shell.execute_reply": "2024-08-30T13:43:54.687497Z" } }, "outputs": [], @@ -276,10 +277,10 @@ "id": "f96ccf30", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.662615Z", - "iopub.status.busy": "2024-03-27T11:26:26.662199Z", - "iopub.status.idle": "2024-03-27T11:26:26.665420Z", - "shell.execute_reply": "2024-03-27T11:26:26.664873Z" + "iopub.execute_input": "2024-08-30T13:43:54.689878Z", + "iopub.status.busy": "2024-08-30T13:43:54.689440Z", + "iopub.status.idle": "2024-08-30T13:43:54.692452Z", + "shell.execute_reply": "2024-08-30T13:43:54.691937Z" } }, "outputs": [ @@ -313,10 +314,10 @@ "id": "fa6e36d5", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.667386Z", - "iopub.status.busy": "2024-03-27T11:26:26.667228Z", - "iopub.status.idle": "2024-03-27T11:26:26.670890Z", - "shell.execute_reply": "2024-03-27T11:26:26.670425Z" + "iopub.execute_input": "2024-08-30T13:43:54.694439Z", + "iopub.status.busy": "2024-08-30T13:43:54.694155Z", + "iopub.status.idle": "2024-08-30T13:43:54.699214Z", + "shell.execute_reply": "2024-08-30T13:43:54.698826Z" } }, "outputs": [], @@ -332,10 +333,10 @@ "id": "dec2c1a5", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.673075Z", - "iopub.status.busy": "2024-03-27T11:26:26.672669Z", - "iopub.status.idle": "2024-03-27T11:26:26.780999Z", - "shell.execute_reply": "2024-03-27T11:26:26.780438Z" + "iopub.execute_input": "2024-08-30T13:43:54.701143Z", + "iopub.status.busy": "2024-08-30T13:43:54.700820Z", + "iopub.status.idle": "2024-08-30T13:43:54.755258Z", + "shell.execute_reply": "2024-08-30T13:43:54.754750Z" } }, "outputs": [ @@ -384,10 +385,10 @@ "id": "2756e72d", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.783640Z", - "iopub.status.busy": "2024-03-27T11:26:26.783173Z", - "iopub.status.idle": "2024-03-27T11:26:26.799711Z", - "shell.execute_reply": "2024-03-27T11:26:26.799261Z" + "iopub.execute_input": "2024-08-30T13:43:54.757339Z", + "iopub.status.busy": "2024-08-30T13:43:54.757008Z", + "iopub.status.idle": "2024-08-30T13:43:54.770138Z", + "shell.execute_reply": "2024-08-30T13:43:54.769738Z" } }, "outputs": [], @@ -403,10 +404,10 @@ "id": "1ac8103a", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.801834Z", - "iopub.status.busy": "2024-03-27T11:26:26.801523Z", - "iopub.status.idle": "2024-03-27T11:26:26.804890Z", - "shell.execute_reply": "2024-03-27T11:26:26.804365Z" + "iopub.execute_input": "2024-08-30T13:43:54.772090Z", + "iopub.status.busy": "2024-08-30T13:43:54.771779Z", + "iopub.status.idle": "2024-08-30T13:43:54.774716Z", + "shell.execute_reply": "2024-08-30T13:43:54.774242Z" } }, "outputs": [ @@ -428,7 +429,7 @@ "id": "e93bfbeb", "metadata": {}, "source": [ - "Now we have the TOAs of the events in the system of the telescope. Please note that the actual precision of the times is higher than the diplayed output (and we really need this precision for the pulsar analysis!). In the next step, the timing in the SSB and the phase for each TOA has to be created. " + "Now we have the TOAs for the events in the system of the telescope. Please note: the actual precision of the times is higher than the displayed output (and we really need this precision for the pulsar analysis!). In the next step, the timing in the SSB and the phase for each TOA has to be created." ] }, { @@ -444,11 +445,11 @@ "id": "fb536b7e", "metadata": {}, "source": [ - "In order to compute the phases of a pulsar, one needs an ephemeris file, usually store as a .par file. \n", + "In order to compute the phases of a pulsar, one needs an ephemeris file, typically stored as a .par file.\n", "\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, it is important to note that many of the ephemeris files are not up-to-date. Therefore, they could give bad results on the phase computation. In particular, you should always check that the MJD of the observations one wants to phase lies between the `START` and `FINISH` entries of the ephemeris file (see next section)." ] }, { @@ -457,16 +458,16 @@ "id": "d4f89ba4", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.807135Z", - "iopub.status.busy": "2024-03-27T11:26:26.806833Z", - "iopub.status.idle": "2024-03-27T11:26:26.809301Z", - "shell.execute_reply": "2024-03-27T11:26:26.808783Z" + "iopub.execute_input": "2024-08-30T13:43:54.776686Z", + "iopub.status.busy": "2024-08-30T13:43:54.776389Z", + "iopub.status.idle": "2024-08-30T13:43:54.778777Z", + "shell.execute_reply": "2024-08-30T13:43:54.778358Z" } }, "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\"" ] }, { @@ -474,7 +475,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 files 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 features from Tempo2. \n", + "\n", + "In our case, an error occurs when using the ephemeris file with PINT. This is due to the `JUMP` line. To proceed, simply comment out the line (with #) or remove it. Note that this line is not important for the gamma-ray instruments, so it is acceptable to disregard it." ] }, { @@ -507,22 +510,21 @@ "id": "d24e1c92", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.811565Z", - "iopub.status.busy": "2024-03-27T11:26:26.811265Z", - "iopub.status.idle": "2024-03-27T11:26:26.907510Z", - "shell.execute_reply": "2024-03-27T11:26:26.906967Z" - }, - "scrolled": false + "iopub.execute_input": "2024-08-30T13:43:54.780756Z", + "iopub.status.busy": "2024-08-30T13:43:54.780435Z", + "iopub.status.idle": "2024-08-30T13:43:54.876016Z", + "shell.execute_reply": "2024-08-30T13:43:54.875575Z" + } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "\u001b[32m2024-03-27 11:26:26.901\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", - "/usr/share/miniconda3/envs/gammapy-recipes/lib/python3.9/site-packages/pint/models/model_builder.py:198: UserWarning: Unrecognized parfile line 'EPHVER 5'\n", + "\u001b[32m2024-08-30 13:43:54.870\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.models.absolute_phase\u001b[0m:\u001b[36mvalidate\u001b[0m:\u001b[36m77\u001b[0m - \u001b[1mTZRFRQ was 0.0 or None. Setting to infinite frequency.\u001b[0m\n", + "/home/runner/miniconda3/envs/gammapy-recipes/lib/python3.11/site-packages/pint/models/model_builder.py:230: UserWarning: Unrecognized parfile line 'EPHVER 5'\n", " warnings.warn(f\"Unrecognized parfile line '{p_line}'\", UserWarning)\n", - "\u001b[32m2024-03-27 11:26:26.903\u001b[0m | \u001b[33m\u001b[1mWARNING \u001b[0m | \u001b[36mpint.models.model_builder\u001b[0m:\u001b[36m__call__\u001b[0m:\u001b[36m202\u001b[0m - \u001b[33m\u001b[1mUNITS is not specified. Assuming TDB...\u001b[0m\n" + "\u001b[32m2024-08-30 13:43:54.872\u001b[0m | \u001b[33m\u001b[1mWARNING \u001b[0m | \u001b[36mpint.models.model_builder\u001b[0m:\u001b[36m__call__\u001b[0m:\u001b[36m234\u001b[0m - \u001b[33m\u001b[1mUNITS is not specified. Assuming TDB...\u001b[0m\n" ] }, { @@ -569,7 +571,111 @@ "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. Check the [PINT documentation](https://nanograv-pint.readthedocs.io) for a list of additional parameters. To obtain the complete set of parameters from the ephemeris file, one can simply print the model:\n", + "`print(model)`" + ] + }, + { + "cell_type": "markdown", + "id": "f02f0ca5-09f2-44d4-ad76-518f8964b6a1", + "metadata": {}, + "source": [ + "As mentioned previously, we should ensure 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": 15, + "id": "2584b571-93a9-4fb6-b8e2-60b8810190f6", + "metadata": { + "execution": { + "iopub.execute_input": "2024-08-30T13:43:54.878085Z", + "iopub.status.busy": "2024-08-30T13:43:54.877785Z", + "iopub.status.idle": "2024-08-30T13:43:54.881053Z", + "shell.execute_reply": "2024-08-30T13:43:54.880542Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Ephemeris time definition:\n", + "54686.1526259 - 56583.1591704\n", + "Observation time definition:\n", + "56569.18112772242 - 56569.19487901596\n" + ] + } + ], + "source": [ + "print(\n", + " f\"Ephemeris time definition:\\n{model.START.value} - {model.FINISH.value}\"\n", + ")\n", + "print(\n", + " f\"Observation time definition:\\n{observation.tstart} - {observation.tstop}\"\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "86041174-5ec4-43ba-9035-cf567b47a3bb", + "metadata": {}, + "source": [ + "If you have several observations that 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 create a small function like the following one:" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "8838ee6c-5b53-4d34-8fd7-94d32daa6bb3", + "metadata": { + "execution": { + "iopub.execute_input": "2024-08-30T13:43:54.882764Z", + "iopub.status.busy": "2024-08-30T13:43:54.882615Z", + "iopub.status.idle": "2024-08-30T13:43:54.886095Z", + "shell.execute_reply": "2024-08-30T13:43:54.885667Z" + } + }, + "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(\n", + " [model.START.value, model.FINISH.value], scale=\"tt\", format=\"mjd\"\n", + " )\n", + " if (model_time[0].value > observation.tstart.tt.mjd) or (\n", + " model_time[1].value < observation.tstop.tt.mjd\n", + " ):\n", + " log.warning(\n", + " f\"Warning: Observation time of observation {observation.obs_id} goes out of timing model validity time.\"\n", + " )" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "0d37e6cc-2cae-4192-87d9-88d52216e83f", + "metadata": { + "execution": { + "iopub.execute_input": "2024-08-30T13:43:54.887762Z", + "iopub.status.busy": "2024-08-30T13:43:54.887614Z", + "iopub.status.idle": "2024-08-30T13:43:54.890615Z", + "shell.execute_reply": "2024-08-30T13:43:54.890203Z" + } + }, + "outputs": [], + "source": [ + "check_time(observation, model)" ] }, { @@ -582,47 +688,53 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 18, "id": "a145cdde", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:26.909929Z", - "iopub.status.busy": "2024-03-27T11:26:26.909738Z", - "iopub.status.idle": "2024-03-27T11:26:44.597210Z", - "shell.execute_reply": "2024-03-27T11:26:44.596640Z" - }, - "scrolled": false + "iopub.execute_input": "2024-08-30T13:43:54.892323Z", + "iopub.status.busy": "2024-08-30T13:43:54.892174Z", + "iopub.status.idle": "2024-08-30T13:44:15.697802Z", + "shell.execute_reply": "2024-08-30T13:44:15.697299Z" + } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "\u001b[32m2024-03-27 11:26:27.247\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m1358\u001b[0m - \u001b[34m\u001b[1mNo pulse number flags found in the TOAs\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:27.263\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mapply_clock_corrections\u001b[0m:\u001b[36m2200\u001b[0m - \u001b[34m\u001b[1mApplying clock corrections (include_gps = False, include_bipm = False)\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:27.923\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-03-27 11:26:31.192\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2251\u001b[0m - \u001b[34m\u001b[1mComputing TDB columns.\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:31.193\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2272\u001b[0m - \u001b[34m\u001b[1mUsing EPHEM = DE421 for TDB calculation.\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:32.378\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2350\u001b[0m - \u001b[34m\u001b[1mComputing PosVels of observatories and Earth, using DE421\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:33.420\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-03-27 11:26:44.359\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2403\u001b[0m - \u001b[34m\u001b[1mSSB obs pos [1.47007462e+11 2.56889811e+10 1.11245045e+10] m\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.587\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-03-27 11:26:44.593\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2417\u001b[0m - \u001b[34m\u001b[1mAdding columns ssb_obs_pos ssb_obs_vel obs_sun_pos\u001b[0m\n" + "\u001b[32m2024-08-30 13:43:55.618\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m1377\u001b[0m - \u001b[34m\u001b[1mNo pulse number flags found in the TOAs\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:55.633\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mapply_clock_corrections\u001b[0m:\u001b[36m2224\u001b[0m - \u001b[34m\u001b[1mApplying clock corrections (include_bipm = False)\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.294\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.observatory\u001b[0m:\u001b[36mgps_correction\u001b[0m:\u001b[36m248\u001b[0m - \u001b[1mApplying GPS to UTC clock correction (~few nanoseconds)\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.294\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.observatory\u001b[0m:\u001b[36m_load_gps_clock\u001b[0m:\u001b[36m122\u001b[0m - \u001b[34m\u001b[1mLoading global GPS clock file\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.297\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.observatory.global_clock_corrections\u001b[0m:\u001b[36mget_file\u001b[0m:\u001b[36m128\u001b[0m - \u001b[1mFile index.txt to be downloaded due to download policy if_expired: https://raw.githubusercontent.com/ipta/pulsar-clock-corrections/main/index.txt\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.451\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.observatory.clock_file\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m812\u001b[0m - \u001b[34m\u001b[1mGlobal clock file gps2utc.clk saving kwargs={'bogus_last_correction': False, 'valid_beyond_ends': False}\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.452\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.observatory.global_clock_corrections\u001b[0m:\u001b[36mget_file\u001b[0m:\u001b[36m128\u001b[0m - \u001b[1mFile T2runtime/clock/gps2utc.clk to be downloaded due to download policy if_missing: https://raw.githubusercontent.com/ipta/pulsar-clock-corrections/main/T2runtime/clock/gps2utc.clk\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.668\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.observatory.clock_file\u001b[0m:\u001b[36mread_tempo2_clock_file\u001b[0m:\u001b[36m463\u001b[0m - \u001b[34m\u001b[1mLoading TEMPO2-format observatory clock correction file gps2utc.clk (/home/runner/.astropy/cache/download/url/d3c81b5766f4bfb84e65504c8a453085/contents) with bogus_last_correction=False\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.687\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.observatory\u001b[0m:\u001b[36mfind_clock_file\u001b[0m:\u001b[36m994\u001b[0m - \u001b[1mUsing global clock file for gps2utc.clk with bogus_last_correction=False\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:56.689\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.observatory.topo_obs\u001b[0m:\u001b[36mclock_corrections\u001b[0m:\u001b[36m354\u001b[0m - \u001b[1mObservatory magic requires no clock corrections.\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:59.900\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2270\u001b[0m - \u001b[34m\u001b[1mComputing TDB columns.\u001b[0m\n", + "\u001b[32m2024-08-30 13:43:59.901\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2291\u001b[0m - \u001b[34m\u001b[1mUsing EPHEM = DE421 for TDB calculation.\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:00.968\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2371\u001b[0m - \u001b[34m\u001b[1mComputing PosVels of observatories and Earth, using DE421\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:02.516\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-08-30 13:44:15.633\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2424\u001b[0m - \u001b[34m\u001b[1mSSB obs pos [1.47007462e+11 2.56889811e+10 1.11245045e+10] m\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.688\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-08-30 13:44:15.694\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2438\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 7.02 s, sys: 188 ms, total: 7.21 s\n", - "Wall time: 17.7 s\n" + "CPU times: user 7.15 s, sys: 199 ms, total: 7.35 s\n", + "Wall time: 20.8 s\n" ] } ], "source": [ "%%time\n", "\n", - "# Put these to True is your observatory has clock correction files.\n", + "# Set these to True is your observatory has clock correction files.\n", "# If it is set to True but your observatory does not have clock correction files, it will be ignored.\n", "include_bipm = False\n", "include_gps = False\n", @@ -648,19 +760,19 @@ "id": "db97ea5b", "metadata": {}, "source": [ - "Once we have the TOAs object and the model, the phases are easily computed using the model.phase() method. Note that the phases are computed in the interval [-0.5,0.5]. Most of the times, we use the phases in the interval [0,1] so we have to shift the negative ones." + "Once we have the TOAs object and the model, the phases are easily computed using the model.phase() method. Note that the phases are computed in the interval [-0.5,0.5]. Most of the time, we use the phases in the interval [0,1] so we have to shift the negative ones." ] }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 19, "id": "6fbf3ad9", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:44.599538Z", - "iopub.status.busy": "2024-03-27T11:26:44.599353Z", - "iopub.status.idle": "2024-03-27T11:26:45.194277Z", - "shell.execute_reply": "2024-03-27T11:26:45.193696Z" + "iopub.execute_input": "2024-08-30T13:44:15.699970Z", + "iopub.status.busy": "2024-08-30T13:44:15.699584Z", + "iopub.status.idle": "2024-08-30T13:44:15.924450Z", + "shell.execute_reply": "2024-08-30T13:44:15.924037Z" } }, "outputs": [ @@ -668,19 +780,19 @@ "name": "stderr", "output_type": "stream", "text": [ - "\u001b[32m2024-03-27 11:26:44.636\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-03-27 11:26:44.640\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-03-27 11:26:44.646\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m1358\u001b[0m - \u001b[34m\u001b[1mNo pulse number flags found in the TOAs\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.646\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mapply_clock_corrections\u001b[0m:\u001b[36m2200\u001b[0m - \u001b[34m\u001b[1mApplying clock corrections (include_gps = False, include_bipm = False)\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.648\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2251\u001b[0m - \u001b[34m\u001b[1mComputing TDB columns.\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.648\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2272\u001b[0m - \u001b[34m\u001b[1mUsing EPHEM = DE421 for TDB calculation.\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.651\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2350\u001b[0m - \u001b[34m\u001b[1mComputing PosVels of observatories and Earth, using DE421\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:44.929\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-03-27 11:26:44.931\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2403\u001b[0m - \u001b[34m\u001b[1mSSB obs pos [-1.49278181e+08 7.07659442e+06 3.07113250e+06] km\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:45.150\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-03-27 11:26:45.176\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2417\u001b[0m - \u001b[34m\u001b[1mAdding columns ssb_obs_pos ssb_obs_vel obs_sun_pos\u001b[0m\n", - "\u001b[32m2024-03-27 11:26:45.177\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-03-27 11:26:45.188\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-08-30 13:44:15.729\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.models.glitch\u001b[0m:\u001b[36mglitch_phase\u001b[0m:\u001b[36m221\u001b[0m - \u001b[34m\u001b[1mGlitch phase for glitch 1: 0.0 \u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.735\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.models.absolute_phase\u001b[0m:\u001b[36mget_TZR_toa\u001b[0m:\u001b[36m100\u001b[0m - \u001b[34m\u001b[1mCreating and dealing with the single TZR_toa for absolute phase\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.738\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m1377\u001b[0m - \u001b[34m\u001b[1mNo pulse number flags found in the TOAs\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.738\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mapply_clock_corrections\u001b[0m:\u001b[36m2224\u001b[0m - \u001b[34m\u001b[1mApplying clock corrections (include_bipm = False)\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.760\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2270\u001b[0m - \u001b[34m\u001b[1mComputing TDB columns.\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.761\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2291\u001b[0m - \u001b[34m\u001b[1mUsing EPHEM = DE421 for TDB calculation.\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.764\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2371\u001b[0m - \u001b[34m\u001b[1mComputing PosVels of observatories and Earth, using DE421\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.834\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-08-30 13:44:15.836\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2424\u001b[0m - \u001b[34m\u001b[1mSSB obs pos [-1.49278181e+08 7.07659442e+06 3.07113250e+06] km\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.907\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-08-30 13:44:15.908\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2438\u001b[0m - \u001b[34m\u001b[1mAdding columns ssb_obs_pos ssb_obs_vel obs_sun_pos\u001b[0m\n", + "\u001b[32m2024-08-30 13:44:15.909\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-08-30 13:44:15.916\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.models.glitch\u001b[0m:\u001b[36mglitch_phase\u001b[0m:\u001b[36m221\u001b[0m - \u001b[34m\u001b[1mGlitch phase for glitch 1: 0.0 \u001b[0m\n" ] } ], @@ -710,14 +822,14 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 20, "id": "735ac718", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.196779Z", - "iopub.status.busy": "2024-03-27T11:26:45.196431Z", - "iopub.status.idle": "2024-03-27T11:26:45.206792Z", - "shell.execute_reply": "2024-03-27T11:26:45.206263Z" + "iopub.execute_input": "2024-08-30T13:44:15.926698Z", + "iopub.status.busy": "2024-08-30T13:44:15.926261Z", + "iopub.status.idle": "2024-08-30T13:44:15.935066Z", + "shell.execute_reply": "2024-08-30T13:44:15.934677Z" } }, "outputs": [], @@ -728,65 +840,93 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 21, "id": "f3269a2c", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.209126Z", - "iopub.status.busy": "2024-03-27T11:26:45.208686Z", - "iopub.status.idle": "2024-03-27T11:26:45.212621Z", - "shell.execute_reply": "2024-03-27T11:26:45.212125Z" - }, - "scrolled": false + "iopub.execute_input": "2024-08-30T13:44:15.936748Z", + "iopub.status.busy": "2024-08-30T13:44:15.936604Z", + "iopub.status.idle": "2024-08-30T13:44:15.942656Z", + "shell.execute_reply": "2024-08-30T13:44:15.942183Z" + } }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "EVENT_ID TIME RA DEC ENERGY \n", - " s deg deg TeV \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", - " 2561 333778853.0339344 84.84237 22.175398 0.118843034\n", - " ... ... ... ... ...\n", - " 356222 333780039.4520397 84.74482 20.894981 0.043312162\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", - "Length = 11189 rows\n" - ] + "data": { + "text/html": [ + "
Table length=11189\n", + "
\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
EVENT_IDTIMERADECENERGY
sdegdegTeV
int64float64float32float32float32
2402333778852.509924984.5945722.030880.18194601
2408333778852.526715384.2146223.449140.08397394
2434333778852.6131505483.52470422.7257920.10596932
2445333778852.669014283.7695722.4510060.19733498
2478333778852.762793983.47851623.4845940.08522219
2481333778852.777854983.7151721.9851151.0020943
2513333778852.864446782.42119622.5676520.14374068
2544333778852.982606483.6413622.0413150.10316629
2559333778853.026941484.06917622.973370.047184493
...............
356223333780039.460049284.1161522.5575050.08110082
356227333780039.4710536683.4153421.673440.2096362
356242333780039.517909583.5516522.7729850.17672835
356282333780039.6299751484.4613321.693570.05068718
356473333780040.338647984.4544121.1598280.1831569
356478333780040.354892683.6833623.4449880.06305169
356485333780040.374132284.3351721.283380.060539745
356486333780040.375515984.8588622.1162220.123453744
356526333780040.5247600784.8692921.2909160.13630114
" + ], + "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": 21, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ "# Show original table\n", - "print(table)" + "table" ] }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 22, "id": "6fc6024c", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.214559Z", - "iopub.status.busy": "2024-03-27T11:26:45.214389Z", - "iopub.status.idle": "2024-03-27T11:26:45.216994Z", - "shell.execute_reply": "2024-03-27T11:26:45.216564Z" + "iopub.execute_input": "2024-08-30T13:44:15.944440Z", + "iopub.status.busy": "2024-08-30T13:44:15.944274Z", + "iopub.status.idle": "2024-08-30T13:44:15.946972Z", + "shell.execute_reply": "2024-08-30T13:44:15.946502Z" } }, "outputs": [], @@ -805,46 +945,44 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 23, "id": "7f29187e", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.219230Z", - "iopub.status.busy": "2024-03-27T11:26:45.218856Z", - "iopub.status.idle": "2024-03-27T11:26:45.225134Z", - "shell.execute_reply": "2024-03-27T11:26:45.224604Z" - }, - "scrolled": false + "iopub.execute_input": "2024-08-30T13:44:15.948805Z", + "iopub.status.busy": "2024-08-30T13:44:15.948513Z", + "iopub.status.idle": "2024-08-30T13:44:15.952984Z", + "shell.execute_reply": "2024-08-30T13:44:15.952497Z" + } }, "outputs": [ { "data": { "text/html": [ "
Table length=11189\n", - "
\n", + "
\n", "\n", "\n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", "
EVENT_IDTIMERADECENERGYPHASE
sdegdegTeV
int64float64float32float32float32float64
2402333778852.509924984.5945722.030880.181946010.39349195931383935
2408333778852.526715384.2146223.449140.083973940.8919526790064667
2434333778852.6131505483.52470422.7257920.105969320.4579789031294724
2445333778852.669014283.7695722.4510060.197334980.11641860219368935
2478333778852.762793983.47851623.4845940.085222190.9004806857711186
2481333778852.777854983.7151721.9851151.00209430.3476011689926769
2513333778852.864446782.42119622.5676520.143740680.9182740999289545
2544333778852.982606483.6413622.0413150.103166290.42611249421537956
2559333778853.026941484.06917622.973370.0471844930.7422975122115125
2402333778852.509924984.5945722.030880.181946010.3934918682770723
2408333778852.526715384.2146223.449140.083973940.8919525879696997
2434333778852.6131505483.52470422.7257920.105969320.45797881185987477
2445333778852.669014283.7695722.4510060.197334980.11641851092409164
2478333778852.762793983.47851623.4845940.085222190.900480594501521
2481333778852.777854983.7151721.9851151.00209430.34760107795590983
2513333778852.864446782.42119622.5676520.143740680.9182740088921875
2544333778852.982606483.6413622.0413150.103166290.42611240294578184
2559333778853.026941484.06917622.973370.0471844930.7422974209419148
..................
356222333780039.452039784.7448220.8949810.0433121620.4537121484157113
356223333780039.460049284.1161522.5575050.081100820.6914920486374702
356227333780039.4710536683.4153421.673440.20963620.018183944316962984
356242333780039.517909583.5516522.7729850.176728350.40920620046641115
356282333780039.6299751484.4613321.693570.050687180.7361270955486778
356473333780040.338647984.4544121.1598280.18315690.7746789518818565
356478333780040.354892683.6833623.4449880.063051690.2569398572226654
356485333780040.374132284.3351721.283380.0605397450.8281109722104576
356486333780040.375515984.8588622.1162220.1234537440.8691881135544401
356526333780040.5247600784.8692921.2909160.136301140.29983901925054285
356223333780039.460049284.1161522.5575050.081100820.6914919573678725
356227333780039.4710536683.4153421.673440.20963620.018183853280195963
356242333780039.517909583.5516522.7729850.176728350.4092061182772071
356282333780039.6299751484.4613321.693570.050687180.7361270045119108
356473333780040.338647984.4544121.1598280.18315690.7746788606122589
356478333780040.354892683.6833623.4449880.063051690.25693976618589837
356485333780040.374132284.3351721.283380.0605397450.8281108809408599
356486333780040.375515984.8588622.1162220.1234537440.8691880225176731
356526333780040.5247600784.8692921.2909160.136301140.29983892821377583
" ], "text/plain": [ @@ -853,29 +991,28 @@ " 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", + " 2402 333778852.5099249 84.59457 22.03088 0.18194601 0.3934918682770723\n", + " 2408 333778852.5267153 84.21462 23.44914 0.08397394 0.8919525879696997\n", + " 2434 333778852.61315054 83.524704 22.725792 0.10596932 0.45797881185987477\n", + " 2445 333778852.6690142 83.76957 22.451006 0.19733498 0.11641851092409164\n", + " 2478 333778852.7627939 83.478516 23.484594 0.08522219 0.900480594501521\n", + " 2481 333778852.7778549 83.71517 21.985115 1.0020943 0.34760107795590983\n", + " 2513 333778852.8644467 82.421196 22.567652 0.14374068 0.9182740088921875\n", + " 2544 333778852.9826064 83.64136 22.041315 0.10316629 0.42611240294578184\n", + " 2559 333778853.0269414 84.069176 22.97337 0.047184493 0.7422974209419148\n", " ... ... ... ... ... ...\n", - " 356222 333780039.4520397 84.74482 20.894981 0.043312162 0.4537121484157113\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" + " 356223 333780039.4600492 84.11615 22.557505 0.08110082 0.6914919573678725\n", + " 356227 333780039.47105366 83.41534 21.67344 0.2096362 0.018183853280195963\n", + " 356242 333780039.5179095 83.55165 22.772985 0.17672835 0.4092061182772071\n", + " 356282 333780039.62997514 84.46133 21.69357 0.05068718 0.7361270045119108\n", + " 356473 333780040.3386479 84.45441 21.159828 0.1831569 0.7746788606122589\n", + " 356478 333780040.3548926 83.68336 23.444988 0.06305169 0.25693976618589837\n", + " 356485 333780040.3741322 84.33517 21.28338 0.060539745 0.8281108809408599\n", + " 356486 333780040.3755159 84.85886 22.116222 0.123453744 0.8691880225176731\n", + " 356526 333780040.52476007 84.86929 21.290916 0.13630114 0.29983892821377583" ] }, - "execution_count": 20, + "execution_count": 23, "metadata": {}, "output_type": "execute_result" } @@ -898,23 +1035,22 @@ "id": "ea9ba223", "metadata": {}, "source": [ - "At this point, we also want to add meta data to the table. It is very useful to keep track of what has been done to the file. For instance, if we have multiple pulsars in the same file, we want to be able to know quickly which column correspond to which pulsar. Moreover, experience shows that one often use different ephemeris file for the same pulsar. Therefore, it is very useful to have several phase columns in the same file and to be able to know which column correspond to which ephemeris file, parameters, etc.\n", + "At this point, we also want to add metadata to the table. It is very useful to keep track of what has been done to the file. For instance, if a file contains multiple pulsars, we want identify quickly which column corresponds to each pulsar. Moreover, experience has shown that it is common to have different ephemeris files for the same pulsar. Therefore, it is useful to have several phase columns in the same file to easily identify which column corresponds to each ephemeris file, parameters, etc.\n", "\n", - "Since there is not yet a \"standard\" format for such metadata, we propose a template for the essential informations that one wants to save in the header of the event file. First, we look at the present meta info on the table." + "Since there is currently no \"standard\" format for such metadata, we propose a template for the essential information that one wants to save in the header of the event file. First, we look at the present meta info on the table." ] }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 24, "id": "af220557", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.227594Z", - "iopub.status.busy": "2024-03-27T11:26:45.227257Z", - "iopub.status.idle": "2024-03-27T11:26:45.231629Z", - "shell.execute_reply": "2024-03-27T11:26:45.231108Z" - }, - "scrolled": false + "iopub.execute_input": "2024-08-30T13:44:15.955025Z", + "iopub.status.busy": "2024-08-30T13:44:15.954655Z", + "iopub.status.idle": "2024-08-30T13:44:15.958777Z", + "shell.execute_reply": "2024-08-30T13:44:15.958278Z" + } }, "outputs": [ { @@ -957,7 +1093,7 @@ " ('AZ_PNT', 103.8848)])" ] }, - "execution_count": 21, + "execution_count": 24, "metadata": {}, "output_type": "execute_result" } @@ -968,14 +1104,14 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 25, "id": "c2285fcd", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.233745Z", - "iopub.status.busy": "2024-03-27T11:26:45.233423Z", - "iopub.status.idle": "2024-03-27T11:26:45.237873Z", - "shell.execute_reply": "2024-03-27T11:26:45.237324Z" + "iopub.execute_input": "2024-08-30T13:44:15.960712Z", + "iopub.status.busy": "2024-08-30T13:44:15.960430Z", + "iopub.status.idle": "2024-08-30T13:44:15.964154Z", + "shell.execute_reply": "2024-08-30T13:44:15.963725Z" } }, "outputs": [], @@ -1018,14 +1154,14 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 26, "id": "8c866a5c", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.240180Z", - "iopub.status.busy": "2024-03-27T11:26:45.239749Z", - "iopub.status.idle": "2024-03-27T11:26:45.243507Z", - "shell.execute_reply": "2024-03-27T11:26:45.242970Z" + "iopub.execute_input": "2024-08-30T13:44:15.966078Z", + "iopub.status.busy": "2024-08-30T13:44:15.965699Z", + "iopub.status.idle": "2024-08-30T13:44:15.968960Z", + "shell.execute_reply": "2024-08-30T13:44:15.968447Z" } }, "outputs": [ @@ -1033,7 +1169,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "COLUMN_PHASE: PHASE; PINT_VERS: 0.9.8; GAMMAPY_VERS: 1.0.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: 60396.4769125122;\n" + "COLUMN_PHASE: PHASE; PINT_VERS: 1.0.1; 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: 60552.572407022526;\n" ] } ], @@ -1044,14 +1180,14 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 27, "id": "5a3e56d2", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.245447Z", - "iopub.status.busy": "2024-03-27T11:26:45.245279Z", - "iopub.status.idle": "2024-03-27T11:26:45.247890Z", - "shell.execute_reply": "2024-03-27T11:26:45.247345Z" + "iopub.execute_input": "2024-08-30T13:44:15.971018Z", + "iopub.status.busy": "2024-08-30T13:44:15.970621Z", + "iopub.status.idle": "2024-08-30T13:44:15.973109Z", + "shell.execute_reply": "2024-08-30T13:44:15.972658Z" } }, "outputs": [], @@ -1062,14 +1198,14 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 28, "id": "f6b44e25", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.250137Z", - "iopub.status.busy": "2024-03-27T11:26:45.249693Z", - "iopub.status.idle": "2024-03-27T11:26:45.254108Z", - "shell.execute_reply": "2024-03-27T11:26:45.253667Z" + "iopub.execute_input": "2024-08-30T13:44:15.974924Z", + "iopub.status.busy": "2024-08-30T13:44:15.974603Z", + "iopub.status.idle": "2024-08-30T13:44:15.978533Z", + "shell.execute_reply": "2024-08-30T13:44:15.978032Z" } }, "outputs": [ @@ -1112,10 +1248,10 @@ " ('ALT_PNT', 69.69974),\n", " ('AZ_PNT', 103.8848),\n", " ('PH_LOG',\n", - " 'COLUMN_PHASE: PHASE; PINT_VERS: 0.9.8; GAMMAPY_VERS: 1.0.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: 60396.4769125122;')])" + " 'COLUMN_PHASE: PHASE; PINT_VERS: 1.0.1; 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: 60552.572407022526;')])" ] }, - "execution_count": 25, + "execution_count": 28, "metadata": {}, "output_type": "execute_result" } @@ -1134,14 +1270,14 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 29, "id": "12545bff", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.256140Z", - "iopub.status.busy": "2024-03-27T11:26:45.255965Z", - "iopub.status.idle": "2024-03-27T11:26:45.306335Z", - "shell.execute_reply": "2024-03-27T11:26:45.305804Z" + "iopub.execute_input": "2024-08-30T13:44:15.980471Z", + "iopub.status.busy": "2024-08-30T13:44:15.980173Z", + "iopub.status.idle": "2024-08-30T13:44:16.013868Z", + "shell.execute_reply": "2024-08-30T13:44:16.013376Z" } }, "outputs": [ @@ -1149,7 +1285,6 @@ "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", "'THETA' axis is stored as a scalar -- converting to 1D array.\n" @@ -1164,14 +1299,14 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 30, "id": "1ac16c51", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.308633Z", - "iopub.status.busy": "2024-03-27T11:26:45.308216Z", - "iopub.status.idle": "2024-03-27T11:26:45.313310Z", - "shell.execute_reply": "2024-03-27T11:26:45.312737Z" + "iopub.execute_input": "2024-08-30T13:44:16.015882Z", + "iopub.status.busy": "2024-08-30T13:44:16.015596Z", + "iopub.status.idle": "2024-08-30T13:44:16.020193Z", + "shell.execute_reply": "2024-08-30T13:44:16.019715Z" } }, "outputs": [ @@ -1179,30 +1314,29 @@ "data": { "text/html": [ "
Table length=11189\n", - "\n", + "
\n", "\n", "\n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", "
EVENT_IDTIMERADECENERGYPHASE
sdegdegTeV
int64float64float32float32float32float64
2402333778852.509924984.5945722.030880.181946010.39349195931383935
2408333778852.526715384.2146223.449140.083973940.8919526790064667
2434333778852.6131505483.52470422.7257920.105969320.4579789031294724
2445333778852.669014283.7695722.4510060.197334980.11641860219368935
2478333778852.762793983.47851623.4845940.085222190.9004806857711186
2481333778852.777854983.7151721.9851151.00209430.3476011689926769
2513333778852.864446782.42119622.5676520.143740680.9182740999289545
2544333778852.982606483.6413622.0413150.103166290.42611249421537956
2559333778853.026941484.06917622.973370.0471844930.7422975122115125
2402333778852.509924984.5945722.030880.181946010.3934918682770723
2408333778852.526715384.2146223.449140.083973940.8919525879696997
2434333778852.6131505483.52470422.7257920.105969320.45797881185987477
2445333778852.669014283.7695722.4510060.197334980.11641851092409164
2478333778852.762793983.47851623.4845940.085222190.900480594501521
2481333778852.777854983.7151721.9851151.00209430.34760107795590983
2513333778852.864446782.42119622.5676520.143740680.9182740088921875
2544333778852.982606483.6413622.0413150.103166290.42611240294578184
2559333778853.026941484.06917622.973370.0471844930.7422974209419148
..................
356222333780039.452039784.7448220.8949810.0433121620.4537121484157113
356223333780039.460049284.1161522.5575050.081100820.6914920486374702
356227333780039.4710536683.4153421.673440.20963620.018183944316962984
356242333780039.517909583.5516522.7729850.176728350.40920620046641115
356282333780039.6299751484.4613321.693570.050687180.7361270955486778
356473333780040.338647984.4544121.1598280.18315690.7746789518818565
356478333780040.354892683.6833623.4449880.063051690.2569398572226654
356485333780040.374132284.3351721.283380.0605397450.8281109722104576
356486333780040.375515984.8588622.1162220.1234537440.8691881135544401
356526333780040.5247600784.8692921.2909160.136301140.29983901925054285
356223333780039.460049284.1161522.5575050.081100820.6914919573678725
356227333780039.4710536683.4153421.673440.20963620.018183853280195963
356242333780039.517909583.5516522.7729850.176728350.4092061182772071
356282333780039.6299751484.4613321.693570.050687180.7361270045119108
356473333780040.338647984.4544121.1598280.18315690.7746788606122589
356478333780040.354892683.6833623.4449880.063051690.25693976618589837
356485333780040.374132284.3351721.283380.0605397450.8281108809408599
356486333780040.375515984.8588622.1162220.1234537440.8691880225176731
356526333780040.5247600784.8692921.2909160.136301140.29983892821377583
" ], "text/plain": [ @@ -1211,29 +1345,28 @@ " 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", + " 2402 333778852.5099249 84.59457 22.03088 0.18194601 0.3934918682770723\n", + " 2408 333778852.5267153 84.21462 23.44914 0.08397394 0.8919525879696997\n", + " 2434 333778852.61315054 83.524704 22.725792 0.10596932 0.45797881185987477\n", + " 2445 333778852.6690142 83.76957 22.451006 0.19733498 0.11641851092409164\n", + " 2478 333778852.7627939 83.478516 23.484594 0.08522219 0.900480594501521\n", + " 2481 333778852.7778549 83.71517 21.985115 1.0020943 0.34760107795590983\n", + " 2513 333778852.8644467 82.421196 22.567652 0.14374068 0.9182740088921875\n", + " 2544 333778852.9826064 83.64136 22.041315 0.10316629 0.42611240294578184\n", + " 2559 333778853.0269414 84.069176 22.97337 0.047184493 0.7422974209419148\n", " ... ... ... ... ... ...\n", - " 356222 333780039.4520397 84.74482 20.894981 0.043312162 0.4537121484157113\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" + " 356223 333780039.4600492 84.11615 22.557505 0.08110082 0.6914919573678725\n", + " 356227 333780039.47105366 83.41534 21.67344 0.2096362 0.018183853280195963\n", + " 356242 333780039.5179095 83.55165 22.772985 0.17672835 0.4092061182772071\n", + " 356282 333780039.62997514 84.46133 21.69357 0.05068718 0.7361270045119108\n", + " 356473 333780040.3386479 84.45441 21.159828 0.1831569 0.7746788606122589\n", + " 356478 333780040.3548926 83.68336 23.444988 0.06305169 0.25693976618589837\n", + " 356485 333780040.3741322 84.33517 21.28338 0.060539745 0.8281108809408599\n", + " 356486 333780040.3755159 84.85886 22.116222 0.123453744 0.8691880225176731\n", + " 356526 333780040.52476007 84.86929 21.290916 0.13630114 0.29983892821377583" ] }, - "execution_count": 27, + "execution_count": 30, "metadata": {}, "output_type": "execute_result" } @@ -1255,31 +1388,31 @@ "id": "e369d2dc", "metadata": {}, "source": [ - "In the following, we show how to write the files in a directory contained in the original datastore directory. This follows the logic of DL3 data store and facilitate the manipulation of the HDU table.\n", + "In the following, we show how to write the files in a directory contained in the original datastore directory. This follows the logic of DL3 data store and facilitates the manipulation of the HDU table.\n", "\n", - "If one does not want to save the events files and directly perform the pulsar analysis, this step is not required as well as the step of the meta data handling. However, be aware that for large dataset, the computation of phases can take tens of minutes. " + "If you do not want to save the events files bur rather directly perform the pulsar analysis, you can skip both this step and the step of the handling metadata. However, be aware that for large datasets, the computation of the phases can take tens of minutes." ] }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 31, "id": "f3c8410c", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.315528Z", - "iopub.status.busy": "2024-03-27T11:26:45.315188Z", - "iopub.status.idle": "2024-03-27T11:26:45.318777Z", - "shell.execute_reply": "2024-03-27T11:26:45.318308Z" + "iopub.execute_input": "2024-08-30T13:44:16.022167Z", + "iopub.status.busy": "2024-08-30T13:44:16.021883Z", + "iopub.status.idle": "2024-08-30T13:44:16.025164Z", + "shell.execute_reply": "2024-08-30T13:44:16.024650Z" } }, "outputs": [ { "data": { "text/plain": [ - "PosixPath('/home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.0.2/magic/rad_max/data')" + "PosixPath('/home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.2/magic/rad_max/data')" ] }, - "execution_count": 28, + "execution_count": 31, "metadata": {}, "output_type": "execute_result" } @@ -1290,14 +1423,14 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 32, "id": "8fd2ce31", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.320738Z", - "iopub.status.busy": "2024-03-27T11:26:45.320560Z", - "iopub.status.idle": "2024-03-27T11:26:45.323746Z", - "shell.execute_reply": "2024-03-27T11:26:45.323305Z" + "iopub.execute_input": "2024-08-30T13:44:16.027018Z", + "iopub.status.busy": "2024-08-30T13:44:16.026717Z", + "iopub.status.idle": "2024-08-30T13:44:16.029663Z", + "shell.execute_reply": "2024-08-30T13:44:16.029226Z" } }, "outputs": [], @@ -1314,24 +1447,24 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 33, "id": "e6e38fc1", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.325950Z", - "iopub.status.busy": "2024-03-27T11:26:45.325616Z", - "iopub.status.idle": "2024-03-27T11:26:45.329021Z", - "shell.execute_reply": "2024-03-27T11:26:45.328467Z" + "iopub.execute_input": "2024-08-30T13:44:16.031501Z", + "iopub.status.busy": "2024-08-30T13:44:16.031183Z", + "iopub.status.idle": "2024-08-30T13:44:16.034289Z", + "shell.execute_reply": "2024-08-30T13:44:16.033820Z" } }, "outputs": [ { "data": { "text/plain": [ - "'/home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.0.2/magic/rad_max/data/pulsar_events_file/'" + "'/home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.2/magic/rad_max/data/pulsar_events_file/'" ] }, - "execution_count": 30, + "execution_count": 33, "metadata": {}, "output_type": "execute_result" } @@ -1342,32 +1475,29 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 34, "id": "f339c797", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.331194Z", - "iopub.status.busy": "2024-03-27T11:26:45.330781Z", - "iopub.status.idle": "2024-03-27T11:26:45.489597Z", - "shell.execute_reply": "2024-03-27T11:26:45.488969Z" - }, - "scrolled": true + "iopub.execute_input": "2024-08-30T13:44:16.036030Z", + "iopub.status.busy": "2024-08-30T13:44:16.035881Z", + "iopub.status.idle": "2024-08-30T13:44:16.168565Z", + "shell.execute_reply": "2024-08-30T13:44:16.168088Z" + } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Writing outputfile in /home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.0.2/magic/rad_max/data/pulsar_events_file/dl3_pulsar_5029747.fits.gz\n" + "Writing output file in /home/runner/work/gammapy-recipes/gammapy-recipes/gammapy-datasets/1.2/magic/rad_max/data/pulsar_events_file/dl3_pulsar_5029747.fits.gz\n" ] } ], "source": [ "# Save the observation object in the specified file_path\n", - "print(\"Writing outputfile in \" + str(file_path))\n", - "observation.events.write(\n", - " filename=file_path, gti=observation.gti, overwrite=True\n", - ")" + "print(\"Writing output file in \" + str(file_path))\n", + "new_obs.write(path=file_path, include_irfs=False, overwrite=True)" ] }, { @@ -1380,14 +1510,14 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 35, "id": "4b8dd431", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.492294Z", - "iopub.status.busy": "2024-03-27T11:26:45.491941Z", - "iopub.status.idle": "2024-03-27T11:26:45.497464Z", - "shell.execute_reply": "2024-03-27T11:26:45.496931Z" + "iopub.execute_input": "2024-08-30T13:44:16.170679Z", + "iopub.status.busy": "2024-08-30T13:44:16.170369Z", + "iopub.status.idle": "2024-08-30T13:44:16.175339Z", + "shell.execute_reply": "2024-08-30T13:44:16.174869Z" } }, "outputs": [ @@ -1395,7 +1525,7 @@ "data": { "text/html": [ "
HDUIndexTable length=10\n", - "\n", + "
\n", "\n", "\n", "\n", @@ -1427,7 +1557,7 @@ "5029747 edisp ... ENERGY DISPERSION" ] }, - "execution_count": 32, + "execution_count": 35, "metadata": {}, "output_type": "execute_result" } @@ -1440,34 +1570,36 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 36, "id": "6f37e101", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.499587Z", - "iopub.status.busy": "2024-03-27T11:26:45.499179Z", - "iopub.status.idle": "2024-03-27T11:26:45.502364Z", - "shell.execute_reply": "2024-03-27T11:26:45.501887Z" + "iopub.execute_input": "2024-08-30T13:44:16.177243Z", + "iopub.status.busy": "2024-08-30T13:44:16.176916Z", + "iopub.status.idle": "2024-08-30T13:44:16.179856Z", + "shell.execute_reply": "2024-08-30T13:44:16.179447Z" } }, "outputs": [], "source": [ "for entry in new_hdu:\n", - " if entry[\"HDU_NAME\"] == \"EVENTS\" and entry[\"OBS_ID\"] == observation.obs_id:\n", + " if (entry[\"HDU_NAME\"] == \"EVENTS\") and (\n", + " entry[\"OBS_ID\"] == observation.obs_id\n", + " ):\n", " entry[\"FILE_DIR\"] = \"./\" + str(output_directory)\n", " entry[\"FILE_NAME\"] = filename" ] }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 37, "id": "d89a7739", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.504469Z", - "iopub.status.busy": "2024-03-27T11:26:45.504078Z", - "iopub.status.idle": "2024-03-27T11:26:45.508565Z", - "shell.execute_reply": "2024-03-27T11:26:45.507988Z" + "iopub.execute_input": "2024-08-30T13:44:16.181702Z", + "iopub.status.busy": "2024-08-30T13:44:16.181410Z", + "iopub.status.idle": "2024-08-30T13:44:16.185572Z", + "shell.execute_reply": "2024-08-30T13:44:16.185152Z" } }, "outputs": [ @@ -1475,7 +1607,7 @@ "data": { "text/html": [ "
HDUIndexTable length=10\n", - "
OBS_IDHDU_TYPEHDU_CLASSFILE_DIRFILE_NAMEHDU_NAME
int64bytes30bytes30bytes100bytes50bytes30
5029748eventsevents./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsEVENTS
\n", + "
\n", "\n", "\n", "\n", @@ -1507,7 +1639,7 @@ "5029747 edisp ... ENERGY DISPERSION" ] }, - "execution_count": 34, + "execution_count": 37, "metadata": {}, "output_type": "execute_result" } @@ -1529,19 +1661,19 @@ "id": "e08bf493", "metadata": {}, "source": [ - "Finally, we need to save the new HDU table in the origianl DL3 directory. Here one should be very careful to not name the new HDU file with the same name as the original HDU file of the data store. Otherwise, the original HDU file will be overwrited. " + "Finally, we need to save the new HDU table in the original DL3 directory. One must be very careful with naming the new HDU file, such that it does not have the same name as the original HDU file of the data store. Otherwise, the original HDU file will be overwritten." ] }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 38, "id": "b1633cd5", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.510689Z", - "iopub.status.busy": "2024-03-27T11:26:45.510412Z", - "iopub.status.idle": "2024-03-27T11:26:45.521520Z", - "shell.execute_reply": "2024-03-27T11:26:45.520994Z" + "iopub.execute_input": "2024-08-30T13:44:16.187343Z", + "iopub.status.busy": "2024-08-30T13:44:16.187186Z", + "iopub.status.idle": "2024-08-30T13:44:16.197275Z", + "shell.execute_reply": "2024-08-30T13:44:16.196738Z" } }, "outputs": [], @@ -1556,7 +1688,7 @@ "id": "e92cf68c", "metadata": {}, "source": [ - "**Note: Here we use only one approach that could be useful, showing the steps to save the new Event files in a random directory and generate a new modified HDU index table. However, the user is free to chose the absolute path of the EventList and DataStore. For instance, another approach could be making a full copy of the DataStore, or changing the location of the pulsar event files to one that could be more convinient for the user.**" + "**Note: Here we demonstrate only one approach that could be useful, showing the steps to save the new Event files in a directory and generate a new modified HDU index table. However, the user is free to choose the absolute path of the EventList and DataStore. Another approach, for instance, could be making a full copy of the DataStore, or changing the location of the pulsar event files to one that is more convenient for the user.**" ] }, { @@ -1572,38 +1704,38 @@ "id": "e1036448", "metadata": {}, "source": [ - "Once all of this is done, we just have to open the data store using `DataStore.from_dir()`and passing the pulsar HDU table to it :" + "Once all of this is done, we just have to open the data store using DataStore.from_dir() and pass the pulsar HDU table to it :" ] }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 39, "id": "88a0e9c1", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.523852Z", - "iopub.status.busy": "2024-03-27T11:26:45.523517Z", - "iopub.status.idle": "2024-03-27T11:26:45.537115Z", - "shell.execute_reply": "2024-03-27T11:26:45.536595Z" + "iopub.execute_input": "2024-08-30T13:44:16.199418Z", + "iopub.status.busy": "2024-08-30T13:44:16.199114Z", + "iopub.status.idle": "2024-08-30T13:44:16.210872Z", + "shell.execute_reply": "2024-08-30T13:44:16.210389Z" } }, "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": 37, + "execution_count": 40, "id": "f7c60c18", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.539197Z", - "iopub.status.busy": "2024-03-27T11:26:45.538882Z", - "iopub.status.idle": "2024-03-27T11:26:45.543864Z", - "shell.execute_reply": "2024-03-27T11:26:45.543346Z" + "iopub.execute_input": "2024-08-30T13:44:16.213029Z", + "iopub.status.busy": "2024-08-30T13:44:16.212605Z", + "iopub.status.idle": "2024-08-30T13:44:16.217590Z", + "shell.execute_reply": "2024-08-30T13:44:16.217079Z" } }, "outputs": [ @@ -1613,7 +1745,7 @@ "['events', 'gti', 'aeff', 'edisp', 'rad_max']" ] }, - "execution_count": 37, + "execution_count": 40, "metadata": {}, "output_type": "execute_result" } @@ -1627,14 +1759,14 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 41, "id": "4ae8ebd2", "metadata": { "execution": { - "iopub.execute_input": "2024-03-27T11:26:45.545837Z", - "iopub.status.busy": "2024-03-27T11:26:45.545678Z", - "iopub.status.idle": "2024-03-27T11:26:45.559836Z", - "shell.execute_reply": "2024-03-27T11:26:45.559308Z" + "iopub.execute_input": "2024-08-30T13:44:16.219467Z", + "iopub.status.busy": "2024-08-30T13:44:16.219161Z", + "iopub.status.idle": "2024-08-30T13:44:16.233657Z", + "shell.execute_reply": "2024-08-30T13:44:16.233153Z" } }, "outputs": [ @@ -1642,61 +1774,59 @@ "data": { "text/html": [ "
Table length=11189\n", - "
OBS_IDHDU_TYPEHDU_CLASSFILE_DIRFILE_NAMEHDU_NAME
int64bytes30bytes30bytes100bytes50bytes30
5029748eventsevents./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsEVENTS
\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "
EVENT_IDTIMERADECENERGY
sdegdegTeV
int64float64float32float32float32
2402333778852.509924984.5945722.030880.18194601
2408333778852.526715384.2146223.449140.08397394
2434333778852.6131505483.52470422.7257920.10596932
2445333778852.669014283.7695722.4510060.19733498
2478333778852.762793983.47851623.4845940.08522219
2481333778852.777854983.7151721.9851151.0020943
2513333778852.864446782.42119622.5676520.14374068
2544333778852.982606483.6413622.0413150.10316629
2559333778853.026941484.06917622.973370.047184493
...............
356222333780039.452039784.7448220.8949810.043312162
356223333780039.460049284.1161522.5575050.08110082
356227333780039.4710536683.4153421.673440.2096362
356242333780039.517909583.5516522.7729850.17672835
356282333780039.6299751484.4613321.693570.05068718
356473333780040.338647984.4544121.1598280.1831569
356478333780040.354892683.6833623.4449880.06305169
356485333780040.374132284.3351721.283380.060539745
356486333780040.375515984.8588622.1162220.123453744
356526333780040.5247600784.8692921.2909160.13630114
\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", "
EVENT_IDTIMERADECENERGYPHASE
sdegdegTeV
int64float64float32float32float32float64
2402333778852.509924984.5945722.030880.181946010.3934918682770723
2408333778852.526715384.2146223.449140.083973940.8919525879696997
2434333778852.6131505483.52470422.7257920.105969320.45797881185987477
2445333778852.669014283.7695722.4510060.197334980.11641851092409164
2478333778852.762793983.47851623.4845940.085222190.900480594501521
2481333778852.777854983.7151721.9851151.00209430.34760107795590983
2513333778852.864446782.42119622.5676520.143740680.9182740088921875
2544333778852.982606483.6413622.0413150.103166290.42611240294578184
2559333778853.026941484.06917622.973370.0471844930.7422974209419148
..................
356223333780039.460049284.1161522.5575050.081100820.6914919573678725
356227333780039.4710536683.4153421.673440.20963620.018183853280195963
356242333780039.517909583.5516522.7729850.176728350.4092061182772071
356282333780039.6299751484.4613321.693570.050687180.7361270045119108
356473333780040.338647984.4544121.1598280.18315690.7746788606122589
356478333780040.354892683.6833623.4449880.063051690.25693976618589837
356485333780040.374132284.3351721.283380.0605397450.8281108809408599
356486333780040.375515984.8588622.1162220.1234537440.8691880225176731
356526333780040.5247600784.8692921.2909160.136301140.29983892821377583
" ], "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", - " 356222 333780039.4520397 84.74482 20.894981 0.043312162\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" + "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.3934918682770723\n", + " 2408 333778852.5267153 84.21462 23.44914 0.08397394 0.8919525879696997\n", + " 2434 333778852.61315054 83.524704 22.725792 0.10596932 0.45797881185987477\n", + " 2445 333778852.6690142 83.76957 22.451006 0.19733498 0.11641851092409164\n", + " 2478 333778852.7627939 83.478516 23.484594 0.08522219 0.900480594501521\n", + " 2481 333778852.7778549 83.71517 21.985115 1.0020943 0.34760107795590983\n", + " 2513 333778852.8644467 82.421196 22.567652 0.14374068 0.9182740088921875\n", + " 2544 333778852.9826064 83.64136 22.041315 0.10316629 0.42611240294578184\n", + " 2559 333778853.0269414 84.069176 22.97337 0.047184493 0.7422974209419148\n", + " ... ... ... ... ... ...\n", + " 356223 333780039.4600492 84.11615 22.557505 0.08110082 0.6914919573678725\n", + " 356227 333780039.47105366 83.41534 21.67344 0.2096362 0.018183853280195963\n", + " 356242 333780039.5179095 83.55165 22.772985 0.17672835 0.4092061182772071\n", + " 356282 333780039.62997514 84.46133 21.69357 0.05068718 0.7361270045119108\n", + " 356473 333780040.3386479 84.45441 21.159828 0.1831569 0.7746788606122589\n", + " 356478 333780040.3548926 83.68336 23.444988 0.06305169 0.25693976618589837\n", + " 356485 333780040.3741322 84.33517 21.28338 0.060539745 0.8281108809408599\n", + " 356486 333780040.3755159 84.85886 22.116222 0.123453744 0.8691880225176731\n", + " 356526 333780040.52476007 84.86929 21.290916 0.13630114 0.29983892821377583" ] }, - "execution_count": 38, + "execution_count": 41, "metadata": {}, "output_type": "execute_result" } @@ -1726,7 +1856,7 @@ "id": "1fe89d60", "metadata": {}, "source": [ - "Once we have the corret DataStore and the modified EventList with the phase information, we can do the pulsar analysis using different tools for Gammapy to compute the phaseogram, maps, SED, lightcurve, etc... To do so, one can check the following [Gammapy tutorial](https://docs.gammapy.org/1.0/tutorials/analysis-time/pulsar_analysis.html#sphx-glr-tutorials-analysis-time-pulsar-analysis-py)." + "Once we have the correct DataStore and the modified EventList with the phase information, we can perform the pulsar analysis using different tools available in Gammapy. Allowing us to compute the phaseogram, maps, SED, lightcurve and more. To do so, please refer to the following [Gammapy tutorial](https://docs.gammapy.org/1.0/tutorials/analysis-time/pulsar_analysis.html#sphx-glr-tutorials-analysis-time-pulsar-analysis-py)." ] }, { @@ -1755,7 +1885,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.19" + "version": "3.11.9" }, "nbsphinx": { "orphan": true diff --git a/recipes/pulsar_phase/pulsar_phase_computation.ipynb b/recipes/pulsar_phase/pulsar_phase_computation.ipynb index 1e0d2f2..e49da4e 100644 --- a/recipes/pulsar_phase/pulsar_phase_computation.ipynb +++ b/recipes/pulsar_phase/pulsar_phase_computation.ipynb @@ -175,9 +175,7 @@ "metadata": {}, "outputs": [], "source": [ - "target_pos = SkyCoord(\n", - " ra=083.633, dec=+22.014, unit=\"deg\", frame=\"icrs\"\n", - ")" + "target_pos = SkyCoord(ra=083.633, dec=+22.014, unit=\"deg\", frame=\"icrs\")" ] }, { @@ -388,8 +386,12 @@ "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}\")" + "print(\n", + " f\"Ephemeris time definition:\\n{model.START.value} - {model.FINISH.value}\"\n", + ")\n", + "print(\n", + " f\"Observation time definition:\\n{observation.tstart} - {observation.tstop}\"\n", + ")" ] }, { @@ -419,9 +421,15 @@ " 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.\")" + " model_time = Time(\n", + " [model.START.value, model.FINISH.value], scale=\"tt\", format=\"mjd\"\n", + " )\n", + " if (model_time[0].value > observation.tstart.tt.mjd) or (\n", + " model_time[1].value < observation.tstop.tt.mjd\n", + " ):\n", + " log.warning(\n", + " f\"Warning: Observation time of observation {observation.obs_id} goes out of timing model validity time.\"\n", + " )" ] }, { @@ -759,9 +767,7 @@ "source": [ "# Save the observation object in the specified file_path\n", "print(\"Writing output file in \" + str(file_path))\n", - "new_obs.write(\n", - " path=file_path, include_irfs=False, overwrite=True\n", - ")" + "new_obs.write(path=file_path, include_irfs=False, overwrite=True)" ] }, { @@ -792,7 +798,9 @@ "outputs": [], "source": [ "for entry in new_hdu:\n", - " if (entry[\"HDU_NAME\"] == \"EVENTS\") and (entry[\"OBS_ID\"] == observation.obs_id):\n", + " if (entry[\"HDU_NAME\"] == \"EVENTS\") and (\n", + " entry[\"OBS_ID\"] == observation.obs_id\n", + " ):\n", " entry[\"FILE_DIR\"] = \"./\" + str(output_directory)\n", " entry[\"FILE_NAME\"] = filename" ]