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": [
+ "
\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",
- "
\n",
- "
EVENT_ID
TIME
RA
DEC
ENERGY
\n",
- "
s
deg
deg
TeV
\n",
- "
int64
float64
float32
float32
float32
\n",
- "
2402
333778852.5099249
84.59457
22.03088
0.18194601
\n",
- "
2408
333778852.5267153
84.21462
23.44914
0.08397394
\n",
- "
2434
333778852.61315054
83.524704
22.725792
0.10596932
\n",
- "
2445
333778852.6690142
83.76957
22.451006
0.19733498
\n",
- "
2478
333778852.7627939
83.478516
23.484594
0.08522219
\n",
- "
2481
333778852.7778549
83.71517
21.985115
1.0020943
\n",
- "
2513
333778852.8644467
82.421196
22.567652
0.14374068
\n",
- "
2544
333778852.9826064
83.64136
22.041315
0.10316629
\n",
- "
2559
333778853.0269414
84.069176
22.97337
0.047184493
\n",
- "
...
...
...
...
...
\n",
- "
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",
+ "
\n",
+ "
EVENT_ID
TIME
RA
DEC
ENERGY
PHASE
\n",
+ "
s
deg
deg
TeV
\n",
+ "
int64
float64
float32
float32
float32
float64
\n",
+ "
2402
333778852.5099249
84.59457
22.03088
0.18194601
0.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
\n",
"
"
],
"text/plain": [
"
\n",
- "EVENT_ID TIME RA DEC ENERGY \n",
- " s deg deg TeV \n",
- " int64 float64 float32 float32 float32 \n",
- "-------- ------------------ --------- --------- -----------\n",
- " 2402 333778852.5099249 84.59457 22.03088 0.18194601\n",
- " 2408 333778852.5267153 84.21462 23.44914 0.08397394\n",
- " 2434 333778852.61315054 83.524704 22.725792 0.10596932\n",
- " 2445 333778852.6690142 83.76957 22.451006 0.19733498\n",
- " 2478 333778852.7627939 83.478516 23.484594 0.08522219\n",
- " 2481 333778852.7778549 83.71517 21.985115 1.0020943\n",
- " 2513 333778852.8644467 82.421196 22.567652 0.14374068\n",
- " 2544 333778852.9826064 83.64136 22.041315 0.10316629\n",
- " 2559 333778853.0269414 84.069176 22.97337 0.047184493\n",
- " ... ... ... ... ...\n",
- " 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": [
+ "
\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",
- "
\n",
- "
EVENT_ID
TIME
RA
DEC
ENERGY
\n",
- "
s
deg
deg
TeV
\n",
- "
int64
float64
float32
float32
float32
\n",
- "
2402
333778852.5099249
84.59457
22.03088
0.18194601
\n",
- "
2408
333778852.5267153
84.21462
23.44914
0.08397394
\n",
- "
2434
333778852.61315054
83.524704
22.725792
0.10596932
\n",
- "
2445
333778852.6690142
83.76957
22.451006
0.19733498
\n",
- "
2478
333778852.7627939
83.478516
23.484594
0.08522219
\n",
- "
2481
333778852.7778549
83.71517
21.985115
1.0020943
\n",
- "
2513
333778852.8644467
82.421196
22.567652
0.14374068
\n",
- "
2544
333778852.9826064
83.64136
22.041315
0.10316629
\n",
- "
2559
333778853.0269414
84.069176
22.97337
0.047184493
\n",
- "
...
...
...
...
...
\n",
- "
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",
+ "
\n",
+ "
EVENT_ID
TIME
RA
DEC
ENERGY
PHASE
\n",
+ "
s
deg
deg
TeV
\n",
+ "
int64
float64
float32
float32
float32
float64
\n",
+ "
2402
333778852.5099249
84.59457
22.03088
0.18194601
0.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
\n",
"
"
],
"text/plain": [
"
\n",
- "EVENT_ID TIME RA DEC ENERGY \n",
- " s deg deg TeV \n",
- " int64 float64 float32 float32 float32 \n",
- "-------- ------------------ --------- --------- -----------\n",
- " 2402 333778852.5099249 84.59457 22.03088 0.18194601\n",
- " 2408 333778852.5267153 84.21462 23.44914 0.08397394\n",
- " 2434 333778852.61315054 83.524704 22.725792 0.10596932\n",
- " 2445 333778852.6690142 83.76957 22.451006 0.19733498\n",
- " 2478 333778852.7627939 83.478516 23.484594 0.08522219\n",
- " 2481 333778852.7778549 83.71517 21.985115 1.0020943\n",
- " 2513 333778852.8644467 82.421196 22.567652 0.14374068\n",
- " 2544 333778852.9826064 83.64136 22.041315 0.10316629\n",
- " 2559 333778853.0269414 84.069176 22.97337 0.047184493\n",
- " ... ... ... ... ...\n",
- " 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": [
+ "
\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",
- "
\n",
- "
EVENT_ID
TIME
RA
DEC
ENERGY
\n",
- "
s
deg
deg
TeV
\n",
- "
int64
float64
float32
float32
float32
\n",
- "
2402
333778852.5099249
84.59457
22.03088
0.18194601
\n",
- "
2408
333778852.5267153
84.21462
23.44914
0.08397394
\n",
- "
2434
333778852.61315054
83.524704
22.725792
0.10596932
\n",
- "
2445
333778852.6690142
83.76957
22.451006
0.19733498
\n",
- "
2478
333778852.7627939
83.478516
23.484594
0.08522219
\n",
- "
2481
333778852.7778549
83.71517
21.985115
1.0020943
\n",
- "
2513
333778852.8644467
82.421196
22.567652
0.14374068
\n",
- "
2544
333778852.9826064
83.64136
22.041315
0.10316629
\n",
- "
2559
333778853.0269414
84.069176
22.97337
0.047184493
\n",
- "
...
...
...
...
...
\n",
- "
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",
+ "
\n",
+ "
EVENT_ID
TIME
RA
DEC
ENERGY
PHASE
\n",
+ "
s
deg
deg
TeV
\n",
+ "
int64
float64
float32
float32
float32
float64
\n",
+ "
2402
333778852.5099249
84.59457
22.03088
0.18194601
0.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
\n",
"
"
],
"text/plain": [
"
\n",
- "EVENT_ID TIME RA DEC ENERGY \n",
- " s deg deg TeV \n",
- " int64 float64 float32 float32 float32 \n",
- "-------- ------------------ --------- --------- -----------\n",
- " 2402 333778852.5099249 84.59457 22.03088 0.18194601\n",
- " 2408 333778852.5267153 84.21462 23.44914 0.08397394\n",
- " 2434 333778852.61315054 83.524704 22.725792 0.10596932\n",
- " 2445 333778852.6690142 83.76957 22.451006 0.19733498\n",
- " 2478 333778852.7627939 83.478516 23.484594 0.08522219\n",
- " 2481 333778852.7778549 83.71517 21.985115 1.0020943\n",
- " 2513 333778852.8644467 82.421196 22.567652 0.14374068\n",
- " 2544 333778852.9826064 83.64136 22.041315 0.10316629\n",
- " 2559 333778853.0269414 84.069176 22.97337 0.047184493\n",
- " ... ... ... ... ...\n",
- " 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 @@
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:
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.
-
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.
+
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.
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.
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)
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.
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]:
+
+
+
defcheck_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=Falseinclude_gps=False
@@ -470,16 +534,23 @@
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.
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
# 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_ID
TIME
RA
DEC
ENERGY
PHASE
s
deg
deg
TeV
int64
float64
float32
float32
float32
float64
-
2402
333778852.5099249
84.59457
22.03088
0.18194601
0.39349195931383935
-
2408
333778852.5267153
84.21462
23.44914
0.08397394
0.8919526790064667
-
2434
333778852.61315054
83.524704
22.725792
0.10596932
0.4579789031294724
-
2445
333778852.6690142
83.76957
22.451006
0.19733498
0.11641860219368935
-
2478
333778852.7627939
83.478516
23.484594
0.08522219
0.9004806857711186
-
2481
333778852.7778549
83.71517
21.985115
1.0020943
0.3476011689926769
-
2513
333778852.8644467
82.421196
22.567652
0.14374068
0.9182740999289545
-
2544
333778852.9826064
83.64136
22.041315
0.10316629
0.42611249421537956
-
2559
333778853.0269414
84.069176
22.97337
0.047184493
0.7422975122115125
+
2402
333778852.5099249
84.59457
22.03088
0.18194601
0.3934918682770723
+
2408
333778852.5267153
84.21462
23.44914
0.08397394
0.8919525879696997
+
2434
333778852.61315054
83.524704
22.725792
0.10596932
0.45797881185987477
+
2445
333778852.6690142
83.76957
22.451006
0.19733498
0.11641851092409164
+
2478
333778852.7627939
83.478516
23.484594
0.08522219
0.900480594501521
+
2481
333778852.7778549
83.71517
21.985115
1.0020943
0.34760107795590983
+
2513
333778852.8644467
82.421196
22.567652
0.14374068
0.9182740088921875
+
2544
333778852.9826064
83.64136
22.041315
0.10316629
0.42611240294578184
+
2559
333778853.0269414
84.069176
22.97337
0.047184493
0.7422974209419148
...
...
...
...
...
...
-
356222
333780039.4520397
84.74482
20.894981
0.043312162
0.4537121484157113
-
356223
333780039.4600492
84.11615
22.557505
0.08110082
0.6914920486374702
-
356227
333780039.47105366
83.41534
21.67344
0.2096362
0.018183944316962984
-
356242
333780039.5179095
83.55165
22.772985
0.17672835
0.40920620046641115
-
356282
333780039.62997514
84.46133
21.69357
0.05068718
0.7361270955486778
-
356473
333780040.3386479
84.45441
21.159828
0.1831569
0.7746789518818565
-
356478
333780040.3548926
83.68336
23.444988
0.06305169
0.2569398572226654
-
356485
333780040.3741322
84.33517
21.28338
0.060539745
0.8281109722104576
-
356486
333780040.3755159
84.85886
22.116222
0.123453744
0.8691881135544401
-
356526
333780040.52476007
84.86929
21.290916
0.13630114
0.29983901925054285
+
356223
333780039.4600492
84.11615
22.557505
0.08110082
0.6914919573678725
+
356227
333780039.47105366
83.41534
21.67344
0.2096362
0.018183853280195963
+
356242
333780039.5179095
83.55165
22.772985
0.17672835
0.4092061182772071
+
356282
333780039.62997514
84.46133
21.69357
0.05068718
0.7361270045119108
+
356473
333780040.3386479
84.45441
21.159828
0.1831569
0.7746788606122589
+
356478
333780040.3548926
83.68336
23.444988
0.06305169
0.25693976618589837
+
356485
333780040.3741322
84.33517
21.28338
0.060539745
0.8281108809408599
+
356486
333780040.3755159
84.85886
22.116222
0.123453744
0.8691880225176731
+
356526
333780040.52476007
84.86929
21.290916
0.13630114
0.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
# 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_ID
TIME
RA
DEC
ENERGY
PHASE
s
deg
deg
TeV
int64
float64
float32
float32
float32
float64
-
2402
333778852.5099249
84.59457
22.03088
0.18194601
0.39349195931383935
-
2408
333778852.5267153
84.21462
23.44914
0.08397394
0.8919526790064667
-
2434
333778852.61315054
83.524704
22.725792
0.10596932
0.4579789031294724
-
2445
333778852.6690142
83.76957
22.451006
0.19733498
0.11641860219368935
-
2478
333778852.7627939
83.478516
23.484594
0.08522219
0.9004806857711186
-
2481
333778852.7778549
83.71517
21.985115
1.0020943
0.3476011689926769
-
2513
333778852.8644467
82.421196
22.567652
0.14374068
0.9182740999289545
-
2544
333778852.9826064
83.64136
22.041315
0.10316629
0.42611249421537956
-
2559
333778853.0269414
84.069176
22.97337
0.047184493
0.7422975122115125
+
2402
333778852.5099249
84.59457
22.03088
0.18194601
0.3934918682770723
+
2408
333778852.5267153
84.21462
23.44914
0.08397394
0.8919525879696997
+
2434
333778852.61315054
83.524704
22.725792
0.10596932
0.45797881185987477
+
2445
333778852.6690142
83.76957
22.451006
0.19733498
0.11641851092409164
+
2478
333778852.7627939
83.478516
23.484594
0.08522219
0.900480594501521
+
2481
333778852.7778549
83.71517
21.985115
1.0020943
0.34760107795590983
+
2513
333778852.8644467
82.421196
22.567652
0.14374068
0.9182740088921875
+
2544
333778852.9826064
83.64136
22.041315
0.10316629
0.42611240294578184
+
2559
333778853.0269414
84.069176
22.97337
0.047184493
0.7422974209419148
...
...
...
...
...
...
-
356222
333780039.4520397
84.74482
20.894981
0.043312162
0.4537121484157113
-
356223
333780039.4600492
84.11615
22.557505
0.08110082
0.6914920486374702
-
356227
333780039.47105366
83.41534
21.67344
0.2096362
0.018183944316962984
-
356242
333780039.5179095
83.55165
22.772985
0.17672835
0.40920620046641115
-
356282
333780039.62997514
84.46133
21.69357
0.05068718
0.7361270955486778
-
356473
333780040.3386479
84.45441
21.159828
0.1831569
0.7746789518818565
-
356478
333780040.3548926
83.68336
23.444988
0.06305169
0.2569398572226654
-
356485
333780040.3741322
84.33517
21.28338
0.060539745
0.8281109722104576
-
356486
333780040.3755159
84.85886
22.116222
0.123453744
0.8691881135544401
-
356526
333780040.52476007
84.86929
21.290916
0.13630114
0.29983901925054285
+
356223
333780039.4600492
84.11615
22.557505
0.08110082
0.6914919573678725
+
356227
333780039.47105366
83.41534
21.67344
0.2096362
0.018183853280195963
+
356242
333780039.5179095
83.55165
22.772985
0.17672835
0.4092061182772071
+
356282
333780039.62997514
84.46133
21.69357
0.05068718
0.7361270045119108
+
356473
333780040.3386479
84.45441
21.159828
0.1831569
0.7746788606122589
+
356478
333780040.3548926
83.68336
23.444988
0.06305169
0.25693976618589837
+
356485
333780040.3741322
84.33517
21.28338
0.060539745
0.8281108809408599
+
356486
333780040.3755159
84.85886
22.116222
0.123453744
0.8691880225176731
+
356526
333780040.52476007
84.86929
21.290916
0.13630114
0.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.
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
-
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.
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": [
+ "
\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": [
"
\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",
- "
\n",
- "
EVENT_ID
TIME
RA
DEC
ENERGY
\n",
- "
s
deg
deg
TeV
\n",
- "
int64
float64
float32
float32
float32
\n",
- "
2402
333778852.5099249
84.59457
22.03088
0.18194601
\n",
- "
2408
333778852.5267153
84.21462
23.44914
0.08397394
\n",
- "
2434
333778852.61315054
83.524704
22.725792
0.10596932
\n",
- "
2445
333778852.6690142
83.76957
22.451006
0.19733498
\n",
- "
2478
333778852.7627939
83.478516
23.484594
0.08522219
\n",
- "
2481
333778852.7778549
83.71517
21.985115
1.0020943
\n",
- "
2513
333778852.8644467
82.421196
22.567652
0.14374068
\n",
- "
2544
333778852.9826064
83.64136
22.041315
0.10316629
\n",
- "
2559
333778853.0269414
84.069176
22.97337
0.047184493
\n",
- "
...
...
...
...
...
\n",
- "
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",
+ "
\n",
+ "
EVENT_ID
TIME
RA
DEC
ENERGY
PHASE
\n",
+ "
s
deg
deg
TeV
\n",
+ "
int64
float64
float32
float32
float32
float64
\n",
+ "
2402
333778852.5099249
84.59457
22.03088
0.18194601
0.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
\n",
"
"
],
"text/plain": [
"
\n",
- "EVENT_ID TIME RA DEC ENERGY \n",
- " s deg deg TeV \n",
- " int64 float64 float32 float32 float32 \n",
- "-------- ------------------ --------- --------- -----------\n",
- " 2402 333778852.5099249 84.59457 22.03088 0.18194601\n",
- " 2408 333778852.5267153 84.21462 23.44914 0.08397394\n",
- " 2434 333778852.61315054 83.524704 22.725792 0.10596932\n",
- " 2445 333778852.6690142 83.76957 22.451006 0.19733498\n",
- " 2478 333778852.7627939 83.478516 23.484594 0.08522219\n",
- " 2481 333778852.7778549 83.71517 21.985115 1.0020943\n",
- " 2513 333778852.8644467 82.421196 22.567652 0.14374068\n",
- " 2544 333778852.9826064 83.64136 22.041315 0.10316629\n",
- " 2559 333778853.0269414 84.069176 22.97337 0.047184493\n",
- " ... ... ... ... ...\n",
- " 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": [
+ "