Cut: Baseline#

filter_by_baseline() cuts on the spacing (days) between each event’s own SNR-qualifying detection epochs: min_baseline requires some pair of detections closer together than that; max_baseline requires the full detected span to exceed it. Together they pick out events with both a dense sub-cadence and a long overall baseline, e.g. for light-curve-shape science.

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
SNR_THRESHOLD = 5.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)
detected = simulator.filter_by_snr(mag_filtered, uvex, snr_threshold=SNR_THRESHOLD)
print(f"{len(detected) * DOWNSAMPLE} events detected at all.")
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.47s/bin, bin=1/10, type=slsn]
Generating events:  10%|█         | 1/10 [00:07<01:07,  7.47s/bin, bin=2/10, type=slsn]
Generating events:  20%|██        | 2/10 [00:07<00:59,  7.47s/bin, bin=3/10, type=slsn]
Generating events:  30%|███       | 3/10 [00:07<00:52,  7.47s/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]

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.80chunk/s, chunk=1/1, type=slsn]
Filtering by mag limit: 100%|██████████| 1/1 [00:00<00:00,  9.78chunk/s, chunk=1/1, type=slsn]

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.32chunk/s, type=slsn]
Computing epochs: 100%|██████████| 1/1 [00:00<00:00,  1.31chunk/s, type=slsn]
6750 events detected at all.

Requiring a long, well-sampled baseline#

An event with fewer than 2 qualifying epochs never satisfies min_baseline (there is no gap to compare); one with 0 or 1 never satisfies max_baseline (there is no span).

well_sampled = simulator.filter_by_baseline(
    mag_filtered, uvex, snr_threshold=SNR_THRESHOLD, min_baseline=15.0, max_baseline=100.0
)
print(f"{len(well_sampled) * DOWNSAMPLE} events have a gap < 15 d and a span > 100 d.")
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.45chunk/s, type=slsn]
Computing epochs: 100%|██████████| 1/1 [00:00<00:00,  1.45chunk/s, type=slsn]
100 events have a gap < 15 d and a span > 100 d.

Before and after#

fig, ax = resolve_fig_axes(fig_size=(5, 4))
ax.bar(
    ["Detected", "min<15 d, max>100 d"],
    [len(detected) * DOWNSAMPLE, len(well_sampled) * DOWNSAMPLE],
    color=["#888888", "#4C72B0"],
)
ax.set_yscale("log")
ax.set_ylabel("Events surviving")
ax.set_title("Effect of the baseline cut")
fig.tight_layout()
plt.show()
Effect of the baseline cut

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

Gallery generated by Sphinx-Gallery