Skip to content
anjavdl edited this page Sep 5, 2017 · 16 revisions

Introduction

Python is an interpreted, object oriented, high-level programming language. An interpreted programming language is dierent from a compiled language in a number of ways, but in practice it means that you need to dene all of the classes and functions at the top of the code, before you use them. In compiled languages some things can appear out of order, because the compiler reads through the whole source code before making the compiled program. Interpreted languages are read line by line by the interpreter, so things cannot be out of order in the code.

Calling python

There are 3 main ways of working with python:

  1. interactively on the command line (shell mode)
  2. with python programs / scripts
  3. through jupyter notebooks

Shell mode

In shell mode, you simply type the command python into a terminal, which will print some details about the version of python you have installed, the date, and the commands for how to get help, credits, and licensing information. The terminal will show >>>, which means you can now type in python commands and the interpreter will execute those commands.

Python tutorial
Data for python tutorial: test_data.txt , spec-4561-55614-0126.fits

Python notebook on reading FITS files, numpy, plotting histograms.
Images: 00000025.BIAS.FIT , 00000026.BIAS.FIT

Python primer

Installing python on your laptop

Python is available for all common operating systems. The easiest way to install it is through anaconda. Anaconda includes all the packages needed for this lab, in particular numpy and astropy. Anaconda does take up significant disk space, so instead you could install miniconda along with the packages you need.

Clone this wiki locally