# Direct Fourier Transform¶

Functions used to compute the discretised direct Fourier transform (DFT) for an ideal interferometer. The DFT for an ideal interferometer is defined as

$V(u,v,w) = \int B(l,m) e^{-2\pi i \left( ul + vm + w(n-1)\right)} \frac{dl dm}{n}$

where $$u,v,w$$ are data space coordinates and where visibilities $$V$$ have been obtained. The $$l,m,n$$ are signal space coordinates at which we wish to reconstruct the signal $$B$$. Note that the signal correspondes to the brightness matrix and not the Stokes parameters. We adopt the convention where we absorb the fixed coordinate $$n$$ in the denominator into the image. Note that the data space coordinates have an implicit dependence on frequency and time and that the image has an implicit dependence on frequency. The discretised form of the DFT can be written as

$V(u,v,w) = \sum_s e^{-2 \pi i (u l_s + v m_s + w (n_s - 1))} \cdot B_s$

where $$s$$ labels the source (or pixel) location. If only a single correlation is present $$B = I$$, this can be cast into a matrix equation as follows

$V = R I$

where $$R$$ is the operator that maps an image to visibility space. This mapping is implemented by the im_to_vis() function. If multiple correlations are present then each one is mapped to its corresponding visibility. An imaging algorithm also requires the adjoint denoted $$R^\dagger$$ which is simply the complex conjugate transpose of $$R$$. The dirty image is obtained by applying the adjoint operator to the visibilities

$I^D = R^\dagger V$

This is implemented by the vis_to_im() function. Note that an imaging algorithm using these operators will actually reconstruct $$\frac{I}{n}$$ but that it is trivial to obtain $$I$$ since $$n$$ is known at each location in the image.

## Numpy¶

 im_to_vis(image, uvw, lm, frequency[, ...]) Computes the discrete image to visibility mapping of an ideal interferometer: vis_to_im(vis, uvw, lm, frequency, flags[, ...]) Computes visibility to image mapping of an ideal interferometer:
africanus.dft.im_to_vis(image, uvw, lm, frequency, convention='fourier', dtype=None)[source]

Computes the discrete image to visibility mapping of an ideal interferometer:

${\Large \sum_s e^{-2 \pi i (u l_s + v m_s + w (n_s - 1))} \cdot I_s }$
Parameters
imagenumpy.ndarray

image of shape (source, chan, corr) The brighness matrix in each pixel (flatten 2D array per channel and corr). Note not Stokes terms

uvwnumpy.ndarray

uvw coordinates of shape (row, 3) with u, v and w components in the last dimension.

lmnumpy.ndarray

lm coordinates of shape (source, 2) with l and m components in the last dimension.

frequencynumpy.ndarray

frequencies of shape (chan,)

convention{‘fourier’, ‘casa’}

Uses the $$e^{-2 \pi \mathit{i}}$$ sign convention if fourier and $$e^{2 \pi \mathit{i}}$$ if casa.

dtypenp.dtype, optional

Datatype of result. Should be either np.complex64 or np.complex128. If None, numpy.result_type() is used to infer the data type from the inputs.

Returns
visibiltiesnumpy.ndarray

complex of shape (row, chan, corr)

africanus.dft.vis_to_im(vis, uvw, lm, frequency, flags, convention='fourier', dtype=None)[source]

Computes visibility to image mapping of an ideal interferometer:

${\Large \sum_k e^{ 2 \pi i (u_k l + v_k m + w_k (n - 1))} \cdot V_k}$
Parameters
visnumpy.ndarray

visibilities of shape (row, chan, corr) Visibilities corresponding to brightness terms. Note the dirty images produced do not necessarily correspond to Stokes terms and need to be converted.

uvwnumpy.ndarray

uvw coordinates of shape (row, 3) with u, v and w components in the last dimension.

lmnumpy.ndarray

lm coordinates of shape (source, 2) with l and m components in the last dimension.

frequencynumpy.ndarray

frequencies of shape (chan,)

flagsnumpy.ndarray

Boolean array of shape (row, chan, corr) Note that if one correlation is flagged we discard all of them otherwise we end up irretrievably mixing Stokes terms.

convention{‘fourier’, ‘casa’}

Uses the $$e^{-2 \pi \mathit{i}}$$ sign convention if fourier and $$e^{2 \pi \mathit{i}}$$ if casa.

dtypenp.dtype, optional

Datatype of result. Should be either np.float32 or np.float64. If None, numpy.result_type() is used to infer the data type from the inputs.

Returns
imagenumpy.ndarray

float of shape (source, chan, corr)

 im_to_vis(image, uvw, lm, frequency[, ...]) Computes the discrete image to visibility mapping of an ideal interferometer: vis_to_im(vis, uvw, lm, frequency, flags[, ...]) Computes visibility to image mapping of an ideal interferometer:
africanus.dft.dask.im_to_vis(image, uvw, lm, frequency, convention='fourier', dtype=numpy.complex128)[source]

Computes the discrete image to visibility mapping of an ideal interferometer:

${\Large \sum_s e^{-2 \pi i (u l_s + v m_s + w (n_s - 1))} \cdot I_s }$
Parameters

image of shape (source, chan, corr) The brighness matrix in each pixel (flatten 2D array per channel and corr). Note not Stokes terms

uvw coordinates of shape (row, 3) with u, v and w components in the last dimension.

lm coordinates of shape (source, 2) with l and m components in the last dimension.

frequencies of shape (chan,)

convention{‘fourier’, ‘casa’}

Uses the $$e^{-2 \pi \mathit{i}}$$ sign convention if fourier and $$e^{2 \pi \mathit{i}}$$ if casa.

dtypenp.dtype, optional

Datatype of result. Should be either np.complex64 or np.complex128. If None, numpy.result_type() is used to infer the data type from the inputs.

Returns

complex of shape (row, chan, corr)

africanus.dft.dask.vis_to_im(vis, uvw, lm, frequency, flags, convention='fourier', dtype=numpy.float64)[source]

Computes visibility to image mapping of an ideal interferometer:

${\Large \sum_k e^{ 2 \pi i (u_k l + v_k m + w_k (n - 1))} \cdot V_k}$
Parameters

visibilities of shape (row, chan, corr) Visibilities corresponding to brightness terms. Note the dirty images produced do not necessarily correspond to Stokes terms and need to be converted.

uvw coordinates of shape (row, 3) with u, v and w components in the last dimension.

lm coordinates of shape (source, 2) with l and m components in the last dimension.

frequencies of shape (chan,)

Boolean array of shape (row, chan, corr) Note that if one correlation is flagged we discard all of them otherwise we end up irretrievably mixing Stokes terms.

convention{‘fourier’, ‘casa’}

Uses the $$e^{-2 \pi \mathit{i}}$$ sign convention if fourier and $$e^{2 \pi \mathit{i}}$$ if casa.

dtypenp.dtype, optional

Datatype of result. Should be either np.float32 or np.float64. If None, numpy.result_type() is used to infer the data type from the inputs.

Returns