##// END OF EJS Templates
- Implementando la lectura del archivo ABS, para obtener el experimento, el numero y el valor de los patrones de configuracion de la antena.
jsalyrosas -
r150:151
parent child
Show More
@@ -249,13 +249,27
249 249 destination.write(chunk) No newline at end of file
250 250 destination.close() No newline at end of file
251 251 f = open('/tmp/'+txtFilename.name, 'r')
252 No newline at end of file
252 content = f.read()
No newline at end of file
253 #for line in f:
No newline at end of file
254 # lsLine = line.readline() No newline at end of file
255 253 f.close()
254 No newline at end of file
256 #content = lsLine No newline at end of file
No newline at end of file
255 for i,line in enumerate(newContent):
No newline at end of file
256 if i == 0:
No newline at end of file
257 newLine = line.replace("'","")
No newline at end of file
258 pos = newLine.find("=")
No newline at end of file
259 expName = newLine[pos+1:].strip()
No newline at end of file
260 elif i == 2:
No newline at end of file
261 pos = line.find("=")
No newline at end of file
262 num_patterns = line[pos+1:].strip()
No newline at end of file
263 else:
No newline at end of file
264 content += line
No newline at end of file
265 No newline at end of file
257 266 else: No newline at end of file
258 267 txtFilename = "Error" No newline at end of file
259 268 content = "Error"
269 No newline at end of file
260 return render_to_response('abscontrol/upload.html', {'txtFilename': txtFilename, 'content' : content})
No newline at end of file
270 No newline at end of file
261 No newline at end of file
No newline at end of file
271
No newline at end of file
272 return render_to_response('abscontrol/upload.html', {'txtFilename': txtFilename, 'content' : content,
No newline at end of file
273 'expName' : expName, 'num_patterns' : num_patterns,
No newline at end of file
274 })
No newline at end of file
275 No newline at end of file
@@ -9,7 +9,11
9 9 <label for="lblFilename">{{ txtFilename }}</label> No newline at end of file
10 10 </div> No newline at end of file
11 11 <div class="divUes">
12 No newline at end of file
12 <label for="lblFile">content:</label> No newline at end of file
No newline at end of file
13 <p>{{ expName }}</p>
No newline at end of file
14 <label for="lblNumber">Number of patterns:</label>
No newline at end of file
15 <p>{{ num_patterns }}</p>
No newline at end of file
16 <label for="lblContent">Content:</label> No newline at end of file
13 17 <p>{{ content }}</p> No newline at end of file
14 18 </div> No newline at end of file
15 19 </div> No newline at end of file
@@ -11,10 +11,36
11 11 No newline at end of file
12 12 def __init__(self, filename): No newline at end of file
13 13 self.fileName = filename No newline at end of file
14 self.content = ""
No newline at end of file
15 self.exp_name = ""
No newline at end of file
16 self.number_patterns = 0
No newline at end of file
17 self.patterns = {} No newline at end of file
14 18
19 No newline at end of file
15 def readFile(self):
No newline at end of file
20 No newline at end of file
16 destination = open(self.fileName, 'wb+') No newline at end of file
No newline at end of file
21 self.content = f.readlines()
No newline at end of file
22 f.close() No newline at end of file
17 23
24 No newline at end of file
18 destination.close() No newline at end of file
No newline at end of file
25 newLine = self.content[0].replace("'","")
No newline at end of file
26 pos = newLine.find("=")
No newline at end of file
27 self.exp_name = newLine[pos+1:].strip() No newline at end of file
19 28 No newline at end of file
29 pos = self.content[2].find("=")
No newline at end of file
30 self.number_patterns = int(self.content[2][pos+1:].strip()) No newline at end of file
20 31 No newline at end of file
32 self.patterns = self.getPatterns(self.content[3:])
No newline at end of file
33
No newline at end of file
34 def getPatterns(self, content):
No newline at end of file
35 lsPattern = []
No newline at end of file
36 index = 8
No newline at end of file
37
No newline at end of file
38 for i in range(0, self.number_patterns):
No newline at end of file
39 first = i+index
No newline at end of file
40 second = first+index
No newline at end of file
41 antennaUp = content[i:first]
No newline at end of file
42 antennaDown = content[first+1:second]
No newline at end of file
43 dicPattern = {"number" : content[i], "up" : antennaUp, "down" : antennaDown}
No newline at end of file
44 lsPattern.append(dicPattern)
No newline at end of file
45
No newline at end of file
46 return lsPattern No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now