Update tutorials/pulsar_analysis.ipynb
"metadata": {},
"outputs": [],
"source": [
- "from regions import CircleSkyRegion\n",
+ "from gammapy.utils.regions import SphericalCircleSkyRegion\n",
"from astropy.coordinates import SkyCoord\n",
"import astropy.units as u\n",
"\n",
"source": [
"pos_target = SkyCoord(ra=128.836 * u.deg, dec=-45.176 * u.deg, frame=\"icrs\")\n",
"on_radius = 0.2 * u.deg\n",
+ "on_region = SphericalCircleSkyRegion(pos_target, on_radius)\n",
"\n",
"# Apply angular selection\n",
- "events_vela = obs_list_vela[0].events.select_sky_cone(\n",
- " center=pos_target, radius=on_radius\n",
- ")\n",
+ "events_vela = obs_list_vela[0].events.select_region(on_region)\n",
"print(events_vela)"
]
},
"metadata": {},
"outputs": [],
"source": [
- "# Defining an on-region around the pulsar to pass it to the background estimator\n",
- "on_region = CircleSkyRegion(pos_target, on_radius)\n",
- "\n",
"# The PhaseBackgroundEstimator uses the OFF-phase in the ON-region to estimate the background\n",
"bkg_estimator = PhaseBackgroundEstimator(\n",
" observations=obs_list_vela,\n",
"source": [
"This tutorial suffers a bit from the lack of statistics: there were 9 Vela observations in the CTA DC1 while there is only one here. When done on the 9 observations, the spectral analysis is much better agreement between the input model and the gammapy fit."
]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
}
],
"metadata": {
