Commit 9ab90078 authored by Brandon Piotrzkowski's avatar Brandon Piotrzkowski

Get preferred external event from em_type

parent 81592980
Pipeline #84609 passed with stages
in 4 minutes
......@@ -17,6 +17,9 @@
- Get p_astro and em_bright files from the superevent instead of the
preferred event in order to accomodate PE-based results.
- Get the preferred external event from 'em_type' field in superevent,
if no value grab first external event.
## 1.1.2 (2019-09-25)
- Remove check that sky map has `public` and `sky_loc` tags in order to
......
......@@ -199,15 +199,18 @@ def compose_raven(gracedb_id, authors=(),
superevent_far = preferred_event['far']
gpstime = float(preferred_event['gpstime'])
for em_event_id in event['em_events']:
em_event = client.event(em_event_id).json()
em_event_gpstime = float(em_event['gpstime'])
external_pipeline = em_event['pipeline']
# FIXME in GraceDb: Even SNEWS triggers have an extra attribute GRB.
external_trigger_id = em_event['extra_attributes']['GRB']['trigger_id']
snews = (em_event['search'] == 'Supernova')
grb = em_event['search'] in ['GRB', 'SubGRB']
subthreshold = (em_event['search'] == 'SubGRB')
try:
em_event_id = event['em_type']
except KeyError:
em_event_id = event['em_events'][0]
em_event = client.event(em_event_id).json()
em_event_gpstime = float(em_event['gpstime'])
external_pipeline = em_event['pipeline']
# FIXME in GraceDb: Even SNEWS triggers have an extra attribute GRB.
external_trigger_id = em_event['extra_attributes']['GRB']['trigger_id']
snews = (em_event['search'] == 'Supernova')
grb = em_event['search'] in ['GRB', 'SubGRB']
subthreshold = (em_event['search'] == 'SubGRB')
o = urllib.parse.urlparse(client.service_url)
kwargs = dict(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment