Kapteyn Package for Python 3

The Kapteyn Package is a collection of Python modules and applications developed by the computer group of the Kapteyn Astronomical Institute, University of Groningen, The Netherlands. The purpose of the package is to provide tools for the development of astronomical applications with Python.

The package is suitable for both inexperienced and experienced users and developers. Documentation is provided for both groups. The documentation also provides in-depth chapters about celestial transformations, spectral translations and non-linear least squares fitting. The start of the development of the package was pre-Astropy and much functionality can nowadays be found in other packages, but not all, so we decided to publish a new version that complies with Python 3.10 and Matplotlib 3.7.

You can install the Kapteyn Package version 3.4 (last update: July 1, 2023) with:

pip install https://www.astro.rug.nl/software/kapteyn/kapteyn-3.4.tar.gz

or download the file kapteyn-3.4.tar.gz and follow the instructions in the installing section of the introduction (Installing)

The source code of the Kapteyn Package is hosted at: gitlab.astro.rug.nl/kapware/kapteyn-package

Galactic pole plot

Graticules from different sky systems

The package’s most important features

  • The handling of spatial and spectral coordinates, WCS projections and transformations between different sky systems. Spectral translations (e.g., between frequencies and velocities) are supported and also mixed coordinates. (Modules wcs and celestial. Module wcs uses Mark Calabretta’s WCSLIB.)

  • Versatile tools for writing small and dedicated applications for the inspection of FITS headers, the extraction and display of (FITS) data, interactive inspection of this data (color editing) and for the creation of plots with world coordinate information. See the examples in the maputils tutorial and the plots in the gallery of all-sky plots.

  • A class for the efficient reading, writing and manipulating simple table-like structures in text files. (Module tabarray)

  • Utilities for use with matplotlib such as obtaining coordinate information from plots, interactively modifiable colormaps and timer events (module mplutil); tools for parsing and interpreting coordinate information entered by the user (module positions).

  • A function to automatically search for gaussian components in a profile (module profiles) and a class for non-linear least squares fitting (module kmpfit).

Documentation in PDF

The documentation is also available as a PDF file: kapteynpackage.pdf


An archive with all the examples and data used in the tutorials can be downloaded from examples.tar.gz

J.C. Kapteyn, age 45 yr

J.C. Kapteyn, age 45.


J.C. Kapteyn, age 45. From the book ‘J.C. Kapteyn, zijn leven en werken’ (1928) by his daughter H. Hertzsprung-Kapteyn. Prof Jacobus Cornelius Kapteyn (1851-1922) was a Dutch astronomer who found evidence for galactic rotation. The Kapteyn Astronomical Institute is named after its founder J.C. Kapteyn.


Indices and tables