added some comments on SensitivityEstimator usage and a control plot
"source": [
"offset = Angle(\"0.5 deg\")\n",
"\n",
- "energy_reco = np.logspace(-1.8, 1.5, 30) * u.TeV\n",
+ "energy_reco = np.logspace(-1.8, 1.5, 20) * u.TeV\n",
"energy_true = np.logspace(-2, 2, 100) * u.TeV"
]
},
"source": [
"## Compute sensitivity\n",
"\n",
- "Choose a few parameters, then run the sentitivity computation."
+ "We impose a minimal number of expected signal counts of 5 per bin and a minimal significance of 3 per bin. We assume an alpha of 0.2 (ratio between ON and OFF area).\n",
+ "We then run the sensitivity estimator."
]
},
{
"outputs": [],
"source": [
"sensitivity_estimator = SensitivityEstimator(\n",
- " arf=arf, rmf=rmf, bkg=bkg, livetime=\"5h\"\n",
+ " arf=arf, rmf=rmf, bkg=bkg, livetime=\"5h\", gamma_min=5, sigma=3, alpha=0.2\n",
")\n",
"sensitivity_table = sensitivity_estimator.run()"
]
"source": [
"## Results\n",
"\n",
- "The results are given as an Astropy table."
+ "The results are given as an Astropy table. A column criterion allows to distinguish bins where the significance is limited by the signal statistical significance from bins where the sensitivity is limited by the number of signal counts.\n",
+ "This is visible in the plot below."
]
},
{
"plt.legend();"
]
},
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "We add some control plots showing the expected number of background counts per bin and the ON region size cut (here the 68% containment radius of the PSF)."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Plot expected number of counts for signal and background\n",
+ "fig, ax1 = plt.subplots()\n",
+ "# ax1.plot( t[\"energy\"], t[\"excess\"],\"o-\", color=\"red\", label=\"signal\")\n",
+ "ax1.plot(\n",
+ " t[\"energy\"], t[\"background\"], \"o-\", color=\"black\", label=\"blackground\"\n",
+ ")\n",
+ "\n",
+ "ax1.loglog()\n",
+ "ax1.set_xlabel(\"Energy ({})\".format(t[\"energy\"].unit))\n",
+ "ax1.set_ylabel(\"Expected number of bkg counts\")\n",
+ "\n",
+ "ax2 = ax1.twinx()\n",
+ "ax2.set_ylabel(\"ON region radius ({})\".format(on_radii.unit), color=\"red\")\n",
+ "ax2.semilogy(t[\"energy\"], on_radii, color=\"red\", label=\"PSF68\")\n",
+ "ax2.tick_params(axis=\"y\", labelcolor=\"red\")\n",
+ "ax2.set_ylim(0.01, 0.5)"
+ ]
+ },
{
"cell_type": "markdown",
"metadata": {},
