BTSbot
is a multi-modal convolutional neural network for automating supernova identification and follow-up in the Zwicky Transient Facility (ZTF) Bright Transient Survey (BTS).
BTSbot
contributed to the first supernova to be fully automatically discovered, confirmed, classified, and shared. (AstroNote, press release)
Presented at the ML for Astrophysics workshop at ICML 2023 (Extended abstract)
The training set for the production model is available on Zenodo.
Also see this animated walkthrough of the fully-automated BTS workflow
Fig. 5 from Rehemtulla et al. 2024
Start with the usual imports.
import tensorflow as tf
import numpy as np
import pandas as pd
I've experienced weird behavior when training and running inference on the GPU cores of my M1 Mac, so we'll disable them here.
import sys
if sys.platform == "darwin":
tf.config.set_visible_devices([], 'GPU')
Load some example data. It contains alerts from two sources: ZTF23abhvlji (SN 2023tyk, a bright SNIa) and ZTF23abdsfms (AT 2023sxt, an average CV).
cand = pd.read_csv("example_data/usage_candidates.csv", index_col=None)
trips = np.load("example_data/usage_triplets.npy", mmap_mode='r')
These are the metadata columns that the multi-modal BTSbot
uses - order matters!
metadata_cols = [
"sgscore1", "distpsnr1", "sgscore2", "distpsnr2", "fwhm", "magpsf",
"sigmapsf", "chipsf", "ra", "dec", "diffmaglim", "ndethist", "nmtchps",
"age", "days_since_peak", "days_to_peak", "peakmag_so_far", "new_drb",
"ncovhist", "nnotdet", "chinr", "sharpnr", "scorr", "sky", "maxmag_so_far"
]
First, unzip BTSbot
at production_models/v1.0.1.tar.gz
and then proceed with loading it.
BTSbot = tf.keras.models.load_model("production_models/best_model/")
Now run BTSbot
on the example alerts!
raw_preds = BTSbot.predict([trips, cand[metadata_cols]], verbose=1)
Rearrange the scores and compare with the scores I get. You should get a number very close to zero - some minor deviation of scores is normal.
raw_preds = np.transpose(raw_preds)[0]
print(np.median(np.abs(cand['expected_scores'] - raw_preds)))
Now BTSbot
is up and running! If you have access to Kowalski
you can query for new sources to run BTSbot
on using download_training_data()
; if not, see alert_utils()
for functions to process raw triplets and compute metadata features as BTSbot
expects them.
BTSbot
finds nearly all SNe of interest from the input data stream (~100% completeness) with little contamination from uninteresting phenomena (93% purity) and does so as quickly as humans typically do.
Fig. 7 from Rehemtulla et al. 2024
If you use or reference BTSbot
please cite Rehemtulla et al. 2024 (ADS).
BibTeX entry for the BTSbot
paper:
@ARTICLE{Rehemtulla+2024,
author = {{Rehemtulla}, Nabeel and {Miller}, Adam A. and {Jegou Du Laz}, Theophile and {Coughlin}, Michael W. and {Fremling}, Christoffer and {Perley}, Daniel A. and {Qin}, Yu-Jing and {Sollerman}, Jesper and {Mahabal}, Ashish A. and {Laher}, Russ R. and {Riddle}, Reed and {Rusholme}, Ben and {Kulkarni}, Shrinivas R.},
title = "{The Zwicky Transient Facility Bright Transient Survey. III. BTSbot: Automated Identification and Follow-up of Bright Transients with Deep Learning}",
journal = {\apj},
keywords = {Time domain astronomy, Sky surveys, Supernovae, Convolutional neural networks, 2109, 1464, 1668, 1938, Astrophysics - Instrumentation and Methods for Astrophysics},
year = 2024,
month = sep,
volume = {972},
number = {1},
eid = {7},
pages = {7},
doi = {10.3847/1538-4357/ad5666},
archivePrefix = {arXiv},
eprint = {2401.15167},
primaryClass = {astro-ph.IM},
adsurl = {https://ui.adsabs.harvard.edu/abs/2024ApJ...972....7R},
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}