Skip to content

Commit

Permalink
add kilonova score to csv
Browse files Browse the repository at this point in the history
  • Loading branch information
simeonreusch committed May 6, 2023
1 parent dc9dfee commit 85ce3e3
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions nuztf/base_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
from astropy.time import Time
from gwemopt.ztf_tiling import get_quadrant_ipix
from matplotlib.backends.backend_pdf import PdfPages
from tqdm import tqdm
from ztfquery import fields as ztfquery_fields

from nuztf.ampel_api import (
ampel_api_acknowledge_chunk,
ampel_api_cone,
Expand All @@ -41,6 +38,8 @@
from nuztf.observations import get_obs_summary
from nuztf.plot import lightcurve_from_alert
from nuztf.utils import cosmo
from tqdm import tqdm
from ztfquery import fields as ztfquery_fields

DEBUG = False
RATELIMIT_CALLS = 10
Expand Down Expand Up @@ -551,14 +550,25 @@ def create_overview_table(self, outfile=None):
mags = []
crossmatches = []

data = {"ztf_id": [], "RA": [], "Dec": [], "mag": [], "xmatch": []}
data = {
"ztf_id": [],
"RA": [],
"Dec": [],
"mag": [],
"xmatch": [],
"kilonova_score": [],
}

for ztf_id, alert in tqdm(sorted(self.cache.items())):
data["ztf_id"].append(ztf_id)
data["RA"].append(alert["candidate"]["ra"])
data["Dec"].append(alert["candidate"]["dec"])
data["mag"].append(alert["candidate"]["magpsf"])
data["xmatch"].append(get_cross_match_info(raw=alert, logger=self.logger))
if alert.get("kilonova_eval") is not None:
data["kilonova_score"].append(alert["kilonova_eval"]["kilonovaness"])
else:
data["kilonova_score"].append(None)

df = pandas.DataFrame.from_dict(data)

Expand Down

0 comments on commit 85ce3e3

Please sign in to comment.