coding & computing

HEAsoft install on a Mac

Updated Feb 1, 2021

Here are my instructions for how to get HEAsoft, the NASA High Energy Astrophysics Software, set up on a Mac with macOS Catalina (v10.15.7). I learned most of this from HEAsoft’s own documentation (and a lot of trial and error over the years). I work in bash, so adapt as needed if you use c-shell or zsh. Disclaimer: I’m not a HEAsoft developer or maintainer, so follow this advice at your own risk. Actual HEAsoft maintainers should be your first point of contact if something goes wrong.

Step 0

Make a full backup of your machine as-is.

Step 1

Install these things:

Xcode from the App Store
Command Line Tools for Xcode by typing xcode-select –install
homebrew (or another package manager like MacPorts or Fink)

prompted to run these by homebrew:

git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch –unshallow
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch –unshallow

Step 2

Using the package manager, install the following (and their dependencies). Some of these are brew upgrade Thing instead of brew install Thing (it will complain and tell you).

brew install gcc@10
brew install x11vnc
brew install perl
brew install wget
brew install automake
brew install mawk
brew install flex
brew install wcslib
brew install lzip
brew install slang
brew install imagemagick
brew install gnuplot
brew install ncurses
brew install pgplot
brew install cfitsio

Step 3

Download the HEAsoft source tarball. The first bullet point, above Step 1 on that page, should have everything you need (and you probably don’t need the extra old XSPEC stuff). This download takes like 30 minutes! I then put it in the directory ~/opt/ and unzip the HEAsoft tarball in there (tar -xvzf). This is a different location than what I’ve previously done! It seems that the new macOS really hates letting the user install things as su.

As it’s downloading, navigate to your old HEADAS directory and rename it to, e.g., old-heasoft6.26. This way there won’t be weird crosstalk. You can also delete your previous old-heasoft and tarball if you still have it. If you’ve never ever installed HEAsoft on your computer, you can skip this part.

Step 4

Follow the instructions for remote CALDB: Remember to save the files in /usr/local/src and put the appropriate export lines in ~/.bashrc!

Step 5

Copy/paste into ~/.bashrc (using homebrew installations of the compilers and the anaconda distribution of python 3):

export CC=/usr/local/bin/gcc-10
export CXX=/usr/local/bin/g++-10
export FC=/usr/local/bin/gfortran-10
export PERL=/usr/local/bin/perl
export PYTHON=/Users/YourUserName/opt/anaconda3/bin/python

Step 6

In the ~/.bash_profile file, be sure that /usr/bin and /usr/local/bin are at the beginning of your PATH environment variable.

Step 7

Restart your computer. I don’t know how necessary this is, but it’s one of the few things that changed in the few days between the install not working and working.

Step 8

To configure, make, and install (your HEAsoft version number might be different when you reference this blog post):

cd ~/opt/heasoft-6.28/BUILD_DIR/
make > build.log 2>&1
make install > install.log 2>&1

Note that I’m no longer passing the X11 include and library directories to the configure script, as I’ve had to do in previous installs. You should be able to open build.log and install.log as those things are going (from a different terminal window) to see their progress. You can also use tail build.log and tail install.log to view the last 10 lines of the files (though this won’t update, so this is more for occasional checks).

The make line with build.log takes a particularly long amount of time (like 20ish minutes). Since it’ll use a lot of memory and you’ll hear the fans going as it’s makeing, I don’t recommend playing videogames on your computer in the downtime.

Step 9

Copy/paste into ~/.bashrc for general use (again, your HEAsoft version number and system architecture might be different. If you ls in the HEAsoft directory you’ll see what to put for the system architecture thing):

export HEADAS=/Users/YourUserName/opt/heasoft-6.28/x86_64-apple-darwin19.6.0
alias heainit=”. $HEADAS/”

To start up XSPEC, in a bash terminal session type


and it should start up an XSPEC environment! Happy analysis!

Step 10

Once I get PyXSPEC working, I’ll put the steps here.

Astronomy projects with Google Summer of Code

Google Summer of Code GSoC
Google Summer of Code projects are now open for application! We’re looking for some undergrads to work in python on black hole X-ray analysis code (they don’t need to know any astrophysics in advance): check out our Timelab ideas page. There are also some astronomy projects with the OpenAstronomy umbrella organization.

If you’re mentoring undergrads (or are an undergrad yourself) who particularly like coding, this could be great astro-programming experience for them! Google Summer of Code is a paid internship for people who are enrolled as undergraduate students as of May 4th 2017.

Please encourage your undergrads to apply!! Applications are open until April 3rd. Check out the main GSoC website for more info.

Hack Together Day at EWASS 2017

We are pleased to announce a hack day to accompany the special session on astronomy research software at EWASS 2017!!

Hack Together Day is a day to work intensively on projects, individually or in small groups, of interest to the astronomical community. A wide variety of projects will be undertaken, spanning everything from software development to community outreach to scientific research to trying out new analysis tools. We’ll also ask the contributors for SS16 (Developments and Practices in Astronomy Research Software) block 3 to be at the hack day, to help participants install, configure, and use the featured software packages. This information will be shared here once the talk schedule is confirmed.

Hack day or programming experience is not required; newcomers are extremely welcome! Project ideas and participants will be solicited before and during the meeting. Participants can lead or join a project, and should plan on focusing on only one thing.

Hack Together Day will take place on Thursday June 29th from 9:00 to 17:30, with the usual breaks for the plenary session, coffee and lunch.

Please register your attendance using this form so we can ensure enough resources for everyone. You do not need to be contributing an oral or poster presentation to the software session in order to participate in the hack day! For more information, see the EWASS 2017 Hack Together Day page on the AstroBetter wiki.

Get in touch if you have any comments/questions/concerns. We look forward to seeing you in Prague this June!

EWASS 2017: Developments & Practices in Astronomy Research Software!!

EXCITING NEWS!! There will be a special session at the European Week of Astronomy and Space Science (EWASS) 2017 on developments and practices in astronomy research software and a hack day!! I’m co-organizing the hack day and a block on different astronomy software packages, where we will have a variety of speakers (invited and contributed) share open-source software packages of interest to a broad portion of the astronomical and space science community.

EWASS is the general meeting for the European Astronomical Society that will be held in Prague, Czech Republic on 26-30 June 2017, hosted this year in partnership with the Czech Astronomical Society. There will be many symposia and special sessions on a variety of research topics, and registration for the meeting will open in December.

UPDATE (25 Jan):

Abstract submission is open for all EWASS 2017 sessions, and here’s a blog post on the hack day with links for registration and more info. The talks will be on June 28 and Hack Together Day #hackEWASS will be on June 29.

PyAstro17 applications are open!

The Python in Astronomy logo is based on the Python Logo, an SDO AIA 17.1nm EUV image courtesy of NASA/SDO and the AIA, EVE, and HMI science teams and this image of the Horsehead nebula which is used courtesy of ESA.
Applications to participate in the Python in Astronomy 2017 workshop are open until December 9th! The workshop will be held on May 8-12, 2017 at the Lorentz Center in Leiden, the Netherlands. Some travel funding will be available if needed, and participant selection will be done with the goal of growing the Python in Astronomy community. All career levels and Python skill levels are welcome to apply.

I’ve been to the previous two Python in Astronomy workshops. At the first meeting, I was a beginner in terms of contributing to open-source python astronomy projects (like, had never done a GitHub pull request, and didn’t know anything about packaging software), but I learned a ton and loved getting involved with a wonderful community! At the second meeting I was able to take a more active participation role, and I co-lead a tutorial on git and GitHub. And I’m now on the Scientific Organizing Committee for this one!

You can learn more on the workshop website! The application form is here. Get in touch with me or other SOC members if you have questions!

Python in Astronomy 2016

By -, GPL,
I’m currently in Seattle at the Python in Astronomy 2016 workshop and wanted to post some notes and reference links for those of you who want to follow along with what we’re up to:

The program for the week

#PyAstro16 hashtag on twitter

Livestream and archived livestreams are recorded and posted by Dan Foreman-Mackey

A Google doc with a list of links to notes from all the presentations and unconference sessions

Zenodo page that will have presentations, notes, as ‘Unproceedings’ (with a DOI for official citing)

Please let me know if there are any other links you’re interested in or that I forgot to include!

New page: Coding resources

Remember kids, the only difference between screwing around and science is writing it down. --Adam Savage, Mythbusters
I’ve put together a long list of coding and computing resources. Since it’s so important, it doesn’t just get a blog post, it gets its own page! Check it out and let me know if your favourite is on there.

EDIT: I’ll (slowly) add my list to the AstroBetter wiki so future generations of students can have a more centralized repository of resources.


This week I’m participating in the Python in Astronomy workshop at the Lorentz Center in Leiden. It is the greatest workshop/conference/unconference I’ve been to, and it’s only day 3 out of 5. I’ve been developing my git and github skills, and submitted my first pull request (i.e., open-source code contribution) yesterday to SunPy! For this afternoon some of us are planning to sit down and try to hammer out the basics of an astroquery HEASARC module for downloading data from NASA’s HEASARC database!

You can follow along with the hashtag #pyastro15

A note on the twitter hashtag feed: I know that abbreviations can be frustrating for those not at the conference or new to the topics. This being said, twitter inherently does not lend itself to verbosity. If you’re trying to follow along and are getting lost in tweets densely packed with abbreviations and acronyms, please reply and request clarification!

Also, you’ll probably find that some people are tweeting with the hashtag more for non-attendees, and some are aiming their tweets at fellow attendees (I admit I tend to be in the latter camp). You may find it less frustrating to follow a few specific people and not everything from the hashtag.

LaTeX workshop and guide

In honor of the impending start of the academic year, here is the pdf of my LaTeX workshop.

Click to access latex_workshop.pdf

Live-tweeting the SURFsara e-infrastructure event

I’m live-tweeting the SURFsara data and supercomputing e-infrastructure event. Follow along with the tag #einfra!