7
$\begingroup$

I would like to work in the field of observational astronomy (not so much theoretical astronomy).

I currently know two computer programming languages: C# and MATLAB.

I have read that computer programming is absolutely essential to every astronomer, and that it takes a very significant part of the time of the work of most astronomers.

Therefore I would like to learn a few more programming languages. Hence my question:

What are the most common programming languages in observational astronomy?

$\endgroup$
  • $\begingroup$ Also, many people are still using IRAF. $\endgroup$ – pela Apr 19 '15 at 17:29
12
$\begingroup$

Python is gaining popularity and replacing MATLAB in many fields of science as the tool for fast prototyping and writing research code.

For example, have a look at:

(I'm not working in astronomy as a researcher but in some other field.)

| improve this answer | |
$\endgroup$
  • 2
    $\begingroup$ Definitely Python: it's open source and free, available almost in every platform by default, has countless available packages, the community is strong and active (and growing), very gradual learning curve (ie: easy to learn), its usage is expanding very quickly in the field, etc. $\endgroup$ – Gabriel Apr 24 '15 at 13:53
7
$\begingroup$

As an observational astronomer, most of your programming will be to perform data analysis, data exploration, and possibly image manipulation. Previously much of this was done with IDL, and the analysis pipelines for several/many/all(?) telescopes still rely on IDL. As GreenMatt points out though, IDL is on its way out. Since you have to buy a license to use it, you can only share code with other IDL users, it's not open source, etc.

The community is in the process of switching to Python, which is absolutely what I would recommend first for a new entry into the field. Python is free, open source, etc, etc. Since you'll be using python for data analysis and numerics, it is vital that you learn the NumPy package as well. With NumPy array operations in python are almost as fast as C or Fortran. SciPy and MatPlotLib are also incredibly useful, you don't need to learn the entire library, but you should be familiar with the basics.

The astronomy community is collaborating on some python packages to make more analysis techniques common. These are the AstroPy and AstroML packages. Once you get a handle on things, both would be good to be familiar with.

C is great to know, but not vital for day-to-day observational astronomy. We use it a lot in theoretical astronomy to write numerical simulations. Mainly I see C codes used in observational either for one-off calculations from a large dataset, or used to write fast modules for Python :) If that sounds up your alley, you should give it a shot too!

| improve this answer | |
$\endgroup$
2
$\begingroup$

While I'm not doing so now, for a significant part of my career I worked as a programmer supporting scientists in in some fields that the general public would consider branches of astronomy. In that time I worked with (chronologically ordered in the sequence in which I first worked with them):

  • Fortran - still useful because of its speed and existing code base
  • C and C++ - useful for commanding instrumentation, as well as being a good - albeit a sometimes difficult - general purpose language
  • Perl - general purpose "glue" language
  • Python - good general purpose language which is easy to learn and understand. See mmh's answer
  • Java - general purpose language
  • IDL - useful for imaging and array manipulation
  • PHP - for websites

My recommendation for two or three to learn, would be: Python, Fortran, and C. Python seems to be rising in popularity in the community and has lots of add on modules for scientific applications (once you've got a handle on Python, I recommend learning NumPy and maybe SciPy). C is an always useful language to know, and I think Fortran will continue to have its uses for a while. Perl is waning in popularity in general. IDL was once very popular, but its expensive licenses are limiting its adoption for new projects now that free alternatives exist.

| improve this answer | |
$\endgroup$
1
$\begingroup$

If you're looking for a replacement for IDL mentioned by Geoff and GreenMatt, try PDL, Perl Data Language. Its development started in the astronomy community as a free alternative to IDL (migration guide), so it can read/write IDL files, FITS files, etc. and the first example in the PDL Book is image processing on M51.

It also has migration guides if you're coming from MATLAB or Scilab and it is still being developed today.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.