-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathicr calculation
More file actions
181 lines (173 loc) · 13.5 KB
/
Copy pathicr calculation
File metadata and controls
181 lines (173 loc) · 13.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
import logging
import numpy as np
from math import exp, pow
import matplotlib.pyplot as pyplot
from scipy.optimize import curve_fit
logger = logging.getLogger(__name__)
def calcFlux(tubeVoltage, tubeCurrent, cuTube, distance, time, numPix, pixArea):
# logger.info('calcFlux')
noAtt = np.array([[0, 0, 0, 0, 0, 5.51389E-31, 2.75759E-17, 1.07107E-09, 0.000149618, 0.190552163, 1.865341688,
84.19044375, 101.4284813,
491.2833375, 1584.0585, 3823.081313, 7474.291875, 12502.38375, 18599.43938, 25306.11, 32141.4075,
38693.30063,
44660.44125, 49856.95688, 54196.56563, 57668.11875, 60311.8125, 62198.775, 63415.74375,
64054.18125, 64203.1875,
63945.675, 63355.78125, 62498.53125, 61429.725, 60196.44375, 58837.89375, 57386.5875, 55868.895,
54306.19125,
52715.50313, 51110.30813, 49501.15875, 47896.07063, 46301.19188, 44720.9775, 43158.61125,
41616.24188, 40095.19688,
38596.1625, 37119.33563, 35664.525, 34231.28625, 32818.93313, 31426.68938, 30053.64938,
28698.89063, 37447.29563,
26040.45375, 41795.865, 23444.04375, 22167, 20903.0625, 19651.56188, 18411.91313, 17183.61,
15966.19688, 19706.72063,
13562.7525, 13639.4325, 11026.90125, 9899.420625, 8775.765, 7656.519375, 6542.29125, 5433.723,
4331.474438, 3236.24475,
2148.75225, 1069.74675, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 4.67184E-31, 2.32589E-17, 9.19676E-10, 0.000147815, 0.199745438,
1.861071188, 94.18365, 90.8886375, 451.0888313, 1499.203125, 3741.694313, 7571.1825, 13096.78875,
20111.45625,
28177.71188, 36759.11063, 45336.13875, 53479.15875, 60878.475, 67343.68125, 72786.09375,
77194.6875, 80612.83125,
83117.64375, 84805.03125, 85777.425, 86136.8625, 85979.7, 85394.1375, 84458.8125, 83242.74375,
81805.21875,
80196.8625, 78460.36875, 76631.23125, 74738.86875, 72807.46875, 70856.55, 68901.80625,
66955.78125, 65028.2625,
63126.675, 61256.75625, 59422.66875, 57627.28125, 55872.35438, 54158.97938, 52487.51625,
50857.7625, 49269.16125,
47720.80125, 46211.535, 99403.70625, 43304.86125, 134520.4125, 40537.28813, 39201.6825,
37896.06375, 36618.83438,
35368.45313, 34143.39, 32942.19938, 58749.46875, 30605.8725, 36364.59563, 26850.68438,
25895.57063, 24945.2325,
23999.50125, 23058.18563, 22121.11688, 21188.14875, 20259.14625, 19334.00813, 18412.63313,
17494.95375, 16580.91938,
15670.5075, 14763.71813, 13860.5625, 12961.08563, 12065.34375, 11173.42688, 10285.43625,
9401.495625, 8521.75125,
7646.360625, 6775.515, 5909.41125, 5048.271, 4192.327125, 3341.836125, 2497.065188, 1658.2995,
825.84, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0], [0, 0, 0, 0, 0, 4.10399E-31, 2.02922E-17,
8.01124E-10, 0.000143153, 0.199228331, 1.751829188, 97.73454375, 81.50416875,
407.7385313, 1373.241938, 3490.070063,
7216.92, 12783.49875, 20114.7075, 28867.93313, 38537.51063, 48570.98625, 58459.8375,
67792.6125, 76274.775,
83724.13125, 90054.3375, 95253.4125, 99362.3625, 102456.9, 104632.3688, 105993.225,
106645.05, 106689.4875,
106221.2625, 105326.325, 104081.4563, 102553.875, 100802.0813, 98876.30625, 96819.3,
94667.11875, 92450.025,
90193.10625, 87917.175, 85639.1625, 83372.79375, 81129.15, 78916.89375, 76742.83125,
74612.025, 72528.35625,
70494.46875, 68511.99375, 66582, 64704.825, 62880.1875, 182151.5625, 59386.275,
263159.4375, 56092.10625,
54516.49875, 52986.4425, 51500.28375, 50056.27313, 48652.68938, 47287.7775, 106138.2938,
44667.0675, 58802.175,
38348.3475, 37429.30688, 36520.62188, 35621.98875, 34733.10938, 33853.64063, 32983.26188,
32121.60188, 31268.34,
30423.105, 29585.55375, 28755.35438, 27932.175, 27115.70063, 26305.605, 25501.60125,
24703.39688, 23910.73875,
23123.36813, 22341.0375, 21563.53875, 20790.6525, 20022.19875, 19257.9975, 18497.89125,
17741.73938, 16989.41813,
16240.80938, 15495.8175, 14754.375, 14016.40313, 13281.85125, 12550.68563, 11822.87813,
11098.42875, 10377.32063,
9659.5875, 8945.24625, 8234.330625, 7526.908125, 6823.02375, 6122.761875, 5426.196188,
4733.425125, 4044.54825,
3359.679188, 2678.939438, 2002.458375, 1330.3755, 662.8381875, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0,
0, 0, 3.6923E-31, 1.81672E-17, 7.14082E-10,
0.000139696, 0.196480631, 1.612499625, 97.69291875,
74.09300625,
371.28645, 1255.96575, 3217.355438, 6730.0875,
12096.0675, 19353.465, 28276.47, 38443.29188,
49333.51688, 60419.08125,
71230.3875, 81393.13125, 90639.45, 98802.5625,
105802.0875, 111625.2563, 116308.9125, 119923.2,
122558.5125,
124315.3688, 125297.4375, 125605.6875, 125335.9688,
124576.875, 123408.3938, 121901.85, 120120.4688,
118119.2063,
115945.7063, 113640.8063, 111239.4938, 108771.3563,
106261.2563, 103730.0625, 101195.1, 98670.54375,
96168.15,
93697.2, 91265.2875, 88878.2625, 86540.68125,
84255.8625, 82026.225, 79853.34375, 281104.2563,
75681, 419499.3938,
71739.95625, 69854.79375, 68025.31875, 66250.18125,
64528.03125, 62857.4625, 61236.84375, 161534.925,
58138.7625,
82745.2125, 48225.9825, 47266.11, 46319.42813,
45386.00438, 44465.7375, 43558.52625, 42664.23,
41782.59563,
40913.40375, 40056.38438, 39211.2, 38377.575,
37555.14375, 36743.55188, 35942.47875, 35151.54188,
34370.3925,
33598.64813, 32835.97688, 32082.01875, 31336.41375,
30598.83563, 29868.9525, 29146.41563, 28430.94375,
27722.21063,
27019.935, 26323.83, 25633.62, 24949.04625,
24269.8725, 23595.84, 22926.75188, 22262.37188,
21602.50875, 20946.97688,
20295.585, 19648.18125, 19004.59688, 18364.69688,
17728.34625, 17095.41563, 16465.7925, 15839.38125,
15216.08063,
14595.81188, 13978.50188, 13364.08313, 12752.49938,
12143.70563, 11537.65688, 10934.33625, 10333.70438,
9735.755625,
9140.484375, 8547.890625, 7957.96875, 7370.7525,
6786.253125, 6204.493125, 5625.511875, 5049.34875,
4476.04875,
3905.6625, 3338.2485, 2773.8675, 2212.588125,
1654.48125, 1099.625625, 548.1029813]])
cuAtt1mm = np.array(
[1000, 1000, 1000, 193.4464, 150.4249961, 119.561434, 96.79422044, 79.59941749, 66.3488, 55.64065729,
47.16144877, 40.35408234, 34.8216294, 30.27584, 26.42809052, 23.21571081, 20.51164683, 18.21832117,
16.25992341, 14.57692774, 13.12213797, 11.85779633, 10.75344398, 9.78432, 8.922312288, 8.160108622,
7.483554528, 6.880850381, 6.342105058, 5.858983984, 5.424429634, 5.032438106, 4.677879404, 4.356352,
4.067065957, 3.803282769, 3.562224757, 3.341471864, 3.138908827, 2.952681114, 2.781158016, 2.622901614,
2.476640584, 2.341248, 2.218726438, 2.104812436, 1.998752763, 1.899872625, 1.807566235, 1.721288674,
1.640548825, 1.564903238, 1.493950787, 1.427328, 1.368218121, 1.312458494, 1.259809696, 1.210052843,
1.162987548, 1.118430098, 1.076211845, 1.036177768, 0.998185194, 0.962102654, 0.927808856, 0.895191771,
0.864147812, 0.834581089, 0.806402743, 0.779530352, 0.753887379, 0.72940269, 0.706010106, 0.683648,
0.664528752, 0.646169061, 0.628530031, 0.611575196, 0.595270339, 0.579583329, 0.564483971, 0.549943872,
0.535936311, 0.522436123, 0.509419595, 0.496864366, 0.484749338, 0.473054588, 0.461761296, 0.450851668,
0.440308876, 0.430116992, 0.42026093, 0.4107264, 0.403469395, 0.396410229, 0.389541648, 0.38285673,
0.376348868, 0.370011753, 0.363839356, 0.357825916, 0.351965924, 0.34625411, 0.340685431, 0.335255057,
0.329958365, 0.324790924, 0.319748488, 0.314826984, 0.310022507, 0.305331308, 0.300749792, 0.296274503,
0.291902125, 0.287629468, 0.28345347, 0.279371184, 0.275379776, 0.271476521, 0.267658794, 0.263924071,
0.260269919, 0.256693996, 0.253194043, 0.249767886, 0.246413427, 0.243128643, 0.239911583, 0.236760365,
0.233673171, 0.230648248, 0.227683902, 0.224778496, 0.221930451, 0.21913824, 0.216400385, 0.21371546,
0.211082084, 0.208498922])
cuAtt = np.zeros(np.shape(noAtt))
coeffcient = 1.072
for i in range(4):
for j in range(140):
cuAtt[i][j] = noAtt[i][j] * exp(-cuAtt1mm[j] * cuTube)
if tubeVoltage == 80:
i = 0
elif tubeVoltage == 100:
i = 1
elif tubeVoltage == 120:
i = 2
elif tubeVoltage == 140:
i = 3
else:
logger.error('Please use a standard X-Ray tube voltage (80, 100, 120 or 140kVp) \n')
totFlux = 0.0
for j in range(140):
totFlux += cuAtt[i][j]
totFlux = coeffcient *totFlux * pow(1 / (distance / 100.0), 2) * time * tubeCurrent * numPix * pixArea
return int(totFlux)
tubeVoltage = np.array([80,100,120,140])
tubeCurrent = np.array([ 0., 0.4 , 0.6 , 0.8 , 1. , 1.5 , 3. , 7. , 10. , 15. , 20. , 25. ])
Filter = 0 #filter thickness mm
distance = 30 #source to detector distance cm
time = 1 #time of irradiation seconds
flux = []
for i in range(len(tubeCurrent)):
flux.append(calcFlux(tubeVoltage[3], tubeCurrent[i], Filter, distance, time, 1, 1))
fig = pyplot.figure(1)
pyplot.plot(tubeCurrent, flux,'k-')
pyplot.xlabel('Tube Current [mA]')
pyplot.ylabel('OCR [CPS/mm2]')
pyplot.ticklabel_format(style='sci', axis='y', scilimits=(0,0))
pyplot.show()