**galario**¶

**GPU Accelerated Library for Analysing Radio Interferometer Observations**¶

**galario** is a library that exploits the computing power of modern graphic cards (GPUs) to accelerate the comparison of model
predictions to radio interferometer observations. Namely, it speeds up the computation of the synthetic visibilities
given a model image (or an axisymmetric brightness profile) and their comparison to the observations.

Along with the GPU accelerated version based on the
CUDA Toolkit, **galario** offers a CPU counterpart accelerated with
openMP.

Modern radio interferometers like
ALMA,
Karl G. Jansky VLA,
NOEMA
are pushing to the extreme the computational efforts needed to model the observations.
The unprecedented sensitivity and resolution achieved by these observatories deliver huge amount of data that sample a wide range of spatial frequencies.
In this context, **galario** provides a fast library useful for comparing a model to observations directly in the Fourier plane.

We presented **galario** in Tazzari, Beaujean and Testi (2017), where you can find more details about the
relevant equations and the algorithm implementation.
Here we do not aim to summarize the vast literature about Radio Interferometry, but we refer the interested reader to the
Synthesis Imaging in Radio Astronomy II book.

**galario** is actively developed on GitHub
and has already been employed in these published studies.

Instructions on how to build and install **galario** can be found here.

More details on how to get started with **galario** are given in the Quickstart example.

Be sure to checkout also the Cookbook with many useful code snippets!

## Basic Usage¶

Let’s say you have an observational dataset of `M`

visibility points located at \((u_j, v_j)\), with \(j=1...M\) and \(u_j\), \(v_j\) expressed in units of the observing wavelength. \(V_{obs\ j}\) (Jy) is the \(j\)-th complex visibility with associated theoretical weight \(w_j\).
With **galario** you can:

**1) Compute visibilities from a model image**

If you want to compute the visibilities of a model

`image`

(Jy/px) with pixel size`dxy`

(rad) in the same \((u_j, v_j)\) locations of the observations, you can easily do it with the GPU acceleratedgalario:from galario.double_cuda import sampleImage vis = sampleImage(image, dxy, u, v)where

`vis`

is a complex array of length \(N\) containing the real (`vis.real`

) and imaginary (`vis.imag`

) part of the synthetic visibilities.

**2) Compute visibilities from an axisymmetric brightness profile**

If you want to compare the observations with a model characterized by an

axisymmetric brightness profile,galariooffers dedicated functions that exploit the symmetry of the model to accelerate the image creation.If \(I(R)\) (Jy/sr) is the radial brightness profile, the command is as simple as:

from galario.double_cuda import sampleProfile vis = sampleProfile(I, Rmin, dR, nxy, dxy, u, v)where

`Rmin`

and`dR`

are expressed in radians and are the innermost radius and the cell size of the grid on which \(I(R)\) is computed. An analogous function`chi2Profile`

allows one to compute directly the chi square.

**3) Compute the** \(\chi^2\) **of a model (image or brightness profile)**

If you are doing a

fitand the only number you are interested in is the \(\chi^2\) for the likelihood computation, you can use directly one of these:from galario.double_cuda import chi2Image chi2 = chi2Image(image, dxy, u, v, V_obs.real, V_obs.imag, w) chi2 = chi2Profile(I, Rmin, dR, nxy, dxy, u, v, V_obs.real, V_obs.imag, w)

**4) Do all the above operations + translate and rotate the model image**

To translate the model image in Right Ascension and Declination direction by (dRA, dDec) offsets (rad), or to rotate the image by a Position Angle PA (rad) (defined East of North), you can specify them as optional parameters.

This works for all the

`sampleImage`

,`sampleProfile`

,`chi2Image`

and`chi2Profile`

functions:from galario.double_cuda import sampleImage vis = sampleImage(image, dxy, u, v, dRA=dRA, dDec=dDec, PA=PA)

Note

If you work on a machine **without** a CUDA-enabled GPU, don’t worry: you can use the CPU version
of **galario** by just removing the subscript `"_cuda"`

from the imports above and benefit from the openMP parallelization.
All the function names and interfaces are the same for GPU and CPU version!

## License and Attribution¶

If you use **galario** for your research, please cite Tazzari, Beaujean and Testi (2017) .
The BibTeX entry for the paper is:

```
@ARTICLE{Tazzari:galario,
Adsurl = {http://adsabs.harvard.edu/cgi-bin/bib_query?arXiv:1709.06999},
Archiveprefix = {arXiv},
Arxivurl = {http://arxiv.org/abs/1709.06999v1},
Author = {{Tazzari}, Marco and {Beaujean}, Frederik and {Testi}, Leonardo},
Eprint = {1709.06999v1},
Jornal = {ArXiv e-prints},
Month = {Sep},
Primaryclass = {astro-ph.IM},
Title = {GALARIO: a GPU Accelerated Library for Analysing Radio Interferometer Observations},
Year = {2017}}
```

**galario** has also a Zenodo DOI, which can be used to refer to the exact
version of **galario** used in a paper.

**galario** is free software licensed under the LGPLv3 License. For more details see the LICENSE.

© Copyright 2017 Marco Tazzari, Frederik Beaujean, Leonardo Testi.