##// 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 destination.write(chunk) No newline at end of file
249 destination.write(chunk)
250 destination.close() No newline at end of file
250 destination.close()
251 f = open('/tmp/'+txtFilename.name, 'r')
251 f = open('/tmp/'+txtFilename.name, 'r')
No newline at end of file
252 newContent = f.readlines() 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 f.close()
253 f.close()
No newline at end of file
254 content = ""
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 else: No newline at end of file
266 else:
258 txtFilename = "Error" No newline at end of file
267 txtFilename = "Error"
259 content = "Error"
268 content = "Error"
No newline at end of file
269 expName = ""
260 return render_to_response('abscontrol/upload.html', {'txtFilename': txtFilename, 'content' : content})
No newline at end of file
No newline at end of file
270 num_patterns = 0
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 <label for="lblFilename">{{ txtFilename }}</label> No newline at end of file
9 <label for="lblFilename">{{ txtFilename }}</label>
10 </div> No newline at end of file
10 </div>
11 <div class="divUes">
11 <div class="divUes">
No newline at end of file
12 <label for="lblExperiment">Experiment:</label>
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 <p>{{ content }}</p> No newline at end of file
17 <p>{{ content }}</p>
14 </div> No newline at end of file
18 </div>
15 </div> No newline at end of file
19 </div>
@@ -11,10 +11,36
11 No newline at end of file
11
12 def __init__(self, filename): No newline at end of file
12 def __init__(self, filename):
13 self.fileName = filename No newline at end of file
13 self.fileName = filename
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
No newline at end of file
19 def readFile(self, path):
15 def readFile(self):
No newline at end of file
No newline at end of file
20 f = open(path, 'r')
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
No newline at end of file
24 def getMetadata(self):
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 No newline at end of file
28
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 No newline at end of file
31
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