8. Computer practical.
8.1. Introduction to computer practical.
The computer optics laboratory offers a number of experiments that can be done on the computer using simulations of real optical problems. The computer lab is part of the introduction to optics (in Dutch!) course given during the second year Applied Physics (TN) Bachelor study of the faculty of Science and Technology (TNW) of the University of Twente.
Optics can be learned traditionally through theory by following lectures and in practice by performing experiments in the laboratory. With these simulations a third method is added: experiments on the student’s computer. Although the simulations are very realistic, computer experiments can never take the place of real experiments in the optics laboratory. Doing physics as opposed to thinking about doing physics should be done in the real laboratory where the student experiences real experimental problems that cannot be simulated even by the most advanced programs. The advantages of simulations are, however, that the student can do the experiment any time he wants in his own place. Also no costly laboratory equipment and stringent time schedules are needed. With these simulations the student will learn many things about the topic’s theory and how the experiment can be performed in the real laboratory.
Each experiment has a number of exercises to be done and questions to be answered. The experiments are done by changing one or more parameters and by measuring characteristic data usually with the mouse. The student is asked to derive an expression for the parameter (wavelength, some radius, thickness, etc.) to be determined from the measurements. Each simulation will generate a random number, which will give the parameter to be measured. The formula relating this number to the parameter is very complicated and only known to the lecturer. The student must write this number on his report so he/she can easily check the answers.
The simulations make use of an optical toolbox (LightPipes) with several commands for propagation, apertures, lenses, etc. The toolbox is written by Gleb Vdovin and is modified for this purpose by me. The toolbox is linked to each simulation program. It makes use of advanced propagation routines for solving the Fresnel-Kirchoff integral in two dimensions. The result is a very realistic optical simulation program for studying physical optics.
Screenshot of one of the simulation programs (Fresnel diffraction with spherical wavefront as input).
Fresnel diffraction pattern as observed in the real optics lab.
The Python script file of each experiment can be downloaded and executed if you properly prepared your Python installation including the installation of the necessary packages, see: Prepare your computer. The experiments should be done in the order given by the assignments and when possible repeated in the real laboratory.
Enjoy playing with optics!
Fred van Goor
8.2. Prepare your computer.
To do the computer practical you have to prepare your computer. You must install Python and some other stuff before you can run the programs.
Go to the Python website, http://www.python.org, and Install Python on your computer.
You will need the download tool pip. It is already installed with your Python installation, but you need to upgrade it. Install and/or upgrade the download tool ‘pip’.
Install the matplotlib plot package. Open a terminal and type at the prompt:
Windows: pip install matplotlib
Linux and mac: sudo pip install matplotlib
Install the LightPipes for Python optical toolbox. Open a terminal and type at the prompt:
Windows: pip install LightPipes
Linux and mac: sudo pip install LightPipes
A nice and convenient environment to run and edit the Python scripts is Geany.