The UNESCO program “Active Learning in Optics and Photonics” (ALOP) promotes a friendly and interactive method for teaching optics using simple and inexpensive equipment [1-3]. The full ALOP manual can be downloaded from UNESCO . Despite the gain provided by these new conceptual experiments, diffraction remains a difficult concept for students. Numerical simulation is a valuable help in this direction and many simulations are now available for free on the web. Numerical tools have been developed to accompany the ALOP modules [5,6]. The dazzling progress in this area allow us, thanks to free distributions like python and the notebook associated with it, to implement the ALOP modules with the numerical code that simulate the various phenomena..
Teaching with Python
Among the multitude of programming languages available, Python has experienced the most rapid growth these past few years. One reason for that is due to the fact that interfacing modules are multiplatform so the same program can be used to generate applications for different Operating Systems (OS). Another important reason is python is a free and open source software. In addition to these two major points python has several advantages over other programming language such as easy syntax. In addition, it comes with various packages (all open source) such as Scipy (Scientific Python), Matplotlib (a plotting program), Numpy (Numerical Python), Statpy (Statistical Python), etc. There are numerous texts on Python [7,8]. It should be emphasized that Python is a very intuitive programming language, which is very flexible and powerful.
Versions of Python
One of the most critical points is the installation of the python distribution. Since most of python distributions are/were developed as open source a wide variety of possibilities are offered to users and accordingly it is difficult to select the one that suits the user most. This is particularly true when organizing an event such as an optics educational workshop. In any case, the most recommended version of python to use is python 2.7 because of its stability. The newer version (Python 3.0 or 3.4) can run version 2.7 with a few minor modifications. The software can be downloaded from the Python Foundation at: https://www.python.org/downloads/.
Notebook is a powerful tool to write and generate lessons in various formats as latex, html or slides. In addition to that it is possible to insert parts of codes, execute them and generate the outputs. This ability facilitates greatly the explanation of programs. The notebook can be downloaded from: http://ipython.org/notebook.html. The code given in the section 3.1.3 illustrates how to interactively affects a value to one of the parameters.
In this example we will deal with diffraction. Diffraction is one of the modules of the ALOP program. Fraunhofer is an application built using python programming language and its packages like Numpy, Matplotlib and wxpython. This program was developed under windows OS and the same code can be compiled under both linux and OSX.
Single slit diffraction
Single slit diffraction is modeled as sinc() function with the suitable parameters. Let I(x) be the distribution of the intensity and I(0) its value at x=0. Let b be the slit width, A the wavelength and D the distance of the screen to the slit. The expression of the intensity normalized to I(0) is:
Making these parameters interactive, it is possible to perform numerical experiments and test a wide variety of configurations. For instance, this allows us to test the effect of different wavelengths, which would be difficult to do in an experimental situation due to lack of light sources with variable wavelengths. We face the same problem with the slits. For example, in ALOP workshop the slits are manually fabricated. So it is not possible to produce a large number of slits different slit widths.
Plotting within application
Creating an application with interactive tools as buttons, menus, sliders make this possible. Figure.1 shows how it is possible to vary the three parameters (b, λ, D) with the help of the sliders at the bottom. Moreover the values of these three parameters, displayed inside the plot along with the formula, change simultaneously with the values in the slider. We show here, as an example, the interface created for this application.
Notebook allows us to explain in a friendly way how the program is built. We can follow the progress, as we will do it with a debugger.
We get as an output:
Enter the slit width (microns)= 1
b = 1
This first part affects the value to the three parameters (d, λ, D] and computes the sinc() function. The following part displays the result.
Multiple slit diffraction
Young’s Double slit diffraction
As in the previous section, let I(x) be the distribution of the intensity and I(0) its value at x=0. Let ‘b’ be the slit width, ‘a’ the distance between slits, T the wavelength and ‘D’ the distance of the screen to the slit. The expression of the intensity normalized to I(0) is:
We proceed with the same way as in the case of the single slit. Making these parameters interactive, it is possible to perform numerical experiments and test a wide variety of configurations. Figure. 2 shows how it is possible to vary the four parameters (b, a, λ, D) with the help of the sliders at the bottom. Likewise these four values are displayed inside the plot along with the formula changing simultaneously with the values in the slider.
Increasing the number of slits lead us to the case of grating diffraction. In this case the mathematical expression of the normalized intensity is given by:
And as previously done we transform this into an interactive application. Figure.3 shows the interface dedicated to this case.
In order to better spread optical physics together with the new software facilities such as Python, we organized a workshop at the Faculty of Science of Tunis in November 2014 with 15 participants. This was the first of (we hope) a long series. During this first workshop, we presented as a first part the basic physics of diffraction phenomena and the second part was dedicated to Python. Two python distributions were prepared for the participants (windows and linux). After the installation of the distribution we tested the two cases: single slit and the Young double slit.
Most of the participants (53%) found the session beneficial and (33%) very beneficial on a scale of 0 to 5, ranging from very beneficial to useless. The majority of the participants were very enthusiastic and asked for information on the next planned workshop
After the tedious step of the Python distribution installation procedure, it is very easy to develop programs and build applications that are available for various OS. Since this new environment is free, this possibility constitutes a very crucial point for teaching and more generally outreach programs. The next steps will be in two directions, (1) organization of several workshop sessions and (2) to develop other simulations and implement them on smartphones and mobiles devices that will be accompany the ALOP program.
M. Alarcon, Z. Ben Lakhdar, I. Culaba, S. Lahmar, V. Lakshminarayanan, A. Mazzolini, J. Maquiling, Niemela J. “Active learning in optics and photonics (ALOP): a model for teacher training and professional development”, Proc SPIE, 7783: 1–8, 2010.Google Scholar
M. Alarcon, Z. Ben Lakhdar, I. Culaba, G. Denardo, V. Lakshminarayanan, J. Maquiling, A.Mazzolini, J. Niemela, D. Sokoloff: “Active learning in optics and photonics: Training Manual” http://unesdoc.unesco.org/images/0021/002171/217100e.pdfGoogle Scholar
H. Ghalila, Z. BenLakhdar, S. Lahmar, Z. Dhouaidi, Y. Majdi: “Active Learning in Optics and Photonics: Fraunhofer diffraction”, Proc. SPIE 9289, doi:10.1117/12.2070776; http://dx.doi.org/10.1117/12.2070776 http://spie.org/Publications/Proceedings/Paper/10.1117/12.207077Google Scholar
V. Lakshminarayanan and R.Burman, Python Optics, unpublished technical report, University of Waterloo, 2014.Google Scholar
M. Lutz, Learning Python, 5th edition, O’Reilly Media, Sebastopol, CA., 2013.Google Scholar
Z.Ben Lakshdar, S.Lahmar, V. Lakshminarayanan, “Workshop on active learning: two examples”, Proc. SPIE 9289 doi:10.1117/12.2070726; 2013.Google Scholar