Seth Gossage, Josh Speagle
Coding is a process that can feel like banging your head on a wall sometimes, but it can also be a great creative outlet and an essential tool in research. We will familiarize ourselves with some of the classic issues new grad students often run into when they start to use coding in graduate level courses and research projects. We will practice skills that are valuable in everyday life as a researcher in order to troubleshoot, read, and write code, using the most common programming language in astrophysics: Python.
One of the reasons Python is so popular is that it contains many useful “packages” (pre-written bits of code) that may be imported into your own program and used freely. For instance, astropy
is a package that contains things like common astronomy constants, unit conversions, coordinate systems, and more. SciPy
is another package that includes many useful mathematical functions to serve many of your math-based needs. We will cover how to use these packages along with some practical exercises.
Lastly, it wouldn’t be astronomy if we didn’t have to read and write data tables, so we will also cover how to read data into arrays and manipulate them. In addition, most of the exercises will be astronomy-oriented!
By the end of the course, students should feel more comfortable:
- problem-solving while coding (Googling, reading documentation, etc.),
- using common packages such as
numpy
,scipy
, andmatplotlib
, - installing and using new packages,
- reading and writing data (txt, fits, etc.), and
- commenting and documenting their code.
We have included several exercises that students will work through throughout the course. These are intended entirely as guidelines meant to aid learning and not as material that has to be completed. Students are strongly encouraged to code in pairs or small groups and to try and help each other out. We will check in with students throughout each class, and periodically interject with short lectures to provide additional context and motivation when necessary.
Students will also be given time each class to ask questions about other topics (e.g., related to their research).