Section 4 presents speed tests and benchmarks. Cygrid makes use of Cython 5 to improve the speed of some performance-critical functions. It was developed in the framework of the Effelsberg–Bonn H i Survey (EBHIS Kerp et al. 3 we discuss our reference implementation for the Python 4 programming language, the cygrid module. Another advantage of our proposed HEALPix lookup scheme is that it brings the time complexity close to O( n), where n is the number of input samples even for arbitrary world coordinate system (WCS Greisen & Calabretta 2002 Calabretta & Greisen 2002) projections, which is otherwise not easily possible. 2005), to optimally distribute the work across different threads. 2.2, we develop an efficient lookup scheme, which is based on the HEALPix tessellation of the sphere ( Górski et al. To parallelize this scheme, we need to make sure that two threads never write to the same output element. The algorithm can easily be implemented to work serially, which is beneficial for its memory footprint.
2.1.Īs long as the applied gridding kernel is sampled with sufficient spatial density on the target grid, convolution-based gridding conserves flux densities. We briefly recapitulate this algorithm in Sect. 2005) and the Galactic All-Sky Survey (GASS McClure-Griffiths et al.
(2005, 2010) apply this gridding technique to produce (all-sky) H i data cubes and column density maps for the Leiden/Argentine/Bonn Survey (LAB Kalberla et al.
#Scipy griddata software#
It is also used by the G ildas software 3. For example, it is included in the long-known and mature interferometry software package AIPS 1 and its successor CASA 2 (sdgrid task). There is a sufficiently fast alternative, convolution-based gridding, which is well known in many disciplines, especially in radio astronomy. Despite the fact that many available methods are fast and memory efficient, they are not always the best choice for astronomical applications because they do not conserve the flux density of a source. Some are easy to understand and implement, such as nearest-neighbor resampling, or linear and cubic spline interpolation, others involve complex statistical inference, for example, the Kriging algorithm ( Krige 1951 Matheron 1963). There are already many different gridding techniques known in the literature. The task of resampling a data set from irregular spacing to a regular grid is called gridding. However, a regular grid is needed to visualize the data on pixel-based devices, enable algorithmic analysis, or store the data in FITS images. Even if the scan pattern was designed well, the measured data point locations might deviate from a perfect rectangular grid, for example, caused by pointing inaccuracies, the spherical geometry of the sky, or distortions in the optics. For example, in astronomy a single-dish telescope actively scans the sky to produce a map. In many natural sciences, observational data are often irregularly sampled.
Cygrid is a very fast and versatile gridding library that significantly outperforms other third-party Python modules, such as the linear and cubic spline interpolation provided by SciPy. We also compare the gridding speed with other techniques, such as nearest-neighbor, and linear and cubic spline interpolation.Ĭonclusions. We show that for n input data points, cygrids runtime scales between O( n) and O( nlog n) and analyze the performance gain that is achieved using multiple CPU cores. We introduce a lookup table scheme that allows us to parallelize the gridding and combine it with the HEALPix tessellation of the sphere for fast neighbor searches. The regridding algorithm is based on the convolution of the original samples with a kernel of arbitrary shape. The FITS world coordinate system standard is supported. Cygrid can be used to resample data to any collection of target coordinates, although its typical application involves FITS maps or data cubes. We present cygrid, a library module for the general purpose programming language Python. It refers to the resampling of irregularly sampled data to a regular grid.Īims. Data gridding is a common task in astronomy and many other science disciplines.