.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "report/full_run/event_detection/plot_detected_yields.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_report_full_run_event_detection_plot_detected_yields.py: Expected Detections =================== How many events of each transient type does UVEX detect, and how repeatable are those detections? An event is **detected** if the survey observes its position after it explodes and, in at least one observation, its signal-to-noise ratio exceeds 5 in at least one band. An event whose only such observation is the first-ever visit to that field is not counted, since there is no reference image to detect it against. No further selection is made here: this is the upper bound on what can be studied, and the :ref:`characterization pages ` apply the cuts that bring it down. Everything on this page is read from the event summary table of the latest release, through :class:`~uvex_transients.utils.summary_report.SummaryReport`. .. GENERATED FROM PYTHON SOURCE LINES 16-34 .. code-block:: Python import numpy as np from uvex_transients.simulation.rates import estimate_yield from uvex_transients.utils.plotting import set_plot_style from uvex_transients.utils.summary_report import POPULATION_GROUPS, STANDARD_POPULATIONS, SummaryReport import matplotlib.pyplot as plt set_plot_style() try: report = SummaryReport.from_release(STANDARD_POPULATIONS) except (ConnectionError, LookupError, OSError, ValueError) as err: report = None print(f"Skipping this page's analysis, the release data is not available: {err}") else: print(f"{len(report.summary):,} detected events in the release's summary table.") .. rst-class:: sphx-glr-script-out .. code-block:: none 12,291 detected events in the release's summary table. .. GENERATED FROM PYTHON SOURCE LINES 35-49 Expected detections per type ----------------------------- The summary table has one row per Monte Carlo event that UVEX detects. One such event stands for :math:`\mu_0 / n` real ones, with :math:`n` the number generated and :math:`\mu_0` the number that exist in UVEX's footprint and observing window, so the expected number of detections is :math:`\mu_0 k / n` for :math:`k` detected events (:func:`~uvex_transients.simulation.rates.estimate_yield`). The black error bars are the Monte Carlo uncertainty on :math:`k / n`, a Clopper-Pearson interval from the finite number of events generated. The pale band is the uncertainty on the event rate, which scales every bar by the same factor and does not shrink as more events are generated. A type with no detected events has only an upper limit. Types are never summed, since that would mix independent Monte Carlo errors with a shared rate uncertainty. .. GENERATED FROM PYTHON SOURCE LINES 49-54 .. code-block:: Python if report is not None: report.plot_yields(mask=report.detected) plt.show() .. image-sg:: /report/full_run/event_detection/images/sphx_glr_plot_detected_yields_001.png :alt: plot detected yields :srcset: /report/full_run/event_detection/images/sphx_glr_plot_detected_yields_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 55-56 The numbers behind the bars, with the fraction of the generated events that is detected: .. GENERATED FROM PYTHON SOURCE LINES 56-65 .. code-block:: Python if report is not None: detected = estimate_yield(report.summary, transient_types=list(report.populations)) detected = detected[[list(detected["transient_type"]).index(key) for key in report.populations]] # plot order detected["transient_type"] = [report.populations[str(key)].label for key in detected["transient_type"]] detected["fraction"].info.format = ".2e" detected["expected_events"].info.format = ",.0f" detected["transient_type", "n_pre_cut", "n_selected", "fraction", "expected_events"].pprint_all() .. rst-class:: sphx-glr-script-out .. code-block:: none transient_type n_pre_cut n_selected fraction expected_events -------------- --------- ---------- -------- --------------- Type Ia 8358 174 2.08e-02 3,548 Type Ib 2678 18 6.72e-03 350 Type Ic 1196 12 1.00e-02 239 Type Ic-BL 730 9 1.23e-02 183 Type IIP 221247 2616 1.18e-02 262,135 Type IIb 188496 414 2.20e-03 16,557 SLSN-I 1270 393 3.09e-01 7,901 TDE 49607 5787 1.17e-01 5,763 llGRB 14063 906 6.44e-02 899 LFBOT 11618 1961 1.69e-01 194 Kilonova 588 1 1.70e-03 0 .. GENERATED FROM PYTHON SOURCE LINES 66-74 How often is each event detected? ---------------------------------- A single detection is a snapshot. An event detected many times has a light curve, which is what classifying it takes. Each panel shows, for the types of one group, the percentage of the detected events that are detected at least :math:`N` times. Every curve starts at 100% at :math:`N = 1`, and the faster it falls the more of the type's detections are one-offs. The number in the legend is the number of Monte Carlo events behind the curve, so a short curve from a few events is noisy. .. GENERATED FROM PYTHON SOURCE LINES 74-80 .. code-block:: Python if report is not None: report.plot_detection_counts(POPULATION_GROUPS, mask=report.detected) plt.show() .. image-sg:: /report/full_run/event_detection/images/sphx_glr_plot_detected_yields_002.png :alt: Type I SNe, Type II SNe, SLSNe, Exotic transients :srcset: /report/full_run/event_detection/images/sphx_glr_plot_detected_yields_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 81-82 Median number of detections per type: .. GENERATED FROM PYTHON SOURCE LINES 82-90 .. code-block:: Python if report is not None: for key, spec in report.populations.items(): n_det = report.n_det[report.detected & (report.types == key)] if n_det.size: print( f"{spec.label:<20s} median {np.median(n_det):>5.0f} 90th percentile {np.percentile(n_det, 90):>6.0f}" ) .. rst-class:: sphx-glr-script-out .. code-block:: none Type Ia median 2 90th percentile 6 Type Ib median 2 90th percentile 5 Type Ic median 2 90th percentile 5 Type Ic-BL median 2 90th percentile 2 Type IIP median 1 90th percentile 4 Type IIb median 1 90th percentile 4 SLSN-I median 2 90th percentile 14 TDE median 2 90th percentile 14 llGRB median 1 90th percentile 3 LFBOT median 2 90th percentile 6 Kilonova median 1 90th percentile 1 .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.662 seconds) .. _sphx_glr_download_report_full_run_event_detection_plot_detected_yields.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_detected_yields.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_detected_yields.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_detected_yields.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_