Commit 3fdd1d6a authored by Leo Pound Singer's avatar Leo Pound Singer

Make identifier names conform to PEP8

All function and variable names should be lower case.
parent f260a8e7
Pipeline #67395 passed with stages
in 5 minutes and 42 seconds
......@@ -178,7 +178,7 @@ def compose(gracedb_id, authors=(), mailto=False,
return '{0}\n{1}'.format(subject, body)
def compose_RAVEN(gracedb_id, authors=(),
def compose_raven(gracedb_id, authors=(),
service=rest.DEFAULT_SERVICE_URL, client=None):
"""Compose EM_COINC RAVEN GCN Circular draft"""
......@@ -202,8 +202,8 @@ def compose_RAVEN(gracedb_id, authors=(),
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'] == 'GRB')
snews = (em_event['search'] == 'Supernova')
grb = (em_event['search'] == 'GRB')
o = urllib.parse.urlparse(client.service_url)
kwargs = dict(
......@@ -214,23 +214,23 @@ def compose_RAVEN(gracedb_id, authors=(),
superevent_far=preferred_event['far'],
external_pipeline=external_pipeline,
external_trigger=external_trigger_id,
SNEWS=SNEWS,
GRB=GRB,
snews=snews,
grb=grb,
latency=abs(round(em_event_gpstime-gpstime, 1)),
beforeafter='before' if gpstime > em_event_gpstime else 'after')
if GRB:
if grb:
# Grab GRB coincidence FARs
files = client.files(gracedb_id).json()
coinc_far_file = 'coincidence_far.json'
if coinc_far_file in files:
coincidence_far = client.files(gracedb_id, coinc_far_file).json()
time_coinc_FAR = coincidence_far.get('temporal_coinc_far')
space_time_coinc_FAR = coincidence_far.get(
time_coinc_far = coincidence_far.get('temporal_coinc_far')
space_time_coinc_far = coincidence_far.get(
'spatiotemporal_coinc_far')
kwargs.update(
time_coinc_FAR=time_coinc_FAR,
space_time_coinc_FAR=space_time_coinc_FAR)
time_coinc_far=time_coinc_far,
space_time_coinc_far=space_time_coinc_far)
# Check if subthreshold trigger
voevent_text = client.files(
......@@ -306,7 +306,7 @@ def compose_grb_medium_latency(
(o.scheme, o.netloc, '/events/', '', '')),
gracedb_id=gracedb_id,
group=group,
GRB=True,
grb=True,
pipeline=pipeline,
external_trigger=external_trigger,
exclusions=[],
......
......@@ -5,13 +5,13 @@
{% filter rewrap %}
A search performed by the RAVEN pipeline found a temporal coincidence between
{{gracedb_id}} and a {% if SNEWS %}SNEWS supernova{% elif GRB %}{% if subthreshold %}sub-threshold {% endif %}{{grbmission(external_pipeline)}}{% endif %} {{propername(external_trigger)}} **CITE ORIGINAL GCN FOR THE EXTERNAL TRIGGER FROM https://gcn.gsfc.nasa.gov/gcn3_archive.html, e.g., (Bhalerao et al., GCN Circular XXXXX)**.
The {% if SNEWS %}neutrino{% elif GRB %}GRB{% endif %} trigger time is {{latency}} seconds {{beforeafter}} the GW candidate event.
{% if GRB %}
The estimated joint false alarm rate for the time coincidence is {{naturalfar(time_coinc_FAR)}}.
{{gracedb_id}} and a {% if snews %}SNEWS supernova{% elif grb %}{% if subthreshold %}sub-threshold {% endif %}{{grbmission(external_pipeline)}}{% endif %} {{propername(external_trigger)}} **CITE ORIGINAL GCN FOR THE EXTERNAL TRIGGER FROM https://gcn.gsfc.nasa.gov/gcn3_archive.html, e.g., (Bhalerao et al., GCN Circular XXXXX)**.
The {% if snews %}neutrino{% elif grb %}GRB{% endif %} trigger time is {{latency}} seconds {{beforeafter}} the GW candidate event.
{% if grb %}
The estimated joint false alarm rate for the time coincidence is {{naturalfar(time_coinc_far)}}.
{% endif %}
{% if GRB %}{%- include 'classification_info.jinja2' -%}{% endif %}
{% if grb %}{%- include 'classification_info.jinja2' -%}{% endif %}
{% if combined_skymap is not defined %}
{% include 'userguide_conclusion.jinja2'%}
......@@ -20,8 +20,8 @@ A combined sky map is also available:
* {{combined_skymap}}, the normalized product of the GW and GRB localizations.
For the {{combined_skymap}} sky map, the {{cl}}% credible region is {{combined_skymap_greedy_area|round|int}} deg2.
{% if space_time_coinc_FAR is not none %}
Considering the overlap of the individual sky maps, the estimated joint false alarm rate for the spatial and temporal coincidence is {{naturalfar(space_time_coinc_FAR)}}.
{% if space_time_coinc_far is not none %}
Considering the overlap of the individual sky maps, the estimated joint false alarm rate for the spatial and temporal coincidence is {{naturalfar(space_time_coinc_far)}}.
{% else %}
The spatial and temporal coincidence is not yet available.
{% endif %}
......
......@@ -11,7 +11,7 @@ analysis pipeline{% if ([pipeline] + other_pipelines)|length > 1 %}s{% endif %}.
{% if change_significance_statement %}
This gravitational wave candidate is not significant enough on its own to produce a public alert
but its coincidence with the {% if SNEWS %}SNEWS neutrino{% endif %}{% if GRB %}GRB{% endif %} trigger increases its significance.
but its coincidence with the {% if snews %}SNEWS neutrino{% endif %}{% if grb %}GRB{% endif %} trigger increases its significance.
{% else %}
{{gracedb_id}} is an event of interest because its false alarm rate, as
estimated by the online analysis, is {{naturalfar(far)}}.
......@@ -20,7 +20,7 @@ The event's properties can be found at this URL:
{{ gracedb_service_url }}{{ gracedb_id }}
{% if not GRB %}{%- include 'classification_info.jinja2' -%}{% endif %}
{% if not grb %}{%- include 'classification_info.jinja2' -%}{% endif %}
{% if skymaps|length == 0 %}
No{% else %}{{ skymaps|length|apnumber|capitalize }}{% endif %} {% if combined_skymap is not defined %}sky map{% else %}GW-only sky map{% endif %}{% if skymaps|length == 1 %} is{% else %}s are{% endif %} available at this time{% if skymaps|length > 0 %} and can be retrieved from the GraceDB event page:{% else %}.{% endif %}
......
......@@ -85,13 +85,13 @@ def test_compose_mailto(mock_gracedb, mock_webbrowser_open):
assert mock_webbrowser_open.called_once()
def test_RAVEN_with_initial_circular(mock_gracedb):
main(['--service', 'https://gracedb.invalid/api/', 'compose_RAVEN',
def test_raven_with_initial_circular(mock_gracedb):
main(['--service', 'https://gracedb.invalid/api/', 'compose_raven',
'S1234'])
def test_RAVEN_without_initial_circular(mock_gracedb):
main(['--service', 'https://gracedb.invalid/api/', 'compose_RAVEN',
def test_raven_without_initial_circular(mock_gracedb):
main(['--service', 'https://gracedb.invalid/api/', 'compose_raven',
'S5678'])
......
......@@ -32,7 +32,7 @@ def main(args=None):
cmd.add_argument('gracedb_id', metavar='S123456',
help='GraceDB ID of superevent')
cmd = add_command(followup_advocate.compose_RAVEN, parents=[authors])
cmd = add_command(followup_advocate.compose_raven, parents=[authors])
cmd.add_argument('gracedb_id', metavar='S123456',
help='GraceDB ID of superevent')
......
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