Python Programming

Python programming

In our lab we use the Python programming language (Python 3) for most of our programming needs. Python is a general purpose programming language. Hence, you can use the programming language for developing both desktop and web applications. Also, you can use Python for developing complex scientific and numeric applications. Python is designed with features to facilitate data analysis and visualization.

Python programming language is dominating other programming languages such as C, C++ or Java. It has undergone more than 25 years of the successful span and it is one of the fastest growing programming languages. Python is powerful because it is very easy. That is a benefit for beginners of course, but also for experienced programmers. This easiness and better code readability allows the programmer to create very complex programs easily, and the better code readability translates into better and faster debugging of the program.

Installation / Usage

The best way to use Python for scientific and engineering work is to install the Anaconda package on your computer. Visit this page to download the Anaconda distribution for your operating system (choose the Python 3.x version). The Anaconda distribution makes all the libraries available in one place. The most common ones will be pre-installed and you can install more as needed through the Anaconda Navigator.

To run Python programs you can use one of the following three options (first two are similar and third is recommended only in special situations):

  1. Spyder: This is a complete GUI interface for writing and executing Python code. It comes pre-installed with Anaconda and can be started directly from the Anaconda Navigator. File format is standard Python (i.e. *.py)
  2. Pyzo: This has similar capabilities to Spyder and also have a very handy help interface that can make code writing easier. It has to be installed separately. File format is standard Python.
  3. Jupyter Notebook: This also comes pre-installed with Anaconda. The file format here is *.ipynb and so the code cannot be read by any other editor. However, it has additional capabilities and can be used in special situations.

External Resources

There are a lot of resources available online, which means anyone can easily start learning how to work with Python. Further, all of the scientific libraries that will be used for performing research in our lab are free and open source and have extensive documentation available on their dedicated webpages. Following is a list of external resources you can use to get started with programming in Python and also for reference while working.

The Python programming language

Libraries for science & engineering

While Python itself is only a programming language (just like C, C++, Java etc.), there are a number of available scientific libraries which transform it into a powerful tool for performing science and engineering computations and data analysis. Use the following links to explore these libraries

  • NumPy is the fundamental package for scientific computing with Python. Refer to the NumPy documentation and briefly go through the user guide. For any details that might be needed refer to the NumPy reference.
  • SciPy (pronounced “Sigh Pie”) is a Python-based ecosystem of open-source software for mathematics, science, and engineering. (In addition to SciPy, the website actually includes a discussion of NumPy and other packages as well). This general documentation page links to information for Numpy, Scipy, Matplotlib, IPython, SymPy, and Pandas. However, the SciPy Documentation and Reference Page is where you will find all the information about SciPy. The Tutorials section will provide helpful examples, but for complete details don't forget to click through the links in the API Reference.
  • Matplotlib is a Python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms.Follow these links for examples, tutorials, and the user guide.