From 73f3417612fa552133b24d40d1b6661f87256b88 Mon Sep 17 00:00:00 2001 From: Maxime Regeard Date: Fri, 14 Jun 2024 00:04:24 +0200 Subject: [PATCH 1/9] update env file --- recipes/pulsar_phase/env.yml | 6 +++--- recipes/pulsar_phase/gammapy-pint-environment.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/recipes/pulsar_phase/env.yml b/recipes/pulsar_phase/env.yml index 4d44158..76a388c 100644 --- a/recipes/pulsar_phase/env.yml +++ b/recipes/pulsar_phase/env.yml @@ -5,10 +5,10 @@ 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/recipes/pulsar_phase/gammapy-pint-environment.yml b/recipes/pulsar_phase/gammapy-pint-environment.yml index d109cba..dc61ccd 100644 --- a/recipes/pulsar_phase/gammapy-pint-environment.yml +++ b/recipes/pulsar_phase/gammapy-pint-environment.yml @@ -5,8 +5,8 @@ channels: - conda-forge dependencies: - - gammapy=1.0.1 - - python=3.9 + - gammapy=1.2 + - python=3.11 - pip - pip: - - pint-pulsar~=0.9.5 + - pint-pulsar~=1.0 From 2aa73739fe888a49c4f6a91ac38f73bd6df12e24 Mon Sep 17 00:00:00 2001 From: Maxime Regeard Date: Fri, 14 Jun 2024 00:04:45 +0200 Subject: [PATCH 2/9] update and correct notebook --- .../pulsar_phase_computation.ipynb | 776 ++++++++++++++++-- 1 file changed, 691 insertions(+), 85 deletions(-) diff --git a/recipes/pulsar_phase/pulsar_phase_computation.ipynb b/recipes/pulsar_phase/pulsar_phase_computation.ipynb index 5a19455..b7dfc94 100644 --- a/recipes/pulsar_phase/pulsar_phase_computation.ipynb +++ b/recipes/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" ] }, { @@ -73,10 +73,19 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "b68d2444", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Gammapy version : 1.2\n", + "PINT version : 1.0\n" + ] + } + ], "source": [ "import gammapy\n", "import pint\n", @@ -87,7 +96,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "e61b5e3e", "metadata": {}, "outputs": [], @@ -110,7 +119,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "id": "22ac4aea", "metadata": {}, "outputs": [], @@ -137,7 +146,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "id": "d0e182bb", "metadata": {}, "outputs": [], @@ -148,7 +157,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "id": "b5019a42", "metadata": {}, "outputs": [], @@ -167,7 +176,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "id": "9ba16fcc", "metadata": {}, "outputs": [], @@ -179,7 +188,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "id": "06bda835", "metadata": {}, "outputs": [], @@ -196,10 +205,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "id": "f96ccf30", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " OBS_ID\n", + "-------\n", + "5029748\n", + "5029747\n" + ] + } + ], "source": [ "obs_id = selected_obs_table[\"OBS_ID\"]\n", "print(obs_id)" @@ -215,7 +235,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "id": "fa6e36d5", "metadata": {}, "outputs": [], @@ -227,10 +247,29 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "id": "dec2c1a5", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Observations\n", + "Number of observations: 1\n", + "Observation\n", + "\n", + "\tobs id : 5029747 \n", + " \ttstart : 56569.18\n", + "\ttstop : 56569.19\n", + "\tduration : 1188.11 s\n", + "\tpointing (icrs) : 84.0 deg, 22.2 deg\n", + "\n", + "\tdeadtime fraction : 0.8%\n", + "\n" + ] + } + ], "source": [ "print(observations)" ] @@ -253,7 +292,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "id": "2756e72d", "metadata": {}, "outputs": [], @@ -265,10 +304,19 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "id": "1ac8103a", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[56569.18112859 56569.18112878 56569.18112978 ... 56569.19487702\n", + " 56569.19487703 56569.19487876]\n" + ] + } + ], "source": [ "print(times)" ] @@ -303,7 +351,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "id": "d4f89ba4", "metadata": {}, "outputs": [], @@ -346,12 +394,50 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "id": "d24e1c92", - "metadata": { - "scrolled": false - }, - "outputs": [], + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "\u001b[32m2024-06-13 23:55:31.812\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.models.absolute_phase\u001b[0m:\u001b[36mvalidate\u001b[0m:\u001b[36m74\u001b[0m - \u001b[1mTZRFRQ was 0.0 or None. Setting to infinite frequency.\u001b[0m\n", + "/Users/mregeard/anaconda3/envs/pulsar_recipe/lib/python3.11/site-packages/pint/models/model_builder.py:228: UserWarning: Unrecognized parfile line 'EPHVER 5'\n", + " warnings.warn(f\"Unrecognized parfile line '{p_line}'\", UserWarning)\n", + "\u001b[32m2024-06-13 23:55:31.815\u001b[0m | \u001b[33m\u001b[1mWARNING \u001b[0m | \u001b[36mpint.models.model_builder\u001b[0m:\u001b[36m__call__\u001b[0m:\u001b[36m232\u001b[0m - \u001b[33m\u001b[1mUNITS is not specified. Assuming TDB...\u001b[0m\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "AstrometryEquatorial(\n", + " MJDParameter( POSEPOCH 50739.0000000000000000 (d) frozen=True),\n", + " floatParameter( PX 0.0 (mas) frozen=True),\n", + " AngleParameter( RAJ 5:34:31.94000000 (hourangle) frozen=True),\n", + " AngleParameter( DECJ 22:00:52.10000000 (deg) frozen=True),\n", + " floatParameter( PMRA -11.8 (mas / yr) +/- 1.0 mas / yr frozen=True),\n", + " floatParameter( PMDEC 4.4 (mas / yr) +/- 1.0 mas / yr frozen=True))\n", + "SolarSystemShapiro(\n", + " boolParameter( PLANET_SHAPIRO N frozen=True))\n", + "DispersionDM(\n", + " floatParameter( DM 56.785579397589822356 (pc / cm3) frozen=True),\n", + " floatParameter( DM1 0.031279168349770640344 (pc / (yr cm3)) frozen=True),\n", + " MJDParameter( DMEPOCH 55107.8071585532816240 (d) frozen=True))\n", + "AbsPhase(\n", + " MJDParameter( TZRMJD 55638.1552775999516551 (d) frozen=True),\n", + " strParameter( TZRSITE coe frozen=True),\n", + " floatParameter( TZRFRQ inf (MHz) frozen=True))\n", + "Spindown(\n", + " floatParameter( F0 29.716913767510206412 (Hz) +/- 7.440760185772888e-08 Hz frozen=True),\n", + " MJDParameter( PEPOCH 55555.0000000000000000 (d) frozen=True),\n", + " floatParameter( F1 -3.7105744257791078768e-10 (Hz / s) +/- 7.182646367277094e-16 Hz / s frozen=True),\n", + " floatParameter( F2 1.1633675551229037574e-20 (Hz / s2) +/- 2.487306981530037e-23 Hz / s2 frozen=True),\n", + " floatParameter( F3 -8.6724769747827286635e-31 (Hz / s3) +/- 0.0 Hz / s3 frozen=True))\n" + ] + } + ], "source": [ "model = pmodels.get_model(ephemeris_file)\n", "print(model.components[\"AstrometryEquatorial\"])\n", @@ -379,12 +465,35 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "id": "a145cdde", - "metadata": { - "scrolled": false - }, - "outputs": [], + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "\u001b[32m2024-06-13 23:55:38.408\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m1362\u001b[0m - \u001b[34m\u001b[1mNo pulse number flags found in the TOAs\u001b[0m\n", + "\u001b[32m2024-06-13 23:55:38.418\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mapply_clock_corrections\u001b[0m:\u001b[36m2204\u001b[0m - \u001b[34m\u001b[1mApplying clock corrections (include_gps = False, include_bipm = False)\u001b[0m\n", + "\u001b[32m2024-06-13 23:55:38.824\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.observatory.topo_obs\u001b[0m:\u001b[36mclock_corrections\u001b[0m:\u001b[36m365\u001b[0m - \u001b[1mObservatory magic requires no clock corrections.\u001b[0m\n", + "\u001b[32m2024-06-13 23:55:40.732\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2255\u001b[0m - \u001b[34m\u001b[1mComputing TDB columns.\u001b[0m\n", + "\u001b[32m2024-06-13 23:55:40.733\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2276\u001b[0m - \u001b[34m\u001b[1mUsing EPHEM = DE421 for TDB calculation.\u001b[0m\n", + "\u001b[32m2024-06-13 23:55:41.481\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2354\u001b[0m - \u001b[34m\u001b[1mComputing PosVels of observatories and Earth, using DE421\u001b[0m\n", + "\u001b[32m2024-06-13 23:55:42.269\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.solar_system_ephemerides\u001b[0m:\u001b[36m_load_kernel_link\u001b[0m:\u001b[36m55\u001b[0m - \u001b[1mSet solar system ephemeris to de421 from download\u001b[0m\n", + "\u001b[32m2024-06-13 23:55:43.362\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2407\u001b[0m - \u001b[34m\u001b[1mSSB obs pos [1.47007462e+11 2.56889811e+10 1.11245045e+10] m\u001b[0m\n", + "\u001b[32m2024-06-13 23:55:44.083\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.solar_system_ephemerides\u001b[0m:\u001b[36m_load_kernel_link\u001b[0m:\u001b[36m55\u001b[0m - \u001b[1mSet solar system ephemeris to de421 from download\u001b[0m\n", + "\u001b[32m2024-06-13 23:55:44.112\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2421\u001b[0m - \u001b[34m\u001b[1mAdding columns ssb_obs_pos ssb_obs_vel obs_sun_pos\u001b[0m\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "CPU times: user 4.73 s, sys: 53.3 ms, total: 4.79 s\n", + "Wall time: 6.18 s\n" + ] + } + ], "source": [ "%%time\n", "\n", @@ -419,10 +528,30 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "id": "6fbf3ad9", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "\u001b[32m2024-06-13 23:55:50.651\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.models.glitch\u001b[0m:\u001b[36mglitch_phase\u001b[0m:\u001b[36m213\u001b[0m - \u001b[34m\u001b[1mGlitch phase for glitch 1: 0.0 \u001b[0m\n", + "\u001b[32m2024-06-13 23:55:50.673\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.models.absolute_phase\u001b[0m:\u001b[36mget_TZR_toa\u001b[0m:\u001b[36m98\u001b[0m - \u001b[34m\u001b[1mCreating and dealing with the single TZR_toa for absolute phase\u001b[0m\n", + "\u001b[32m2024-06-13 23:55:50.675\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m1362\u001b[0m - \u001b[34m\u001b[1mNo pulse number flags found in the TOAs\u001b[0m\n", + "\u001b[32m2024-06-13 23:55:50.675\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mapply_clock_corrections\u001b[0m:\u001b[36m2204\u001b[0m - \u001b[34m\u001b[1mApplying clock corrections (include_gps = False, include_bipm = False)\u001b[0m\n", + "\u001b[32m2024-06-13 23:55:50.676\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2255\u001b[0m - \u001b[34m\u001b[1mComputing TDB columns.\u001b[0m\n", + "\u001b[32m2024-06-13 23:55:50.677\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2276\u001b[0m - \u001b[34m\u001b[1mUsing EPHEM = DE421 for TDB calculation.\u001b[0m\n", + "\u001b[32m2024-06-13 23:55:50.679\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2354\u001b[0m - \u001b[34m\u001b[1mComputing PosVels of observatories and Earth, using DE421\u001b[0m\n", + "\u001b[32m2024-06-13 23:55:51.261\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.solar_system_ephemerides\u001b[0m:\u001b[36m_load_kernel_link\u001b[0m:\u001b[36m55\u001b[0m - \u001b[1mSet solar system ephemeris to de421 from download\u001b[0m\n", + "\u001b[32m2024-06-13 23:55:51.281\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2407\u001b[0m - \u001b[34m\u001b[1mSSB obs pos [-1.49278181e+08 7.07659442e+06 3.07113250e+06] km\u001b[0m\n", + "\u001b[32m2024-06-13 23:55:51.871\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.solar_system_ephemerides\u001b[0m:\u001b[36m_load_kernel_link\u001b[0m:\u001b[36m55\u001b[0m - \u001b[1mSet solar system ephemeris to de421 from download\u001b[0m\n", + "\u001b[32m2024-06-13 23:55:51.888\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2421\u001b[0m - \u001b[34m\u001b[1mAdding columns ssb_obs_pos ssb_obs_vel obs_sun_pos\u001b[0m\n", + "\u001b[32m2024-06-13 23:55:51.893\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.models.absolute_phase\u001b[0m:\u001b[36mget_TZR_toa\u001b[0m:\u001b[36m121\u001b[0m - \u001b[34m\u001b[1mDone with TZR_toa\u001b[0m\n", + "\u001b[32m2024-06-13 23:55:51.941\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.models.glitch\u001b[0m:\u001b[36mglitch_phase\u001b[0m:\u001b[36m213\u001b[0m - \u001b[34m\u001b[1mGlitch phase for glitch 1: 0.0 \u001b[0m\n" + ] + } + ], "source": [ "# Compute phases\n", "phases = model.phase(toas, abs_phase=True)[1]\n", @@ -449,7 +578,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 23, "id": "735ac718", "metadata": {}, "outputs": [], @@ -460,20 +589,79 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 24, "id": "f3269a2c", - "metadata": { - "scrolled": false - }, - "outputs": [], + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
Table length=11189\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
EVENT_IDTIMERADECENERGY
sdegdegTeV
int64float64float32float32float32
2402333778852.509924984.5945722.030880.18194601
2408333778852.526715384.2146223.449140.08397394
2434333778852.6131505483.52470422.7257920.10596932
2445333778852.669014283.7695722.4510060.19733498
2478333778852.762793983.47851623.4845940.08522219
2481333778852.777854983.7151721.9851151.0020943
2513333778852.864446782.42119622.5676520.14374068
2544333778852.982606483.6413622.0413150.10316629
2559333778853.026941484.06917622.973370.047184493
...............
356223333780039.460049284.1161522.5575050.08110082
356227333780039.4710536683.4153421.673440.2096362
356242333780039.517909583.5516522.7729850.17672835
356282333780039.6299751484.4613321.693570.05068718
356473333780040.338647984.4544121.1598280.1831569
356478333780040.354892683.6833623.4449880.06305169
356485333780040.374132284.3351721.283380.060539745
356486333780040.375515984.8588622.1162220.123453744
356526333780040.5247600784.8692921.2909160.13630114
" + ], + "text/plain": [ + "\n", + "EVENT_ID TIME RA DEC ENERGY \n", + " s deg deg TeV \n", + " int64 float64 float32 float32 float32 \n", + "-------- ------------------ --------- --------- -----------\n", + " 2402 333778852.5099249 84.59457 22.03088 0.18194601\n", + " 2408 333778852.5267153 84.21462 23.44914 0.08397394\n", + " 2434 333778852.61315054 83.524704 22.725792 0.10596932\n", + " 2445 333778852.6690142 83.76957 22.451006 0.19733498\n", + " 2478 333778852.7627939 83.478516 23.484594 0.08522219\n", + " 2481 333778852.7778549 83.71517 21.985115 1.0020943\n", + " 2513 333778852.8644467 82.421196 22.567652 0.14374068\n", + " 2544 333778852.9826064 83.64136 22.041315 0.10316629\n", + " 2559 333778853.0269414 84.069176 22.97337 0.047184493\n", + " ... ... ... ... ...\n", + " 356223 333780039.4600492 84.11615 22.557505 0.08110082\n", + " 356227 333780039.47105366 83.41534 21.67344 0.2096362\n", + " 356242 333780039.5179095 83.55165 22.772985 0.17672835\n", + " 356282 333780039.62997514 84.46133 21.69357 0.05068718\n", + " 356473 333780040.3386479 84.45441 21.159828 0.1831569\n", + " 356478 333780040.3548926 83.68336 23.444988 0.06305169\n", + " 356485 333780040.3741322 84.33517 21.28338 0.060539745\n", + " 356486 333780040.3755159 84.85886 22.116222 0.123453744\n", + " 356526 333780040.52476007 84.86929 21.290916 0.13630114" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Show original table\n", - "print(table)" + "table" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 25, "id": "6fc6024c", "metadata": {}, "outputs": [], @@ -492,12 +680,71 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 26, "id": "7f29187e", - "metadata": { - "scrolled": false - }, - "outputs": [], + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
Table length=11189\n", + "
\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
EVENT_IDTIMERADECENERGYPHASE
sdegdegTeV
int64float64float32float32float32float64
2402333778852.509924984.5945722.030880.181946010.39349195931383935
2408333778852.526715384.2146223.449140.083973940.8919526790064667
2434333778852.6131505483.52470422.7257920.105969320.4579789031294724
2445333778852.669014283.7695722.4510060.197334980.11641860219368935
2478333778852.762793983.47851623.4845940.085222190.9004806857711186
2481333778852.777854983.7151721.9851151.00209430.3476011689926769
2513333778852.864446782.42119622.5676520.143740680.9182740999289545
2544333778852.982606483.6413622.0413150.103166290.42611249421537956
2559333778853.026941484.06917622.973370.0471844930.7422975122115125
..................
356223333780039.460049284.1161522.5575050.081100820.6914920486374702
356227333780039.4710536683.4153421.673440.20963620.018183944316962984
356242333780039.517909583.5516522.7729850.176728350.40920620046641115
356282333780039.6299751484.4613321.693570.050687180.7361270955486778
356473333780040.338647984.4544121.1598280.18315690.7746789518818565
356478333780040.354892683.6833623.4449880.063051690.2569398572226654
356485333780040.374132284.3351721.283380.0605397450.8281109722104576
356486333780040.375515984.8588622.1162220.1234537440.8691881135544401
356526333780040.5247600784.8692921.2909160.136301140.29983901925054285
" + ], + "text/plain": [ + "\n", + "EVENT_ID TIME RA DEC ENERGY PHASE \n", + " s deg deg TeV \n", + " int64 float64 float32 float32 float32 float64 \n", + "-------- ------------------ --------- --------- ----------- --------------------\n", + " 2402 333778852.5099249 84.59457 22.03088 0.18194601 0.39349195931383935\n", + " 2408 333778852.5267153 84.21462 23.44914 0.08397394 0.8919526790064667\n", + " 2434 333778852.61315054 83.524704 22.725792 0.10596932 0.4579789031294724\n", + " 2445 333778852.6690142 83.76957 22.451006 0.19733498 0.11641860219368935\n", + " 2478 333778852.7627939 83.478516 23.484594 0.08522219 0.9004806857711186\n", + " 2481 333778852.7778549 83.71517 21.985115 1.0020943 0.3476011689926769\n", + " 2513 333778852.8644467 82.421196 22.567652 0.14374068 0.9182740999289545\n", + " 2544 333778852.9826064 83.64136 22.041315 0.10316629 0.42611249421537956\n", + " 2559 333778853.0269414 84.069176 22.97337 0.047184493 0.7422975122115125\n", + " ... ... ... ... ... ...\n", + " 356223 333780039.4600492 84.11615 22.557505 0.08110082 0.6914920486374702\n", + " 356227 333780039.47105366 83.41534 21.67344 0.2096362 0.018183944316962984\n", + " 356242 333780039.5179095 83.55165 22.772985 0.17672835 0.40920620046641115\n", + " 356282 333780039.62997514 84.46133 21.69357 0.05068718 0.7361270955486778\n", + " 356473 333780040.3386479 84.45441 21.159828 0.1831569 0.7746789518818565\n", + " 356478 333780040.3548926 83.68336 23.444988 0.06305169 0.2569398572226654\n", + " 356485 333780040.3741322 84.33517 21.28338 0.060539745 0.8281109722104576\n", + " 356486 333780040.3755159 84.85886 22.116222 0.123453744 0.8691881135544401\n", + " 356526 333780040.52476007 84.86929 21.290916 0.13630114 0.29983901925054285" + ] + }, + "execution_count": 26, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Show table with phases\n", "table" @@ -523,19 +770,62 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 27, "id": "af220557", - "metadata": { - "scrolled": false - }, - "outputs": [], + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "OrderedDict([('EXTNAME', 'EVENTS'),\n", + " ('HDUCLASS', 'GADF'),\n", + " ('HDUDOC',\n", + " 'https://github.com/open-gamma-ray-astro/gamma-astro-data-formats'),\n", + " ('HDUVERS', '0.2'),\n", + " ('HDUCLAS1', 'EVENTS'),\n", + " ('OBS_ID', 5029747),\n", + " ('TSTART', 333778852.435217),\n", + " ('TSTOP', 333780040.546979),\n", + " ('ONTIME', 1188.111761868),\n", + " ('LIVETIME', 1178.06621791733),\n", + " ('DEADC', 0.991545),\n", + " ('EQUINOX', 2000.0),\n", + " ('RADECSYS', 'FK5'),\n", + " ('ORIGIN', 'MAGIC Collaboration'),\n", + " ('TELESCOP', 'MAGIC'),\n", + " ('INSTRUME', 'MAGIC stereo'),\n", + " ('CREATOR', 'MAGIC_DL3'),\n", + " ('VERSION', '0.1.8'),\n", + " ('MJDREFI', 52706),\n", + " ('MJDREFF', 0.0),\n", + " ('TIMEUNIT', 's'),\n", + " ('TIMESYS', 'UTC'),\n", + " ('TIMEREF', 'local'),\n", + " ('OBJECT', 'CrabNebula'),\n", + " ('RA_OBJ', 83.63333),\n", + " ('DEC_OBJ', 22.01444),\n", + " ('OBS_MODE', 'POINTING'),\n", + " ('RA_PNT', 83.98333),\n", + " ('DEC_PNT', 22.24389),\n", + " ('GEOLON', -17.89),\n", + " ('GEOLAT', 28.761944),\n", + " ('ALTITUDE', 2231.28),\n", + " ('ALT_PNT', 69.69974),\n", + " ('AZ_PNT', 103.8848)])" + ] + }, + "execution_count": 27, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "table.meta" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 28, "id": "c2285fcd", "metadata": {}, "outputs": [], @@ -578,10 +868,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 29, "id": "8c866a5c", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "COLUMN_PHASE: PHASE; PINT_VERS: 1.0; GAMMAPY_VERS: 1.2; EPHEM_FILE: ./0534+2200_ApJ_708_1254_2010.par; PSRJ :J0534+2200; START: 54686.1526259; FINISH: 56583.1591704; TZRMJD: 55638.155277599951656; TZRSITE: coe; TZRFREQ: inf; EPHEM: DE405; EPHEM_RA: 5.575538888888889; EPHEM_DEC: 22.01447222222222; PHASE_OFFSET: default = 0; DATE: 60474.9143641169;\n" + ] + } + ], "source": [ "phase_log = get_log(ephemeris_file=ephemeris_file, phase_column_name=\"PHASE\")\n", "print(phase_log)" @@ -589,7 +887,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 30, "id": "5a3e56d2", "metadata": {}, "outputs": [], @@ -600,10 +898,57 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 31, "id": "f6b44e25", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "OrderedDict([('EXTNAME', 'EVENTS'),\n", + " ('HDUCLASS', 'GADF'),\n", + " ('HDUDOC',\n", + " 'https://github.com/open-gamma-ray-astro/gamma-astro-data-formats'),\n", + " ('HDUVERS', '0.2'),\n", + " ('HDUCLAS1', 'EVENTS'),\n", + " ('OBS_ID', 5029747),\n", + " ('TSTART', 333778852.435217),\n", + " ('TSTOP', 333780040.546979),\n", + " ('ONTIME', 1188.111761868),\n", + " ('LIVETIME', 1178.06621791733),\n", + " ('DEADC', 0.991545),\n", + " ('EQUINOX', 2000.0),\n", + " ('RADECSYS', 'FK5'),\n", + " ('ORIGIN', 'MAGIC Collaboration'),\n", + " ('TELESCOP', 'MAGIC'),\n", + " ('INSTRUME', 'MAGIC stereo'),\n", + " ('CREATOR', 'MAGIC_DL3'),\n", + " ('VERSION', '0.1.8'),\n", + " ('MJDREFI', 52706),\n", + " ('MJDREFF', 0.0),\n", + " ('TIMEUNIT', 's'),\n", + " ('TIMESYS', 'UTC'),\n", + " ('TIMEREF', 'local'),\n", + " ('OBJECT', 'CrabNebula'),\n", + " ('RA_OBJ', 83.63333),\n", + " ('DEC_OBJ', 22.01444),\n", + " ('OBS_MODE', 'POINTING'),\n", + " ('RA_PNT', 83.98333),\n", + " ('DEC_PNT', 22.24389),\n", + " ('GEOLON', -17.89),\n", + " ('GEOLAT', 28.761944),\n", + " ('ALTITUDE', 2231.28),\n", + " ('ALT_PNT', 69.69974),\n", + " ('AZ_PNT', 103.8848),\n", + " ('PH_LOG',\n", + " 'COLUMN_PHASE: PHASE; PINT_VERS: 1.0; GAMMAPY_VERS: 1.2; EPHEM_FILE: ./0534+2200_ApJ_708_1254_2010.par; PSRJ :J0534+2200; START: 54686.1526259; FINISH: 56583.1591704; TZRMJD: 55638.155277599951656; TZRSITE: coe; TZRFREQ: inf; EPHEM: DE405; EPHEM_RA: 5.575538888888889; EPHEM_DEC: 22.01447222222222; PHASE_OFFSET: default = 0; DATE: 60474.9143641169;')])" + ] + }, + "execution_count": 31, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "table.meta" ] @@ -618,10 +963,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 32, "id": "12545bff", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "'THETA' axis is stored as a scalar -- converting to 1D array.\n", + "'THETA' axis is stored as a scalar -- converting to 1D array.\n", + "'THETA' axis is stored as a scalar -- converting to 1D array.\n" + ] + } + ], "source": [ "# Create new event list and add it to observation object\n", "new_event_list = EventList(table)\n", @@ -630,10 +985,71 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 33, "id": "1ac16c51", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
Table length=11189\n", + "
\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
EVENT_IDTIMERADECENERGYPHASE
sdegdegTeV
int64float64float32float32float32float64
2402333778852.509924984.5945722.030880.181946010.39349195931383935
2408333778852.526715384.2146223.449140.083973940.8919526790064667
2434333778852.6131505483.52470422.7257920.105969320.4579789031294724
2445333778852.669014283.7695722.4510060.197334980.11641860219368935
2478333778852.762793983.47851623.4845940.085222190.9004806857711186
2481333778852.777854983.7151721.9851151.00209430.3476011689926769
2513333778852.864446782.42119622.5676520.143740680.9182740999289545
2544333778852.982606483.6413622.0413150.103166290.42611249421537956
2559333778853.026941484.06917622.973370.0471844930.7422975122115125
..................
356223333780039.460049284.1161522.5575050.081100820.6914920486374702
356227333780039.4710536683.4153421.673440.20963620.018183944316962984
356242333780039.517909583.5516522.7729850.176728350.40920620046641115
356282333780039.6299751484.4613321.693570.050687180.7361270955486778
356473333780040.338647984.4544121.1598280.18315690.7746789518818565
356478333780040.354892683.6833623.4449880.063051690.2569398572226654
356485333780040.374132284.3351721.283380.0605397450.8281109722104576
356486333780040.375515984.8588622.1162220.1234537440.8691881135544401
356526333780040.5247600784.8692921.2909160.136301140.29983901925054285
" + ], + "text/plain": [ + "\n", + "EVENT_ID TIME RA DEC ENERGY PHASE \n", + " s deg deg TeV \n", + " int64 float64 float32 float32 float32 float64 \n", + "-------- ------------------ --------- --------- ----------- --------------------\n", + " 2402 333778852.5099249 84.59457 22.03088 0.18194601 0.39349195931383935\n", + " 2408 333778852.5267153 84.21462 23.44914 0.08397394 0.8919526790064667\n", + " 2434 333778852.61315054 83.524704 22.725792 0.10596932 0.4579789031294724\n", + " 2445 333778852.6690142 83.76957 22.451006 0.19733498 0.11641860219368935\n", + " 2478 333778852.7627939 83.478516 23.484594 0.08522219 0.9004806857711186\n", + " 2481 333778852.7778549 83.71517 21.985115 1.0020943 0.3476011689926769\n", + " 2513 333778852.8644467 82.421196 22.567652 0.14374068 0.9182740999289545\n", + " 2544 333778852.9826064 83.64136 22.041315 0.10316629 0.42611249421537956\n", + " 2559 333778853.0269414 84.069176 22.97337 0.047184493 0.7422975122115125\n", + " ... ... ... ... ... ...\n", + " 356223 333780039.4600492 84.11615 22.557505 0.08110082 0.6914920486374702\n", + " 356227 333780039.47105366 83.41534 21.67344 0.2096362 0.018183944316962984\n", + " 356242 333780039.5179095 83.55165 22.772985 0.17672835 0.40920620046641115\n", + " 356282 333780039.62997514 84.46133 21.69357 0.05068718 0.7361270955486778\n", + " 356473 333780040.3386479 84.45441 21.159828 0.1831569 0.7746789518818565\n", + " 356478 333780040.3548926 83.68336 23.444988 0.06305169 0.2569398572226654\n", + " 356485 333780040.3741322 84.33517 21.28338 0.060539745 0.8281109722104576\n", + " 356486 333780040.3755159 84.85886 22.116222 0.123453744 0.8691881135544401\n", + " 356526 333780040.52476007 84.86929 21.290916 0.13630114 0.29983901925054285" + ] + }, + "execution_count": 33, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "new_obs.events.table" ] @@ -658,17 +1074,28 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 34, "id": "f3c8410c", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "PosixPath('/Users/mregeard/Workspace/dev/code/gammapy/gammapy-data/magic/rad_max/data')" + ] + }, + "execution_count": 34, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "data_store.hdu_table.base_dir" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 35, "id": "8fd2ce31", "metadata": {}, "outputs": [], @@ -685,27 +1112,44 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 36, "id": "e6e38fc1", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "'/Users/mregeard/Workspace/dev/code/gammapy/gammapy-data/magic/rad_max/data/pulsar_events_file/'" + ] + }, + "execution_count": 36, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "output_path" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 49, "id": "f339c797", - "metadata": { - "scrolled": true - }, - "outputs": [], + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Writing output file in /Users/mregeard/Workspace/dev/code/gammapy/gammapy-data/magic/rad_max/data/pulsar_events_file/dl3_pulsar_5029747.fits.gz\n" + ] + } + ], "source": [ "# Save the observation object in the specified file_path\n", - "print(\"Writing outputfile in \" + str(file_path))\n", - "observation.events.write(\n", - " filename=file_path, gti=observation.gti, overwrite=True\n", + "print(\"Writing output file in \" + str(file_path))\n", + "new_obs.write(\n", + " path=file_path, include_irfs=False, overwrite=True\n", ")" ] }, @@ -719,10 +1163,51 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 50, "id": "4b8dd431", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
HDUIndexTable length=10\n", + "
\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
OBS_IDHDU_TYPEHDU_CLASSFILE_DIRFILE_NAMEHDU_NAME
int64bytes30bytes30bytes100bytes50bytes30
5029748eventsevents./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsEVENTS
5029748gtigti./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsGTI
5029748rad_maxrad_max_2d./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsRAD_MAX
5029748aeffaeff_2d./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsEFFECTIVE AREA
5029748edispedisp_2d./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsENERGY DISPERSION
5029747eventsevents./20131004_05029747_DL3_CrabNebula-W0.40+035.fitsEVENTS
5029747gtigti./20131004_05029747_DL3_CrabNebula-W0.40+035.fitsGTI
5029747rad_maxrad_max_2d./20131004_05029747_DL3_CrabNebula-W0.40+035.fitsRAD_MAX
5029747aeffaeff_2d./20131004_05029747_DL3_CrabNebula-W0.40+035.fitsEFFECTIVE AREA
5029747edispedisp_2d./20131004_05029747_DL3_CrabNebula-W0.40+035.fitsENERGY DISPERSION
" + ], + "text/plain": [ + "\n", + " OBS_ID HDU_TYPE ... HDU_NAME \n", + " int64 bytes30 ... bytes30 \n", + "------- -------- ... -----------------\n", + "5029748 events ... EVENTS\n", + "5029748 gti ... GTI\n", + "5029748 rad_max ... RAD_MAX\n", + "5029748 aeff ... EFFECTIVE AREA\n", + "5029748 edisp ... ENERGY DISPERSION\n", + "5029747 events ... EVENTS\n", + "5029747 gti ... GTI\n", + "5029747 rad_max ... RAD_MAX\n", + "5029747 aeff ... EFFECTIVE AREA\n", + "5029747 edisp ... ENERGY DISPERSION" + ] + }, + "execution_count": 50, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Print the current data store HDU table.\n", "new_hdu = data_store.hdu_table.copy()\n", @@ -731,23 +1216,64 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 57, "id": "6f37e101", "metadata": {}, "outputs": [], "source": [ "for entry in new_hdu:\n", - " if entry[\"HDU_NAME\"] == \"EVENTS\" and entry[\"OBS_ID\"] == observation.obs_id:\n", + " if (entry[\"HDU_NAME\"] == \"EVENTS\") and (entry[\"OBS_ID\"] == observation.obs_id):\n", " entry[\"FILE_DIR\"] = \"./\" + str(output_directory)\n", " entry[\"FILE_NAME\"] = filename" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 58, "id": "d89a7739", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
HDUIndexTable length=10\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
OBS_IDHDU_TYPEHDU_CLASSFILE_DIRFILE_NAMEHDU_NAME
int64bytes30bytes30bytes100bytes50bytes30
5029748eventsevents./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsEVENTS
5029748gtigti./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsGTI
5029748rad_maxrad_max_2d./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsRAD_MAX
5029748aeffaeff_2d./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsEFFECTIVE AREA
5029748edispedisp_2d./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsENERGY DISPERSION
5029747eventsevents./pulsar_events_file/dl3_pulsar_5029747.fits.gzEVENTS
5029747gtigti./20131004_05029747_DL3_CrabNebula-W0.40+035.fitsGTI
5029747rad_maxrad_max_2d./20131004_05029747_DL3_CrabNebula-W0.40+035.fitsRAD_MAX
5029747aeffaeff_2d./20131004_05029747_DL3_CrabNebula-W0.40+035.fitsEFFECTIVE AREA
5029747edispedisp_2d./20131004_05029747_DL3_CrabNebula-W0.40+035.fitsENERGY DISPERSION
" + ], + "text/plain": [ + "\n", + " OBS_ID HDU_TYPE ... HDU_NAME \n", + " int64 bytes30 ... bytes30 \n", + "------- -------- ... -----------------\n", + "5029748 events ... EVENTS\n", + "5029748 gti ... GTI\n", + "5029748 rad_max ... RAD_MAX\n", + "5029748 aeff ... EFFECTIVE AREA\n", + "5029748 edisp ... ENERGY DISPERSION\n", + "5029747 events ... EVENTS\n", + "5029747 gti ... GTI\n", + "5029747 rad_max ... RAD_MAX\n", + "5029747 aeff ... EFFECTIVE AREA\n", + "5029747 edisp ... ENERGY DISPERSION" + ] + }, + "execution_count": 58, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "new_hdu" ] @@ -770,7 +1296,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 53, "id": "b1633cd5", "metadata": {}, "outputs": [], @@ -806,7 +1332,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 54, "id": "88a0e9c1", "metadata": {}, "outputs": [], @@ -818,10 +1344,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 55, "id": "f7c60c18", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "['events', 'gti', 'aeff', 'edisp', 'rad_max']" + ] + }, + "execution_count": 55, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "observations = pulsar_datastore.get_observations(\n", " [5029747], required_irf=\"point-like\"\n", @@ -831,10 +1368,71 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 56, "id": "4ae8ebd2", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
Table length=11189\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
EVENT_IDTIMERADECENERGYPHASE
sdegdegTeV
int64float64float32float32float32float64
2402333778852.509924984.5945722.030880.181946010.39349195931383935
2408333778852.526715384.2146223.449140.083973940.8919526790064667
2434333778852.6131505483.52470422.7257920.105969320.4579789031294724
2445333778852.669014283.7695722.4510060.197334980.11641860219368935
2478333778852.762793983.47851623.4845940.085222190.9004806857711186
2481333778852.777854983.7151721.9851151.00209430.3476011689926769
2513333778852.864446782.42119622.5676520.143740680.9182740999289545
2544333778852.982606483.6413622.0413150.103166290.42611249421537956
2559333778853.026941484.06917622.973370.0471844930.7422975122115125
..................
356223333780039.460049284.1161522.5575050.081100820.6914920486374702
356227333780039.4710536683.4153421.673440.20963620.018183944316962984
356242333780039.517909583.5516522.7729850.176728350.40920620046641115
356282333780039.6299751484.4613321.693570.050687180.7361270955486778
356473333780040.338647984.4544121.1598280.18315690.7746789518818565
356478333780040.354892683.6833623.4449880.063051690.2569398572226654
356485333780040.374132284.3351721.283380.0605397450.8281109722104576
356486333780040.375515984.8588622.1162220.1234537440.8691881135544401
356526333780040.5247600784.8692921.2909160.136301140.29983901925054285
" + ], + "text/plain": [ + "\n", + "EVENT_ID TIME RA DEC ENERGY PHASE \n", + " s deg deg TeV \n", + " int64 float64 float32 float32 float32 float64 \n", + "-------- ------------------ --------- --------- ----------- --------------------\n", + " 2402 333778852.5099249 84.59457 22.03088 0.18194601 0.39349195931383935\n", + " 2408 333778852.5267153 84.21462 23.44914 0.08397394 0.8919526790064667\n", + " 2434 333778852.61315054 83.524704 22.725792 0.10596932 0.4579789031294724\n", + " 2445 333778852.6690142 83.76957 22.451006 0.19733498 0.11641860219368935\n", + " 2478 333778852.7627939 83.478516 23.484594 0.08522219 0.9004806857711186\n", + " 2481 333778852.7778549 83.71517 21.985115 1.0020943 0.3476011689926769\n", + " 2513 333778852.8644467 82.421196 22.567652 0.14374068 0.9182740999289545\n", + " 2544 333778852.9826064 83.64136 22.041315 0.10316629 0.42611249421537956\n", + " 2559 333778853.0269414 84.069176 22.97337 0.047184493 0.7422975122115125\n", + " ... ... ... ... ... ...\n", + " 356223 333780039.4600492 84.11615 22.557505 0.08110082 0.6914920486374702\n", + " 356227 333780039.47105366 83.41534 21.67344 0.2096362 0.018183944316962984\n", + " 356242 333780039.5179095 83.55165 22.772985 0.17672835 0.40920620046641115\n", + " 356282 333780039.62997514 84.46133 21.69357 0.05068718 0.7361270955486778\n", + " 356473 333780040.3386479 84.45441 21.159828 0.1831569 0.7746789518818565\n", + " 356478 333780040.3548926 83.68336 23.444988 0.06305169 0.2569398572226654\n", + " 356485 333780040.3741322 84.33517 21.28338 0.060539745 0.8281109722104576\n", + " 356486 333780040.3755159 84.85886 22.116222 0.123453744 0.8691881135544401\n", + " 356526 333780040.52476007 84.86929 21.290916 0.13630114 0.29983901925054285" + ] + }, + "execution_count": 56, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "observations[0].events.table" ] @@ -871,6 +1469,14 @@ "\n", "Recipe made by [Alvaros Mas](https://github.com/alvmas), [Maxime Regeard](https://github.com/MRegeard), [Jan Lukas Schubert](https://github.com/jalu98)." ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "17b4f370-f3f6-4c5b-ba09-2d3a329def54", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { @@ -889,7 +1495,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.16" + "version": "3.11.9" } }, "nbformat": 4, From 3ee44c6106e2ac3176b33caa671aae3a4be90acd Mon Sep 17 00:00:00 2001 From: Maxime Regeard Date: Wed, 26 Jun 2024 17:56:26 +0200 Subject: [PATCH 3/9] atreyee comments --- .../pulsar_phase_computation.ipynb | 824 +++--------------- 1 file changed, 137 insertions(+), 687 deletions(-) diff --git a/recipes/pulsar_phase/pulsar_phase_computation.ipynb b/recipes/pulsar_phase/pulsar_phase_computation.ipynb index b7dfc94..d83fe6a 100644 --- a/recipes/pulsar_phase/pulsar_phase_computation.ipynb +++ b/recipes/pulsar_phase/pulsar_phase_computation.ipynb @@ -54,7 +54,7 @@ "In order to run this notebook, one needs to have installed Gammapy as well as PINT (see documentation above) in the same environment. We recommend to first install Gammapy and then install PINT using your prefered package manager.\n", "\n", "\n", - "`$ conda env create -n gammapy-pint -f gammapy-1.0-environment.yml`\n", + "`$ conda env create -n gammapy-pint -f gammapy-pint-environment.yml`\n", "\n", "`$ conda activate gammapy-pint`\n", "\n", @@ -73,19 +73,10 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "b68d2444", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Gammapy version : 1.2\n", - "PINT version : 1.0\n" - ] - } - ], + "outputs": [], "source": [ "import gammapy\n", "import pint\n", @@ -96,7 +87,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "e61b5e3e", "metadata": {}, "outputs": [], @@ -106,7 +97,10 @@ "from astropy.coordinates import SkyCoord\n", "import numpy as np\n", "from pathlib import Path\n", - "from gammapy.data import DataStore, EventList, Observation" + "from gammapy.data import DataStore, EventList, Observation\n", + "import logging\n", + "\n", + "log = logging.getLogger(__name__)" ] }, { @@ -119,7 +113,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "22ac4aea", "metadata": {}, "outputs": [], @@ -146,24 +140,25 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "d0e182bb", "metadata": {}, "outputs": [], "source": [ "# Define the directory containing the DL3 data\n", - "DL3_direc = \"$GAMMAPY_DATA/magic/rad_max/data\"" + "DL3_dir = \"$GAMMAPY_DATA/magic/rad_max/data\"\n", + "DL3_dir = \"/Users/mregeard/Workspace/dev/code/gammapy/gammapy-data/magic/rad_max/data/\"" ] }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "b5019a42", "metadata": {}, "outputs": [], "source": [ "# Read DataStore from a directory\n", - "data_store = DataStore.from_dir(DL3_direc)" + "data_store = DataStore.from_dir(DL3_dir)" ] }, { @@ -176,19 +171,19 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "9ba16fcc", "metadata": {}, "outputs": [], "source": [ "target_pos = SkyCoord(\n", - " ra=083.6331144560900, dec=+22.0144871383400, unit=\"deg\", frame=\"icrs\"\n", + " ra=083.633, dec=+22.014, unit=\"deg\", frame=\"icrs\"\n", ")" ] }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "06bda835", "metadata": {}, "outputs": [], @@ -205,21 +200,10 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "f96ccf30", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " OBS_ID\n", - "-------\n", - "5029748\n", - "5029747\n" - ] - } - ], + "outputs": [], "source": [ "obs_id = selected_obs_table[\"OBS_ID\"]\n", "print(obs_id)" @@ -235,7 +219,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "fa6e36d5", "metadata": {}, "outputs": [], @@ -247,29 +231,10 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "dec2c1a5", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Observations\n", - "Number of observations: 1\n", - "Observation\n", - "\n", - "\tobs id : 5029747 \n", - " \ttstart : 56569.18\n", - "\ttstop : 56569.19\n", - "\tduration : 1188.11 s\n", - "\tpointing (icrs) : 84.0 deg, 22.2 deg\n", - "\n", - "\tdeadtime fraction : 0.8%\n", - "\n" - ] - } - ], + "outputs": [], "source": [ "print(observations)" ] @@ -292,7 +257,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "2756e72d", "metadata": {}, "outputs": [], @@ -304,19 +269,10 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "1ac8103a", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "[56569.18112859 56569.18112878 56569.18112978 ... 56569.19487702\n", - " 56569.19487703 56569.19487876]\n" - ] - } - ], + "outputs": [], "source": [ "print(times)" ] @@ -346,18 +302,18 @@ "\n", "In the following, we will use an ephemeris file for the Crab provided by Fermi-LAT, see [Kerr, M.; Ray, P. S.; et al; 2015](https://arxiv.org/abs/1510.05099). This ephemeris file for the Crab pulsar can be found alongside other pulsar ephemeris files at this [confluence page]( https://confluence.slac.stanford.edu/display/GLAMCOG/LAT+Gamma-ray+Pulsar+Timing+Models). \n", "\n", - "However, be aware that most of these ephemeris files are not up-to-date. Therefore they could give bad results on the phase computation. In particular, one should always checked that the MJD of the observations one wants to phased lies between the `START`and `FINISH`entry of the ephemeris file." + "However, be aware that most of these ephemeris files are not up-to-date. Therefore they could give bad results on the phase computation. In particular, one should always checked that the MJD of the observations one wants to phased lies between the `START`and `FINISH`entry of the ephemeris file (see next section)." ] }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "d4f89ba4", "metadata": {}, "outputs": [], "source": [ "# Path to the ephemeris file\n", - "ephemeris_file = \"./0534+2200_ApJ_708_1254_2010.par\"" + "ephemeris_file = \"0534+2200_ApJ_708_1254_2010.par\"" ] }, { @@ -365,7 +321,9 @@ "id": "52eb3086", "metadata": {}, "source": [ - "Note that sometimes one needs to change some of the parameters of the ephemeris file that are not used in gamma-ray astronomy by hand. For instance, here we have removed the 'JUMP' line since it does not have any effect in our computation and raise an error in PINT. The ephemeris file provided with this notebook does not have this line. " + "Note that *Fermi*-LAT ephemeris file are created primarily by and for [Tempo2](https://www.pulsarastronomy.net/pulsar/software/tempo2). Most of the time, using such ephemeris file with PINT will not raise any issues. However, in a few cases, PINT does not support feature from Tempo2. \n", + "\n", + "In our case, an error occur when using the ephemeris file with PINT. This is due to the `JUMP` line. In order to proceed, one as to either comment (with #) or remove this line. Note that this line is not important for gamma-ray instrument, so it is totally fine to ignore it." ] }, { @@ -394,50 +352,10 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "d24e1c92", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "\u001b[32m2024-06-13 23:55:31.812\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.models.absolute_phase\u001b[0m:\u001b[36mvalidate\u001b[0m:\u001b[36m74\u001b[0m - \u001b[1mTZRFRQ was 0.0 or None. Setting to infinite frequency.\u001b[0m\n", - "/Users/mregeard/anaconda3/envs/pulsar_recipe/lib/python3.11/site-packages/pint/models/model_builder.py:228: UserWarning: Unrecognized parfile line 'EPHVER 5'\n", - " warnings.warn(f\"Unrecognized parfile line '{p_line}'\", UserWarning)\n", - "\u001b[32m2024-06-13 23:55:31.815\u001b[0m | \u001b[33m\u001b[1mWARNING \u001b[0m | \u001b[36mpint.models.model_builder\u001b[0m:\u001b[36m__call__\u001b[0m:\u001b[36m232\u001b[0m - \u001b[33m\u001b[1mUNITS is not specified. Assuming TDB...\u001b[0m\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "AstrometryEquatorial(\n", - " MJDParameter( POSEPOCH 50739.0000000000000000 (d) frozen=True),\n", - " floatParameter( PX 0.0 (mas) frozen=True),\n", - " AngleParameter( RAJ 5:34:31.94000000 (hourangle) frozen=True),\n", - " AngleParameter( DECJ 22:00:52.10000000 (deg) frozen=True),\n", - " floatParameter( PMRA -11.8 (mas / yr) +/- 1.0 mas / yr frozen=True),\n", - " floatParameter( PMDEC 4.4 (mas / yr) +/- 1.0 mas / yr frozen=True))\n", - "SolarSystemShapiro(\n", - " boolParameter( PLANET_SHAPIRO N frozen=True))\n", - "DispersionDM(\n", - " floatParameter( DM 56.785579397589822356 (pc / cm3) frozen=True),\n", - " floatParameter( DM1 0.031279168349770640344 (pc / (yr cm3)) frozen=True),\n", - " MJDParameter( DMEPOCH 55107.8071585532816240 (d) frozen=True))\n", - "AbsPhase(\n", - " MJDParameter( TZRMJD 55638.1552775999516551 (d) frozen=True),\n", - " strParameter( TZRSITE coe frozen=True),\n", - " floatParameter( TZRFRQ inf (MHz) frozen=True))\n", - "Spindown(\n", - " floatParameter( F0 29.716913767510206412 (Hz) +/- 7.440760185772888e-08 Hz frozen=True),\n", - " MJDParameter( PEPOCH 55555.0000000000000000 (d) frozen=True),\n", - " floatParameter( F1 -3.7105744257791078768e-10 (Hz / s) +/- 7.182646367277094e-16 Hz / s frozen=True),\n", - " floatParameter( F2 1.1633675551229037574e-20 (Hz / s2) +/- 2.487306981530037e-23 Hz / s2 frozen=True),\n", - " floatParameter( F3 -8.6724769747827286635e-31 (Hz / s3) +/- 0.0 Hz / s3 frozen=True))\n" - ] - } - ], + "outputs": [], "source": [ "model = pmodels.get_model(ephemeris_file)\n", "print(model.components[\"AstrometryEquatorial\"])\n", @@ -452,7 +370,69 @@ "id": "0f8cd0d8", "metadata": {}, "source": [ - "There are multiple parameters such as the name of the source, the interval of validity of the model (START to FINISH), the frequencies of rotation and its derivatives (F0,F1,F2). There are other additional parameters that can be checked in the [PINT documentation](https://nanograv-pint.readthedocs.io)" + "There are multiple parameters such as the name of the source, the frequencies of rotation and its derivatives (F0,F1,F2), the dispersion measure, etc. There are other additional parameters that can be checked in the [PINT documentation](https://nanograv-pint.readthedocs.io). To get the complete set of parameter of the ephemeris file, one can simply print the model:\n", + "`print(model)`" + ] + }, + { + "cell_type": "markdown", + "id": "f02f0ca5-09f2-44d4-ad76-518f8964b6a1", + "metadata": {}, + "source": [ + "As said above, we should make sure that the time of the observation lies within the ephemeris time definition. In our example, we only have one run, so we can check that manually:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2584b571-93a9-4fb6-b8e2-60b8810190f6", + "metadata": {}, + "outputs": [], + "source": [ + "print(f\"Ephemeris time definition:\\n{model.START.value} - {model.FINISH.value}\")\n", + "print(f\"Observation time definition:\\n{observation.tstart} - {observation.tstop}\")" + ] + }, + { + "cell_type": "markdown", + "id": "86041174-5ec4-43ba-9035-cf567b47a3bb", + "metadata": {}, + "source": [ + "In the case you have several observations, if you know that they are sorted by time, you can manually check for the start time of the first observation and the stop time of the last one. Otherwise, you can build a small function such as the following one:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8838ee6c-5b53-4d34-8fd7-94d32daa6bb3", + "metadata": {}, + "outputs": [], + "source": [ + "def check_time(observation, timing_model):\n", + " \"\"\"\n", + " Check that the observation time lies within the time definition of the pulsar\n", + " timing model.\n", + "\n", + " Parameters\n", + " ----------\n", + " observation: `gammapy.data.Observation`\n", + " Observation to check.\n", + " timing_model: `pint.models.TimingModel`\n", + " The timing model that will be used.\n", + " \"\"\"\n", + " model_time = Time([model.START.value, model.FINISH.value], scale=\"tt\", format='mjd')\n", + " if (model_time[0].value > observation.tstart.tt.mjd) or (model_time[1].value < observation.tstop.tt.mjd):\n", + " log.warning(f\"Warning: Observation time of observation {observation.obs_id} goes out of timing model validity time.\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0d37e6cc-2cae-4192-87d9-88d52216e83f", + "metadata": {}, + "outputs": [], + "source": [ + "check_time(observation, model)" ] }, { @@ -465,35 +445,10 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "a145cdde", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "\u001b[32m2024-06-13 23:55:38.408\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m1362\u001b[0m - \u001b[34m\u001b[1mNo pulse number flags found in the TOAs\u001b[0m\n", - "\u001b[32m2024-06-13 23:55:38.418\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mapply_clock_corrections\u001b[0m:\u001b[36m2204\u001b[0m - \u001b[34m\u001b[1mApplying clock corrections (include_gps = False, include_bipm = False)\u001b[0m\n", - "\u001b[32m2024-06-13 23:55:38.824\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.observatory.topo_obs\u001b[0m:\u001b[36mclock_corrections\u001b[0m:\u001b[36m365\u001b[0m - \u001b[1mObservatory magic requires no clock corrections.\u001b[0m\n", - "\u001b[32m2024-06-13 23:55:40.732\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2255\u001b[0m - \u001b[34m\u001b[1mComputing TDB columns.\u001b[0m\n", - "\u001b[32m2024-06-13 23:55:40.733\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2276\u001b[0m - \u001b[34m\u001b[1mUsing EPHEM = DE421 for TDB calculation.\u001b[0m\n", - "\u001b[32m2024-06-13 23:55:41.481\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2354\u001b[0m - \u001b[34m\u001b[1mComputing PosVels of observatories and Earth, using DE421\u001b[0m\n", - "\u001b[32m2024-06-13 23:55:42.269\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.solar_system_ephemerides\u001b[0m:\u001b[36m_load_kernel_link\u001b[0m:\u001b[36m55\u001b[0m - \u001b[1mSet solar system ephemeris to de421 from download\u001b[0m\n", - "\u001b[32m2024-06-13 23:55:43.362\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2407\u001b[0m - \u001b[34m\u001b[1mSSB obs pos [1.47007462e+11 2.56889811e+10 1.11245045e+10] m\u001b[0m\n", - "\u001b[32m2024-06-13 23:55:44.083\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.solar_system_ephemerides\u001b[0m:\u001b[36m_load_kernel_link\u001b[0m:\u001b[36m55\u001b[0m - \u001b[1mSet solar system ephemeris to de421 from download\u001b[0m\n", - "\u001b[32m2024-06-13 23:55:44.112\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2421\u001b[0m - \u001b[34m\u001b[1mAdding columns ssb_obs_pos ssb_obs_vel obs_sun_pos\u001b[0m\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "CPU times: user 4.73 s, sys: 53.3 ms, total: 4.79 s\n", - "Wall time: 6.18 s\n" - ] - } - ], + "outputs": [], "source": [ "%%time\n", "\n", @@ -528,30 +483,10 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "id": "6fbf3ad9", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "\u001b[32m2024-06-13 23:55:50.651\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.models.glitch\u001b[0m:\u001b[36mglitch_phase\u001b[0m:\u001b[36m213\u001b[0m - \u001b[34m\u001b[1mGlitch phase for glitch 1: 0.0 \u001b[0m\n", - "\u001b[32m2024-06-13 23:55:50.673\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.models.absolute_phase\u001b[0m:\u001b[36mget_TZR_toa\u001b[0m:\u001b[36m98\u001b[0m - \u001b[34m\u001b[1mCreating and dealing with the single TZR_toa for absolute phase\u001b[0m\n", - "\u001b[32m2024-06-13 23:55:50.675\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36m__init__\u001b[0m:\u001b[36m1362\u001b[0m - \u001b[34m\u001b[1mNo pulse number flags found in the TOAs\u001b[0m\n", - "\u001b[32m2024-06-13 23:55:50.675\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mapply_clock_corrections\u001b[0m:\u001b[36m2204\u001b[0m - \u001b[34m\u001b[1mApplying clock corrections (include_gps = False, include_bipm = False)\u001b[0m\n", - "\u001b[32m2024-06-13 23:55:50.676\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2255\u001b[0m - \u001b[34m\u001b[1mComputing TDB columns.\u001b[0m\n", - "\u001b[32m2024-06-13 23:55:50.677\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_TDBs\u001b[0m:\u001b[36m2276\u001b[0m - \u001b[34m\u001b[1mUsing EPHEM = DE421 for TDB calculation.\u001b[0m\n", - "\u001b[32m2024-06-13 23:55:50.679\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2354\u001b[0m - \u001b[34m\u001b[1mComputing PosVels of observatories and Earth, using DE421\u001b[0m\n", - "\u001b[32m2024-06-13 23:55:51.261\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.solar_system_ephemerides\u001b[0m:\u001b[36m_load_kernel_link\u001b[0m:\u001b[36m55\u001b[0m - \u001b[1mSet solar system ephemeris to de421 from download\u001b[0m\n", - "\u001b[32m2024-06-13 23:55:51.281\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2407\u001b[0m - \u001b[34m\u001b[1mSSB obs pos [-1.49278181e+08 7.07659442e+06 3.07113250e+06] km\u001b[0m\n", - "\u001b[32m2024-06-13 23:55:51.871\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36mpint.solar_system_ephemerides\u001b[0m:\u001b[36m_load_kernel_link\u001b[0m:\u001b[36m55\u001b[0m - \u001b[1mSet solar system ephemeris to de421 from download\u001b[0m\n", - "\u001b[32m2024-06-13 23:55:51.888\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.toa\u001b[0m:\u001b[36mcompute_posvels\u001b[0m:\u001b[36m2421\u001b[0m - \u001b[34m\u001b[1mAdding columns ssb_obs_pos ssb_obs_vel obs_sun_pos\u001b[0m\n", - "\u001b[32m2024-06-13 23:55:51.893\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.models.absolute_phase\u001b[0m:\u001b[36mget_TZR_toa\u001b[0m:\u001b[36m121\u001b[0m - \u001b[34m\u001b[1mDone with TZR_toa\u001b[0m\n", - "\u001b[32m2024-06-13 23:55:51.941\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mpint.models.glitch\u001b[0m:\u001b[36mglitch_phase\u001b[0m:\u001b[36m213\u001b[0m - \u001b[34m\u001b[1mGlitch phase for glitch 1: 0.0 \u001b[0m\n" - ] - } - ], + "outputs": [], "source": [ "# Compute phases\n", "phases = model.phase(toas, abs_phase=True)[1]\n", @@ -578,7 +513,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "id": "735ac718", "metadata": {}, "outputs": [], @@ -589,71 +524,10 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "id": "f3269a2c", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
Table length=11189\n", - "
\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "
EVENT_IDTIMERADECENERGY
sdegdegTeV
int64float64float32float32float32
2402333778852.509924984.5945722.030880.18194601
2408333778852.526715384.2146223.449140.08397394
2434333778852.6131505483.52470422.7257920.10596932
2445333778852.669014283.7695722.4510060.19733498
2478333778852.762793983.47851623.4845940.08522219
2481333778852.777854983.7151721.9851151.0020943
2513333778852.864446782.42119622.5676520.14374068
2544333778852.982606483.6413622.0413150.10316629
2559333778853.026941484.06917622.973370.047184493
...............
356223333780039.460049284.1161522.5575050.08110082
356227333780039.4710536683.4153421.673440.2096362
356242333780039.517909583.5516522.7729850.17672835
356282333780039.6299751484.4613321.693570.05068718
356473333780040.338647984.4544121.1598280.1831569
356478333780040.354892683.6833623.4449880.06305169
356485333780040.374132284.3351721.283380.060539745
356486333780040.375515984.8588622.1162220.123453744
356526333780040.5247600784.8692921.2909160.13630114
" - ], - "text/plain": [ - "\n", - "EVENT_ID TIME RA DEC ENERGY \n", - " s deg deg TeV \n", - " int64 float64 float32 float32 float32 \n", - "-------- ------------------ --------- --------- -----------\n", - " 2402 333778852.5099249 84.59457 22.03088 0.18194601\n", - " 2408 333778852.5267153 84.21462 23.44914 0.08397394\n", - " 2434 333778852.61315054 83.524704 22.725792 0.10596932\n", - " 2445 333778852.6690142 83.76957 22.451006 0.19733498\n", - " 2478 333778852.7627939 83.478516 23.484594 0.08522219\n", - " 2481 333778852.7778549 83.71517 21.985115 1.0020943\n", - " 2513 333778852.8644467 82.421196 22.567652 0.14374068\n", - " 2544 333778852.9826064 83.64136 22.041315 0.10316629\n", - " 2559 333778853.0269414 84.069176 22.97337 0.047184493\n", - " ... ... ... ... ...\n", - " 356223 333780039.4600492 84.11615 22.557505 0.08110082\n", - " 356227 333780039.47105366 83.41534 21.67344 0.2096362\n", - " 356242 333780039.5179095 83.55165 22.772985 0.17672835\n", - " 356282 333780039.62997514 84.46133 21.69357 0.05068718\n", - " 356473 333780040.3386479 84.45441 21.159828 0.1831569\n", - " 356478 333780040.3548926 83.68336 23.444988 0.06305169\n", - " 356485 333780040.3741322 84.33517 21.28338 0.060539745\n", - " 356486 333780040.3755159 84.85886 22.116222 0.123453744\n", - " 356526 333780040.52476007 84.86929 21.290916 0.13630114" - ] - }, - "execution_count": 24, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "# Show original table\n", "table" @@ -661,7 +535,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "id": "6fc6024c", "metadata": {}, "outputs": [], @@ -680,71 +554,10 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "id": "7f29187e", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
Table length=11189\n", - "
\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "
EVENT_IDTIMERADECENERGYPHASE
sdegdegTeV
int64float64float32float32float32float64
2402333778852.509924984.5945722.030880.181946010.39349195931383935
2408333778852.526715384.2146223.449140.083973940.8919526790064667
2434333778852.6131505483.52470422.7257920.105969320.4579789031294724
2445333778852.669014283.7695722.4510060.197334980.11641860219368935
2478333778852.762793983.47851623.4845940.085222190.9004806857711186
2481333778852.777854983.7151721.9851151.00209430.3476011689926769
2513333778852.864446782.42119622.5676520.143740680.9182740999289545
2544333778852.982606483.6413622.0413150.103166290.42611249421537956
2559333778853.026941484.06917622.973370.0471844930.7422975122115125
..................
356223333780039.460049284.1161522.5575050.081100820.6914920486374702
356227333780039.4710536683.4153421.673440.20963620.018183944316962984
356242333780039.517909583.5516522.7729850.176728350.40920620046641115
356282333780039.6299751484.4613321.693570.050687180.7361270955486778
356473333780040.338647984.4544121.1598280.18315690.7746789518818565
356478333780040.354892683.6833623.4449880.063051690.2569398572226654
356485333780040.374132284.3351721.283380.0605397450.8281109722104576
356486333780040.375515984.8588622.1162220.1234537440.8691881135544401
356526333780040.5247600784.8692921.2909160.136301140.29983901925054285
" - ], - "text/plain": [ - "\n", - "EVENT_ID TIME RA DEC ENERGY PHASE \n", - " s deg deg TeV \n", - " int64 float64 float32 float32 float32 float64 \n", - "-------- ------------------ --------- --------- ----------- --------------------\n", - " 2402 333778852.5099249 84.59457 22.03088 0.18194601 0.39349195931383935\n", - " 2408 333778852.5267153 84.21462 23.44914 0.08397394 0.8919526790064667\n", - " 2434 333778852.61315054 83.524704 22.725792 0.10596932 0.4579789031294724\n", - " 2445 333778852.6690142 83.76957 22.451006 0.19733498 0.11641860219368935\n", - " 2478 333778852.7627939 83.478516 23.484594 0.08522219 0.9004806857711186\n", - " 2481 333778852.7778549 83.71517 21.985115 1.0020943 0.3476011689926769\n", - " 2513 333778852.8644467 82.421196 22.567652 0.14374068 0.9182740999289545\n", - " 2544 333778852.9826064 83.64136 22.041315 0.10316629 0.42611249421537956\n", - " 2559 333778853.0269414 84.069176 22.97337 0.047184493 0.7422975122115125\n", - " ... ... ... ... ... ...\n", - " 356223 333780039.4600492 84.11615 22.557505 0.08110082 0.6914920486374702\n", - " 356227 333780039.47105366 83.41534 21.67344 0.2096362 0.018183944316962984\n", - " 356242 333780039.5179095 83.55165 22.772985 0.17672835 0.40920620046641115\n", - " 356282 333780039.62997514 84.46133 21.69357 0.05068718 0.7361270955486778\n", - " 356473 333780040.3386479 84.45441 21.159828 0.1831569 0.7746789518818565\n", - " 356478 333780040.3548926 83.68336 23.444988 0.06305169 0.2569398572226654\n", - " 356485 333780040.3741322 84.33517 21.28338 0.060539745 0.8281109722104576\n", - " 356486 333780040.3755159 84.85886 22.116222 0.123453744 0.8691881135544401\n", - " 356526 333780040.52476007 84.86929 21.290916 0.13630114 0.29983901925054285" - ] - }, - "execution_count": 26, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "# Show table with phases\n", "table" @@ -770,62 +583,17 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": null, "id": "af220557", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "OrderedDict([('EXTNAME', 'EVENTS'),\n", - " ('HDUCLASS', 'GADF'),\n", - " ('HDUDOC',\n", - " 'https://github.com/open-gamma-ray-astro/gamma-astro-data-formats'),\n", - " ('HDUVERS', '0.2'),\n", - " ('HDUCLAS1', 'EVENTS'),\n", - " ('OBS_ID', 5029747),\n", - " ('TSTART', 333778852.435217),\n", - " ('TSTOP', 333780040.546979),\n", - " ('ONTIME', 1188.111761868),\n", - " ('LIVETIME', 1178.06621791733),\n", - " ('DEADC', 0.991545),\n", - " ('EQUINOX', 2000.0),\n", - " ('RADECSYS', 'FK5'),\n", - " ('ORIGIN', 'MAGIC Collaboration'),\n", - " ('TELESCOP', 'MAGIC'),\n", - " ('INSTRUME', 'MAGIC stereo'),\n", - " ('CREATOR', 'MAGIC_DL3'),\n", - " ('VERSION', '0.1.8'),\n", - " ('MJDREFI', 52706),\n", - " ('MJDREFF', 0.0),\n", - " ('TIMEUNIT', 's'),\n", - " ('TIMESYS', 'UTC'),\n", - " ('TIMEREF', 'local'),\n", - " ('OBJECT', 'CrabNebula'),\n", - " ('RA_OBJ', 83.63333),\n", - " ('DEC_OBJ', 22.01444),\n", - " ('OBS_MODE', 'POINTING'),\n", - " ('RA_PNT', 83.98333),\n", - " ('DEC_PNT', 22.24389),\n", - " ('GEOLON', -17.89),\n", - " ('GEOLAT', 28.761944),\n", - " ('ALTITUDE', 2231.28),\n", - " ('ALT_PNT', 69.69974),\n", - " ('AZ_PNT', 103.8848)])" - ] - }, - "execution_count": 27, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "table.meta" ] }, { "cell_type": "code", - "execution_count": 28, + "execution_count": null, "id": "c2285fcd", "metadata": {}, "outputs": [], @@ -868,18 +636,10 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": null, "id": "8c866a5c", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "COLUMN_PHASE: PHASE; PINT_VERS: 1.0; GAMMAPY_VERS: 1.2; EPHEM_FILE: ./0534+2200_ApJ_708_1254_2010.par; PSRJ :J0534+2200; START: 54686.1526259; FINISH: 56583.1591704; TZRMJD: 55638.155277599951656; TZRSITE: coe; TZRFREQ: inf; EPHEM: DE405; EPHEM_RA: 5.575538888888889; EPHEM_DEC: 22.01447222222222; PHASE_OFFSET: default = 0; DATE: 60474.9143641169;\n" - ] - } - ], + "outputs": [], "source": [ "phase_log = get_log(ephemeris_file=ephemeris_file, phase_column_name=\"PHASE\")\n", "print(phase_log)" @@ -887,7 +647,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": null, "id": "5a3e56d2", "metadata": {}, "outputs": [], @@ -898,57 +658,10 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": null, "id": "f6b44e25", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "OrderedDict([('EXTNAME', 'EVENTS'),\n", - " ('HDUCLASS', 'GADF'),\n", - " ('HDUDOC',\n", - " 'https://github.com/open-gamma-ray-astro/gamma-astro-data-formats'),\n", - " ('HDUVERS', '0.2'),\n", - " ('HDUCLAS1', 'EVENTS'),\n", - " ('OBS_ID', 5029747),\n", - " ('TSTART', 333778852.435217),\n", - " ('TSTOP', 333780040.546979),\n", - " ('ONTIME', 1188.111761868),\n", - " ('LIVETIME', 1178.06621791733),\n", - " ('DEADC', 0.991545),\n", - " ('EQUINOX', 2000.0),\n", - " ('RADECSYS', 'FK5'),\n", - " ('ORIGIN', 'MAGIC Collaboration'),\n", - " ('TELESCOP', 'MAGIC'),\n", - " ('INSTRUME', 'MAGIC stereo'),\n", - " ('CREATOR', 'MAGIC_DL3'),\n", - " ('VERSION', '0.1.8'),\n", - " ('MJDREFI', 52706),\n", - " ('MJDREFF', 0.0),\n", - " ('TIMEUNIT', 's'),\n", - " ('TIMESYS', 'UTC'),\n", - " ('TIMEREF', 'local'),\n", - " ('OBJECT', 'CrabNebula'),\n", - " ('RA_OBJ', 83.63333),\n", - " ('DEC_OBJ', 22.01444),\n", - " ('OBS_MODE', 'POINTING'),\n", - " ('RA_PNT', 83.98333),\n", - " ('DEC_PNT', 22.24389),\n", - " ('GEOLON', -17.89),\n", - " ('GEOLAT', 28.761944),\n", - " ('ALTITUDE', 2231.28),\n", - " ('ALT_PNT', 69.69974),\n", - " ('AZ_PNT', 103.8848),\n", - " ('PH_LOG',\n", - " 'COLUMN_PHASE: PHASE; PINT_VERS: 1.0; GAMMAPY_VERS: 1.2; EPHEM_FILE: ./0534+2200_ApJ_708_1254_2010.par; PSRJ :J0534+2200; START: 54686.1526259; FINISH: 56583.1591704; TZRMJD: 55638.155277599951656; TZRSITE: coe; TZRFREQ: inf; EPHEM: DE405; EPHEM_RA: 5.575538888888889; EPHEM_DEC: 22.01447222222222; PHASE_OFFSET: default = 0; DATE: 60474.9143641169;')])" - ] - }, - "execution_count": 31, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "table.meta" ] @@ -963,20 +676,10 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": null, "id": "12545bff", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "'THETA' axis is stored as a scalar -- converting to 1D array.\n", - "'THETA' axis is stored as a scalar -- converting to 1D array.\n", - "'THETA' axis is stored as a scalar -- converting to 1D array.\n" - ] - } - ], + "outputs": [], "source": [ "# Create new event list and add it to observation object\n", "new_event_list = EventList(table)\n", @@ -985,71 +688,10 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": null, "id": "1ac16c51", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
Table length=11189\n", - "
\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "
EVENT_IDTIMERADECENERGYPHASE
sdegdegTeV
int64float64float32float32float32float64
2402333778852.509924984.5945722.030880.181946010.39349195931383935
2408333778852.526715384.2146223.449140.083973940.8919526790064667
2434333778852.6131505483.52470422.7257920.105969320.4579789031294724
2445333778852.669014283.7695722.4510060.197334980.11641860219368935
2478333778852.762793983.47851623.4845940.085222190.9004806857711186
2481333778852.777854983.7151721.9851151.00209430.3476011689926769
2513333778852.864446782.42119622.5676520.143740680.9182740999289545
2544333778852.982606483.6413622.0413150.103166290.42611249421537956
2559333778853.026941484.06917622.973370.0471844930.7422975122115125
..................
356223333780039.460049284.1161522.5575050.081100820.6914920486374702
356227333780039.4710536683.4153421.673440.20963620.018183944316962984
356242333780039.517909583.5516522.7729850.176728350.40920620046641115
356282333780039.6299751484.4613321.693570.050687180.7361270955486778
356473333780040.338647984.4544121.1598280.18315690.7746789518818565
356478333780040.354892683.6833623.4449880.063051690.2569398572226654
356485333780040.374132284.3351721.283380.0605397450.8281109722104576
356486333780040.375515984.8588622.1162220.1234537440.8691881135544401
356526333780040.5247600784.8692921.2909160.136301140.29983901925054285
" - ], - "text/plain": [ - "\n", - "EVENT_ID TIME RA DEC ENERGY PHASE \n", - " s deg deg TeV \n", - " int64 float64 float32 float32 float32 float64 \n", - "-------- ------------------ --------- --------- ----------- --------------------\n", - " 2402 333778852.5099249 84.59457 22.03088 0.18194601 0.39349195931383935\n", - " 2408 333778852.5267153 84.21462 23.44914 0.08397394 0.8919526790064667\n", - " 2434 333778852.61315054 83.524704 22.725792 0.10596932 0.4579789031294724\n", - " 2445 333778852.6690142 83.76957 22.451006 0.19733498 0.11641860219368935\n", - " 2478 333778852.7627939 83.478516 23.484594 0.08522219 0.9004806857711186\n", - " 2481 333778852.7778549 83.71517 21.985115 1.0020943 0.3476011689926769\n", - " 2513 333778852.8644467 82.421196 22.567652 0.14374068 0.9182740999289545\n", - " 2544 333778852.9826064 83.64136 22.041315 0.10316629 0.42611249421537956\n", - " 2559 333778853.0269414 84.069176 22.97337 0.047184493 0.7422975122115125\n", - " ... ... ... ... ... ...\n", - " 356223 333780039.4600492 84.11615 22.557505 0.08110082 0.6914920486374702\n", - " 356227 333780039.47105366 83.41534 21.67344 0.2096362 0.018183944316962984\n", - " 356242 333780039.5179095 83.55165 22.772985 0.17672835 0.40920620046641115\n", - " 356282 333780039.62997514 84.46133 21.69357 0.05068718 0.7361270955486778\n", - " 356473 333780040.3386479 84.45441 21.159828 0.1831569 0.7746789518818565\n", - " 356478 333780040.3548926 83.68336 23.444988 0.06305169 0.2569398572226654\n", - " 356485 333780040.3741322 84.33517 21.28338 0.060539745 0.8281109722104576\n", - " 356486 333780040.3755159 84.85886 22.116222 0.123453744 0.8691881135544401\n", - " 356526 333780040.52476007 84.86929 21.290916 0.13630114 0.29983901925054285" - ] - }, - "execution_count": 33, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "new_obs.events.table" ] @@ -1074,28 +716,17 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": null, "id": "f3c8410c", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "PosixPath('/Users/mregeard/Workspace/dev/code/gammapy/gammapy-data/magic/rad_max/data')" - ] - }, - "execution_count": 34, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "data_store.hdu_table.base_dir" ] }, { "cell_type": "code", - "execution_count": 35, + "execution_count": null, "id": "8fd2ce31", "metadata": {}, "outputs": [], @@ -1112,39 +743,20 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": null, "id": "e6e38fc1", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'/Users/mregeard/Workspace/dev/code/gammapy/gammapy-data/magic/rad_max/data/pulsar_events_file/'" - ] - }, - "execution_count": 36, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "output_path" ] }, { "cell_type": "code", - "execution_count": 49, + "execution_count": null, "id": "f339c797", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Writing output file in /Users/mregeard/Workspace/dev/code/gammapy/gammapy-data/magic/rad_max/data/pulsar_events_file/dl3_pulsar_5029747.fits.gz\n" - ] - } - ], + "outputs": [], "source": [ "# Save the observation object in the specified file_path\n", "print(\"Writing output file in \" + str(file_path))\n", @@ -1163,51 +775,10 @@ }, { "cell_type": "code", - "execution_count": 50, + "execution_count": null, "id": "4b8dd431", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
HDUIndexTable length=10\n", - "
\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "
OBS_IDHDU_TYPEHDU_CLASSFILE_DIRFILE_NAMEHDU_NAME
int64bytes30bytes30bytes100bytes50bytes30
5029748eventsevents./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsEVENTS
5029748gtigti./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsGTI
5029748rad_maxrad_max_2d./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsRAD_MAX
5029748aeffaeff_2d./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsEFFECTIVE AREA
5029748edispedisp_2d./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsENERGY DISPERSION
5029747eventsevents./20131004_05029747_DL3_CrabNebula-W0.40+035.fitsEVENTS
5029747gtigti./20131004_05029747_DL3_CrabNebula-W0.40+035.fitsGTI
5029747rad_maxrad_max_2d./20131004_05029747_DL3_CrabNebula-W0.40+035.fitsRAD_MAX
5029747aeffaeff_2d./20131004_05029747_DL3_CrabNebula-W0.40+035.fitsEFFECTIVE AREA
5029747edispedisp_2d./20131004_05029747_DL3_CrabNebula-W0.40+035.fitsENERGY DISPERSION
" - ], - "text/plain": [ - "\n", - " OBS_ID HDU_TYPE ... HDU_NAME \n", - " int64 bytes30 ... bytes30 \n", - "------- -------- ... -----------------\n", - "5029748 events ... EVENTS\n", - "5029748 gti ... GTI\n", - "5029748 rad_max ... RAD_MAX\n", - "5029748 aeff ... EFFECTIVE AREA\n", - "5029748 edisp ... ENERGY DISPERSION\n", - "5029747 events ... EVENTS\n", - "5029747 gti ... GTI\n", - "5029747 rad_max ... RAD_MAX\n", - "5029747 aeff ... EFFECTIVE AREA\n", - "5029747 edisp ... ENERGY DISPERSION" - ] - }, - "execution_count": 50, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "# Print the current data store HDU table.\n", "new_hdu = data_store.hdu_table.copy()\n", @@ -1216,7 +787,7 @@ }, { "cell_type": "code", - "execution_count": 57, + "execution_count": null, "id": "6f37e101", "metadata": {}, "outputs": [], @@ -1229,51 +800,10 @@ }, { "cell_type": "code", - "execution_count": 58, + "execution_count": null, "id": "d89a7739", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
HDUIndexTable length=10\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "
OBS_IDHDU_TYPEHDU_CLASSFILE_DIRFILE_NAMEHDU_NAME
int64bytes30bytes30bytes100bytes50bytes30
5029748eventsevents./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsEVENTS
5029748gtigti./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsGTI
5029748rad_maxrad_max_2d./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsRAD_MAX
5029748aeffaeff_2d./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsEFFECTIVE AREA
5029748edispedisp_2d./20131004_05029748_DL3_CrabNebula-W0.40+215.fitsENERGY DISPERSION
5029747eventsevents./pulsar_events_file/dl3_pulsar_5029747.fits.gzEVENTS
5029747gtigti./20131004_05029747_DL3_CrabNebula-W0.40+035.fitsGTI
5029747rad_maxrad_max_2d./20131004_05029747_DL3_CrabNebula-W0.40+035.fitsRAD_MAX
5029747aeffaeff_2d./20131004_05029747_DL3_CrabNebula-W0.40+035.fitsEFFECTIVE AREA
5029747edispedisp_2d./20131004_05029747_DL3_CrabNebula-W0.40+035.fitsENERGY DISPERSION
" - ], - "text/plain": [ - "\n", - " OBS_ID HDU_TYPE ... HDU_NAME \n", - " int64 bytes30 ... bytes30 \n", - "------- -------- ... -----------------\n", - "5029748 events ... EVENTS\n", - "5029748 gti ... GTI\n", - "5029748 rad_max ... RAD_MAX\n", - "5029748 aeff ... EFFECTIVE AREA\n", - "5029748 edisp ... ENERGY DISPERSION\n", - "5029747 events ... EVENTS\n", - "5029747 gti ... GTI\n", - "5029747 rad_max ... RAD_MAX\n", - "5029747 aeff ... EFFECTIVE AREA\n", - "5029747 edisp ... ENERGY DISPERSION" - ] - }, - "execution_count": 58, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "new_hdu" ] @@ -1296,7 +826,7 @@ }, { "cell_type": "code", - "execution_count": 53, + "execution_count": null, "id": "b1633cd5", "metadata": {}, "outputs": [], @@ -1332,33 +862,22 @@ }, { "cell_type": "code", - "execution_count": 54, + "execution_count": null, "id": "88a0e9c1", "metadata": {}, "outputs": [], "source": [ "pulsar_datastore = DataStore.from_dir(\n", - " DL3_direc, hdu_table_filename=\"hdu-index-pulsar.fits.gz\"\n", + " DL3_dir, hdu_table_filename=\"hdu-index-pulsar.fits.gz\"\n", ")" ] }, { "cell_type": "code", - "execution_count": 55, + "execution_count": null, "id": "f7c60c18", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "['events', 'gti', 'aeff', 'edisp', 'rad_max']" - ] - }, - "execution_count": 55, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "observations = pulsar_datastore.get_observations(\n", " [5029747], required_irf=\"point-like\"\n", @@ -1368,71 +887,10 @@ }, { "cell_type": "code", - "execution_count": 56, + "execution_count": null, "id": "4ae8ebd2", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
Table length=11189\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "
EVENT_IDTIMERADECENERGYPHASE
sdegdegTeV
int64float64float32float32float32float64
2402333778852.509924984.5945722.030880.181946010.39349195931383935
2408333778852.526715384.2146223.449140.083973940.8919526790064667
2434333778852.6131505483.52470422.7257920.105969320.4579789031294724
2445333778852.669014283.7695722.4510060.197334980.11641860219368935
2478333778852.762793983.47851623.4845940.085222190.9004806857711186
2481333778852.777854983.7151721.9851151.00209430.3476011689926769
2513333778852.864446782.42119622.5676520.143740680.9182740999289545
2544333778852.982606483.6413622.0413150.103166290.42611249421537956
2559333778853.026941484.06917622.973370.0471844930.7422975122115125
..................
356223333780039.460049284.1161522.5575050.081100820.6914920486374702
356227333780039.4710536683.4153421.673440.20963620.018183944316962984
356242333780039.517909583.5516522.7729850.176728350.40920620046641115
356282333780039.6299751484.4613321.693570.050687180.7361270955486778
356473333780040.338647984.4544121.1598280.18315690.7746789518818565
356478333780040.354892683.6833623.4449880.063051690.2569398572226654
356485333780040.374132284.3351721.283380.0605397450.8281109722104576
356486333780040.375515984.8588622.1162220.1234537440.8691881135544401
356526333780040.5247600784.8692921.2909160.136301140.29983901925054285
" - ], - "text/plain": [ - "\n", - "EVENT_ID TIME RA DEC ENERGY PHASE \n", - " s deg deg TeV \n", - " int64 float64 float32 float32 float32 float64 \n", - "-------- ------------------ --------- --------- ----------- --------------------\n", - " 2402 333778852.5099249 84.59457 22.03088 0.18194601 0.39349195931383935\n", - " 2408 333778852.5267153 84.21462 23.44914 0.08397394 0.8919526790064667\n", - " 2434 333778852.61315054 83.524704 22.725792 0.10596932 0.4579789031294724\n", - " 2445 333778852.6690142 83.76957 22.451006 0.19733498 0.11641860219368935\n", - " 2478 333778852.7627939 83.478516 23.484594 0.08522219 0.9004806857711186\n", - " 2481 333778852.7778549 83.71517 21.985115 1.0020943 0.3476011689926769\n", - " 2513 333778852.8644467 82.421196 22.567652 0.14374068 0.9182740999289545\n", - " 2544 333778852.9826064 83.64136 22.041315 0.10316629 0.42611249421537956\n", - " 2559 333778853.0269414 84.069176 22.97337 0.047184493 0.7422975122115125\n", - " ... ... ... ... ... ...\n", - " 356223 333780039.4600492 84.11615 22.557505 0.08110082 0.6914920486374702\n", - " 356227 333780039.47105366 83.41534 21.67344 0.2096362 0.018183944316962984\n", - " 356242 333780039.5179095 83.55165 22.772985 0.17672835 0.40920620046641115\n", - " 356282 333780039.62997514 84.46133 21.69357 0.05068718 0.7361270955486778\n", - " 356473 333780040.3386479 84.45441 21.159828 0.1831569 0.7746789518818565\n", - " 356478 333780040.3548926 83.68336 23.444988 0.06305169 0.2569398572226654\n", - " 356485 333780040.3741322 84.33517 21.28338 0.060539745 0.8281109722104576\n", - " 356486 333780040.3755159 84.85886 22.116222 0.123453744 0.8691881135544401\n", - " 356526 333780040.52476007 84.86929 21.290916 0.13630114 0.29983901925054285" - ] - }, - "execution_count": 56, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "observations[0].events.table" ] @@ -1469,14 +927,6 @@ "\n", "Recipe made by [Alvaros Mas](https://github.com/alvmas), [Maxime Regeard](https://github.com/MRegeard), [Jan Lukas Schubert](https://github.com/jalu98)." ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "17b4f370-f3f6-4c5b-ba09-2d3a329def54", - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { From 8241cfda25e088ae4626a876e10f7551ddd8c22c Mon Sep 17 00:00:00 2001 From: Maxime Regeard Date: Fri, 28 Jun 2024 22:56:13 +0200 Subject: [PATCH 4/9] kirsty comments Co-authored-by: Astro-Kirsty --- .../pulsar_phase_computation.ipynb | 47 +++++++++---------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/recipes/pulsar_phase/pulsar_phase_computation.ipynb b/recipes/pulsar_phase/pulsar_phase_computation.ipynb index d83fe6a..b657a81 100644 --- a/recipes/pulsar_phase/pulsar_phase_computation.ipynb +++ b/recipes/pulsar_phase/pulsar_phase_computation.ipynb @@ -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,7 +51,7 @@ "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-pint-environment.yml`\n", @@ -108,7 +108,7 @@ "id": "81ae3a58", "metadata": {}, "source": [ - "And we also need some imports from PINT:" + "We also need some imports from PINT:" ] }, { @@ -135,7 +135,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" ] }, { @@ -146,8 +146,7 @@ "outputs": [], "source": [ "# Define the directory containing the DL3 data\n", - "DL3_dir = \"$GAMMAPY_DATA/magic/rad_max/data\"\n", - "DL3_dir = \"/Users/mregeard/Workspace/dev/code/gammapy/gammapy-data/magic/rad_max/data/\"" + "DL3_dir = \"$GAMMAPY_DATA/magic/rad_max/data\"" ] }, { @@ -282,7 +281,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." ] }, { @@ -298,11 +297,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 (see next section)." + "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 phased lies between the `START`and `FINISH`entries of the ephemeris file (see next section)." ] }, { @@ -321,9 +320,9 @@ "id": "52eb3086", "metadata": {}, "source": [ - "Note that *Fermi*-LAT ephemeris file are created primarily by and for [Tempo2](https://www.pulsarastronomy.net/pulsar/software/tempo2). Most of the time, using such ephemeris file with PINT will not raise any issues. However, in a few cases, PINT does not support feature from Tempo2. \n", + "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 occur when using the ephemeris file with PINT. This is due to the `JUMP` line. In order to proceed, one as to either comment (with #) or remove this line. Note that this line is not important for gamma-ray instrument, so it is totally fine to ignore it." + "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." ] }, { @@ -370,7 +369,7 @@ "id": "0f8cd0d8", "metadata": {}, "source": [ - "There are multiple parameters such as the name of the source, the frequencies of rotation and its derivatives (F0,F1,F2), the dispersion measure, etc. There are other additional parameters that can be checked in the [PINT documentation](https://nanograv-pint.readthedocs.io). To get the complete set of parameter of the ephemeris file, one can simply print the model:\n", + "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 parameter from the ephemeris file, one can simply print the model:\n", "`print(model)`" ] }, @@ -379,7 +378,7 @@ "id": "f02f0ca5-09f2-44d4-ad76-518f8964b6a1", "metadata": {}, "source": [ - "As said above, we should make sure that the time of the observation lies within the ephemeris time definition. In our example, we only have one run, so we can check that manually:" + "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:" ] }, { @@ -398,7 +397,7 @@ "id": "86041174-5ec4-43ba-9035-cf567b47a3bb", "metadata": {}, "source": [ - "In the case you have several observations, if you know that they are sorted by time, you can manually check for the start time of the first observation and the stop time of the last one. Otherwise, you can build a small function such as the following one:" + "If you have several observations that they are sorted by time, you can manually check for the start time of the first observation and the stop time of the last one. Otherwise, you can create a small function like the following one:" ] }, { @@ -452,7 +451,7 @@ "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", @@ -478,7 +477,7 @@ "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." ] }, { @@ -576,9 +575,9 @@ "id": "ea9ba223", "metadata": {}, "source": [ - "At this point, we also want to add meta data to the table. It is very useful to keep track of what has been done to the file. For instance, if we have multiple pulsars in the same file, we want to be able to know quickly which column correspond to which pulsar. Moreover, experience shows that one often use different ephemeris file for the same pulsar. Therefore, it is very useful to have several phase columns in the same file and to be able to know which column correspond to which ephemeris file, parameters, etc.\n", + "At this point, we also want to add metadata to the table. It is very useful to keep track of what has been done to the file. For instance, if a file contains multiple pulsars, we want identify quickly which column corresponds to each pulsar. Moreover, experience has shown that it is common to have different ephemeris files for the same pulsar. Therefore, it is useful to have several phase columns in the same file to easily identify which column corresponds to each ephemeris file, parameters, etc.\n", "\n", - "Since there is not yet a \"standard\" format for such metadata, we propose a template for the essential informations that one wants to save in the header of the event file. First, we look at the present meta info on the table." + "Since there is currently no \"standard\" format for such metadata, we propose a template for the essential information that one wants to save in the header of the event file. First, we look at the present meta info on the table." ] }, { @@ -709,9 +708,9 @@ "id": "e369d2dc", "metadata": {}, "source": [ - "In the following, we show how to write the files in a directory contained in the original datastore directory. This follows the logic of DL3 data store and facilitate the manipulation of the HDU table.\n", + "In the following, we show how to write the files in a directory contained in the original datastore directory. This follows the logic of DL3 data store and facilitates the manipulation of the HDU table.\n", "\n", - "If one does not want to save the events files and directly perform the pulsar analysis, this step is not required as well as the step of the meta data handling. However, be aware that for large dataset, the computation of phases can take tens of minutes. " + "If you do not want to save the events files bur rather directly perform the pulsar analysis, you can skip both this step and the step of the handling metadata. However, be aware that for large datasets, the computation of the phases can take tens of minutes." ] }, { @@ -821,7 +820,7 @@ "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." ] }, { @@ -841,7 +840,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.**" ] }, { @@ -857,7 +856,7 @@ "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 :" ] }, { @@ -916,7 +915,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)." ] }, { From d5c817bc3f12b595ac4658e5346e95deb62efd91 Mon Sep 17 00:00:00 2001 From: Atreyee Sinha Date: Mon, 1 Jul 2024 16:07:34 +0200 Subject: [PATCH 5/9] Update recipes/pulsar_phase/pulsar_phase_computation.ipynb --- recipes/pulsar_phase/pulsar_phase_computation.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/pulsar_phase/pulsar_phase_computation.ipynb b/recipes/pulsar_phase/pulsar_phase_computation.ipynb index b657a81..13974c7 100644 --- a/recipes/pulsar_phase/pulsar_phase_computation.ipynb +++ b/recipes/pulsar_phase/pulsar_phase_computation.ipynb @@ -301,7 +301,7 @@ "\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, 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 phased lies between the `START`and `FINISH`entries of the ephemeris file (see next section)." + "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)." ] }, { From 11fb3725bdc8be34577ed13f72e0c9f47fcedd5f Mon Sep 17 00:00:00 2001 From: REGEARD Maxime <108189156+MRegeard@users.noreply.github.com> Date: Fri, 12 Jul 2024 20:26:08 +0200 Subject: [PATCH 6/9] Regis comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Régis Terrier --- recipes/pulsar_phase/pulsar_phase_computation.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/pulsar_phase/pulsar_phase_computation.ipynb b/recipes/pulsar_phase/pulsar_phase_computation.ipynb index 13974c7..d406f9c 100644 --- a/recipes/pulsar_phase/pulsar_phase_computation.ipynb +++ b/recipes/pulsar_phase/pulsar_phase_computation.ipynb @@ -301,7 +301,7 @@ "\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, 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)." + "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)." ] }, { From d2d931ca0adaec2c55f9c31e961918c346ea4519 Mon Sep 17 00:00:00 2001 From: REGEARD Maxime <108189156+MRegeard@users.noreply.github.com> Date: Fri, 12 Jul 2024 20:26:21 +0200 Subject: [PATCH 7/9] Regis comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Régis Terrier --- recipes/pulsar_phase/pulsar_phase_computation.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/pulsar_phase/pulsar_phase_computation.ipynb b/recipes/pulsar_phase/pulsar_phase_computation.ipynb index d406f9c..cd5f22c 100644 --- a/recipes/pulsar_phase/pulsar_phase_computation.ipynb +++ b/recipes/pulsar_phase/pulsar_phase_computation.ipynb @@ -369,7 +369,7 @@ "id": "0f8cd0d8", "metadata": {}, "source": [ - "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 parameter from the ephemeris file, one can simply print the model:\n", + "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)`" ] }, From a10c3e8cd33826966278cb4781b2a5549e41695b Mon Sep 17 00:00:00 2001 From: REGEARD Maxime <108189156+MRegeard@users.noreply.github.com> Date: Fri, 12 Jul 2024 20:26:36 +0200 Subject: [PATCH 8/9] Regis comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Régis Terrier --- recipes/pulsar_phase/pulsar_phase_computation.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/pulsar_phase/pulsar_phase_computation.ipynb b/recipes/pulsar_phase/pulsar_phase_computation.ipynb index cd5f22c..1e0d2f2 100644 --- a/recipes/pulsar_phase/pulsar_phase_computation.ipynb +++ b/recipes/pulsar_phase/pulsar_phase_computation.ipynb @@ -397,7 +397,7 @@ "id": "86041174-5ec4-43ba-9035-cf567b47a3bb", "metadata": {}, "source": [ - "If you have several observations that they are sorted by time, you can manually check for the start time of the first observation and the stop time of the last one. Otherwise, you can create a small function like the following one:" + "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:" ] }, { From 45f4f4b727a508278b5bca102e8d8e31fa4bf985 Mon Sep 17 00:00:00 2001 From: Maxime Regeard Date: Fri, 12 Jul 2024 20:28:49 +0200 Subject: [PATCH 9/9] make expolsed env simlink of env.yaml --- recipes/pulsar_phase/gammapy-pint-environment.yml | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) mode change 100644 => 120000 recipes/pulsar_phase/gammapy-pint-environment.yml diff --git a/recipes/pulsar_phase/gammapy-pint-environment.yml b/recipes/pulsar_phase/gammapy-pint-environment.yml deleted file mode 100644 index dc61ccd..0000000 --- a/recipes/pulsar_phase/gammapy-pint-environment.yml +++ /dev/null @@ -1,12 +0,0 @@ -#Declare your specific environment -name: pulsar-gammapy - -channels: - - conda-forge - -dependencies: - - gammapy=1.2 - - python=3.11 - - pip - - pip: - - pint-pulsar~=1.0 diff --git a/recipes/pulsar_phase/gammapy-pint-environment.yml b/recipes/pulsar_phase/gammapy-pint-environment.yml new file mode 120000 index 0000000..066b96f --- /dev/null +++ b/recipes/pulsar_phase/gammapy-pint-environment.yml @@ -0,0 +1 @@ +env.yml \ No newline at end of file