# Fourth ASTERICS School¶

### International Virtual Observatory school¶

Observatoire Astronomique de Strasbourg, France

# Electromagnetic follow-up of gravitational-wave events¶

by G. Greco [email protected], E. Chassande-Mottin [email protected] and M.Branchesi [email protected] and many others

The tutorial focuses on some basic strategies for working with gravitational-wave sky localization maps in the context of electromagnetic follow-up activities. Here we propose the usage of Aladin, TOPCAT and GWsky. The following main topics are addressed.

1. Gravitational-Wave sky localization map: visualization and tiling
3. Planning for EM follow-up observations

# The gravitational-wave (GW) astronomy¶

The era of gravitational-wave (GW) astronomy began with the detection of binary black hole (BBH) mergers, by the Advanced Laser Interferometer Gravitational-Wave Observatory (LIGO) detectors, during the first of the Advanced Detector Observation Runs. Three detections, GW150914, GW151226, and GW170104, and a lower significance candidate, LVT151012, have been announced so far. The Advanced Virgo detector joined the second observation run on August 1, 2017.

### Three-Way Detection of Gravitational Waves¶

On August 14, a signal was seen at LIGO-Livingston; 8 milliseconds later, LIGO-Hanford reported a detection; and 6 milliseconds after that, Virgo detected a signal. A statistical analysis by the LIGO and Virgo collaborations suggested that such a multi-site detection would occur in random signals at most once in 27,000 years. The first simultaneous detection of gravitational radiation by the LIGO and Virgo detectors greatly improves localization of the source and permits a novel test of general relativity - GW170814: A Three-Detector Observation of Gravitational Waves from a Binary Black Hole Coalescence.

The LIGO and Virgo team alerted the astronomical community to the detection, but no corresponding signal has been found in any part of the electromagnetic spectrum or in neutrinos. The lack of an optical counterpart isn’t really a surprise two such black holes in a close orbit are likely to sweep their immediate vicinity clear of gas and dust and the gravitational radiation released by the merger does not agitate what little material remains enough to emit electromagnetic energy. Focus: Three-Way Detection of Gravitational Waves.

### Observations of a Binary Neutron Star Merger¶

On August 17, 2017 astronomers around the world were alerted to gravitational waves observed by the Advanced LIGO and Advanced Virgo detectors. This gravitational wave event, now known as GW170817, appeared to be the result of the merger of two neutron stars (BNS). Less than two seconds after the GW170817 signal, NASA's Fermi satellite observed a gamma-ray burst, now known as GRB170817A, and within minutes of these initial detections telescopes around the world began an extensive observing campaign. The Swope telescope in Chile was the first to report a bright optical source (SSS17a/AT2017gfo) in the galaxy NGC 4993 and several other teams independently detected the same transient over the next minutes and hours. For the next several weeks astronomers observed this location with instruments sensitive across the electromagnetic spectrum; these observations provide a comprehensive view of this cataclysmic event starting ~100 seconds before merger until several weeks after. The observations support the hypothesis that two neutron stars merged in NGC 4993 - producing gravitational waves, a short-duration gamma-ray burst, and a kilonova. This observation firmly connects kilonovae with the BNS merger, providing evidence that kilonovae result from the radioactive decay of the heavy elements formed by neutron capture during a BNS merger - including gold and platinum - solving a decades long mystery of where about half of all elements heavier than iron are produced. GW170817 marks a new era of multi-messenger astronomy, where the same event is observed by both gravitational waves and electromagnetic waves The Dawn of Multi-Messenger Astrophysics: Observations of a Binary Neutron Star Merger.

In [2]:
from IPython.display import Image
from IPython.display import display
display(Image(url='http://ligo.org/science/Publication-GW170817MMA/images/BNS.png',width=500, height=400, ))


Fig.1. shows an artist's illustration of two merging neutron stars. The narrow beams represent the gamma-ray burst while the rippling spacetime grid indicates the isotropic gravitational waves that characterize the merger. Swirling clouds of material ejected from the merging stars are a possible source of the light that was seen at lower energies.

### The gravitational-wave events detected so far¶

The gif shows the sky localizations of the gravitational-wave events detected so far in galactic projection. GW150914, GW151226, GW170104 and GW170814 are generated from the merger of two black holes. GW170817 is the first observation of gravitational-waves from a pair of inspiraling neutron stars. Electromagnetic emission from the resulting collision was also observed in multiple wavelength bands. This occured on August 17, 2017 and represents the first time a cosmic event was observed with both gravitational waves and light.

In [3]:
display(Image(url='https://github.com/ggreco77/Electromagnetic-follow-up-of-gravitational-wave-events/blob/master/sky_localizations_v2.gif?raw=true'))


FIG.2. Sky localizations computed using LALinference for a selection of GW events. The addition of Virgo shows a dramatic increase in the sky localizations of GW170814 and GW170817. Credit Background image: Mellinger.

## Gravitational wave sky localization¶

Providing prompt localizations for GW signals helps to maximise the chance that electromagnetic observatories can catch a counterpart. Sky maps will be produced at several different latencies, with updates coming from more computationally expensive algorithms that refine our understanding of the source. For Compact Binary Coalescences (CBCs), rapid sky localization is performed using bayestar, a Bayesian parameter-estimation code that computes source location using output from the detection pipeline. It can produce sky maps with latencies of only a few seconds.

At higher latency, compact binary coalescences (CBCs) parameter estimation is performed using the stochastic sampling algorithms of LALInference. LALInference constructs posterior probability distributions for system parameters (not just location, but also mass, orientation, etc.) by matching GW templates to the detector strain. Sky locations can be reported with latency of days/weeks/months - Prospects for Observing and Localizing Gravitational-Wave Transients with Advanced LIGO and Advanced Virgo.

In [4]:
display(Image(url='https://www.emis.de/journals/LRG/Articles/lrr-2016-1/f4.png'))


FIG.3. Source localization by triangulation for the aLIGO–AdV network. The locations of the three detectors are indicated by black dots, with LIGO Hanford labeled H; LIGO Livingston as L, and Virgo as V. The locus of constant time delay (with associated timing uncertainty) between two detectors forms an annulus on the sky concentric about the baseline between the two sites (labeled by the two detectors). For three detectors, these annuli may intersect in two locations. One is centered on the true source direction (S), while the other (′ S) is its mirror image with respect to the geometrical plane passing through the three sites. For four or more detectors there is a unique intersection region of all of the annuli. However the triangulation approach underestimates how well a source can be localized, since it does not include all the relevant information. Its predictions can be improved by introducing the requirement of phase consistency between detectors.

### LIGO/Virgo probability sky maps¶

Probability sky maps associated with a gravitational-wave signal detected by the Advanced LIGO and Virgo are given as all-sky images stored in the HEALPix (Hierarchical Equal Area isoLatitude Pixelisation) projection. The sphere is hierarchically tessellated into curvilinear quadrilaterals; the resolution of the tessellation can be increased by the division of each pixel into four new ones.
The lowest resolution partition is comprised of twelve base pixels. The pixel position on the sky is uniquely specified by the index in the array and the array’s length. The resolution of the grid is expressed by the parameter Nside, and the total number of pixels equal to Npix = 12 x Nside2. In such context, the value stored at each pixel represents the probability that the gravitational-wave source is located within that pixel (see LIGO-Virgo EM Follow-Up Tutorial).

In [5]:
display(Image(url='https://healpix.jpl.nasa.gov/images/healpixGridRefinement.jpg'))


FIG.4. It shows the partitioning of a sphere at progressively higher resolutions, from left to right. The green sphere represents the lowest resolution possible with the HEALPix base partitioning of the sphere surface into 12 equal sized pixels. The yellow sphere has a HEALPix grid of 48 pixels, the red sphere has 192 pixels, and the blue sphere has a grid of 768 pixels (more information here).

### 3D sky maps¶

Singer et al.(2016) discuss a rapid algorithm for obtaining a three-dimensional probability estimates of sky location and luminosity distance from observations of binary compact object mergers with Advanced LIGO and Virgo. Combining the reconstructed gravitational wave volumes with positions and redshifts of possible host galaxies provides a manageable list of sky location targets to search for the electromagnetic counterpart of the gravitational wave signal.

The marginal distance posterior distribution integrated over the whole sky is reported in the header with

   DISTMEAN    /Posterior mean distance (Mpc)
DISTSTB     /Posterior standard deviation of distance (Mpc)

# 1. Working with the sky localizations of GW150914, GW151226 and GW170104¶

The probability sky maps are produced using a sequence of algorithms with increasing accuracy and computational cost. Here, we compare three location estimates: the prompt cWB and/or the rapid BAYESTAR localizations that were initially shared with observing partners and the final localization from LALInference.

The exercise focuses on the GUI/script command to organize the Aladin stack planes and generate a defined contour plot using the Multi Order Coverage method (MOC).

                     The expected time to finish the exercise is 30 minutes

The Aladin stack is the panel at the right of the central view window. It shows all elements that have been loaded during your Aladin Desktop session. The stack is a pile of individual planes, which can be pointed images, HiPS surveys, catalogues, graphical overlays, filters, data cubes, etc... See Introducing the Aladin stack and Using the Aladin stack.

Aladin can be controlled via in-line commands opening the script console. The detailed help on script commands is obtained from the Help menu. The on-line reference manual on Aladin script commands is here.

1.1.2 Create three stack folders: GW150914, GW151226, GW170104

Open Aladin Console Tool → Script Console

1.1.3 Load the refined sky localizations (LALInference) from the Gravitational Wave Open Science Center

• Using Aladin Console load https://losc.ligo.org/s/events/GW150914/P1500227/LALInference_skymap.fits.gz; load https://losc.ligo.org/s/events/GW151226/P1500227/LALInference_skymap_2.fits.gz; load https://losc.ligo.org/s/events/GW170104/P1500227/LALInference_f.fits.gz;
• or pasting the URL at the Command box (at the top of the main Aladin window)

1.1.4 Rename the GW sky localizations files in

⟶ GW150914_lal

⟶ GW151226_lal

⟶ GW170104_lal

• Using Aladin GUI Aladin stack → Select the plane → right-click → Properties... → Properties window
• Using Aladin Console rename LALInference_skymap.fits GW150914_lal; rename LALInference_skymap_2.fits GW151226_lal; rename LALInference_f.fits GW170104_lal;

1.1.5 Move the sky localization files in the specific folders

• Using Aladin GUI Aladin stack → Select the plane → drag the file in the folder
• Using Aladin Console mv GW150914_lal GW150914; mv GW151226_lal GW151226; mv GW170104_lal GW170104;

## 1.2 MOC contour plot generation¶

The Multi-Order Coverage (MOC) method is based on the HEALPix tessellation algorithm and it is essentially a simple way to map irregular and complex sky regions into hierarchically grouped predefined cells. The operations between MOC maps (union, intersection, subtraction, difference, complement) are extremely simple and fast (generally a few milliseconds) even for very complex sky regions. In addition to this, same data servers, such as VizieR, can be “queried by MOC” in order to return data (catalog sources/list of images) only inside the MOC coverage. Each contour plot encloses a given percentage of the total probability. These contours were constructed using a “water-filling” algorithm: the pixels from most probable to least are ranked, and finally the pixels are summed up to get a fixed level of probability Singer et al. 2014.

The enclosed area within a given probability level of a GW sky map can be effectively described through the Multi-Order Coverage (MOC) method. The HEALPix pixels (ipix) inside a given contour plot are extracted and the ipix table is used to generate the MOC coverage; for more details see Handling gravitational-wave sky maps with Multi-Order Coverage.

1.2.1 Create the 90% credible level contours (enclosed probability) for each skymap in 1.1.3. Move the MOC files in the specific folders. Set as Drawing method: perimeter

#### ↳ MOC Creation¶

• Using Aladin GUI Coverage → Generate a MOC based on... → The current probability skymap → MOC generation window
• Using Aladin Console "MOC 0.9 GW150914_lal" = cmoc -threshold=0.9 GW150914_lal; "MOC 0.9 GW151226_lal" = cmoc -threshold=0.9 GW151226_lal; "MOC 0.9 GW170104_lal" = cmoc -threshold=0.9 GW170104_lal;

#### ↳ Set Drawing method¶

• Using Aladin GUI Aladin stack → Select the plane → right-click → Properties... → Properties window
• Using Aladin Console set "MOC 0.9 GW150914_lal" drawing=+perimeter,-border; set "MOC 0.9 GW151226_lal" drawing=+perimeter,-border; set "MOC 0.9 GW170104_lal" drawing=+perimeter,-border

1.2.2 Check the values of the Area (90%) obtained in 1.2.1 with the values reported here

In [6]:
display(Image(url='https://github.com/ggreco77/Electromagnetic-follow-up-of-gravitational-wave-events/blob/master/detection_page.png?raw=true'))


1.2.3 Save the confidence levels in .fits format

• File → Export planes (FITS, VOTable,...)... → New window

1.2.4 Remove all planes from Aladin stack

• Aladin stack → Select the last plane → right-click → Delete all planes

# 2. GW170814: A Three-Detector Observation of Gravitational Waves from a Binary Black Hole Coalescence¶

GW170814 is the fourth published detection of gravitational waves. As was the case with the first three published detections, the waves were generated by the coalescence of a pair of stellar-mass black holes. When we compare its position reconstruction in the Universe with the previous events, the sky localization of GW170814 is the narrowest. This new and exciting result was reached through a triple-coincident detection, coordinated by a body of more than 1,000 international scientists forming the LIGO and Virgo Collaboration (LVC).

                     The expected time to finish the exercise is 25 minutes
In [7]:
display(Image(url='http://www.virgo-gw.eu/docs/GW170814/three_skymaps.png'))


Fig.5. See also the Astronomy Picture of the Day - 2017 September 28 -

The event was recorded on 2017 August 14, and so christened GW170814, by the LIGO observatory sites in Hanford, Washington and Livingston, Louisiana, and the more recently operational Virgo Observatory near Pisa, Italy. The signal was emitted in the final moments of the coalescence of two black holes of 31 and 25 solar masses located about 1.8 billion light-years away. But comparing the timing of the gravitational wave detections at all three sites allowed astronomers to vastly improve the location of the signal's origin on the sky. Just above the Magellanic clouds and generally toward the constellation Eridanus, the only sky region consistent with signals in all three detectors is indicated by the yellow contour line in this all-sky map. The all-sky projection includes the arc of our Milky Way Galaxy. An improved three-detector location of the gravitational wave source allowed rapid follow-up observations by other, more conventional, electromagnetic wave observatories that can search for potentially related signals. The addition of the Virgo detector also allowed the gravitational wave polarization to be measured, a property that further confirms predictions of Einstein's general relativity.

To facilitate repetitive tasks Aladin provides a macro controller which is based on Aladin script commands. It allows for the script commands to include input variables that allow for the execution of a set of commands for a list of object names. The macro controller window is divided into 3 parts:

1) The top panel allows the input of a script. The variables can be specified as $1 $2 etc.

2) The middle panel allows the input of lists of values to be taken by the variables.

3) The lower panel controls the execution of the script.

The script and the input values for the variables may be saved for future use by using the File menu of the macro controller window

• File → Save Script

When writing a script, Aladin automatically recognizes the syntax and colours the various elements of the script to ease the editing. The commands are also clickable to provide immediate help.

2.1.1 Create the stack folder GW170814

2.1.2 Load three sky localizations from the Gravitational Wave Open Science Center. For educational purposes Nside = 512 for all sky maps and they are stored in an external site.

2.1.3 Rename the skymaps as reported below and move them in the folder created in 2.2.1

⟶bayestar_without_Virgo

⟶bayestar_with_Virgo

⟶lalinference

2.1.4 Build the 90% credible levels (enclosed probability) for the GW sky localizations in Section 2.1.3 using as Drawing method: perimeter and stored the files in the folder created in Section 2.2.1. Execute the tasks written a macro.

   Script:
moc_$1_$2 =cmoc -threshold=$1$2
set drawing =+perimeter,-border
mv moc_$1_$2 gw170814

Parameters:
0.9    bayestar_without_Virgo
0.9    bayestar_with_Virgo
0.9    lalinference

2.1.5 How many times the location of GW170814 has been improved thanks to the presence of Virgo?

2.1.6 Calculate the intersection area between the rapid (BAYESTAR) LIGO/Virgo sky localization and the refined one (LALInference)

2.1.7 How much the intersection area is worth?

2.1.8 Calculate the intersection area between the final LIGO/Virgo sky localization (90% c.l.) and

⟶ the PanSTARRS DR1 (color compositions)

⟶ GALEX GR6 AIS (color compositions)

↳ To obtain the coverage of PanSTARRS and GALEX GR6 AIS you can use the data collection tree by checking the coverage box when the info window appears after clicking on the selected collection.

2.1.9 Remove all planes from Aladin stack

Aladin stack → Select the last plane → right-click → Delete all planes

## 2.2 GW170814 in Virtual Reality¶

### Just for fun! Identify the Magellanic Clouds in the photospheres and if they are within the localization region!

In [8]:
display(Image(url='https://github.com/ggreco77/Electromagnetic-follow-up-of-gravitational-wave-events/blob/master/gw170817_vr.png?raw=true'))


## 2.3 Support for IOS¶

Download the photosperes from the links below and install the VR support for IOS systems - PhotoSphere Viewer app or similar from the App store.

# 3 VST tiling of GW170814¶

You are at ESO-Paranal Observatory in Chile and your team are planning to observe the LIGO and Virgo trigger G297595 (confirmed as GW170814), with the VLT Survey Telescope (VST) equipped with OMEGACAM. The observations are divided in 9 regions - 3° x 3° - centered on the following coordinates RA, Dec (ICRSd):

Pointings RA[deg] DEC[deg]
p1 041.06842 -45.48795
p2 036.78869 -45.48795
p3 045.34815 -45.48795
p4 042.42450 -42.48795
p5 042.42450 -39.48795
p6 039.71234 -48.48795
p7 044.97423 -36.48795
p8 046.17326 -33.80461
p9 046.17326 -51.48795
p10 047.59596 -42.43116
p11 048.41606 -39.37287

Table 1 VST observations of GW170814

In [9]:
display(Image(url='https://github.com/ggreco77/Electromagnetic-follow-up-of-gravitational-wave-events/blob/master/vst_gw170814_2.png?raw=true'))


Fig.6. The pointing sequence is taken from GCN 21498 and GRAWITA paper in preparation.

You can describe your FoV in a simple XML/VOTable document and you can load this file in Aladin to draw it.

• File → Load Instrument FoV → Server selector → Create your... → Instrument Footprint Editor page

You are directed to the page Instrument Footprint Editor in which we can draw your suitable FoV. Save the file from the page and load in Aladin using the Load it... button in the Server selector window. Once all previous operations have been carried out, specify a position in the Target (ICRS, name) and press the SUBMIT button. The FoVs will be drawn as new Aladin planes.

                    The expected time to finish the exercise is 20 minutes

Your team ask you to prepare a sky chart showing the VST coverage. The chart should show

3.1.1 The FoV footprints of VST reported in Table 1.

3.1.2 The MOC contour of 10% - 50% - 90% confidence levels setting as Drawing method: perimeter

↳ (re)load the rapid LIGO and Virgo localization in Section 2.1.2

3.1.3 Create a Macro Controller for the repetitive task in 3.1.1

Script:
get FoV(MyFootprint)  $2$3
sync

Parameters:
Copy in a file the VST observations of Table 1 and load them from the File Menu of the Macros   

3.1.4 Save the macros script and the input values for future applications.

• Tool → Macros Controller... → Macros → File → Save script/Save params

3.1.5 Remove all planes from Aladin stack

• Aladin stack → Select the last plane → right-click → Delete all planes

# 4. GW 170817: sky localizations of the golden binary¶

Fig.7 shows the localization of the gravitational-wave, gamma-ray, and optical signals. The left panel shows a projection of the 90% credible regions from LIGO (light green), LIGO-Virgo (dark green), triangulation from the time delay between Fermi and INTEGRAL (light blue), and Fermi GBM (dark blue). The inset shows the location of the apparent host galaxy NGC 4993 in the Swope optical discovery image at 10.9 hours after the merger (top right) and the DLT40 pre-discovery image from 20.5 days prior to merger (bottom right).

                    The expected time to finish the exercise is 30 minutes
In [10]:
display(Image(url='http://ligo.org/science/Publication-GW170817MMA/images/Fig1.png',width=500, height=500))


Fig.7. Localization of the gravitational-wave, gamma-ray, and optical signals - GW170817/GRB170817/AT2017gfo

4.1. Create the stack folder *GW170817*

4.2. Load the refined sky localization from the LIGO and Virgo Open Science Center

4.3. Create the 5%, 10%, 50% and 90% MOC contour plots setting as Drawing method: perimeter

4.4. draw the location of the optical transient AT2017gfo reported in GCN 21529

• Using Aladin Console draw rgb(100,34,89) tag(13:09:48.089, -23:22:53.35,"AT2017gfo",100,30,circle,22) </strong> </span>

4.5. In which confidence level the position of AT2017gfo fall?

4.6. Show the GLADE galaxies in 90% of probability threshold using the distance information in the header

DISTMEAN=    38.59 / Posterior mean distance (Mpc)

DISTSTD =     6.99 / Posterior standard deviation of distance (Mpc)



Send Aladin plane to TOPCAT via SAMP right-click on the selected plane → broadcast selected tables to → TOPCAT

↳ Filtering the galaxies from 30 Mpc to 50 Mpc - Dist > 30 & Dist < 50

4.7. Search for information on NGC 4993 following the Section 3 of the tutorial [An introduction to the CDS services and tools](https://www.asterics2020.eu/dokuwiki/lib/exe/fetch.php?media=open:wp4:school3:cdstutorial_4asterics.pdf) - Optional

4.8. Apply a filter labeling the galaxies in order of their Absolute B Magnitude Catalog → Create a filter → Properties window → Advanced mode → Or enter your filter definition

• {draw rainbow(${BMAG},-20,-15) square} From the Properties window → Show rainbow color table 4.9. Make thumbnails of the selected brightest sources *from* • Tools → Thumbnail view generator 4.10. Save the Thumbnails using a macro and load the parameters *from* • File → Use selected plane sources as params MACRO Script: reset grid on "GAL_GW170817-$2_DSS" = get DSS.STScI(POSS2UKSTU_Red,10,10) $3 sync pause 1 save /your/path/folder/GAL_GW170817-$2_chart.fits

Parameters:
Use selected plane sources as params   

## 4.1 GW170817 in Virtual Reality¶

### Just for fun! Identify the Fermi error box of GRB 170817.

In [11]:
display(Image(url='https://github.com/ggreco77/Electromagnetic-follow-up-of-gravitational-wave-events/blob/master/gwsky17.png?raw=true'))


# 5. GWsky: an interactive script to tile the sky localization of gravitational-wave signals (Optional).¶

GWsky is an easy-to-use, interactive Python script to effectively tile the sky localization of a gravitational-wave event providing accurate telescope pointings. The Field-of-View footprints for each electromagnetic or neutrino observatory are displayed in real time in the Aladin Sky Atlas software using a dedicated interoperability application. Each Field of View is accompanied by descriptive statistics to manage the sequence of pointings. The ability to manage interactively and quickly a set of strategies – when a GW sky localization is issued – may be especially useful for a large class of space/ground-based telescopes to formulate requests of target-of-opportunity observations.

Full documentation, source code, and installation instructions are available here

In [12]:
from IPython.display import HTML

HTML('''<script>
code_show=true;
function code_toggle() {
if (code_show){
$('div.input').hide(); } else {$('div.input').show();
}
code_show = !code_show
}