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
Compare and Show latest version
2 files
+ 96
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,15 +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']
snr = alert['rate_snr']
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 = \
@@ -771,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
@@ -792,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()
@@ -812,7 +819,7 @@ def _kafka_to_voevent(alert):
root.find("./What/Param[@name='Integ_Time']").attrib['value'] = \
str(duration).encode()
else:
root.find("./Group[@name='Svom_Identifiers']"
root.find("./Group[@name='Detection_Info']"
"/Param[@name='Timescale']").attrib['value'] = \
(str(duration).encode())
Loading