The GALPROP program (http://galprop.stanford.edu) computes cosmic-ray propagation in the Galaxy, in 2D or 3D. The ouput cosmic-ray distribution is in the form of FITS files which however are not convenient for viewing or plotting with the standard ftools program fv, since the files have 4 or 5 dimensional arrays (due to the momentum and species axes) while fv handles only 3 dimensional arrays. This program converts to fv-compatible FITS files, either from 2D to (R,z) or from 3D to (x,z) at y=0 or (x,y) at z=0, in each case for a chosen cosmic-ray species.
The third axis is momentum in each case. The distribution can be viewed with fv as a colour image, contoured, output to a file etc.
The program is stand-alone and requires only the cfitsio library to be installed. Build instructions are in the program header.
The FITS.cc/FITS.h class used provides simple convenient access to image data, useful also for other projects.
For fv and cfitsio see http://heasarc.gsfc.nasa.gov/fitsio
- 28 Oct 2013: gcr_convert.cc replaced by V2. Now species indexing starts at 1 as in the FITS header, instead of starting with 0 as in the original version. .
- 15 Nov 2013: gcr_convert.cc replaced by V3: include cstdio to resolve sscanf reference
- For GALPROP updates see https://sourceforge.net/projects/galprop/
to astrotula: try adding at the top: #include <cstdio> If that works I will update it.
I'm getting the error: gcr_convert.cc:81: error: ‘sscanf’ was not declared in this scope