Spiralling spots
Purpose: to show usage of python preparser with meta-input code.
Meta-input file
# create a spiralling irradiation pattern by displacing the phantom
region: phantom ; L=[10,10,10] ; voxels = [101,101,20]
def: N = 5 # number of turns
def: nspots = 100 # total number of spots
def: Rmax = 3 # major radius
def: Rmin =0 # minor radius
func: r(th) = Rmax-(Rmax-Rmin)*th/(N*2*pi)
for(th in np.linspace(0,N*2*pi,nspots))<
def: x = r(th)*cos(th)
def: y = r(th)*sin(th)
transform: phantom move_to $x $y 0
deliver: all
for>
The python preparser generates the following input file (look into out/log/run.inp
):
region: phantom ; L=[10,10,10] ; voxels = [101,101,20]
transform: phantom move_to 3 0 0
deliver: all
transform: phantom move_to 2.82142 0.926645 0
deliver: all
transform: phantom move_to 2.36701 1.74279 0
deliver: all
transform: phantom move_to 1.68744 2.36968 0
deliver: all
transform: phantom move_to 0.854771 2.74896 0
deliver: all
transform: phantom move_to -0.045194 2.84813 0
deliver: all
transform: phantom move_to -0.921737 2.66318 0
deliver: all
...
...
...
Results:
here the technique is to keep fixed the main beam and move the phantom after each spot.
The resulting irradiation pattern on the phantom looks like:
![spiralling spots](../../_images/spiralling_spots.png)
Irradiation pattern made with spiralling spots (log scale)