6. Python API reference

The documentation of each function that is reported in this page can also be directly accessed from Python with, e.g.:

from galario.double import sampleImage

help(sampleImage)

6.1. Computing synthetic visibilities

To compute the synthetic visibilities of a model use the sampleImage() and sampleProfile() functions.

Note

The translation by (dRA, dDec) and the rotation by PA of the model image are optimized for speed: they are not obtained with extra interpolations of the model image, but rather applied in the Fourier plane.

The offset is achieved by applying a complex phase to the sampled visibilities. To rotation is achieved by internally rotating the (u, v) locations by -PA.

Suggestion: We recommend starting with check set to True to ensure the results obtained are correct. Once a combination of matrix size and dxy for the given data has been found, uvcheck can be safely set to False.

6.2. Computing chi squared directly

To compute the \(\chi^2\) of a model use the chi2Image() and chi2Profile() functions.

6.4. Other useful functions

6.5. Exceptions

|galario|’s C++ core throws various exception. They can be distinguished by the type and the error message.

Event

C++

Python

Out of memory on GPU

std::bad_alloc

MemoryError

Invalid argument (CPU/GPU)

std::invalid_argument

ValueError

Miscellaneous, including out of memory (CPU/GPU)

std::runtime_error

RuntimeError