Introduction - Why Python?

The sceintific computing Ecosystem

  • Low level code written in compiled languages as C or Fortran

    • Most widespread scientific computing model in the world of physics. It was there from the very beginning!
    • Strongly oriented on computers and delivers best possible performance.
    • Millions lines of code of highly-optimised code bases (LAPACK etc.); we must work with them!
    • Computing time is more precious than human time!
    • No direct access to higher-level data analysis tools (postprocessing, plotting)
    • Code base is often horrible (badly documented, very hard to read code)
    • Young physicists still must work with them (existing code, it's what the supervisor can help me with).
  • Mathematica, Maple, MATLAB, IDL: popular interactive environments

    • Interactive visualization
    • Extensive Libraries (IDL astro package)
    • Difficult to use in non-interactive batch environment or for large amounts of data
    • Optimised for small to medium tasks <img src="images/DECam.jpg",width=400,height=400>
    • Very expensive, proprieatory software (are you able to reuse your code in your first post-doc?)
    • Usually very specialised to a specific field
  • The command line (gluing together low-level C/Fortran results with high-level analysis tools)

    • Requires knowledge of many different tools and programming languages (grep, sed, awk, bash, gnuplot, ...)

How does Python fit in?

  • Python is a high-level, non-compiled, general-purpose scripting language offering very powerful libraries (modules) for scientific computing.
  • Very readable syntax and programs
  • It offers programming batch-possibilities from the C/Fortran-world as well as rich interactive capabilties.
  • Simple: Non-professional programmers can use it efficiently
  • (Clean Object-oriented model; everything is an object) but you do not need to use it
  • Very rich built-in data types (lists, sets, dictionaries)
  • Libraries and data-structures for MATLAB-like work available (numpy)
  • Possible to wrap with C or Fortran (I never did it)
  • People from a large variety of fields in academia and indistry use it (you get tools and libraries for data-base access, web access etc. for free)
  • Python gets things right for about 90% of our needs!

I could completely switch from C to Python for new tools! It significantly reduce the amount of programs I use in the command line model.

Other Pros of Python

  • Python is not limited to numerics. We need to talk to the WEB, to databases etc.

<img src="https://cdn.eso.org/images/screen/eso1238a.jpg", ,width=400,height=400>

  • Support for automated testing
  • Excellent documentation tools (You are just seeing one of them)

Cons(?) of Python

  • Python is slower than C or Fortran; we have less memory control
  • (Too) many good tools (many people try many before sticking to one) - no clear single point of entry for newcomers.
  • Often scattered community but this seems to be solved for the scientific ecosystem
  • Not a standardized language (see Python2 vs. Python3)
  • Important tools that you need might not yet exist (largely solved for astronomy)!

In [ ]: