Commit 95a21751 authored by Brandon Piotrzkowski's avatar Brandon Piotrzkowski

Add update type circular

parent fa526168
Pipeline #76072 failed with stages
in 35 seconds
......@@ -2,6 +2,8 @@
## 1.0.3 (unreleased)
- Add update type circular template.
- Uses search field to identify sub-threshold GRBs.
## 1.0.2 (2019-06-06)
......
......@@ -346,6 +346,26 @@ def compose_grb_medium_latency(
return '{0}\n{1}'.format(subject, body)
def compose_update(gracedb_id, authors=(),
service=rest.DEFAULT_SERVICE_URL,
update_types=['sky_localization', 'p_astro', 'em_bright'],
client=None):
"""Compose GCN update circular"""
if client is None:
client = rest.GraceDb(service)
kwargs = main_dict(gracedb_id, client=client)
kwargs.update(authors=authors)
kwargs.update(change_significance_statement=False)
kwargs.update(subject='Update')
kwargs.update(update_types=update_types)
subject = env.get_template('subject.jinja2').render(**kwargs).strip()
body = env.get_template(
'update_circular.jinja2').render(**kwargs).strip()
return '{0}\n{1}'.format(subject, body)
def compose_retraction(gracedb_id, authors=(),
service=rest.DEFAULT_SERVICE_URL, client=None):
"""Compose GCN retraction circular"""
......
......@@ -11,7 +11,10 @@ The {% if snews %}neutrino{% elif grb %}GRB{% endif %} trigger time is {{latency
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 'p_astro.jinja2' -%}
{%- include 'em_bright.jinja2' -%}
{% endif %}
{% if combined_skymap is not defined %}
{% include 'userguide_conclusion.jinja2'%}
......
Area Overlap Algorithm (filename)
{% filter rewrap %}
Area Overlap Algorithm (filename)
-------------------------------------------------------------
{%- for filename, pipeline, area, joint_area in params %}
{{'%4d'|format(area|round(-1)|int)}} {% if loop.last %}----{% else %}{{'%4d'|format(joint_area|round(-1)|int)}}{% endif %} {{pipeline}} ({{filename}})
{%- endfor -%}
{% endfilter %}
{% from 'macros.jinja2' import naturalclassifications, evidence_for,
probability %}
{% from 'macros.jinja2' import evidence_for, probability,
citeskymap_number %}
{% filter rewrap %}
{% if classifications|length > 0 %}
The classification of the GW signal, in order of descending probability,
is {{naturalclassifications(classifications)}}.
{% endif %}
{% if prob_has_ns is not none %}
Assuming the candidate is astrophysical in origin, there
is {{evidence_for(prob_has_ns)}} the lighter compact object having a mass
{% if subject == 'Update' %}Based on posterior support from parameter
estimation {{citeskymap_number(skymaps[-1].pipeline, [], [skymaps[-1]])}}, under the
assumption that the candidate {{gracedb_id}} is astrophysical in origin,
{% else %}Assuming the candidate is astrophysical in origin, {% endif %}
there is {{evidence_for(prob_has_ns)}} the lighter compact object having a mass
< 3 solar masses (HasNS: {{probability(prob_has_ns)}}). Using the
masses and spins inferred from the signal, there is
{{evidence_for(prob_has_remnant)}} matter outside the final compact object
(HasRemnant: {{probability(prob_has_remnant)}}).
{% endif %}
{% endfilter %}
......@@ -2,7 +2,6 @@
naturalinstruments, naturalfar,
naturalclassifications, naturalotherpipelines,
renamegroup, citeskymap %}
{% filter rewrap %}
We identified the {{renamegroup(group)}} candidate {{gracedb_id}} during real-time processing of data from
{{naturalinstruments(instruments)}} at {{utctime}} UTC (GPS time: {{gpstime}}).
......@@ -17,11 +16,14 @@ but its coincidence with the {% if snews %}SNEWS neutrino{% endif %}{% if grb %}
estimated by the online analysis, is {{naturalfar(far)}}.
{% endif %}
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 and classifications|length > 0 %}
{%- include 'p_astro.jinja2' -%}
{% endif %}
{% if not grb and prob_has_ns is not none %}
{%- include 'em_bright.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 %}
......@@ -29,26 +31,5 @@ No{% else %}{{ skymaps|length|apnumber|capitalize }}{% endif %} {% if combined_s
* {{skymap.filename}}, an {% if skymap.alert_type == 'initial' %}initial{% else %}updated{% endif %} localization generated by {{citeskymap(skymap.pipeline, all_pipelines, skymaps)}}, distributed via GCN notice about {{skymap.latency|naturaldelta}} after the candidate
{% endfor %}
{% if skymaps|length != 0 %}
{% if skymaps|length != 1 %}The preferred sky map at this time is {{preferred_skymap}}. {% endif %}
For the {{preferred_skymap}} sky map, the {{cl}}% credible region is
{% if not include_ellipse %}
{{greedy_area|round|int}} deg2.
{% else %}
well fit by an ellipse with an area of {{ellipse_area|round|int}} deg2 described
by the following DS9 region (right ascension, declination, semi-major axis,
semi-minor axis, position angle of the semi-minor axis):
icrs; ellipse(
{{- ra.to('15 arcsec').round().to_string(unit='hourangle', pad=True,
alwayssign=False) }},
{{- ' ' }}{{ dec.to('arcsec').round().to_string(unit='deg', pad=True,
alwayssign=True) }},
{{- ' ' }}{{ a.round().to_string(fields=1, unit='deg') }},
{{- ' ' }}{{ b.round().to_string(fields=1, unit='deg') }},
{{- ' ' }}{{ pa.round().to_string(fields=1, unit='deg') }})
{% endif %}
{% if distmu %}
Marginalized over the whole sky, the a posteriori luminosity distance estimate is {{distmu|round|int}} +/- {{distsig|round|int}} Mpc (a posteriori mean +/- standard deviation).
{% endif %}
{% endif %}
{% if skymaps|length != 0 %}{%- include 'skymap_info.jinja2' -%}{% endif %}
{% endfilter %}
......@@ -6,7 +6,6 @@
{% filter rewrap %}
{% include 'initial_body.jinja2' %}
{% include 'userguide_conclusion.jinja2' %}
{% include 'numbered_pipeline_citations.jinja2' %}
{% endfilter %}
......@@ -44,6 +44,23 @@ Macro to render a percentage between 0 and 100, capping at <1% and >99%.
{%- endmacro %}
Macro to write Update type in natural-language
{% macro naturalupdatetype(update_type) %}
{% if 'sky_localization' == update_type|lower %}Sky Localization{% elif 'p_astro' == update_type|lower %}Source Classification
{% elif 'em_bright' == update_type|lower %}EM Bright Classification{% endif %}
{%- endmacro %}
Macro to write Update type subject
{% macro naturalupdatesubject(update_types) %}
{% if update_types|length == 1 %}{{naturalupdatetype(update_types[0])}}
{% elif update_types|length == 2 %}{{naturalupdatetype(update_types[0])}} and {{naturalupdatetype(update_types[1])}}
{% elif update_types|length > 2 %}
{% for update_type in update_types[:-1] %}{{naturalupdatetype(update_type)}}, {% endfor %}and {{naturalupdatetype(update_types[-1])}}{% endif %}
{%- endmacro %}
Macro to transform a list like ['H1', 'L1', 'V1'] to natural-language list like
"H1 (LIGO Hanford Observatory), L1 (LIGO Livingston Observatory), and V1 (Virgo
Observatory)".
......@@ -78,6 +95,19 @@ number of all GW analysis pipelines + 1.
{%- endmacro %}
Macro to simply write the citation number of a skymap in brackets.
{% macro citeskymap_number(skymappipeline, all_pipelines, skymaps) %}
{% set skymapcitationnumber.count = 0 %}
{% for skymap in skymaps %}
{% if skymap.pipeline|lower in skymapcitations %}{% set skymapcitationnumber.count = skymapcitationnumber.count + 1 %}{% endif %}
{% if skymap.pipeline == skymappipeline %}{% break %}{% endif %}
{% endfor %}
{% if skymappipeline|lower in skymapcitations %}[{{ all_pipelines|length + skymapcitationnumber.count }}]
{%- endif -%}
{%- endmacro %}
Macro to transform a list of other GW analysis pipelines like ['gstlal', 'mbtaonline', 'pycbc']
to a natural-language list like "gstlal [2], mbtaonline [3], and pycbc [4]".
......
{% from 'macros.jinja2' import naturalclassifications, evidence_for,
probability %}
{% filter rewrap %}
{% if classifications|length > 0 %}
The {% if subject == 'Update' %}updated parameter estimation based {% endif %}classification of the GW signal, in order of descending probability,
is {{naturalclassifications(classifications)}}.
{% else %}
{% endif %}
{% endfilter %}
{% filter rewrap %}
{% if skymaps|length != 1 %}The preferred sky map at this time is {{preferred_skymap}}. {% endif %}
For the {{preferred_skymap}} sky map, the {{cl}}% credible region is
{% if not include_ellipse %}
{{greedy_area|round|int}} deg2.
{% else %}
well fit by an ellipse with an area of {{ellipse_area|round|int}} deg2 described
by the following DS9 region (right ascension, declination, semi-major axis,
semi-minor axis, position angle of the semi-minor axis):
icrs; ellipse(
{{- ra.to('15 arcsec').round().to_string(unit='hourangle', pad=True,
alwayssign=False) }},
{{- ' ' }}{{ dec.to('arcsec').round().to_string(unit='deg', pad=True,
alwayssign=True) }},
{{- ' ' }}{{ a.round().to_string(fields=1, unit='deg') }},
{{- ' ' }}{{ b.round().to_string(fields=1, unit='deg') }},
{{- ' ' }}{{ pa.round().to_string(fields=1, unit='deg') }})
{% endif %}
{% if distmu %}
Marginalized over the whole sky, the a posteriori luminosity distance estimate is {{distmu|round|int}} +/- {{distsig|round|int}} Mpc (a posteriori mean +/- standard deviation).
{% endif %}
{% endfilter %}
{% from 'macros.jinja2' import renamegroup %}
{% from 'macros.jinja2' import renamegroup, naturalupdatesubject %}
SUBJECT: LIGO/Virgo {{gracedb_id}}: {{subject}} of{% if subject == 'Retraction' %}{% else%} a{% endif %} GW {{renamegroup(group)}} candidate
SUBJECT: LIGO/Virgo {{gracedb_id}}: {%if subject == 'Update' %}Updated {{naturalupdatesubject(update_types)}}{% else %}{{subject}} of{% if subject == 'Retraction' %}{% else%} a{% endif %} GW {{renamegroup(group)}} candidate{% endif %}
{% from 'macros.jinja2' import citeskymap, citenumberedpipelines,
naturalinstruments, renamegroup %}
{% include 'authors.jinja2' %}
{% filter rewrap %}
We have conducted further analysis of the {{naturalinstruments(instruments)}} data around
the time of the {{renamegroup(group)}} ({{(group)}}) candidate {{gracedb_id}}
(GCN ***CITE ORIGINAL GCN ID, e.g. 25012***). {% if skymaps|length != 0 and 'sky_localization' in update_types %}
Parameter estimation has been performed using
{{citeskymap(skymaps[-1].pipeline, [], [skymaps[-1]])}} and a new sky map, {{preferred_skymap}},
distributed via GCN Notice, is available for retrieval from the
GraceDB event page:
{{ gracedb_service_url }}{{ gracedb_id }}
{% else %}
{% endif %}
{% if skymaps|length != 0 and 'sky_localization' in update_types %}{%- include 'skymap_info.jinja2' -%}{% endif %}
{% if 'em_bright' in update_types %}{% include 'em_bright.jinja2' %}{% endif %}
{% if 'p_astro' in update_types %}{% include 'p_astro.jinja2' %}{% endif %}
{% include 'userguide_conclusion.jinja2' %}
{% if (skymaps|length != 0 and 'sky_localization' in update_types) or ('p_astro' in update_types) %}
{{citenumberedpipelines([], [skymaps[-1]])}}
{% endif %}
{% endfilter %}
......@@ -9,8 +9,8 @@
"psd.xml.gz": "https://gracedb-dev1.ligo.org/api/events/S5678/files/psd.xml.gz",
"coinc.xml,0": "https://gracedb-dev1.ligo.org/api/events/S5678/files/coinc.xml,0",
"bayestar.fits.gz": "https://gracedb-dev1.ligo.org/api/events/S5678/files/bayestar.fits.gz",
"LALInference.fits.gz": "https://gracedb-dev1.ligo.org/api/events/S5678/files/LALInference.fits.gz",
"LALInference.fits.gz,0": "https://gracedb-dev1.ligo.org/api/events/S5678/files/LALInference.fits.gz,0",
"LALInference.v1.fits.gz": "https://gracedb-dev1.ligo.org/api/events/S5678/files/LALInference.v1.fits.gz",
"LALInference.v1.fits.gz,0": "https://gracedb-dev1.ligo.org/api/events/S5678/files/LALInference.v1.fits.gz,0",
"S5678-1-Initial.xml": "https://gracedb-dev1.ligo.org/api/events/S5678/files/S5678-1-Initial.xml",
"S5678-2-Update.xml": "https://gracedb-dev1.ligo.org/api/events/S5678/files/S5678-2-Update.xml",
"coincidence_far.json": "https://gracedb-dev1.ligo.org/api/events/S5678/files/coincidence_far.json"
......
......@@ -54,7 +54,7 @@
<Description>Specific low-latency search</Description>
</Param>
<Group type="GW_SKYMAP" name="LALInference">
<Param name="skymap_fits" dataType="string" value="https://gracedb-playground.ligo.org/apibasic/superevents/S5678/files/LALInference.fits.gz" ucd="meta.ref.url" unit=""> <Description>Sky Map FITS basic auth protected</Description>
<Param name="skymap_fits" dataType="string" value="https://gracedb-playground.ligo.org/apibasic/superevents/S5678/files/LALInference.v1.fits.gz" ucd="meta.ref.url" unit=""> <Description>Sky Map FITS basic auth protected</Description>
<Description>Sky Map FITS</Description>
</Param>
</Group>
......
......@@ -124,11 +124,11 @@
"lvem",
"public"
],
"file": "https://gracedb-dev1.ligo.org/api/events/S5678/files/LALInference.fits.gz,0",
"file": "https://gracedb-dev1.ligo.org/api/events/S5678/files/LALInference.v1.fits.gz,0",
"created": "2018-06-28 04:08:44 UTC",
"self": "https://gracedb-dev1.ligo.org/api/events/S5678/log/10",
"issuer": "leo.singer@LIGO.ORG",
"filename": "LALInference.fits.gz",
"filename": "LALInference.v1.fits.gz",
"tags": "https://gracedb-dev1.ligo.org/api/events/S5678/log/10/tag/",
"N": 10
},
......
......@@ -79,6 +79,22 @@ def test_burst_compose(mock_gracedb):
main(['--service', 'https://gracedb.invalid/api/', 'compose', 'S2468'])
def test_skymap_update(mock_gracedb):
main(['--service', 'https://gracedb.invalid/api/',
'compose_update', 'S5678', ['sky_localization']])
def test_general_update(mock_gracedb):
main(['--service', 'https://gracedb.invalid/api/',
'compose_update', 'S5678',
['sky_localization', 'p_astro', 'em_bright']])
def test_classification_update(mock_gracedb):
main(['--service', 'https://gracedb.invalid/api/',
'compose_update', 'S5678', ['p_astro', 'em_bright']])
def test_compose_mailto(mock_gracedb, mock_webbrowser_open):
main(['--service', 'https://gracedb.invalid/api/', 'compose',
'--mailto', 'S1234'])
......
......@@ -40,6 +40,11 @@ def main(args=None):
parents=[authors])
cmd.add_argument('gracedb_id', metavar='E123456', help='GraceDB ID of GRB')
cmd = add_command(followup_advocate.compose_update, parents=[authors])
cmd.add_argument('gracedb_id', metavar='S123456', help='GraceDB ID')
cmd.add_argument('update_types', metavar='[sky_localization]',
help='List of Update types')
cmd = add_command(followup_advocate.compose_retraction, parents=[authors])
cmd.add_argument('gracedb_id', metavar='S123456', help='GraceDB ID')
......
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