{#- macro for presenting a list joined by (Oxford) commas -#}
{%- macro oxford_commas(seq) -%}
{%- for item in seq -%}
{{ caller(item) }}
{%- if loop.length > 2 and not loop.last %},{% endif -%}
{%- if loop.length > 1 and not loop.last %} {% endif -%}
{%- if loop.length > 1 and loop.revindex == 2 %}and {% endif %}
{%- endfor -%}
{%- endmacro -%}

{#- macro for selecting correct probability statement -#}
{%- macro select_probability_statement(value) -%}
  {%- if 95 <= value -%}
        strong evidence for
  {%- elif 75 <= value < 95 -%}
        evidence for
  {%- elif 25 <= value < 75 -%}
        indeterminate evidence for
  {%- elif 5 <= value < 25 -%}
        evidence against
  {%- else -%}
        strong evidence against
  {%- endif -%}
{%- endmacro -%}

{%- set long_instruments = {'H1': 'LIGO Hanford Observatory',
                            'L1': 'LIGO Livingston Observatory',
                            'V1': 'Virgo Observatory'}
-%}

{%- set citations = {'pycbc': 'Nitz et al. arXiv:1705.01513 (2017); '
                              'Usman et al. CQG 33, 215004 (2016); '
                              'Dal Canton et al. PRD 90, 082004 (2014)',
                     'mbtaonline': 'Adams et al. CQG 33, 175012 (2016)',
                     'gstlal': 'Messick et al. PRD 95, 042001 (2017)',
                     'cwb': 'Klimenko et al. PRD 93, 042004 (2016)',
                     'lib': 'Lynch et al. PRD 95, 104046 (2017)'}
-%}

{%- set embright_public_dcc = 'https://dcc.ligo.org/public/0139/T1600571/010/Description_Document.pdf' -%}

{% include 'authors.txt' %}
{% filter rewrap -%}
The {{ pipeline }} {{ group }} analysis
{% if pipeline|lower in citations -%}
	({{ citations[pipeline|lower] }})
{%- endif %}
identified candidate {{ gracedb_id }} during real-time processing of data from
{% call(instrument) oxford_commas(instruments) -%}
	{%- if instrument in long_instruments -%}
		{{ long_instruments[instrument] }} ({{ instrument }})
	{%- else -%}
		{{ instrument }}
	{%- endif -%}
{%- endcall %}
at {{ utctime }} UTC (GPS time: {{ gpstime }}).

{{ gracedb_id }} is an event of interest because its false alarm rate, as determined by the online analysis, is
{% with max_ifar = 365 * 86400 * 100 -%}
{% if far * max_ifar < 1 -%}
    less than one in {{ max_ifar|naturaldelta }}
{%- else -%}
    {{ '%.3g'|format(far) }} Hz or about one in {{ (1 / far)|naturaldelta }}
{%- endif %}
{%- endwith %}.
The event's properties can be found at this URL:

{{ gracedb_service_url }}{{ gracedb_id }}

{% if prob_has_ns is not none -%}If the candidate is astrophysical in origin,
there is {{ select_probability_statement(prob_has_ns) }} the lighter compact
object having a mass < 2.83 solar masses (ProbHasNS: {{ prob_has_ns|round|int }}%).
This 2.83 solar mass cutoff corresponds to the maximum neutron star mass
assuming a very stiff (2H) equation of state. Additionally, the pipeline found
there is {{ select_probability_statement(prob_has_remnant) }} matter outside the
final compact object (ProbHasRemnant: {{ prob_has_remnant|round|int }}%). For
more details on the source classification pipeline, please consult this technical
document: <{{ embright_public_dcc }}>.

{% endif %}{% if skymaps|length == 0 %}No{% else %}{{ skymaps|length|apnumber|capitalize }}{% endif %} sky map{% 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 %}
{%- for skymap in skymaps %}
 * {{ skymap.filename }}, an {% if skymap.alert_type == 'initial' %}initial{% else %}updated{% endif %} localization generated by {{ skymap.pipeline }},
   distributed via GCN notice about {{ skymap.latency|naturaldelta }} after the event
{%- endfor %}

Updates on our analysis of this event will be sent as they become
available.
{%- endfilter -%}
