Note
Go to the end to download the full example code.
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:
Sample TDEs from the default UVEX schedule and keep the ones UVEX detects.
Mask them against the LSST footprints with
in_footprint().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.
Sample and detect TDEs with UVEX#
This follows the end-to-end TDE example: draw a thinned Monte Carlo population, then keep the events detected above \(\mathrm{SNR}=5\) at an observation the schedule actually made.
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.")
Generating events: 0%| | 0/20 [00:00<?, ?bin/s]
Generating events: 0%| | 0/20 [00:00<?, ?bin/s, bin=1/20, type=tde]
Building HEALPix coverage index for (nside=64, order='nested'); this can be slow for a long schedule.
Generating events: 0%| | 0/20 [00:00<?, ?bin/s, bin=1/20, type=tde]
Generating events: 5%|▌ | 1/20 [00:08<02:43, 8.58s/bin, bin=1/20, type=tde]
Generating events: 5%|▌ | 1/20 [00:08<02:43, 8.58s/bin, bin=2/20, type=tde]
Generating events: 10%|█ | 2/20 [00:08<02:34, 8.58s/bin, bin=3/20, type=tde]
Generating events: 15%|█▌ | 3/20 [00:08<00:38, 2.27s/bin, bin=3/20, type=tde]
Generating events: 15%|█▌ | 3/20 [00:08<00:38, 2.27s/bin, bin=4/20, type=tde]
Generating events: 20%|██ | 4/20 [00:08<00:36, 2.27s/bin, bin=5/20, type=tde]
Generating events: 25%|██▌ | 5/20 [00:08<00:17, 1.13s/bin, bin=5/20, type=tde]
Generating events: 25%|██▌ | 5/20 [00:08<00:17, 1.13s/bin, bin=6/20, type=tde]
Generating events: 30%|███ | 6/20 [00:08<00:15, 1.13s/bin, bin=7/20, type=tde]
Generating events: 35%|███▌ | 7/20 [00:08<00:08, 1.47bin/s, bin=7/20, type=tde]
Generating events: 35%|███▌ | 7/20 [00:08<00:08, 1.47bin/s, bin=8/20, type=tde]
Generating events: 40%|████ | 8/20 [00:09<00:08, 1.47bin/s, bin=9/20, type=tde]
Generating events: 45%|████▌ | 9/20 [00:09<00:05, 2.18bin/s, bin=9/20, type=tde]
Generating events: 45%|████▌ | 9/20 [00:09<00:05, 2.18bin/s, bin=10/20, type=tde]
Generating events: 50%|█████ | 10/20 [00:09<00:04, 2.18bin/s, bin=11/20, type=tde]
Generating events: 55%|█████▌ | 11/20 [00:09<00:02, 3.13bin/s, bin=11/20, type=tde]
Generating events: 55%|█████▌ | 11/20 [00:09<00:02, 3.13bin/s, bin=12/20, type=tde]
Generating events: 60%|██████ | 12/20 [00:09<00:02, 3.13bin/s, bin=13/20, type=tde]
Generating events: 65%|██████▌ | 13/20 [00:09<00:01, 4.27bin/s, bin=13/20, type=tde]
Generating events: 65%|██████▌ | 13/20 [00:09<00:01, 4.27bin/s, bin=14/20, type=tde]
Generating events: 70%|███████ | 14/20 [00:09<00:01, 4.27bin/s, bin=15/20, type=tde]
Generating events: 75%|███████▌ | 15/20 [00:09<00:00, 5.60bin/s, bin=15/20, type=tde]
Generating events: 75%|███████▌ | 15/20 [00:09<00:00, 5.60bin/s, bin=16/20, type=tde]
Generating events: 80%|████████ | 16/20 [00:09<00:00, 5.60bin/s, bin=17/20, type=tde]
Generating events: 85%|████████▌ | 17/20 [00:09<00:00, 7.16bin/s, bin=17/20, type=tde]
Generating events: 85%|████████▌ | 17/20 [00:09<00:00, 7.16bin/s, bin=18/20, type=tde]
Generating events: 90%|█████████ | 18/20 [00:09<00:00, 7.16bin/s, bin=19/20, type=tde]
Generating events: 95%|█████████▌| 19/20 [00:09<00:00, 7.16bin/s, bin=20/20, type=tde]
Generating events: 100%|██████████| 20/20 [00:09<00:00, 9.80bin/s, bin=20/20, type=tde]
Generating events: 100%|██████████| 20/20 [00:09<00:00, 2.05bin/s, bin=20/20, type=tde]
Computing epochs: 0%| | 0/2 [00:00<?, ?chunk/s]
Computing epochs: 0%| | 0/2 [00:00<?, ?chunk/s, type=tde]
Computing epochs: 50%|█████ | 1/2 [00:01<00:01, 1.52s/chunk, type=tde]
Computing epochs: 50%|█████ | 1/2 [00:01<00:01, 1.52s/chunk, type=tde]
Computing epochs: 100%|██████████| 2/2 [00:02<00:00, 1.03chunk/s, type=tde]
Computing epochs: 100%|██████████| 2/2 [00:02<00:00, 1.05s/chunk, type=tde]
57000 TDEs sampled, 6120 detected by UVEX.
Mask against the Rubin footprint#
in_footprint() takes a footprint
or its registered name and returns one boolean per event, from a single vectorized MOC lookup.
lsst:combined is everything LSST observes: the main survey plus the deep drilling fields.
in_lsst = detected.in_footprint(lsst_combined_footprint)
n_detected = len(detected) * DOWNSAMPLE
n_overlap = int(in_lsst.sum()) * DOWNSAMPLE
print(f"{n_overlap} of {n_detected} UVEX-detected TDEs ({n_overlap / n_detected:.0%}) are in the LSST footprint.")
4320 of 6120 UVEX-detected TDEs (71%) are in the LSST footprint.
Which LSST region?#
The regions overlap, so the per-region counts need not add up to the total. The wide-fast-deep area carries the best LSST cadence and depth.
regions = {
"Combined": "lsst:combined",
"Wide-fast-deep": "lsst:wfd",
"Galactic plane and bulge": "lsst:galplane",
"North ecliptic spur": "lsst:nes",
"South celestial pole": "lsst:scp",
"Deep drilling fields": "lsst:ddf",
}
counts = {label: int(detected.in_footprint(name).sum()) * DOWNSAMPLE for label, name in regions.items()}
for label, count in counts.items():
print(f"{label:>26}: {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()

Combined: 4320
Wide-fast-deep: 3780
Galactic plane and bulge: 40
North ecliptic spur: 100
South celestial pole: 100
Deep drilling fields: 20
Sky distribution#
The LSST footprint is drawn first, with the detected TDEs on top: those inside it are colored, and those outside are gray.
# 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()

Total running time of the script: (0 minutes 13.210 seconds)