-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathres.py
More file actions
65 lines (33 loc) · 1.14 KB
/
Copy pathres.py
File metadata and controls
65 lines (33 loc) · 1.14 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
import openpyxl
import math
wb = openpyxl.load_workbook('dose.xlsx')
# print(type(wb))
# print(wb.get_sheet_names())
sheet = wb.get_sheet_by_name('Sheet1')
# print(sheet)
# print(type(sheet))
# print(sheet.title)
# print(sheet['A1'])
# print(sheet['A1'].value)
# NAME
c = sheet['B1']
# print('Row '+str(c.row)+', Column '+str(c.column)+' is '+str(c.value))
# Row 1, Column 2 is DOSE
# print('Cell ' + c.coordinate + ' is ' + c.value)
#Cell B1 is DOSE
def display(dist, res, zone1, extent, speed):
radiation = (37.5*zone1*zone1)/(dist*dist)
walkDist = dist*2*math.tan(math.radians(extent/2))
timeTaken = walkDist/speed
radiationAbsorbed = radiation*timeTaken
a = ''
p = 0
for i in range(2, 42):
if int(sheet.cell(row=i, column =2).value)+radiationAbsorbed < res :
p = p+1
text = sheet.cell(row=i, column =1).value
text1 = text.ljust(30)
text2 = str(sheet.cell(row=i, column =2).value).ljust(3) + '\t'
text3 = str(sheet.cell(row=i, column =2).value+int(radiationAbsorbed)) + '\n'
a = a+ str(p)+'\t'+ text1+text2+text3
return a, p