In [1]:
%pylab inline
from scipy.interpolate import interp1d

from IPython.display import Image


Populating the interactive namespace from numpy and matplotlib

Details

Below are the recorded measurements for the first batch of cutout factor measurements

Ionisation conversion

The following cell is used to initialise the ionisation to dose conversion function. Data is extracted from table 20 within TRS398. R50 of the 12 MeV beam is $4.75~g/cm^2$


In [2]:
zOnR50 = concatenate((array([0.02]), arange(0.05,1.25,0.05)))
R50of45 = array([0.997,1,1.004,1.008,1.012,1.017,1.021,1.026,1.03,
                 1.035,1.04,1.045,1.051,1.056,1.062,1.067,1.073,1.08,
                 1.086,1.092,1.099,1.106,1.113,1.120,1.128])

R50of50 = array([0.991,0.994,0.998,1.002,1.006,1.011,1.016,1.02,1.025,
                 1.03,1.035,1.041,1.046,1.052,1.058,1.064,1.07,1.076,
                 1.083,1.09,1.097,1.104,1.112,1.119,1.128])

R50of47_5 = mean([R50of45,R50of50],axis=0)

stopRatio = interp1d(zOnR50 * 47.5,R50of47_5)

Measurements

These measurements were done on Harry 2694, with a Markus chamber set to +300 V. The sensitivity was $1.398 \times 10^9$. All measurements were done at 100 SSD with a 12 MeV beam and a $10\times10$ cm applicator. Below are the readings recorded in chronological order.

Readings


In [3]:
standard_insert_reading = {}
cutout_reading = {}
factor = {}

Standard Insert


In [4]:
standard_insert_reading = array([])

standard_insert_reading = append(standard_insert_reading,mean([1.529,1.529,1.529])) # Measured before
standard_insert_reading = append(standard_insert_reading,mean([1.526,1.527,1.527])) # Measured middle
standard_insert_reading = append(standard_insert_reading,mean([1.529,1.530,1.529])) # Measured at end, but before remeasures
standard_insert_reading = append(standard_insert_reading,mean([1.525,1.525,1.525])) # Measured at last

uncertainty = std(standard_insert_reading)

standard_insert_reading = mean(standard_insert_reading)

In [5]:
print("Standard uncertainty in cutout factor = %0.1f%%" %(sqrt(2) * uncertainty*100/standard_insert_reading))


Standard uncertainty in cutout factor = 0.2%

Output function definition


In [6]:
def outputFunction(cutout,depth,readings,reference):
    
    if size(readings) == 1:
        
        cutout_reading = readings
        factor = reference / cutout_reading * (stopRatio(25) / stopRatio(depth[0]))
        
    else:
    
        stop_ratio_corrected = stopRatio(depth) * readings

        scatter(depth,stop_ratio_corrected)
        ylabel('Stopping power ratio corrected')
        xlabel('Depth (mm)')
        title('Relative ionsation to relative dose')
        show()
        
        ref = argmax(stop_ratio_corrected)
        
        cutout_reading = readings[ref]
        
        factor = (reference / cutout_reading) * (stopRatio(25) / stopRatio(depth[ref]))
    
    
    print("Reading = %0.3f" %(cutout_reading))

    
    print("Cutout factor = %0.3f | %0.1f%%" %(factor, (factor - 1) * 100))
   
    return cutout_reading, factor

Cutout readings


In [7]:
cutout = '104'
depth = array([24,25,25])
readings = array([])

# readings = append(readings,mean([1.519,1.519,1.519])) # ionisation at depth 25 mm RW3

# Measured after the third applicator check
readings = append(readings,mean([1.516,1.517,1.517])) # ionisation at depth 24 mm RW3
readings = append(readings,mean([1.515,1.515])) # ionisation at depth 25 mm RW3

# Same depth except solid water swapped order
readings = append(readings,mean([1.515])) # ionisation at depth 25 mm RW3

cutout_reading[cutout], factor[cutout] = outputFunction(cutout,depth,readings,1.525)

Image('../figures/saved/'+cutout+'.png')


Reading = 1.515
Cutout factor = 1.007 | 0.7%
Out[7]:

In [8]:
cutout = '022'
depth = array([25,24])
readings = array([])

# readings = append(readings,mean([1.513,1.514,1.514])) # ionisation at depth 25 mm RW3

# Measured after the third applicator check
readings = append(readings,mean([1.508,1.508,1.509])) # ionisation at depth 25 mm RW3
readings = append(readings,mean([1.510,1.511])) # ionisation at depth 24 mm RW3


cutout_reading[cutout], factor[cutout] = outputFunction(cutout,depth,readings,1.526)

Image('../figures/saved/'+cutout+'.png')


Reading = 1.508
Cutout factor = 1.012 | 1.2%
Out[8]:

In [9]:
cutout = '038'
depth = array([22,23,24,25])
readings = array([])

# readings = append(readings,mean([1.487,1.487])) # ionisation at depth 25 mm RW3
# readings = append(readings,mean([1.491,1.491])) # ionisation at depth 24 mm RW3
# readings = append(readings,mean([1.492])) # ionisation at depth 24 mm RW3
# readings = append(readings,mean([1.498])) # ionisation at depth 22 mm RW3

# Measured after the third applicator check
readings = append(readings,mean([1.492,1.493,1.494])) # ionisation at depth 22 mm RW3
readings = append(readings,mean([1.493,1.493])) # ionisation at depth 23 mm RW3
readings = append(readings,mean([1.486,1.487])) # ionisation at depth 24 mm RW3
readings = append(readings,mean([1.481,1.482])) # ionisation at depth 25 mm RW3


cutout_reading[cutout], factor[cutout] = outputFunction(cutout,depth,readings,1.527)

Image('../figures/saved/'+cutout+'.png')


Reading = 1.493
Cutout factor = 1.027 | 2.7%
Out[9]:

In [10]:
cutout = '003'
depth = array([23,24,25,22])
readings = array([])

# readings = append(readings,mean([1.482,1.482,1.483])) # ionisation at depth 25 mm RW3
# Measured after the third applicator check
readings = append(readings,mean([1.486,1.486])) # ionisation at depth 23 mm RW3
readings = append(readings,mean([1.481,1.481])) # ionisation at depth 24 mm RW3
readings = append(readings,mean([1.475,1.475])) # ionisation at depth 25 mm RW3
readings = append(readings,mean([1.485,1.485])) # ionisation at depth 22 mm RW3


cutout_reading[cutout], factor[cutout] = outputFunction(cutout,depth,readings,1.528)

Image('../figures/saved/'+cutout+'.png')


Reading = 1.486
Cutout factor = 1.033 | 3.3%
Out[10]:

In [11]:
# cutout = '014'
# depth = array([25,24,23,22,21])
# readings = array([])

# # readings = append(readings,mean([1.466,1.466])) # ionisation at depth 25 mm RW3
# # readings = append(readings,mean([1.469])) # ionisation at depth 24 mm RW3
# # Measured after the third applicator check
# readings = append(readings,mean([1.463,1.463])) # ionisation at depth 25 mm RW3
# readings = append(readings,mean([1.469,1.469])) # ionisation at depth 24 mm RW3
# readings = append(readings,mean([1.473,1.473])) # ionisation at depth 23 mm RW3
# readings = append(readings,mean([1.471,1.472])) # ionisation at depth 22 mm RW3
# readings = append(readings,mean([1.476,1.476])) # ionisation at depth 21 mm RW3



# cutout_reading[cutout], factor[cutout] = outputFunction(cutout,depth,readings,1.529)

# Image('../figures/saved/'+cutout+'.png')

In [12]:
cutout = '020'
depth = array([22,21,20])
readings = array([])

# readings = append(readings,mean([1.463,1.462,1.462])) # ionisation at depth 25 mm RW3
# Measured after middle standard applicator remeasure
readings = append(readings,mean([1.479,1.481])) # ionisation at depth 22 mm RW3
readings = append(readings,mean([1.484,1.485])) # ionisation at depth 21 mm RW3
readings = append(readings,mean([1.487])) # ionisation at depth 20 mm RW3


# readings = append(readings,mean([])) # ionisation at depth 24 mm RW3
# readings = append(readings,mean([])) # ionisation at depth 23 mm RW3


cutout_reading[cutout], factor[cutout] = outputFunction(cutout,depth,readings,1.528)

Image('../figures/saved/'+cutout+'.png')


Reading = 1.485
Cutout factor = 1.038 | 3.8%
Out[12]:

In [13]:
cutout = '057'
depth = array([25,24,23,22,21,20,21,22])
readings = array([])

readings = append(readings,mean([1.410,1.411])) # ionisation at depth 25 mm RW3
readings = append(readings,mean([1.435])) # ionisation at depth 24 mm RW3
readings = append(readings,mean([1.444])) # ionisation at depth 23 mm RW3
readings = append(readings,mean([1.448])) # ionisation at depth 22 mm RW3
readings = append(readings,mean([1.452])) # ionisation at depth 21 mm RW3
readings = append(readings,mean([1.453])) # ionisation at depth 20 mm RW3
readings = append(readings,mean([1.455,1.455])) # ionisation at depth 21 mm RW3
readings = append(readings,mean([1.451,1.451])) # ionisation at depth 22 mm RW3

cutout_reading[cutout], factor[cutout] = outputFunction(cutout,depth,readings,1.529)

Image('../figures/saved/'+cutout+'.png')


Reading = 1.455
Cutout factor = 1.060 | 6.0%
Out[13]:

In [14]:
# Standard insert reading here

In [15]:
cutout = '112'
depth = array([21,20])
readings = array([])

readings = append(readings,mean([1.463,1.463])) # ionisation at depth 21 mm RW3
readings = append(readings,mean([1.466])) # ionisation at depth 20 mm RW3


cutout_reading[cutout], factor[cutout] = outputFunction(cutout,depth,readings,1.529)

Image('../figures/saved/'+cutout+'.png')


Reading = 1.466
Cutout factor = 1.054 | 5.4%
Out[15]:

In [16]:
# Third standard insert measured here

In [17]:
# Final standard insert measured here

In [18]:
# f = open ('mydict.txt', 'w')
# >>>>f.write(str(mydict))
with open('cutout_factors','r') as f:
    
    loaded_factors = eval(f.read())

    
factors_to_save = dict(list(loaded_factors.items()) + list(factor.items()))

with open('cutout_factors','w') as f:
    
    f.write(str(factors_to_save))