.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/surveys/plot_tde_rubin_overlap.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_auto_examples_surveys_plot_tde_rubin_overlap.py: UVEX TDEs in the Rubin Footprint ================================ How many of the TDEs UVEX detects also fall where Rubin LSST observes? Those are the ones that can have optical follow-up or pre-discovery data from LSST. We'll: 1. **Sample TDEs from the default UVEX schedule** and keep the ones UVEX detects. 2. **Mask them against the LSST footprints** with :meth:`~uvex_transients.simulation.event_catalog.EventCatalog.in_footprint`. 3. **Count and plot** the overlap. .. note:: Generating the LSST footprints needs the optional ``rubin_scheduler`` package (``pip install "uvex-transients[rubin]"``). The finished MOCs are cached, so later runs don't. .. GENERATED FROM PYTHON SOURCE LINES 20-26 Sample and detect TDEs with UVEX ------------------------------------ This follows :ref:`the end-to-end TDE example `: draw a thinned Monte Carlo population, then keep the events detected above :math:`\mathrm{SNR}=5` at an observation the schedule actually made. .. GENERATED FROM PYTHON SOURCE LINES 26-52 .. code-block:: Python from astropy import units as u from matplotlib import pyplot as plt from uvex_transients.missions import uvex_fast as uvex from uvex_transients.simulation.core import SurveySimulator from uvex_transients.surveys import get_schedule from uvex_transients.surveys.footprints import lsst_combined_footprint from uvex_transients.transients.TDEs import TidalDisruptionEvent from uvex_transients.utils.plotting import get_categorical_colors, plot_footprints, resolve_fig_axes, set_plot_style set_plot_style() schedule = get_schedule() tde = TidalDisruptionEvent() simulator = SurveySimulator(schedule, transients={"tde": tde}, simulation_seed=42) TIME_BINS = 20 NSIDE = 64 DOWNSAMPLE = 20 SNR_THRESHOLD = 5.0 catalog = simulator.generate_events(time_bins=TIME_BINS, nside=NSIDE, sampling_factor=1 / DOWNSAMPLE) detected = simulator.filter_by_snr(catalog, uvex, snr_threshold=SNR_THRESHOLD) print(f"{len(catalog) * DOWNSAMPLE} TDEs sampled, {len(detected) * DOWNSAMPLE} detected by UVEX.") .. rst-class:: sphx-glr-script-out .. code-block:: none Generating events: 0%| | 0/20 [00:0026}: {count}") fig, ax = resolve_fig_axes(fig_size=(8, 4)) labels = list(counts) ax.barh(labels, list(counts.values()), color=get_categorical_colors(1)[0]) ax.invert_yaxis() ax.set_xlabel("UVEX-detected TDEs") ax.set_title("UVEX-detected TDEs by LSST region") for i, count in enumerate(counts.values()): ax.text(count, i, f" {count:,}", va="center") fig.tight_layout() .. image-sg:: /auto_examples/surveys/images/sphx_glr_plot_tde_rubin_overlap_001.png :alt: UVEX-detected TDEs by LSST region :srcset: /auto_examples/surveys/images/sphx_glr_plot_tde_rubin_overlap_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none Combined: 4320 Wide-fast-deep: 3780 Galactic plane and bulge: 40 North ecliptic spur: 100 South celestial pole: 100 Deep drilling fields: 20 .. GENERATED FROM PYTHON SOURCE LINES 95-100 Sky distribution --------------------- The LSST footprint is drawn first, with the detected TDEs on top: those inside it are colored, and those outside are gray. .. GENERATED FROM PYTHON SOURCE LINES 100-118 .. code-block:: Python # sphinx_gallery_thumbnail_number = 2 fig, ax = plot_footprints({"LSST (combined)": lsst_combined_footprint}, colors=["#cfe0f5"], fig_size=(10, 6.5)) for mask, color, label in ( (~in_lsst, "#888888", "Outside LSST"), (in_lsst, "#eb6834", "Inside LSST"), ): coord = detected.coord[mask] ax.scatter( coord.ra.wrap_at(180 * u.deg).radian, coord.dec.radian, s=6, color=color, label=f"{label} ({int(mask.sum()) * DOWNSAMPLE})", ) ax.legend(loc="lower right", markerscale=3) ax.set_title("UVEX-detected TDEs and the Rubin LSST footprint") plt.show() .. image-sg:: /auto_examples/surveys/images/sphx_glr_plot_tde_rubin_overlap_002.png :alt: UVEX-detected TDEs and the Rubin LSST footprint :srcset: /auto_examples/surveys/images/sphx_glr_plot_tde_rubin_overlap_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 13.210 seconds) .. _sphx_glr_download_auto_examples_surveys_plot_tde_rubin_overlap.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_tde_rubin_overlap.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_tde_rubin_overlap.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_tde_rubin_overlap.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_