9 wb = load_workbook(
"/Users/caradonna/Downloads/paddle_locations.xlsx", data_only =
True)
12 sheet_names = wb.get_sheet_names()
15 muons =
open(
"muoncounters.txt",
'a')
19 for q
in range(0,len(sheet_names)):
21 ws = wb[sheet_names[q]]
23 muons.write(
"# " + sheet_names[q] +
"\n")
25 for a
in range(1,100):
26 for j
in range(1,100):
27 k = ws.cell(row = a, column = j).value
28 if isinstance(k, basestring):
31 start_column_tmp = j-1
35 for b
in range(start_row,100):
36 if ws.cell(row = b, column = start_column_tmp).value ==
None:
42 start_column = chr(start_column_tmp + ord(
'A'))
43 end_column = chr(end_column_tmp +ord(
'A'))
46 wsr = np.array(ws.range(
'%s%s:%s%s' %(start_column,start_row,end_column, end_row)))
48 init_coord = np.zeros((end_row - start_row + 1,3))
51 for j
in range(0,end_row - start_row + 1):
52 init_coord[j][i] = wsr[j][i].value
61 detector_points = np.zeros((4,3))
64 if (init_coord[1][0] - init_coord[0][0] < 0.)
or (init_coord[1][2] - init_coord[0][2] < 0):
65 init_coord = np.flipud(init_coord)
75 if (math.fabs(init_coord[1][0] - init_coord[0][0]) == 14)
and (init_coord[1][2] - init_coord[0][2] == 0):
76 for i
in range(0,end_row-start_row + 1):
77 detector_points[0][0] = init_coord[i][0]
78 detector_points[0][1] = init_coord[i][1]
79 detector_points[0][2] = init_coord[i][2]
82 detector_points[1][0] = init_coord[i][0] + ((12.82-10.65)/2)*wall_or
83 detector_points[1][1] = init_coord[i][1] - (24.90)
84 detector_points[1][2] = init_coord[i][2]
86 detector_points[2][0] = init_coord[i][0] + (((12.82-10.65)/2) +10.65) *wall_or
87 detector_points[2][1] = init_coord[i][1] -(24.90)
88 detector_points[2][2] = init_coord[i][2]
90 detector_points[3][0] = init_coord[i][0] + (12.82 * wall_or)
91 detector_points[3][1] = init_coord[i][1]
92 detector_points[3][2] = init_coord[i][2]
97 detector_points[a][0] = detector_points[a][0] * -1
98 detector_points[a][2] = detector_points[a][2] * -1
100 detector_points = detector_points *2.54
102 muons.write(
str(detector_number) +
" 1 ")
105 muons.write(
str(detector_points[j][k]) +
" ")
109 if (math.fabs(init_coord[1][0] - init_coord[0][0]) == 6.75)
and (init_coord[1][2] - init_coord[0][2] == 0):
110 for i
in range(0,end_row - start_row + 1):
112 detector_points[0][0] = init_coord[i][0]
113 detector_points[0][1] = init_coord[i][1]
114 detector_points[0][2] = init_coord[i][2]
116 detector_points[1][0] = init_coord[i][0]
117 detector_points[1][1] = init_coord[i][1]
118 detector_points[1][2] = init_coord[i][2] - 64.75
120 detector_points[2][0] = init_coord[i][0] - 6.625
121 detector_points[2][1] = init_coord[i][1]
122 detector_points[2][2] = init_coord[i][2] - 64.75
124 detector_points[3][0] = init_coord[i][0] - 6.625
125 detector_points[3][1] = init_coord[i][1]
126 detector_points[3][2] = init_coord[i][2]
130 detector_points[a][0] = detector_points[a][0] * -1
131 detector_points[a][2] = detector_points[a][2] * -1
133 detector_points = detector_points *2.54
135 muons.write(
str(detector_number) +
" 1 ")
138 muons.write(
str(detector_points[j][k]) +
" ")
146 if sheet_names[q].lower() == (
"south wall - table 1")
or sheet_names[q].lower() == (
"north wall - table 1"):
149 for i
in range(0,end_row - start_row + 1):
150 detector_points[0][0] = init_coord[i][0]
151 detector_points[0][1] = init_coord[i][1]
152 detector_points[0][2] = init_coord[i][2]
154 detector_points[1][0] = init_coord[i][0]
155 detector_points[1][1] = init_coord[i][1] - 24.90
156 detector_points[1][2] = init_coord[i][2] + ((12.82 - 10.65)/2) * wall_or
158 detector_points[2][0] = init_coord[i][0]
159 detector_points[2][1] = init_coord[i][1] - 24.90
160 detector_points[2][2] = init_coord[i][2] + (((12.82 - 10.65)/2) + 10.65) * wall_or
162 detector_points[3][0] = init_coord[i][0]
163 detector_points[3][1] = init_coord[i][1]
164 detector_points[3][2] = init_coord[i][2] + 12.82 * wall_or
168 detector_points[a][0] = detector_points[a][0] * -1
169 detector_points[a][2] = detector_points[a][2] * -1
171 detector_points = detector_points *2.54
173 muons.write(
str(detector_number) +
" 1 ")
176 muons.write(
str(detector_points[j][k]) +
" ")
181 if (math.fabs(init_coord[1][2] - init_coord[0][2]) == 6.75)
and (init_coord[1][0] - init_coord[0][0] == 0):
182 for i
in range(0,end_row-start_row + 1):
183 detector_points[0][0] = init_coord[i][0]
184 detector_points[0][1] = init_coord[i][1]
185 detector_points[0][2] = init_coord[i][2]
187 detector_points[1][0] = init_coord[i][0] + 64.75
188 detector_points[1][1] = init_coord[i][1]
189 detector_points[1][2] = init_coord[i][2]
191 detector_points[2][0] = init_coord[i][0] + 64.75
192 detector_points[2][1] = init_coord[i][1]
193 detector_points[2][2] = init_coord[i][2] - 6.625
195 detector_points[3][0] = init_coord[i][0]
196 detector_points[3][1] = init_coord[i][1]
197 detector_points[3][2] = init_coord[i][2] - 6.625
201 detector_points[a][0] = detector_points[a][0] * -1
202 detector_points[a][2] = detector_points[a][2] * -1
204 detector_points = detector_points *2.54
206 muons.write(
str(detector_number) +
" 1 ")
209 muons.write(
str(detector_points[j][k]) +
" ")
int open(const char *, int)
Opens a file descriptor.
int close(int)
Closes the file descriptor fd.