Open In Colab

Signal Generation#

This notebook demonstrates the generation of a core-collapse supernova signal using the staccato package. We present both the python and the command-line application protocal interfaces (APIs) to generate the signal.

%load_ext autoreload
%autoreload 2
%matplotlib inline
! pip install starccato -q
[notice] A new release of pip is available: 23.1.2 -> 24.0
[notice] To update, run: /Library/Developer/CommandLineTools/usr/bin/python3 -m pip install --upgrade pip

Python API#

import matplotlib.pyplot as plt
from starccato import generate_signals

signals = generate_signals(n=10000)
Downloading default weights...: 100%|██████████| 48.0M/48.0M [00:08<00:00, 5.38MiB/s]
2024-05-13 00:13:32.146 | INFO     | starccato.utils:generate_signals:61 - Generated 10000 signals [10.35s].
from starccato.plotting import overplot_signals

fig = overplot_signals(signals, color="k", alpha=0.02)
fig.axes[0].set_axis_off()
fig.axes[0].grid(False)
mean_signal = signals.mean(axis=0)
plt.plot(mean_signal, c="k", lw=2)
# transparent background when saving
fig.savefig(
    "signal_generation.png", bbox_inches="tight", transparent=True, dpi=500
)
_ = fig.suptitle("Stellar Core Collapse Signals [GAN-Generated]")
_images/57c12687457e570ca0b3b47c63a77e2afe61fb265c936711326a5eb5fe1f881d.png