Cut: Limiting Magnitude#

filter_by_limiting_magnitude() is the cheapest of the cuts: no schedule, no noise model, just “could this event, at its brightest sampled phase, ever clear a fixed magnitude limit?” It is meant to run first, on a freshly sampled catalog, before anything schedule-aware.

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.transients.supernovae import MagnetarSLSNe
from uvex_transients.utils.plotting import resolve_fig_axes, set_plot_style

set_plot_style()

schedule = get_schedule()
slsn = MagnetarSLSNe()
simulator = SurveySimulator(schedule, transients={"slsn": slsn}, simulation_seed=42)

Sampling a population#

A freshly sampled catalog, with no screening applied yet.

TIME_BINS = 10
NSIDE = 32
DOWNSAMPLE = 50

catalog = simulator.generate_events(time_bins=TIME_BINS, nside=NSIDE, sampling_factor=1 / DOWNSAMPLE)
print(f"Sampled {len(catalog) * DOWNSAMPLE} SLSNe across {TIME_BINS} time bin(s) at NSIDE={NSIDE}.")
Generating events:   0%|          | 0/10 [00:00<?, ?bin/s]
Generating events:   0%|          | 0/10 [00:00<?, ?bin/s, bin=1/10, type=slsn]

Building HEALPix coverage index for (nside=32, order='nested'); this can be slow for a long schedule.

Generating events:   0%|          | 0/10 [00:00<?, ?bin/s, bin=1/10, type=slsn]
Generating events:  10%|█         | 1/10 [00:07<01:07,  7.48s/bin, bin=1/10, type=slsn]
Generating events:  10%|█         | 1/10 [00:07<01:07,  7.48s/bin, bin=2/10, type=slsn]
Generating events:  20%|██        | 2/10 [00:07<00:59,  7.48s/bin, bin=3/10, type=slsn]
Generating events:  30%|███       | 3/10 [00:07<00:52,  7.48s/bin, bin=4/10, type=slsn]
Generating events:  40%|████      | 4/10 [00:07<00:08,  1.45s/bin, bin=4/10, type=slsn]
Generating events:  40%|████      | 4/10 [00:07<00:08,  1.45s/bin, bin=5/10, type=slsn]
Generating events:  50%|█████     | 5/10 [00:07<00:07,  1.45s/bin, bin=6/10, type=slsn]
Generating events:  60%|██████    | 6/10 [00:07<00:05,  1.45s/bin, bin=7/10, type=slsn]
Generating events:  70%|███████   | 7/10 [00:07<00:02,  1.45bin/s, bin=7/10, type=slsn]
Generating events:  70%|███████   | 7/10 [00:07<00:02,  1.45bin/s, bin=8/10, type=slsn]
Generating events:  80%|████████  | 8/10 [00:07<00:01,  1.45bin/s, bin=9/10, type=slsn]
Generating events:  90%|█████████ | 9/10 [00:07<00:00,  1.45bin/s, bin=10/10, type=slsn]
Generating events: 100%|██████████| 10/10 [00:07<00:00,  2.46bin/s, bin=10/10, type=slsn]
Generating events: 100%|██████████| 10/10 [00:07<00:00,  1.28bin/s, bin=10/10, type=slsn]
Sampled 28550 SLSNe across 10 time bin(s) at NSIDE=32.

Comparing magnitude limits#

Stricter limits keep fewer events. n_visits raises the bar further: an event must clear the limit at more than one sampled phase, not just momentarily.

mag_limits = [22.0, 23.5, 25.0]
counts = []
for mag_limit in mag_limits:
    kept = simulator.filter_by_limiting_magnitude(catalog, uvex, mag_limit=mag_limit)
    counts.append(len(kept) * DOWNSAMPLE)
    print(f"mag_limit={mag_limit}: {len(kept) * DOWNSAMPLE} survive.")

strict_kept = simulator.filter_by_limiting_magnitude(catalog, uvex, mag_limit=25.0, n_visits=3)
print(f"mag_limit=25.0, n_visits=3: {len(strict_kept) * DOWNSAMPLE} survive.")
Filtering by mag limit:   0%|          | 0/1 [00:00<?, ?chunk/s]
Filtering by mag limit:   0%|          | 0/1 [00:00<?, ?chunk/s, chunk=1/1, type=slsn]
Filtering by mag limit: 100%|██████████| 1/1 [00:00<00:00,  9.72chunk/s, chunk=1/1, type=slsn]
Filtering by mag limit: 100%|██████████| 1/1 [00:00<00:00,  9.70chunk/s, chunk=1/1, type=slsn]
mag_limit=22.0: 6250 survive.

Filtering by mag limit:   0%|          | 0/1 [00:00<?, ?chunk/s]
Filtering by mag limit:   0%|          | 0/1 [00:00<?, ?chunk/s, chunk=1/1, type=slsn]
Filtering by mag limit: 100%|██████████| 1/1 [00:00<00:00,  9.73chunk/s, chunk=1/1, type=slsn]
Filtering by mag limit: 100%|██████████| 1/1 [00:00<00:00,  9.71chunk/s, chunk=1/1, type=slsn]
mag_limit=23.5: 14050 survive.

Filtering by mag limit:   0%|          | 0/1 [00:00<?, ?chunk/s]
Filtering by mag limit:   0%|          | 0/1 [00:00<?, ?chunk/s, chunk=1/1, type=slsn]
Filtering by mag limit: 100%|██████████| 1/1 [00:00<00:00,  5.67chunk/s, chunk=1/1, type=slsn]
Filtering by mag limit: 100%|██████████| 1/1 [00:00<00:00,  5.67chunk/s, chunk=1/1, type=slsn]
mag_limit=25.0: 19700 survive.

Filtering by mag limit:   0%|          | 0/1 [00:00<?, ?chunk/s]
Filtering by mag limit:   0%|          | 0/1 [00:00<?, ?chunk/s, chunk=1/1, type=slsn]
Filtering by mag limit: 100%|██████████| 1/1 [00:00<00:00,  9.68chunk/s, chunk=1/1, type=slsn]
Filtering by mag limit: 100%|██████████| 1/1 [00:00<00:00,  9.65chunk/s, chunk=1/1, type=slsn]
mag_limit=25.0, n_visits=3: 18950 survive.

The falling survival count#

fig, ax = resolve_fig_axes(fig_size=(6, 4))
ax.bar([str(m) for m in mag_limits], counts, color="#4C72B0")
ax.set_yscale("log")
ax.set_xlabel("Magnitude limit (AB)")
ax.set_ylabel("Events surviving")
ax.set_title("Effect of the limiting-magnitude cut")
fig.tight_layout()
plt.show()
Effect of the limiting-magnitude cut

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

Gallery generated by Sphinx-Gallery