Cygrid: A fast Cython-powered convolution-based gridding module for Python

Context. Data gridding is a common task in astronomy and many other science disciplines. It refers to the resampling of irregularly sampled data to a regular grid. Aims. We present cygrid, a library module for the general purpose programming language Python. Cygrid can be used to resample data to any collection of target coordinates, although its typical application involves FITS maps or data cubes. The FITS world coordinate system standard is supported. Methods. The regridding algorithm is based on the convolution of the original samples with a kernel of arbitrary shape. 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. Results. We show that for n input data points, cygrids runtime scales between O ( n ) and O ( n log  n ) and analyze the performance gain that is achieved using multiple CPU cores. We also compare the gridding speed with other techniques, such as nearest-neighbor, and linear and cubic spline interpolation. Conclusions. 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.

[1]  T. Murphy,et al.  GASS: The Parkes Galactic All-Sky Survey. II. Stray-Radiation Correction and Second Data Release , 2010, 1007.0686.

[2]  W. B. Burton,et al.  The Leiden/Argentine/Bonn (LAB) Survey of Galactic HI - Final data release of the combined LDS and IAR surveys with improved stray-radiation corrections , 2005, astro-ph/0504140.

[3]  Gaël Varoquaux,et al.  The NumPy Array: A Structure for Efficient Numerical Computation , 2011, Computing in Science & Engineering.

[4]  B. Gibson,et al.  GASS: THE PARKES GALACTIC ALL-SKY SURVEY. I. SURVEY DESCRIPTION, GOALS, AND INITIAL DATA RELEASE , 2009, 0901.1159.

[5]  B. Winkel,et al.  The Effelsberg Bonn H I Survey (EBHIS) , 2011, 1104.1185.

[6]  B. Winkel,et al.  The Effelsberg-Bonn H i Survey: Milky Way gas - First data release , 2015, 1512.05348.

[7]  Mark R. Calabretta,et al.  Representations of world coordinates in FITS , 2002, astro-ph/0207407.

[8]  John D. Hunter,et al.  Matplotlib: A 2D Graphics Environment , 2007, Computing in Science & Engineering.

[9]  Stefan Behnel,et al.  Cython: The Best of Both Worlds , 2011, Computing in Science & Engineering.

[10]  Prasanth H. Nair,et al.  Astropy: A community Python package for astronomy , 2013, 1307.6212.

[11]  K. Gorski,et al.  HEALPix: A Framework for High-Resolution Discretization and Fast Analysis of Data Distributed on the Sphere , 2004, astro-ph/0409513.

[12]  E. Greisen,et al.  Representations of celestial coordinates in FITS , 2002, astro-ph/0207413.

[13]  G. Matheron Principles of geostatistics , 1963 .