Cut: Signal-to-Noise Ratio#

filter_by_snr() asks the real question a magnitude-limit screen can only approximate: over every observation the schedule actually made of an event’s position while it was active, is it ever detected above a given SNR? It is schedule-aware, so it is run after the cheaper filter_by_limiting_magnitude(), not instead of it.

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)

TIME_BINS = 10
NSIDE = 32
DOWNSAMPLE = 50
MAG_LIMIT = 25.0

catalog = simulator.generate_events(time_bins=TIME_BINS, nside=NSIDE, sampling_factor=1 / DOWNSAMPLE)
mag_filtered = simulator.filter_by_limiting_magnitude(catalog, uvex, mag_limit=MAG_LIMIT)
print(f"{len(mag_filtered) * DOWNSAMPLE} could ever clear {MAG_LIMIT} AB mag.")
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.50s/bin, bin=1/10, type=slsn]
Generating events:  10%|█         | 1/10 [00:07<01:07,  7.50s/bin, bin=2/10, type=slsn]
Generating events:  20%|██        | 2/10 [00:07<01:00,  7.50s/bin, bin=3/10, type=slsn]
Generating events:  30%|███       | 3/10 [00:07<00:52,  7.50s/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.44bin/s, bin=7/10, type=slsn]
Generating events:  70%|███████   | 7/10 [00:07<00:02,  1.44bin/s, bin=8/10, type=slsn]
Generating events:  80%|████████  | 8/10 [00:07<00:01,  1.44bin/s, bin=9/10, type=slsn]
Generating events:  90%|█████████ | 9/10 [00:07<00:00,  1.44bin/s, bin=10/10, type=slsn]
Generating events: 100%|██████████| 10/10 [00:07<00:00,  2.45bin/s, bin=10/10, type=slsn]
Generating events: 100%|██████████| 10/10 [00:07<00:00,  1.27bin/s, bin=10/10, type=slsn]

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.75chunk/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]
19700 could ever clear 25.0 AB mag.

Comparing SNR thresholds#

Raising n_visits on top of snr_threshold requires the event to be detected more than once, which is a much stricter, and schedule-real, requirement than filter_by_limiting_magnitude’s own n_visits ever could be.

snr_thresholds = [3.0, 5.0, 10.0]
counts = []
for snr_threshold in snr_thresholds:
    detected = simulator.filter_by_snr(mag_filtered, uvex, snr_threshold=snr_threshold)
    counts.append(len(detected) * DOWNSAMPLE)
    print(f"snr_threshold={snr_threshold}: {len(detected) * DOWNSAMPLE} detected.")

twice_detected = simulator.filter_by_snr(mag_filtered, uvex, snr_threshold=5.0, n_visits=2)
print(f"snr_threshold=5.0, n_visits=2: {len(twice_detected) * DOWNSAMPLE} detected on 2+ visits.")
Computing epochs:   0%|          | 0/1 [00:00<?, ?chunk/s]
Computing epochs:   0%|          | 0/1 [00:00<?, ?chunk/s, type=slsn]
Computing epochs: 100%|██████████| 1/1 [00:00<00:00,  1.35chunk/s, type=slsn]
Computing epochs: 100%|██████████| 1/1 [00:00<00:00,  1.34chunk/s, type=slsn]
snr_threshold=3.0: 8550 detected.

Computing epochs:   0%|          | 0/1 [00:00<?, ?chunk/s]
Computing epochs:   0%|          | 0/1 [00:00<?, ?chunk/s, type=slsn]
Computing epochs: 100%|██████████| 1/1 [00:00<00:00,  1.47chunk/s, type=slsn]
Computing epochs: 100%|██████████| 1/1 [00:00<00:00,  1.46chunk/s, type=slsn]
snr_threshold=5.0: 6750 detected.

Computing epochs:   0%|          | 0/1 [00:00<?, ?chunk/s]
Computing epochs:   0%|          | 0/1 [00:00<?, ?chunk/s, type=slsn]
Computing epochs: 100%|██████████| 1/1 [00:00<00:00,  1.46chunk/s, type=slsn]
Computing epochs: 100%|██████████| 1/1 [00:00<00:00,  1.46chunk/s, type=slsn]
snr_threshold=10.0: 4950 detected.

Computing epochs:   0%|          | 0/1 [00:00<?, ?chunk/s]
Computing epochs:   0%|          | 0/1 [00:00<?, ?chunk/s, type=slsn]
Computing epochs: 100%|██████████| 1/1 [00:00<00:00,  1.44chunk/s, type=slsn]
Computing epochs: 100%|██████████| 1/1 [00:00<00:00,  1.43chunk/s, type=slsn]
snr_threshold=5.0, n_visits=2: 5000 detected on 2+ visits.

The detected count vs. threshold#

fig, ax = resolve_fig_axes(fig_size=(6, 4))
ax.bar([str(s) for s in snr_thresholds], counts, color="#55A868")
ax.set_yscale("log")
ax.set_xlabel("SNR threshold")
ax.set_ylabel("Events detected")
ax.set_title("Effect of the SNR cut")
fig.tight_layout()
plt.show()
Effect of the SNR cut

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

Gallery generated by Sphinx-Gallery