All Projects → bwinkel → cygrid

bwinkel / cygrid

Licence: other
Cygrid is a cython-powered convolution-based gridding module for astronomy

Programming Languages

Jupyter Notebook
11667 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to cygrid

nextdriver
An Arduino-based controller for Celestron CG5-series equatorial mounts
Stars: ✭ 21 (-34.37%)
Mutual labels:  astronomy
A-Track
A-Track: Detecting Moving Objects in FITS images.
Stars: ✭ 18 (-43.75%)
Mutual labels:  astronomy
nmmn
Miscellaneous methods for: astronomy, dealing with arrays, statistical distributions, computing goodness-of-fit, numerical simulations and much more
Stars: ✭ 16 (-50%)
Mutual labels:  astronomy
yt astro analysis
yt astrophysical analysis modules
Stars: ✭ 18 (-43.75%)
Mutual labels:  astronomy
AstroTime.jl
Astronomical time keeping in Julia
Stars: ✭ 32 (+0%)
Mutual labels:  astronomy
fritz
Astronomical data platform for the Zwicky Transient Facility.
Stars: ✭ 20 (-37.5%)
Mutual labels:  astronomy
AstronomicAL
An interactive dashboard for visualisation, integration and classification of data using Active Learning.
Stars: ✭ 45 (+40.63%)
Mutual labels:  astronomy
indi-allsky
Software to manage a Linux-based All Sky Camera.
Stars: ✭ 59 (+84.38%)
Mutual labels:  astronomy
astrobook
The Astrobook source files
Stars: ✭ 32 (+0%)
Mutual labels:  astronomy
starclass
Stellar Classification
Stars: ✭ 15 (-53.12%)
Mutual labels:  astronomy
sbpy
A Python package for small bodies research
Stars: ✭ 60 (+87.5%)
Mutual labels:  astronomy
dsp
DSP and filtering library
Stars: ✭ 36 (+12.5%)
Mutual labels:  resampling
apod chrome extension
Astronomy Picture of the Day (APOD) Chrome Extension for the new tab screen
Stars: ✭ 16 (-50%)
Mutual labels:  astronomy
heyoka.py
Python library for ODE integration via Taylor's method and LLVM
Stars: ✭ 45 (+40.63%)
Mutual labels:  astronomy
pydl
Library of IDL astronomy routines converted to Python.
Stars: ✭ 20 (-37.5%)
Mutual labels:  astronomy
skymapper
Mapping astronomical survey data on the sky, handsomely
Stars: ✭ 35 (+9.38%)
Mutual labels:  astronomy
allsky-portal
A simple, responsive web interface to control an allsky camera connected to a Raspberry Pi
Stars: ✭ 28 (-12.5%)
Mutual labels:  astronomy
mlr3spatiotempcv
Spatiotemporal resampling methods for mlr3
Stars: ✭ 43 (+34.38%)
Mutual labels:  resampling
PandExo
A Community Tool for Transiting Exoplanet Science with the JWST & HST
Stars: ✭ 23 (-28.12%)
Mutual labels:  astronomy
sunraster
A SunPy-affiliated package which provides tools to analyze data from spectral data from any solar mission.
Stars: ✭ 19 (-40.62%)
Mutual labels:  astronomy

cygrid

  • Version: 2.0
  • Authors: Benjamin Winkel, Lars Flöer, Daniel Lenz
  • User manual: stable | developer
PyPI tag License Publication https://img.shields.io/badge/ascl-1606.003-blue.svg?colorB=262255

Project Status

cygrid's Travis CI Status cygrid's AppVeyor CI Status cygrid's Coveralls 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:

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:

python setup.py install

Dependencies

We kept the dependencies as minimal as possible. The following packages are required:

  • Python 3.6 or later (cygrid versions prior to v1.0 support Python 2.7)
  • NumPy 1.13 or later
  • Cython 0.27 or later (if you want to build cygrid yourself)
  • Astropy 3.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. (If you have absolutely no possibility to upgrade gcc, older version may work if you replace -std=c++11 with -std=c++0x in setup.py. Thanks to bs538 for pointing this out.)

For Mac OS, it is required to use gcc-6 in order to install cygrid. We recommend to simply use the homebrew package manager and then use brew install gcc.

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}
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].