Astro 330 Course Book: Scientific Computing in Astrophysics

This website serves as the repository for materials presented in the Astro 330 Course taught by Imad Pasha and Marla Geha at Yale University. It includes Python lectures, Lab assignments, and solutions, as well as short articles (“Quick Tips”) that came up during the course. The first iteration of this class was taught in Fall 2021, and had an enrollment of ~15 students.

We welcome you to peruse these materials, attempt the labs, or modify/use them for your own teaching (with attribution). All materials are provided as-is, but we welcome suggestions and bug-fixes; you can create an issue at the Github page for this site.

About the Course

The course focuses on high level Python computing in the context of astrophysics research. The course goal is to provide students with the fundamentals of building astronomical pipelines and the general use of cutting edge tools and techniques currently used in the astronomical community. We will discuss and build software for the analysis, manipulation, reduction, and visualization of astronomical data from observations and simulations. You can find a detailed summary of the modules and topics we covered at the sidebar tab for “Course Overview”.


This course is intended to build on the introductory programming experience students gained during the required ASTR 255 (“Research Methods in Astrophysics”) or equivalent research experience. Students should know basic python coding, including working with numpy arrays and creating basic plots with matplotlib, before attempting the assignments in this course.

Course Format

The course consists of (1) weekly Python lectures (2) in-depth tutorial/workshop days during which students work together on programming assignments, and (3) seminar lectures by invited outside experts who are pushing the forefront of Python in Astronomy. There are weekly coding assignments and a final capstone project. We found that several of the assignments available on the left are best given 2 weeks (with 2 in-class work days) to complete, but this will depend on the level of the students.

Guest Speakers

We are grateful to the speakers who met with our students this semester - below is a running list, including some of the packages they are associated with:

  • Prof. X Prochaska (UCSC; pypeit)

  • Prof. David Hogg (NYU/Flatiron CCA; emcee)

  • Shany Danieli (IAS/Princeton; artpop)

  • Yao-Yuan Mao (Rutgers;adstex)

  • Adrian Price-Whelan (CCA/Flatiron; gala,astropy)

Lab Assignments & Github

Our course handled distribution and submission of assignments via Github classroom. Students pulled assignments (Jupyter Notebooks) from Github, worked on them, and pushed the final labs back to Github.

Labs were also available here at this site, which uses the jupyter-book package to create nicely formatted assignments. The data needed to complete the labs will be available in the Data Access panel to the left.


We graded the course as follows:

  • 50% Weekly Assignments

  • 45% Capstone Project (Computing project + talk, see below)

  • 5% Participation

Capstone Projects

The page linked at left details the components of the capstone project, which is completed in stages and has rubrics associated with each component. Ultimately the final project is designed as an opportunity for students to write a “substantial” piece of code that leverages the skills they have learned in the course. Their goal is to create a package which

  • Is stored as functions and classes in python modules, and can thus

  • Be imported into other code for general use, is

  • Installable via pip, allowing functions/classes to be imported from anywhere on the system, and is

  • Distributed and maintained on Github.

At the end of the course, we will link to the student’s packages here.