CUDA Nifty Gridder
CUDA Nifty Gridder is a GPU-accelerated implementation of Nifty Gridder.
Requirements
The system used for development must have an CUDA capable GPU and Python 3 and pip
installed, along with the Python packages numpy
and setuptools
.
To run the unit tests Nifty Gridder must also be installed.
Installation
From the root directory of the CUDA Nifty Gridder git repo, run:
$ pip3 install --user .
Alternatively, assuming git
is installed, this can also be done with:
$ pip3 install 'git+https://gitlab.com/ska-telescope/sdp/ska-gridder-nifty-cuda.git'
This is also an easy way to install the reference Nifty Gridder in order to run the unit tests.
$ pip3 install 'git+https://gitlab.mpcdf.mpg.de/ift/nifty_gridder.git'
Usage
CUDA Nifty Gridder can then be used in your Python code as:
import cuda_nifty_gridder as cng
See the files test_ms2dirty.py
and test_dirty2ms.py
in tests/unit/
for more ideas on how to use CUDA Nifty Gridder.
The full documentation is available at ReadTheDocs and the GitLab Page
Unit Tests
If PyTest is installed, the unit tests can be run from the root directory of the repo as:
$ py.test -s
the -s
provides feedback during the tests, and can be omitted.
Otherwise the tests can be run as:
$ python3 test.py
Public API Documentation
This section lists the functions implemented, using the same interface as DUCC/nifty gridder, by Martin Reinecke.
Note
Only square images are supported at the moment, so, pixsize_x_rad and pixsize_y_rad must be equal, and npix_x and npix_y must be equal.
Functions
- cuda_nifty_gridder.ms2dirty(uvw, freq, ms, weight, npix_x, npix_y, pixsize_x_rad, pixsize_y_rad, epsilon, do_wstacking=True)[source]
Converts visibilities to a dirty image.
- Parameters
uvw (numpy.array((nrows, 3), dtype=numpy.float32 or numpy.float64)) – (u,v,w) coordinates.
freq (numpy.array((nchan,))) – Channel frequencies.
ms (numpy.array((nrows, nchan), dtype=numpy.complex64 or numpy.complex128)) – The input measurement set data. Its data type determines the precision used for the gridding.
weight (numpy.array((nrows, nchan), same precision as ms), optional) – If present, its values are used to multiply the input.
npix_x (int) – x dimension of the dirty image (see Note above).
npix_y (int) – y dimension of the dirty image (see Note above).
pixsize_x_rad (float) – Angular x pixel size (in radians) of the dirty image (see Note above).
pixsize_y_rad (float) – Angular y pixel size (in radians) of the dirty image (see Note above).
epsilon (float) – Accuracy at which the computation should be done. Must be larger than 2e-13. If ms has type numpy.complex64, it must be larger than 1e-5.
do_wstacking (bool) – If True, the full improved w-stacking algorithm is carried out, otherwise the w values are assumed to be zero.
- Returns
The dirty image.
- Return type
numpy.array((nxdirty, nydirty), dtype=float of same precision as ms)
- cuda_nifty_gridder.dirty2ms(uvw, freq, dirty, weight, pixsize_x_rad, pixsize_y_rad, epsilon, do_wstacking=True)[source]
Converts a dirty image to visibilities.
- Parameters
uvw (numpy.array((nrows, 3), dtype=numpy.float32 or numpy.float64)) – (u,v,w) coordinates.
freq (numpy.array((nchan,))) – Channel frequencies.
dirty (numpy.array((npix_x, npix_y), dtype=numpy.float32 or numpy.float64)) – The dirty image. Its data type determines the precision used for the degridding.
weight (numpy.array((nrows, nchan), same precision as dirty), optional) – If present, its values are used to multiply the input.
pixsize_x_rad (float) – Angular x pixel size (in radians) of the dirty image (see Note above).
pixsize_y_rad (float) – Angular y pixel size (in radians) of the dirty image (see Note above).
epsilon (float) – Accuracy at which the computation should be done. Must be larger than 2e-13. If dirty has type numpy.float32, it must be larger than 1e-5.
do_wstacking (bool) – If True, the full improved w-stacking algorithm is carried out, otherwise the w values are assumed to be zero.
- Returns
The visibility data.
- Return type
numpy.array((nrows, nchan), dtype=complex of same precision as dirty)
CUDA Nifty Gridder
This the user documentation for the CUDA Nifty Gridder.