Installing HEAsoft on Windows to run Xspec

The High Energy Astrophysics software, HEAsoft, is used by researchers for the analysis of astronomical data by using the multiple packages and tools provided. The guide details the installation of the software on a windows pc.

1. Downloading the software

The software can be downloaded from the official HEASARC website: https://heasarc.nasa.gov/lheasoft/download.html

a) STEP 1 - Select the type of software Select the SOURCE CODE DISTRIBUTION option by clicking on the Source code checkbox. It is preferable to select this option if you wish to run your own models on Xspec. It will then display the list of supported platforms and ask you to select the operating system you would be using to compile the HEAsoft code. Since the software works best on Linux distributions and Mac OS X, we will have to go for the PC- Cygwin option for a Windows pc.

Aside: To learn more about Cygwin, visit this website. In short, it provides a Linux-like environment required for HEAsoft to function smoothly on Windows.

b) STEP 2 - Download the desired packages Select All and click on Submit. You should notice the heasoft-6.24src.tar.gz file downloading in the assigned directory.

2. Setting up Cygwin and the pre-requisites for HEAsoft

As mentioned earlier, you will need Cygwin to run HEAsoft.

a) Visit the cygwin installation website, and click on Run setup-x86.exe for the 32-bit version of Windows. The next step is selecting the packages during installation.

b) Select the following packages from the drop-down menu and click on the check-box:

  1. DEVEL: gcc-core, gcc-fortran, gcc-g++, make

  2. INTERPRETERS: perl, python, python-devel

  3. LIBS: libcrypt-devel, libncurses-devel, libreadline-devel, libXt-devel

  4. X11: xinit

c) The official HEAsoft installation guide details all the pre-requisites required for installation of the software:

The pre-requisites are: Perl, X11, GNU make, C, C++, Fortran, and Perl compilers.

All of which are obtained while downloading the packages mention in 2.b) during Cygwin installation. We are finally on track to start installing the software!

3. Installation of HEAsoft

a) EXPORTING

Open the Cygwin terminal by going to the start menu and searching for cygwin. You will then need to make sure that the correct set of compilers are chosen by the configure script. You would need to specify the path to the installed compilers [downloaded in step 2.b) 4) ] while executing the export command.

$    export CC=/usr/bin/gcc

$    export CXX=/usr/bin/g++

$    export FC=/usr/bin/gfortran

$    export PYTHON=/usr/bin/python

Aside: You can check if the above commands are exported by typing the following:

$    export -p 

This will show all the exported variables on the current shell.

b) UNZIPPING AND CONFIGURING

You will have to go to the directory in which you downloaded the heasoft-6.24src.tar.gz file and unzip the tar file using the command:

$    tar -zxvf heasoft-6.24src.tar.gz

You will now need to run the main configure script to probe the system for libraries, header files, compilers, etc., and then generate the Makefile. This can be done by typing in the following:

$    cd heasoft-6.24/BUILD_DIR/
$    ./configure
$    make
$    make install

The above commands could take 3+ hours to execute. If the installation is on your laptop, make sure your laptop is charged during the process. Finally, type:

$    ./configure > config.out 2>&1 & 

c) STARTING THE BUILD PROCESS

For source code distribution, the build process must be initiated. The output is recommended to be written out in a log file. This step could also take a long time based on the computer used. You can build in the background and check what is going on in real time:

$    make > build.log 2>&1 &
$    tail -f build.log

4. Initialization and Setup

For initializing the software:

$    export HEADAS=/path/to/your/installed/heasoft-6.24/i686-pc-cygwin
$    . $HEADAS/headas-init.sh

Note: The following set up of alias is not mandatory rather is a step to make it convinient for the user when initiating Xspec repeatedly. The last two lines of code would have to be executed everytime if the alias is not set.

To set up an alias, first you would need to open the ./bashr or ./cshrc file in your preferred text editor. Go to the end of the file and add the alias:

$    Notepad ~/.bashrc
$    alias heainit=". $HEADAS/headas-init.sh"

When you log out and log back in, the .bashrc file would be installed.

5. Post-installation

Additional problems exist with Perl modules under Cygwin. For that purpose, at the end of the installation you must go to the cygwin directory and run;

$    /bin/perlrebase

Then exit the cygwin shell and start "ash" by opening Start Menu -> Run and type "C:/cygwin/bin/ash". Then type into the ash terminal:

$    /bin/rebaseall

Exit ash if no errors appear and go back to the Cygwin terminal. In the Cygwin terminal, type:

$    startx

Congrats! You have now completed the installation and can run HEAsoft on your Windows computer. For further information on how to use Xspec, you can have a look at the manual. In the new windows which opens, upon typing startx on the Cygwin shell; you can initiate Xspec by typing heainit (if alias has been set) followed by xpsec. This should get Xspec running on your computer, have fun!

Written by: Soumya Shreeram, Last Updated: 06/08/2018