Skip to content
This repository has been archived by the owner on Jun 1, 2020. It is now read-only.


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?


Failed to load latest commit information.
Latest commit message
Commit time

This archive is deprecated; please use PyGDSM


Note: GSM2016 methods are in beta!!

PyGSM is a Python interface for the Global Sky Model (GSM2008) of Oliveira-Costa et. al., (2008), and recently Zheng et. al., (2016), GSM2016. The GSMs are all-sky maps in Healpix format of diffuse Galactic radio emission from 10 MHz to 94 GHz (GSM2008) and 10 MHz to 5 THz (GSM2016).

This is not a wrapper of the original code, it is a python-based equivalent that provides a useful API which has some additional features and advantages, such as healpy integration for imaging. The GSM2008 and GSM2016 classes provided here are designed to have the same API (i.e. function names & usage). Instead of the original ASCII DAT files that contain the principal component analysis (PCA), from the GSM2008, data are stored in HDF5, which can be quickly read into memory, and takes up less space to boot. Similarly, the GSM2016 data is converted into HDF5.


The first thing to do will be to make sure you've got the dependencies:

Then clone the directory

    git clone

You need to have git-lfs installed to download the data files. If you don't, you can get these via wget:

  wget -O gsm2016_components.h5
  wget -O gsm_components.h5

Which are hosted on Zenodo.

You may then install this by running python install.

To get a quick feel of what PyGSM does, have a look at the GSM2008 quickstart guide, and the new GSM2016 quickstart guide.

Q & A

Q. What's the difference between this and the gsm.f from the main GSM2008 website? The gsm.f is a very basic Fortran code, which reads and writes values to and from ASCII files, and uses a command line interface for input. If you want to run this code on an ancient computer with nothing by Fortran installed, then gsm.f is the way to go. In contrast, PyGSM is a Python code that leverages a lot of other Packages so that you can do more stuff more efficiently. For example: you can view a sky model in a healpy image; you can write a sky model to a Healpix FITS file; and believe it or not, the Python implementation is much faster. Have a look at the quickstart guide to get a feel for what PyGSM does.

Q. Are the outputs of gsm.f and pygsm identical? At the moment: no. The cubic spline interpolation implementation differs, so values will differ by as much as a few percent. The interpolation code used in gsm.f does not have an open-source license (it's from Numerical Recipes ), so we haven't implemented it (one could probably come up with an equivalent that didn't infringe). Nevertheless, the underlying PCA data are identical, and I've run tests to check that the two outputs are indeed comparable.

Q. What's the difference between this and the Zheng et. al. github repo? pygsm provides two classes: GlobalSkyModel2016() and GSMObserver2016(), which once instantiated provide methods for programatically generating sky models. The Zheng et. al. github repo is a simple, low-dependency, command line tool. Have a look at the GSM2016 quickstart guide to get a feel for what PyGSM does.

Q. Why is this package so large? The package size is dominated by the PCA healpix maps, which have about 3 million points each. They're compressed using HDF5 LZF, so are actually about 3x smaller than the *.dat files that come in the original gsm.tar.gz file. The next biggest thing is test data, so that the output can be compared against precomputed output from gsm.f. The package now also includes the Zheng et. al. data, which is another ~300 MB.

Q. Why do I need h5py? h5py is required to read the PCA data, which are stored in a HDF5 file. Reading from HDF5 into Python is incredibly efficient, and the compression is transparent to the end user. This means that you can't eyeball the data using vim or less or a text editor, but if you're trying to do that on a file with millions of data points you're doing science wrong anyway.


The PCA data contained here is from and

The original GSM2008 paper is:

A. de Oliveira-Costa, M. Tegmark, B.M. Gaensler, J. Jonas, T.L. Landecker and P. Reich
A model of diffuse Galactic radio emission from 10 MHz to 100 GHz
Mon. Not. R. Astron. Soc. 388, 247-260 (2008)

Which is published in MNRAS and is also available on the arXiv.

And the GSM2016 paper is:

H. Zheng (MIT), M. Tegmark, J. Dillon, A. Liu, A. Neben, J. Jonas, P. Reich, W.Reich
An Improved Model of Diffuse Galactic Radio Emission from 10 MHz to 5 THz

which is available on the arXiv.

PyGSM has an entry:

D. C. Price, 2016, 2.0.0, Astrophysics Source Code Library, 1603.013


All code in PyGSM is licensed under the MIT license (not the underlying data). The PCA data, by Zheng et. al. is licensed under MIT also (see


Python implementation of the Global Sky Model (GSM) for the radio sky between 10 MHz - 5 THz






No packages published