Exercice 2.1 - Start
Source code of the examples: dosimetry
Step 1
Go into the folder dosimetry
and read carefully the file mac/ex1.mac
to understand what is the purpose of the simulation. Note: the command /control/execute <filename>
includes the content of the given file. This command allows to split simulation macros in several files.
Run the simulation with Gate mac/ex1.mac
and analyze the results. The analysis can be performed with Python : see Step 5 below.
Back to Gate macros. You can play with the verbose options in the verbose.mac file and with the commands: /tracking/verbose 2
(change the number to increase the verbosity). 'Verbososity' means the amount of text information written in the screen during the simulation. You can use Gate mac/ex1.mac | more
to display the terminal's output page by page. Warning, using verbose may increase the computation time, you should only use large verbose value for debug purpose not for production. You may also use Gate mac/ex1.mac > result.txt
to create a file named result.txt
that will contains the text written on the screen by Gate.
In most of the macro, you can enable visualization with two steps: 1) uncomment the line in the macro that include the file mac/visu.mac
and 2) execute Gate with the --qt
option : Gate --qt mac/ex1.mac
. Be careful to reduce the number of primaries to a very low number (around 10 max) before launching the visualization.
Step 2
Change the number of simulated particles (primaries Events). What are the changes regarding the results? Comment the computing time, the uncertainties. Analyze a bit deeper the gamma-stat.txt
file, what can be said about the Events/Tracks/Steps ? How to estimate the number of particles needed to reach 1% uncertainty in a given region of interest ?
Step 3
Change the target (the phantom). Insert for example an aluminum box somewhere in the beam path, comment the results in term of dose, uncertainty, computing time, number of Track/Steps etc. Modify the production cuts and analyse the differences.
Step 4
Modify the DoseActor
. Change parameters: size, resolution, voxel size, position etc (but keep 1D measurements and .txt file format). Observe the results and comments.
Step 5 (analysis)
Python is a powerful language for data analysis. You may want to investigate it from the main web site. The two Python packages that are useful for us here are: numpy (for scientific calculation) and matplotlib for plotting.
In your terminal, from the folder gate-exercices
, run the following command jupyter lab
. It will start a server and open a web page from wich you will be able to perform Python analysis of the simulation output. In the Jupyter lab web page, navigate to the 2_dosimetry
folder and open the file ex1 dose depth profile.ipynb
. This file contains some Python instructions to read the simulation output and display it. You can learn more on notebook on this web page: https://jupyter.org
In the notebook page, you can see a set of cells (box with grey background color) with python code. Each cell can be run by pressing Shift-Enter, the result of the code is displayed below the cell.