.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/simulating/plot_cut_baseline.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_simulating_plot_cut_baseline.py: Cut: Baseline ================= :meth:`~uvex_transients.simulation.core.SurveySimulator.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. .. GENERATED FROM PYTHON SOURCE LINES 11-37 .. code-block:: Python 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.") .. rst-class:: sphx-glr-script-out .. code-block:: none Generating events: 0%| | 0/10 [00:00 100 d.") .. rst-class:: sphx-glr-script-out .. code-block:: none Computing epochs: 0%| | 0/1 [00:00 100 d. .. GENERATED FROM PYTHON SOURCE LINES 50-52 Before and after --------------------- .. GENERATED FROM PYTHON SOURCE LINES 52-64 .. code-block:: Python 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() .. image-sg:: /auto_examples/simulating/images/sphx_glr_plot_cut_baseline_001.png :alt: Effect of the baseline cut :srcset: /auto_examples/simulating/images/sphx_glr_plot_cut_baseline_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 10.523 seconds) .. _sphx_glr_download_auto_examples_simulating_plot_cut_baseline.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_cut_baseline.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_cut_baseline.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_cut_baseline.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_