Skip to content

Instantly share code, notes, and snippets.

@trigfa
Created December 28, 2015 17:17
Show Gist options
  • Save trigfa/6fa90d7f06477e5bcfdd to your computer and use it in GitHub Desktop.
Save trigfa/6fa90d7f06477e5bcfdd to your computer and use it in GitHub Desktop.
Spencer Attix stopping power ratios
def stoppingPowerRatio(R50D,z):
"""Given the beam quality R50,D calculates the Spencer Attix stopping power ratios at depth, z, using
the fit by Burns et al given in the 2003 IPEM code of practice for electron dosimetry.
This fit is valid for for beam qualities R50,D in the range 1-20 cm of water and for depths of 0.02 to
1.2 times R50,D"""
a = 1.075
b = -0.5087
c = 0.0887
d = -0.084
e = -0.4281
f = 0.0646
g = 0.00309
h = -0.125
x = np.log(R50D) # np.log gives the natural log ln of a number
y = z/R50D
S = (a + b*x + c*x**2 + d*y)/(1 + e*x + f*x**2 + g*x**3 + h*y)
return S
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment