Project Status
Cygrid is already used in several “production” systems, for example it was utilized for two major 21-cm HI surveys, EBHIS and HI4PI. Nevertheless, we cannot guarantee that it’s completely bug-free. We kindly invite you to use the library and we are grateful for feedback. Note, that work on the documentation is still ongoing.
Purpose
cygrid allows to resample a number of spectra (or data points) to a regular grid - a data cube - using any valid astronomical FITS/WCS projection (see http://docs.astropy.org/en/stable/wcs/).
The method is a based on serialized convolution with finite gridding kernels. Currently, only Gaussian (radial-symmetric or elliptical) kernels are provided (which has the drawback of slight degradation of the effective resolution). The algorithm has very small memory footprint, allows easy parallelization, and is very fast.
A detailed description of the algorithm is given in Winkel, Lenz & Flöer (2016), which we kindly ask to be used as reference if you found cygrid useful for your research.
Features
Supports any WCS projection system as target.
Conserves flux.
Low memory footprint.
Scales very well on multi-processor/core platforms.
Installation
We highly recommend to use cygrid with the Anaconda Python distribution, in which case installiation is as easy as
conda install -c conda-forge cygrid
Otherwise, you should install cygrid via pip:
python -m pip install cygrid
The installation is also possible from source, but you’ll need a C++ compiler. Download the tar.gz-file, extract (or clone from GitHub) and execute (in project directory):
python -m pip install .
Dependencies
We kept the dependencies as minimal as possible. The following packages are required:
Python 3.8 or later (cygrid versions prior to v1.0 support Python 2.7)
NumPy 1.13 or later
Cython 3 or later (if you want to build cygrid yourself)
Astropy 4.0 or later
(Older versions of these libraries may work, but we didn’t test this!)
If you want to run the notebooks yourself, you will also need the Jupyter server, matplotlib and wcsaxes packages. To run the tests, you’ll need HealPy.
Note, for compiling the C-extension, openmp is used for parallelization and some C++11 language features are necessary. If you use gcc, for example, you need at least version 4.8 otherwise the setup-script will fail. It is highly recommended to use Anaconda, which offers the proper compilers for many platforms.
Usage
Minimal example
Using cygrid is extremely simple. Just define a FITS header (with valid WCS), define gridding kernel and run the grid function:
from astropy.io import fits
import cygrid
# read-in data
glon, glat, signal = get_data(...)
# define target FITS/WCS header
header = {
'NAXIS': 3,
'NAXIS1': 101,
'NAXIS2': 101,
'NAXIS3': 1024,
'CTYPE1': 'GLON-SFL',
'CTYPE2': 'GLAT-SFL',
'CDELT1': -0.1,
'CDELT2': 0.1,
'CRPIX1': 51,
'CRPIX2': 51,
'CRVAL1': 12.345,
'CRVAL2': 3.14,
}
# prepare gridder
kernelsize_sigma = 0.2
kernel_type = 'gauss1d'
kernel_params = (kernelsize_sigma, )
kernel_support = 3 * kernelsize_sigma
hpx_maxres = kernelsize_sigma / 2
mygridder = cygrid.WcsGrid(header)
mygridder.set_kernel(
kernel_type,
kernel_params,
kernel_support,
hpx_maxres
)
# do the gridding
mygridder.grid(glon, glat, signal)
# query result and store to disk
data_cube = mygridder.get_datacube()
fits.writeto(
'example.fits',
header=header, data=data_cube
)
More use-cases and tutorials
Check out the user manual or the Jupyter tutorial notebooks in the repository for further examples of how to use cygrid. Note that you can only view the notebooks on GitHub, if you want to edit something it is necessary to clone the repository or download a notebook to run it on your machine.
Who do I talk to?
If you encounter any problems or have questions, do not hesitate to raise an issue or make a pull request. Moreover, you can contact the devs directly:
Preferred citation method
Please cite our paper if you use cygrid for your projects.
@ARTICLE{2016A&A...591A..12W,
author = {{Winkel}, B. and {Lenz}, D. and {Fl{\"o}er}, L.},
title = "{Cygrid: A fast Cython-powered convolution-based gridding module for Python}",
journal = {\aap},
archivePrefix = "arXiv",
eprint = {1604.06667},
primaryClass = "astro-ph.IM",
keywords = {methods: numerical, techniques: image processing},
year = 2016,
month = jun,
volume = 591,
eid = {A12},
pages = {A12},
doi = {10.1051/0004-6361/201628475},
adsurl = {http://adsabs.harvard.edu/abs/2016A%26A...591A..12W},
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}
Metadata
Release files for cygrid 2.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| cygrid-2.0.4.tar.gz | 4.5 MB | Without provenance | Details |
Built distributions (wheels)
Total release size: 40.4 MB
Release files / cygrid-2.0.4.tar.gz
| Download URL | cygrid-2.0.4.tar.gz |
|---|---|
| Size | 4.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ebc49f8ff3cd2c0363783e261825a3e6b948374703be56289f0937e11af4456a
|
|
BLAKE2b-256 checksum How to use checksums |
ae7881b638e0457ba277c45e3723d26b6e95510c5625c28bd6b804ab3f476570
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.8
|
Release files / cygrid-2.0.4-cp312-cp312-win_amd64.whl
| Download URL | cygrid-2.0.4-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
40ca7e15b04ad66b02e74c700fd1ad1a74b14d7cb7036f8469c538bc3d67d97d
|
|
BLAKE2b-256 checksum How to use checksums |
bc6e5da9e5c6b6dbff6573929e7235c7b16037e62dfebdaaf720091a8b9934a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.2
|
Release files / cygrid-2.0.4-cp312-cp312-manylinux_2_28_x86_64.whl
| Download URL | cygrid-2.0.4-cp312-cp312-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 4.4 MB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
d360c25a18e5713946a2f5d89ee39bd8621ecb05564ca628a0f2f2a73d87a2a1
|
|
BLAKE2b-256 checksum How to use checksums |
75399fcbcc64f04bf39bf9812df2ca72f4ed247f50b0767820bf0ad6cdd8c8a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.2
|
Release files / cygrid-2.0.4-cp312-cp312-macosx_10_9_x86_64.whl
| Download URL | cygrid-2.0.4-cp312-cp312-macosx_10_9_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.12 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
bd9fca6c85c3c19f4266125e83b1cbfb267bcd50cd83648f176c0d3027c85610
|
|
BLAKE2b-256 checksum How to use checksums |
65dbae23e8e94a03e99765dc5b68c19331587d2f2faf6ca4f83b7f60d40ebab2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.2
|
Release files / cygrid-2.0.4-cp311-cp311-win_amd64.whl
| Download URL | cygrid-2.0.4-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
3f7b5430061bbebd0c73ef556a3e575d86ae706df84843739bfab2efa34af8d8
|
|
BLAKE2b-256 checksum How to use checksums |
7784a1b5fb3fcad647e4e044232167241f446028998af2d459fca699171b7583
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.8
|
Release files / cygrid-2.0.4-cp311-cp311-manylinux_2_28_x86_64.whl
| Download URL | cygrid-2.0.4-cp311-cp311-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 4.5 MB |
| Tags | CPython 3.11 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
6fe5ee78a824e4dc2d429f45fab6e65ddec09a020c70a22bdd2b189f00b9b7c3
|
|
BLAKE2b-256 checksum How to use checksums |
c265a24425d376fb06f970e354581e81350e5b1db88a86b4b9c046a6c735b90a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.8
|
Release files / cygrid-2.0.4-cp311-cp311-macosx_10_9_x86_64.whl
| Download URL | cygrid-2.0.4-cp311-cp311-macosx_10_9_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.11 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
d987e4dea09958882a9cfb30de8744eb9c7bd61f70950f4551d3892104bc7ea9
|
|
BLAKE2b-256 checksum How to use checksums |
7679ad631c64bff4eb2cb868dba5bf7322fe1340249b78941c235b49cf18274c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.8
|
Release files / cygrid-2.0.4-cp310-cp310-win_amd64.whl
| Download URL | cygrid-2.0.4-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
514582ed0a280f9140db018d17fdbd6446ef1be6dafaeeec1b0225677321d3b7
|
|
BLAKE2b-256 checksum How to use checksums |
3ad9fc1a6d26c514ac7635d73d55e1533aff8bc923c44d8da1dd140e68b0545e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.10.14
|
Release files / cygrid-2.0.4-cp310-cp310-manylinux_2_28_x86_64.whl
| Download URL | cygrid-2.0.4-cp310-cp310-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 4.3 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
f0f479e2a5baf219d4a7b9621ed12cbfd638e32a10733bb447d2b41ed48d4126
|
|
BLAKE2b-256 checksum How to use checksums |
9373170b531e8834475f9e0da75bab0bb71f6887a6e42b0abb9d75f2d87ad3a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.10.14
|
Release files / cygrid-2.0.4-cp310-cp310-macosx_10_9_x86_64.whl
| Download URL | cygrid-2.0.4-cp310-cp310-macosx_10_9_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.10 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
addf53e68e48f43f1b2747055846fe94c256d9a8d01c78a0492b96da62706814
|
|
BLAKE2b-256 checksum How to use checksums |
d988ce6f346f93c22444742acaa59ceedff5f3be90e06f99eaf0c90dbe694d12
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.10.14
|
Release files / cygrid-2.0.4-cp39-cp39-win_amd64.whl
| Download URL | cygrid-2.0.4-cp39-cp39-win_amd64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.9 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
b23b0b910c5ade6e9ca46f02a1232a5bde8b3400396dd361affb1b3f32d46729
|
|
BLAKE2b-256 checksum How to use checksums |
6c32e0b9e084b3448fe43b8b1b9e058cbf17f609ab8665d3c448ec346421ffa5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.9.19
|
Release files / cygrid-2.0.4-cp39-cp39-manylinux_2_28_x86_64.whl
| Download URL | cygrid-2.0.4-cp39-cp39-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 4.3 MB |
| Tags | CPython 3.9 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
b3b5377192abe9b869b980fe2cd19998941e8be1d17c7daf6b72717405c984d5
|
|
BLAKE2b-256 checksum How to use checksums |
2aee573507022bab3ad899aad9f229ccc36aa862c63e9b8c0cee96245f6da502
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.9.19
|
Release files / cygrid-2.0.4-cp39-cp39-macosx_10_9_x86_64.whl
| Download URL | cygrid-2.0.4-cp39-cp39-macosx_10_9_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.9 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
c1d6adb872c97156549ae3322427c3829a429e6e621e1f3e9d9b0465abc59e5d
|
|
BLAKE2b-256 checksum How to use checksums |
c3ed5b4bbdc26136b84de5036d4a5a94568ccec518e8e4d8ef22e186379e9767
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.9.19
|
Release files / cygrid-2.0.4-cp38-cp38-win_amd64.whl
| Download URL | cygrid-2.0.4-cp38-cp38-win_amd64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.8 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
915ab9e9e37586eaef9c61be9c2ecd40a1fcc50343c8df1a39b354ebdb3b7525
|
|
BLAKE2b-256 checksum How to use checksums |
fe932b105617eea71f70bf780ac5d75bd90389a69269f9b38b1d091ae4e053a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.8.19
|
Release files / cygrid-2.0.4-cp38-cp38-manylinux_2_28_x86_64.whl
| Download URL | cygrid-2.0.4-cp38-cp38-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 4.3 MB |
| Tags | CPython 3.8 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
ee4ecc20bce88c89bcae68037ed94fcfa0d9679b4321620244d6bdc8a17d60b7
|
|
BLAKE2b-256 checksum How to use checksums |
a5eb921fe244b96f99524b0ae69ce0de574f2da1df70353655f8586b405d1e83
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.8.19
|
Release files / cygrid-2.0.4-cp38-cp38-macosx_10_9_x86_64.whl
| Download URL | cygrid-2.0.4-cp38-cp38-macosx_10_9_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.8 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
f3162158c626951d69dcdb3ea26eacaa1f5d4a25454f039c14a6e10221a3f35d
|
|
BLAKE2b-256 checksum How to use checksums |
5790a0f58765990f5e6d910937278da712b600369ec56a745351eef24f74f159
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.8.19
|
Security for cygrid 2.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.