Skip to content
Snippets Groups Projects

HIGH_PROFILE label for RRT

Compare and
1 file
+ 50
0
Compare changes
  • Side-by-side
  • Inline
+ 50
0
from . import gracedb
import json
import tempfile
from ligo.skymap.io import read_sky_map
from ligo.skymap.postprocess.crossmatch import crossmatch
def high_profile_label(em_bright,
pastro,
skymap,
superevent):
superevent_id = superevent['superevent_id']
# condition 1
if 'RAVEN_ALERT' in superevent['labels']:
## code to apply the HIGH PROFILE
# Satisfies condition 1
gracedb.create_label.si('HIGH_PROFILE', superevent_id)
#condition 2
far_dict = {}
gw_events = superevent["gw_events"]
for events in gw_events:
events_dict = gracedb.get_event._orig_run(events).json()
far_dict[events_dict["group"]] = events_dict["far"]
# search for lowest far
if min(far_dict, key=far_dict.get) is "Burst":
## code to apply HIGH PROFILE
# Satisfies condition 2
gracedb.create_label.si('HIGH_PROFILE', superevent_id)
# condition 3
em_bright_dict = json.loads(em_bright)
has_remnant = em_bright_dict['HasRemnant']
pastro_dict = json.loads(pastro)
p_bns = pastro_dict['BNS']
p_terr = pastro_dict['Terrestrial']
p_nsbh = pastro_dict['NSBH']
with tempfile.NamedTemporaryFile(content=skymap) as skymap_file:
gw_skymap = read_sky_map(skymap_file, moc=True)
cl = 90
result = crossmatch(gw_skymap, contours=[cl / 100])
greedy_area = result.contour_areas[0]
Loading