The exercises will consist of writing and executing python code which implements certain statistical methods. To complete them, you will need:
- a browser, to view this documentation. If you have an internet connection, you can also use it to view the theta documentation and the documentation for scipy (although this is not a requirement for completing the exercises).
- a text editor, for editing the python code
- a command line (console), to execute the code from
- a pdf viewer to see the plots generated by your code
If you are reading this, you successfully completed item 1. Now, open the text editor and open the file <theta-svn>/utils2/examples/infn2013/ex0.py, where <theta-svn> is the directory where you checked out theta. This file is a “Hello World” program meant to test your setup and introduce some python code notation in case you don’t know python.
To run the code in ex0.py, open a console, change to the directory <theta-svn>/utils2/examples/infn2013/ and execute:
../../theta-auto.py ex0.py
In case your setup is working, you should see an output like this:
[INFO] executing script ex0.py
Hello World!
Hello World from indented code.
called print_s with s=
called print_s with s=hello world
list items 0, 2: 1 3
list items:
1
2
3
[INFO] Running 'XXX/bin/theta XXX/utils2/examples/infn2013/ex0/dnll-toys:0.0-s-d193c794a1.cfg --nowarn'
progress: 1000 / 1000 [100.0%] errors: 0 [ 0.0%]
Total number of likelihood evaluations: 22914
[INFO] workdir is /space/ottjoc/code/theta-testing/utils2/examples/infn2013/ex0
Everything between the first and second “[INFO]”-line is printed from the python source; make sure to roughly understand how the code which produces this output works. The second “[INFO]”-line and everything below is generated by the theta-auto framework, which calls the “theta” main program to do the actual work. The code also creates a file called test.pdf in the current directory. Open it with a pdf viewer to see the (spiky) histogram for the likelihood ratio test statistic – the statistics details are not important right now, this is a technical test at this point only.
In the exercises, also the other scripts will be executed in this way, i.e. by:
../../theta-auto.py <script-name>
where <script-name> is ex1.py, ex2.py, ...
Open the file common.py in the editor. This file implements methods you can use in the exercises. You do not need to edit it or to understand the methods implementations in order to complete the exercises. However, the source-code comments just above the method definitions are needed to use the methods correctly, so keep this file open and refer to those comments whenever needed.
In general, most of the code for completing the exercises is already included in the python files ex1.py, ex2.py, etc. and only minor modifications are required. Some parts, however, require the implementation of some more code. In case you are stuck, have a look at the corresponding “solutions” python files (ex1-solutions.py, ...) which contains those parts.
The exercises also include some introduction and discussion; most of it should sound familiar from the lecture. Each exercise part has at least one “Question” which you should be able to answer (most of the times as a numerical value). You are encouraged, though, to go beyond the questions to find out what you are interested in, e.g. different numerical setting, plotting/printing intermediate results, etc.