From 9484b0f3c75ab6b9556548d44b9d2aa11e41a0b7 Mon Sep 17 00:00:00 2001 From: moralejo Date: Fri, 24 Nov 2023 11:16:40 +0000 Subject: [PATCH] Addressed reviewer's comments, several small changes for clarity --- .../calculate_sensitivity_from_Crab.ipynb | 44 +++++++------------ 1 file changed, 17 insertions(+), 27 deletions(-) diff --git a/notebooks/calculate_sensitivity_from_Crab.ipynb b/notebooks/calculate_sensitivity_from_Crab.ipynb index 82fa717131..24c9818755 100644 --- a/notebooks/calculate_sensitivity_from_Crab.ipynb +++ b/notebooks/calculate_sensitivity_from_Crab.ipynb @@ -32,9 +32,7 @@ "from ctapipe_io_lst import LSTEventSource\n", "from ctapipe.io import read_table\n", "\n", - "%matplotlib inline\n", - "\n", - "#%load_ext filprofiler" + "%matplotlib inline" ] }, { @@ -99,8 +97,8 @@ "# Assumed (effective) observation time for the calculation (note: it has nothing to do with \n", "# the actual observation time of the sample used for the calculation!):\n", "obs_time = 50 * u.h \n", - "# obs_time = 1/60. * u.h # 1 minute\n", - "# obs_time = 0.083333333 * u.h # 5 minutes\n", + "# obs_time = 1 * u.min\n", + "# obs_time = 5 * u.min\n", "# obs_time = 0.5 * u.h\n", "# obs_time = 0.7 * u.h\n", "# obs_time = 5 * u.h\n", @@ -133,9 +131,16 @@ "# We separate them so that we can optimize the cuts in one and apply them to \n", "# the other (and vice versa)\n", "\n", - "# For source-independent analysis we will use one off region up to 250 GeV. \n", + "# Background estimation:\n", + "# For source-independent analysis, we will use one off region up to 250 GeV. \n", "# Three off regions for higher energies:\n", "first_ebin_with_3offs = 7 # i.e. from ~250 GeV onwards\n", + "# NOTE! This is just what is used to *estimate* the average background in the on-region. \n", + "# For the actual computation of sensitivity, in order to follow the standard definition, \n", + "# we use (Li & Ma's) alpha = 0.2 (define in the cell above), i.e. we assume we can compute \n", + "# the background in a region 5 times larger than the on-region. In practice it is somehow \n", + "# optimistic for a standalone telescope like LST-1, with its limited angular resolution.\n", + "#\n", "\n", "# Intensity cuts:\n", "min_intensity = 50\n", @@ -182,17 +187,6 @@ "norm_range = np.array([[0.1, 0.16], [20., 59.8]]) # deg2 for theta2, deg for Alpha" ] }, - { - "cell_type": "code", - "execution_count": null, - "id": "9574f30b", - "metadata": {}, - "outputs": [], - "source": [ - "sa = LSTEventSource.create_subarray(tel_id=1)\n", - "focal = sa.tel[1].optics.effective_focal_length" - ] - }, { "cell_type": "code", "execution_count": null, @@ -200,6 +194,9 @@ "metadata": {}, "outputs": [], "source": [ + "sa = LSTEventSource.create_subarray(tel_id=1)\n", + "focal = sa.tel[1].optics.effective_focal_length\n", + "\n", "# The source position src_x, src_y (in m), stored in \"source_position\", is calculated by \n", "# lstchain_dl2_add_sourcepos.py using the effective focal length (29.30565 m), which means \n", "# that it is \"consistent\" with the reco values reco_src_x, reco_src_y (which are affected \n", @@ -236,8 +233,6 @@ }, "outputs": [], "source": [ - "#%%filprofile\n", - "\n", "tablename = \"/dl2/event/telescope/parameters/LST_LSTCam\"\n", "livetimes = []\n", "\n", @@ -350,7 +345,6 @@ }, "outputs": [], "source": [ - "#%%filprofile\n", "# Columns to be kept in the case of source-dependent analysis (again, so save memory):\n", "\n", "columns_srcdep = [\"('on', 'expected_src_x')\",\n", @@ -502,8 +496,6 @@ }, "outputs": [], "source": [ - "#%%filprofile\n", - "\n", "# Obtain the cumulative histograms: integrate in gammaness and in theta (or alpha).\n", "\n", "for evtid in range(cum_on_events[0].shape[0]):\n", @@ -685,7 +677,7 @@ "source": [ "#################################################################################################\n", "# #\n", - "# SECOND PART OF THE NOTEBOOK!!! RUN FROM HERE OF YOU JUST WANT TO RE-RUN THE CUT OPTIMIZATION #\n", + "# SECOND PART OF THE NOTEBOOK!!! RUN FROM HERE IF YOU JUST WANT TO RE-RUN THE CUT OPTIMIZATION #\n", "# USING THE SAME DATA SAMPLES! #\n", "# #\n", "##################################################################################################" @@ -715,8 +707,8 @@ "# Assumed (effective) observation time for the calculation (note: it has nothing to do with \n", "# the actual observation time of the sample used for the calculation!):\n", "# obs_time = 50 * u.h \n", - "# obs_time = 1/60. * u.h # 1 minute\n", - "# obs_time = 0.083333333 * u.h # 5 minutes\n", + "# obs_time = 1 * u.min\n", + "# obs_time = 5 * u.min\n", "# obs_time = 0.5 * u.h\n", "# obs_time = 0.7 * u.h\n", "# obs_time = 5 * u.h\n", @@ -849,8 +841,6 @@ "metadata": {}, "outputs": [], "source": [ - "#%%filprofile\n", - "\n", "lima_signi = [[], []]\n", "flux_for_5_sigma = [[], []]\n", "\n",