2. 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 sizedxy
(rad) in the same \((u_j, v_j)\) locations of the observations, you can easily do it with the GPU accelerated galario: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, galario offers 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
anddR
are expressed in radians and are the innermost radius and the cell size of the grid on which \(I(R)\) is computed. An analogous functionchi2Profile
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 fit and 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
andchi2Profile
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!