Skip to content
Snippets Groups Projects

Draft: Ingestion of SVOM ECLAIRS notices into LLAI workflow

Open Naresh Adhikari requested to merge naresh.adhikari/gwcelery:addsvom into main
12 unresolved threads
Compare and Show latest version
2 files
+ 99
8
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -486,6 +486,12 @@ def handle_targeted_kafka_alert(alert):
# FIXME: This is required until native ingesting of kafka events in GraceDB
payload, pipeline, time, trig_id = _kafka_to_voevent(alert)
if pipeline.lower() == 'svom':
snr_grb = alert['image_snr']
veto_event =
# Apply SVOM-specific logic or threshold adjustments
pass
else:
# Veto events that don't pass GRB FAR threshold
far_grb = alert['far']
veto_event = \
@@ -734,14 +740,15 @@ def _kafka_to_voevent(alert):
-------
payload : str
XML GCN notice alert packet in string format
payload, pipeline, time, trig_id
"""
# Define basic values
pipeline = alert['mission']
start_time = alert['trigger_time']
alert_time = alert['alert_datetime']
far = alert['far']
duration = alert['rate_duration']
far = alert.get('far')
snr = alert.get('image_snr') # change this to make optional
duration = alert['image_duration']
id = '_'.join(str(x) for x in alert['id'])
# Use central time since starting time is not well measured
central_time = \
@@ -770,7 +777,7 @@ def _kafka_to_voevent(alert):
fname = f'{pipeline.lower()}_subgrbtargeted_template.xml'
ivorn_suffix = 'targeted_subthreshold'
else:
fname = 'svom_grb_template_xml'
fname = 'svom_grb_template.xml' #change the saved filename
ivorn_suffix = 'grb'
# Construct the full path to the template
@@ -791,7 +798,8 @@ def _kafka_to_voevent(alert):
if pipeline.lower() in ['fermi', 'swift']:
root.find("./What/Param[@name='TrigID']").attrib['value'] = str(id)
else:
root.find("./What/Param[@name='Burst_Id']").attrib['value'] = str(id)
root.find("./What/Group[@name='Svom_Identifiers']"
"/Param[@name='Burst_Id']").attrib['value'] = str(id)
# Change times to chosen time
root.find("./Who/Date").text = str(alert_time).encode()
@@ -803,14 +811,16 @@ def _kafka_to_voevent(alert):
root.find("./What/Param[@name='FAR']").attrib['value'] = \
(str(far).encode())
else:
root.find("./What/Param[@name='SNR']").attrib['value'] = \
root.find("./Group[@name='Detection_Info']"
"/Param[@name='SNR']").attrib['value'] = \
(str(snr).encode())
if pipeline.lower() in ['fermi', 'swift']:
root.find("./What/Param[@name='Integ_Time']").attrib['value'] = \
str(duration).encode()
else:
root.find("./What/Param[@name='Timescale']").attrib['value'] = \
root.find("./Group[@name='Detection_Info']"
"/Param[@name='Timescale']").attrib['value'] = \
(str(duration).encode())
# Sky position
Loading