From 799cbf7754bf1344352dcb48e3c74b1dd5a3904c Mon Sep 17 00:00:00 2001 From: Branson Stephens <stephenb@uwm.edu> Date: Tue, 4 Feb 2014 11:05:07 -0600 Subject: [PATCH] Modified translator for CWB events to consume links to the CED and FITS skymap, if available, and write log messages with the links. Resolves Issue #1179. --- gracedb/translator.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/gracedb/translator.py b/gracedb/translator.py index 9000531de..78b8a30a1 100644 --- a/gracedb/translator.py +++ b/gracedb/translator.py @@ -360,6 +360,23 @@ def handle_uploaded_data(event, datafilename, comment="Log File Created" ) log.save() + # Log the link to the CED. + if data.data['ced_link']: + comment = '<a href="%s">Coherent Event Display (CED)</a>' % data.data['ced_link'] + log = EventLog(event=event, + issuer=event.submitter, + comment=comment) + log.save() + + + # Log the link to the skymap. + if data.data['fits_skymap_link']: + comment = '<a href="%s">FITS skymap</a>' % data.data['fits_skymap_link'] + log = EventLog(event=event, + issuer=event.submitter, + comment=comment) + log.save() + elif event.analysisType == 'GRB': # Get the event time from the VOEvent file error = None @@ -493,6 +510,9 @@ class CwbData(Translator): # # The 2nd number following the "24*6" line is FAR. # + # https://... (link to CED) + # https://... (link to fits skymap) + rawdata = {} # Get Key/Value info @@ -549,6 +569,19 @@ class CwbData(Translator): data['ligo_axis_ra'] = data['rawdata'].get('phi',[None,None,None])[2] data['ligo_axis_dec'] = data['rawdata'].get('theta',[None,None,None])[2] + # Check for the links at the end. + ced_link = None + fits_skymap_link = None + for line in datafile: + if line.startswith("https"): + if line.find(".fits") > 0: + fits_skymap_link = line + else: + ced_link = line + + data['ced_link'] = ced_link + data['fits_skymap_link'] = fits_skymap_link + if needToClose: datafile.close() -- GitLab