##// END OF EJS Templates
- Finalizada la funcion que lee(importa) un archivo ABS sin guardarlo a la base de datos....
jsalyrosas -
r152:153
parent child
Show More
@@ -1,105 +1,107
1 1 from django.db import models No newline at end of file
2 2 from django.utils import timezone No newline at end of file
3 3 No newline at end of file
4 4 class Profile(models.Model): No newline at end of file
5 5 No newline at end of file
6 6 name = models.CharField(max_length=250) No newline at end of file
7 7 date_create = models.DateTimeField() No newline at end of file
8 8 date_modified = models.DateTimeField(null=True) No newline at end of file
9 9 hits = models.PositiveIntegerField() No newline at end of file
10 10 state = models.PositiveSmallIntegerField() No newline at end of file
11 11 No newline at end of file
12 12 class Meta: No newline at end of file
13 13 db_table = "abs_profile_antenna" No newline at end of file
14 14 No newline at end of file
15 15 def save(self): No newline at end of file
16 16 if self.pk is None: No newline at end of file
17 17 self.date_create = timezone.now() No newline at end of file
18 18 self.hits = 0 No newline at end of file
19 19 self.state = 1 No newline at end of file
20 20 else: No newline at end of file
21 21 self.date_modified = timezone.now() No newline at end of file
22 22 super(Profile, self).save() No newline at end of file
23 23 No newline at end of file
24 24 def __unicode__(self): No newline at end of file
25 25 return u'%s' % self.name No newline at end of file
26 26 No newline at end of file
27 27 class Pattern(models.Model): No newline at end of file
28 28 No newline at end of file
29 29 profile = models.ForeignKey(Profile) No newline at end of file
30 30 value = models.PositiveIntegerField() No newline at end of file
31 31 date_create = models.DateTimeField() No newline at end of file
32 32 date_modified = models.DateTimeField(null=True) No newline at end of file
33 33 hits = models.PositiveIntegerField() No newline at end of file
34 34 state = models.PositiveSmallIntegerField() No newline at end of file
35 35 No newline at end of file
36 36 class Meta: No newline at end of file
37 37 db_table = "abs_pattern_antenna" No newline at end of file
38 38 No newline at end of file
39 39 def save(self, *args, **kwargs): No newline at end of file
40 40 if not self.pk: No newline at end of file
41 41 self.date_create = timezone.now() No newline at end of file
42 42 self.hits = 0 No newline at end of file
43 43 self.state = 1 No newline at end of file
44 44 else: No newline at end of file
45 45 self.date_modified = timezone.now() No newline at end of file
46 46 super(Pattern, self).save(*args, **kwargs) No newline at end of file
47 47 No newline at end of file
48 48 def __unicode__(self): No newline at end of file
49 49 return u'%s' % self.value No newline at end of file
50 50 No newline at end of file
51 51 No newline at end of file
52 52 class AntennaUp(models.Model): No newline at end of file
53 53 No newline at end of file
54 54 pattern = models.ForeignKey(Pattern) No newline at end of file
55 55 value = models.TextField()
56 No newline at end of file
56 tx = models.TextField()
No newline at end of file
57 No newline at end of file
57 rx = models.TextField()
No newline at end of file
58 No newline at end of file
58 ues = models.CharField(max_length=120) No newline at end of file
No newline at end of file
59 only_rx = models.PositiveSmallIntegerField(default=0) No newline at end of file
59 60 date_create = models.DateTimeField() No newline at end of file
60 61 date_modified = models.DateTimeField(null=True) No newline at end of file
61 62 hits = models.PositiveIntegerField() No newline at end of file
62 63 state = models.PositiveSmallIntegerField() No newline at end of file
63 64 No newline at end of file
64 65 class Meta: No newline at end of file
65 66 db_table = "abs_antenna_up" No newline at end of file
66 67 No newline at end of file
67 68 def save(self, *args, **kwargs): No newline at end of file
68 69 if self.pk is None: No newline at end of file
69 70 self.date_create = timezone.now() No newline at end of file
70 71 self.hits = 0 No newline at end of file
71 72 self.state = 1 No newline at end of file
72 73 else: No newline at end of file
73 74 self.date_modified = timezone.now() No newline at end of file
74 75 super(AntennaUp, self).save(*args, **kwargs) No newline at end of file
75 76 No newline at end of file
76 77 def __unicode__(self): No newline at end of file
77 78 return u'%s' % self.value No newline at end of file
78 79 No newline at end of file
79 80 No newline at end of file
80 81 class AntennaDown(models.Model): No newline at end of file
81 82 No newline at end of file
82 83 pattern = models.ForeignKey(Pattern) No newline at end of file
83 84 value = models.TextField()
85 No newline at end of file
84 tx = models.TextField()
No newline at end of file
86 No newline at end of file
85 rx = models.TextField()
No newline at end of file
87 No newline at end of file
86 ues = models.CharField(max_length=120) No newline at end of file
No newline at end of file
88 only_rx = models.PositiveSmallIntegerField(default=0) No newline at end of file
87 89 date_create = models.DateTimeField() No newline at end of file
88 90 date_modified = models.DateTimeField(null=True) No newline at end of file
89 91 hits = models.PositiveIntegerField() No newline at end of file
90 92 state = models.PositiveSmallIntegerField() No newline at end of file
91 93 No newline at end of file
92 94 class Meta: No newline at end of file
93 95 db_table = "abs_antenna_down" No newline at end of file
94 96 No newline at end of file
95 97 def save(self, *args, **kwargs): No newline at end of file
96 98 if self.pk is None: No newline at end of file
97 99 self.date_create = timezone.now() No newline at end of file
98 100 self.hits = 0 No newline at end of file
99 101 self.state = 1 No newline at end of file
100 102 else: No newline at end of file
101 103 self.date_modified = timezone.now() No newline at end of file
102 104 super(AntennaDown, self).save(*args, **kwargs) No newline at end of file
103 105 No newline at end of file
104 106 def __unicode__(self): No newline at end of file
105 107 return u'%s' % self.value No newline at end of file
@@ -1,281 +1,264
1 1 from django.shortcuts import render_to_response, redirect No newline at end of file
2 2 from abscontrol.models import Profile, Pattern, AntennaDown, AntennaUp No newline at end of file
3 3 from util.readABSFile import readABSFile No newline at end of file
4 4 No newline at end of file
5 5 txtAntenna = "[[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5]," \ No newline at end of file
6 6 "[1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0]," \ No newline at end of file
7 7 "[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5]," \ No newline at end of file
8 8 "[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5]," \ No newline at end of file
9 9 "[1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0]," \ No newline at end of file
10 10 "[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5]," \ No newline at end of file
11 11 "[1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0]," \ No newline at end of file
12 12 "[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5]]" No newline at end of file
13 13 No newline at end of file
14 14 txtTxUp = "[[1,1,1,1,1,1,1,1]," \ No newline at end of file
15 15 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
16 16 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
17 17 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
18 18 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
19 19 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
20 20 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
21 21 "[1,1,1,1,1,1,1,1]]" No newline at end of file
22 22 No newline at end of file
23 23 txtTxDown = "[[1,1,1,1,0,0,0,0]," \ No newline at end of file
24 24 "[1,1,1,1,0,0,0,0]," \ No newline at end of file
25 25 "[1,1,1,1,0,0,0,0]," \ No newline at end of file
26 26 "[1,1,1,1,0,0,0,0]," \ No newline at end of file
27 27 "[0,0,0,0,1,1,1,1]," \ No newline at end of file
28 28 "[0,0,0,0,1,1,1,1]," \ No newline at end of file
29 29 "[0,0,0,0,1,1,1,1]," \ No newline at end of file
30 30 "[0,0,0,0,1,1,1,1]]" No newline at end of file
31 31 No newline at end of file
32 32 txtRxUp = "[[0,0,0,0,1,1,1,1]," \ No newline at end of file
33 33 "[0,0,0,0,1,1,1,1]," \ No newline at end of file
34 34 "[0,0,0,0,1,1,1,1]," \ No newline at end of file
35 35 "[0,0,0,0,1,1,1,1]," \ No newline at end of file
36 36 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
37 37 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
38 38 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
39 39 "[1,1,1,1,1,1,1,1]]" No newline at end of file
40 40 No newline at end of file
41 41 txtRxDown = "[[1,1,1,1,1,1,1,1]," \ No newline at end of file
42 42 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
43 43 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
44 44 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
45 45 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
46 46 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
47 47 "[1,1,1,1,1,1,1,1]," \ No newline at end of file
48 48 "[1,1,1,1,1,1,1,1]]" No newline at end of file
49 49 No newline at end of file
50 50 txtUes = "[0.533333,0.00000,1.06667,0.00000]" No newline at end of file
51 51 No newline at end of file
52 52 def index(request): No newline at end of file
53 53 #latest_poll_list = profileAntenna.objects.all().order_by('-pub_date')[:5] No newline at end of file
54 54 profile_list = Profile.objects.all() No newline at end of file
55 55 return render_to_response('abscontrol/index.html', {'profile_list': profile_list}) No newline at end of file
56 56 No newline at end of file
57 57 def new(request): No newline at end of file
58 58 profile_list = Profile.objects.all() No newline at end of file
59 59 No newline at end of file
60 60 return render_to_response('abscontrol/new.html', {'profile_list': profile_list, No newline at end of file
61 61 'txtAntenna' : txtAntenna, No newline at end of file
62 62 'txtUes' : txtUes, 'txtTxUp' : txtTxUp, No newline at end of file
63 63 'txtTxDown' : txtTxDown, 'txtRxUp' : txtRxUp, No newline at end of file
64 64 'txtRxDown' : txtRxDown, No newline at end of file
65 65 }) No newline at end of file
66 66 No newline at end of file
67 67 def save(request): No newline at end of file
68 68 No newline at end of file
69 69 txtProfile = request.POST["txtProfile"] No newline at end of file
70 70 No newline at end of file
71 71 txtAntennaUp = request.POST["txtAntennaUp"] No newline at end of file
72 72 txtTxUp = request.POST["txtTxUp"] No newline at end of file
73 73 txtRxUp = request.POST["txtRxUp"] No newline at end of file
74 74 txtUesUp = request.POST["txtUesUp"] No newline at end of file
75 75 No newline at end of file
76 76 txtAntennaDown = request.POST["txtAntennaDown"] No newline at end of file
77 77 txtTxDown = request.POST["txtTxDown"] No newline at end of file
78 78 txtRxDown = request.POST["txtRxDown"] No newline at end of file
79 79 txtUesDown = request.POST["txtUesDown"] No newline at end of file
80 80 No newline at end of file
81 81 newprofile = Profile(name=txtProfile) No newline at end of file
82 82 newprofile.save() No newline at end of file
83 83 No newline at end of file
84 84 newpattern = newprofile.pattern_set.create(value=1) No newline at end of file
85 85 newpattern.antennaup_set.create(value=txtAntennaUp,tx=txtTxUp,rx=txtRxUp,ues=txtUesUp) No newline at end of file
86 86 newpattern.antennadown_set.create(value=txtAntennaDown,tx=txtTxDown,rx=txtRxDown,ues=txtUesDown) No newline at end of file
87 87 No newline at end of file
88 88 newurl = '/abscontrol/view/%d' % newprofile.id No newline at end of file
89 89 No newline at end of file
90 90 return redirect(newurl) No newline at end of file
91 91 No newline at end of file
92 92 def view(request, profile_id): No newline at end of file
93 93 nextPattern = 0 No newline at end of file
94 94 No newline at end of file
95 95 if request.method == 'GET' and 'pattern' in request.GET: No newline at end of file
96 96 pattern_value = request.GET["pattern"] No newline at end of file
97 97 else: No newline at end of file
98 98 pattern_value = 1 No newline at end of file
99 99 No newline at end of file
100 100 profile_list = Profile.objects.all() No newline at end of file
101 101 objProfile = Profile.objects.get(pk=profile_id) No newline at end of file
102 102 No newline at end of file
103 103 lsPatterns = objProfile.pattern_set.all() No newline at end of file
104 104 patternChoosen = objProfile.pattern_set.get(value=pattern_value) No newline at end of file
105 105 objAntennaUp = patternChoosen.antennaup_set.get() No newline at end of file
106 106 objAntennaDown = patternChoosen.antennadown_set.get() No newline at end of file
107 107 No newline at end of file
108 108 if len(lsPatterns) > 1: No newline at end of file
109 109 if pattern_value == 1: No newline at end of file
110 110 nextValuePattern = pattern_value + 1 No newline at end of file
111 111 nextPattern = objProfile.pattern_set.get(value=nextValuePattern) No newline at end of file
112 112 No newline at end of file
113 113 No newline at end of file
114 114 return render_to_response('abscontrol/view.html', {'objProfile': objProfile, 'profile_list': profile_list, No newline at end of file
115 115 'patternChoosen' : patternChoosen, 'lsPatterns' : lsPatterns, No newline at end of file
116 116 'antennaUp' : objAntennaUp, 'antennaDown' : objAntennaDown, No newline at end of file
117 117 'nextPattern' : nextPattern, No newline at end of file
118 118 }) No newline at end of file
119 119 No newline at end of file
120 120 def edit(request, profile_id): No newline at end of file
121 121 if request.method == 'GET' and 'pattern' in request.GET: No newline at end of file
122 122 pattern_value = request.GET["pattern"] No newline at end of file
123 123 else: No newline at end of file
124 124 pattern_value = 1 No newline at end of file
125 125 No newline at end of file
126 126 profile_list = Profile.objects.all() No newline at end of file
127 127 objProfile = Profile.objects.get(pk=profile_id) No newline at end of file
128 128 No newline at end of file
129 129 lsPatterns = objProfile.pattern_set.all() No newline at end of file
130 130 patternChoosen = objProfile.pattern_set.get(value=pattern_value) No newline at end of file
131 131 objAntennaUp = patternChoosen.antennaup_set.get() No newline at end of file
132 132 objAntennaDown = patternChoosen.antennadown_set.get() No newline at end of file
133 133 No newline at end of file
134 134 return render_to_response('abscontrol/edit.html', {'objProfile': objProfile, 'profile_list': profile_list, No newline at end of file
135 135 'patternChoosen' : patternChoosen, 'lsPatterns' : lsPatterns, No newline at end of file
136 136 'antennaUp' : objAntennaUp, 'antennaDown' : objAntennaDown, No newline at end of file
137 137 }) No newline at end of file
138 138 No newline at end of file
139 139 def addPattern(request, profile_id): No newline at end of file
140 140 profile_list = Profile.objects.all() No newline at end of file
141 141 objProfile = Profile.objects.get(pk=profile_id) No newline at end of file
142 142 No newline at end of file
143 143 return render_to_response('abscontrol/addPattern.html', {'objProfile': objProfile, 'profile_list': profile_list, No newline at end of file
144 144 'txtAntenna' : txtAntenna, 'txtUes' : txtUes, No newline at end of file
145 145 'txtTxUp' : txtTxUp, 'txtTxDown' : txtTxDown, No newline at end of file
146 146 'txtRxUp' : txtRxUp, 'txtRxDown' : txtRxDown, No newline at end of file
147 147 }) No newline at end of file
148 148 No newline at end of file
149 149 def editPattern(request, profile_id, pattern_id): No newline at end of file
150 150 profile_list = Profile.objects.all() No newline at end of file
151 151 objProfile = Profile.objects.get(pk=profile_id) No newline at end of file
152 152 lsPatterns = objProfile.pattern_set.all() No newline at end of file
153 153 patternChoosen = Pattern.objects.get(pk=pattern_id) No newline at end of file
154 154 objAntennaUp = patternChoosen.antennaup_set.get() No newline at end of file
155 155 objAntennaDown = patternChoosen.antennadown_set.get() No newline at end of file
156 156 No newline at end of file
157 157 return render_to_response('abscontrol/editPattern.html', {'objProfile': objProfile, 'profile_list': profile_list, No newline at end of file
158 158 'patternChoosen' : patternChoosen, 'lsPatterns' : lsPatterns, No newline at end of file
159 159 'antennaUp' : objAntennaUp, 'antennaDown' : objAntennaDown, No newline at end of file
160 160 }) No newline at end of file
161 161 No newline at end of file
162 162 def savePattern(request, profile_id): No newline at end of file
163 163 pattern_id = 0 No newline at end of file
164 164 method = "save" No newline at end of file
165 165 No newline at end of file
166 166 if 'pattern_id' in request.POST: No newline at end of file
167 167 pattern_id = request.POST["pattern_id"] No newline at end of file
168 168 method = "update" No newline at end of file
169 169 No newline at end of file
170 170 maxValuePattern = 0 No newline at end of file
171 171 txtAntennaUp = request.POST["txtAntennaUp"] No newline at end of file
172 172 txtTxUp = request.POST["txtTxUp"] No newline at end of file
173 173 txtRxUp = request.POST["txtRxUp"] No newline at end of file
174 174 txtUesUp = request.POST["txtUesUp"] No newline at end of file
175 175 No newline at end of file
176 176 txtAntennaDown = request.POST["txtAntennaDown"] No newline at end of file
177 177 txtTxDown = request.POST["txtTxDown"] No newline at end of file
178 178 txtRxDown = request.POST["txtRxDown"] No newline at end of file
179 179 txtUesDown = request.POST["txtUesDown"] No newline at end of file
180 180 No newline at end of file
181 181 if method == "save": No newline at end of file
182 182 objProfile = Profile.objects.get(pk=profile_id) No newline at end of file
183 183 lsPatterns = objProfile.pattern_set.all() No newline at end of file
184 184 for element in lsPatterns: No newline at end of file
185 185 if element.value > maxValuePattern: No newline at end of file
186 186 maxPattern = element.value No newline at end of file
187 187 No newline at end of file
188 188 if maxPattern < 10 : No newline at end of file
189 189 newValuePattern = maxPattern + 1 No newline at end of file
190 190 newpattern = objProfile.pattern_set.create(value=newValuePattern) No newline at end of file
191 191 newpattern.antennaup_set.create(value=txtAntennaUp,tx=txtTxUp,rx=txtRxUp,ues=txtUesUp) No newline at end of file
192 192 newpattern.antennadown_set.create(value=txtAntennaDown,tx=txtTxDown,rx=txtRxDown,ues=txtUesDown) No newline at end of file
193 193 No newline at end of file
194 194 newurl = '/abscontrol/%d/view/%d' % (int(profile_id), newpattern.id) No newline at end of file
195 195 else: No newline at end of file
196 196 newurl = '/abscontrol/edit/%d' % (int(profile_id)) No newline at end of file
197 197 else: No newline at end of file
198 198 txtAntennaUpId = request.POST["txtAntennaUpId"] No newline at end of file
199 199 objAntennaUp = AntennaUp.objects.get(pk=txtAntennaUpId) No newline at end of file
200 200 objAntennaUp.value = txtAntennaUp No newline at end of file
201 201 objAntennaUp.tx = txtTxUp No newline at end of file
202 202 objAntennaUp.rx = txtRxUp No newline at end of file
203 203 objAntennaUp.ues = txtUesUp No newline at end of file
204 204 objAntennaUp.save() No newline at end of file
205 205 No newline at end of file
206 206 txtAntennaDownId = request.POST["txtAntennaDownId"] No newline at end of file
207 207 objAntennaDown = AntennaDown.objects.get(pk=txtAntennaDownId) No newline at end of file
208 208 objAntennaDown.value = txtAntennaDown No newline at end of file
209 209 objAntennaDown.tx = txtTxDown No newline at end of file
210 210 objAntennaDown.rx = txtRxDown No newline at end of file
211 211 objAntennaDown.ues = txtUesDown No newline at end of file
212 212 objAntennaDown.save() No newline at end of file
213 213 No newline at end of file
214 214 newurl = '/abscontrol/%d/view/%d' % (int(profile_id), int(pattern_id)) No newline at end of file
215 215 No newline at end of file
216 216 return redirect(newurl) No newline at end of file
217 217 No newline at end of file
218 218 def viewPattern(request, profile_id, pattern_id): No newline at end of file
219 219 No newline at end of file
220 220 profile_list = Profile.objects.all() No newline at end of file
221 221 objProfile = Profile.objects.get(pk=profile_id) No newline at end of file
222 222 No newline at end of file
223 223 patternChoosen = Pattern.objects.get(pk=pattern_id) No newline at end of file
224 224 No newline at end of file
225 225 objAntennaUp = patternChoosen.antennaup_set.get() No newline at end of file
226 226 objAntennaDown = patternChoosen.antennadown_set.get() No newline at end of file
227 227 No newline at end of file
228 228 lsPatterns = objProfile.pattern_set.all() No newline at end of file
229 229 No newline at end of file
230 230 return render_to_response('abscontrol/viewPattern.html', {'objProfile': objProfile, 'profile_list': profile_list, No newline at end of file
231 231 'patternChoosen' : patternChoosen, 'lsPatterns' : lsPatterns, No newline at end of file
232 232 'antennaUp' : objAntennaUp, 'antennaDown' : objAntennaDown, No newline at end of file
233 233 }) No newline at end of file
234 234 No newline at end of file
235 235 def deletePattern(request, profile_id, pattern_id): No newline at end of file
236 236 newurl = '/abscontrol/edit/%d' % int(profile_id) No newline at end of file
237 237 No newline at end of file
238 238 return redirect(newurl) No newline at end of file
239 239 No newline at end of file
240 240 def importProfile(request): No newline at end of file
241 241 No newline at end of file
242 242 return render_to_response('abscontrol/import.html', { }) No newline at end of file
243 243 No newline at end of file
244 244 def saveImport(request): No newline at end of file
245 245 if request.method == 'POST': No newline at end of file
246 246 txtFilename = request.FILES['txtFile'] No newline at end of file
247 247 if txtFilename: No newline at end of file
248 248 destination = open('/tmp/'+txtFilename.name, 'wb+') No newline at end of file
249 249 for chunk in txtFilename.chunks(): No newline at end of file
250 250 destination.write(chunk) No newline at end of file
251 251 destination.close() No newline at end of file
252 252 filename = '/tmp/'+txtFilename.name No newline at end of file
253 253 readFile = readABSFile(filename) No newline at end of file
254 254 expName, num_patterns, patterns = readFile.getMetadata()
No newline at end of file
255
No newline at end of file
256 '''
No newline at end of file
257 f = open('/tmp/'+txtFilename.name, 'r')
No newline at end of file
258 newContent = f.readlines()
No newline at end of file
259 f.close()
No newline at end of file
260 content = ""
No newline at end of file
261 for i,line in enumerate(newContent):
No newline at end of file
262 if i == 0:
No newline at end of file
263 newLine = line.replace("'","")
No newline at end of file
264 pos = newLine.find("=")
No newline at end of file
265 expName = newLine[pos+1:].strip()
No newline at end of file
266 elif i == 2:
No newline at end of file
267 pos = line.find("=")
No newline at end of file
268 num_patterns = line[pos+1:].strip()
No newline at end of file
269 else:
No newline at end of file
270 content += line
No newline at end of file
271 ''' No newline at end of file
272 255 else: No newline at end of file
273 256 txtFilename = "Error" No newline at end of file
274 257 #content = "Error" No newline at end of file
275 258 expName = "" No newline at end of file
276 259 num_patterns = 0 No newline at end of file
277 260 No newline at end of file
278 261 return render_to_response('abscontrol/upload.html', {'txtFilename': txtFilename, 'patterns' : patterns, No newline at end of file
279 262 'expName' : expName, 'num_patterns' : num_patterns, No newline at end of file
280 263 }) No newline at end of file
281 264 No newline at end of file
@@ -1,81 +1,85
1 1 /* No newline at end of file
2 2 * font-family: 'Droid Sans', sans-serif; No newline at end of file
3 3 * font-family: 'Ubuntu', sans-serif; No newline at end of file
4 4 * font-family: 'Open Sans', sans-serif; No newline at end of file
5 5 * font-family: 'Open Sans Condensed', sans-serif; No newline at end of file
6 6 * font-family: 'Roboto Condensed', sans-serif; No newline at end of file
7 7 */ No newline at end of file
8 8
9 No newline at end of file
9 body { font-size: 11px; } No newline at end of file
10 10 header {border: 1px solid #fcc; font-size: 2em; height: 50px; text-align: center; line-height: 50px} No newline at end of file
11 11 #schema {margin: 0 auto; width: 980px; border: 1px solid #f00; padding: 10px 10px 10px 10px} No newline at end of file
12 12 #content {border: 1px solid #1cc; margin-top: 5px; margin-bottom: 5px} No newline at end of file
13 13 #content #leftcolumn {float: left;border: 1px solid #c55; width: 150px; } No newline at end of file
14 14 #content #maincolumn {float: left; border: 1px solid #000; width: 800px; padding-left: 20px;} No newline at end of file
15 15 footer {border: 1px solid #200; font-size: 0.9em; height: 30px; text-align: center; line-height: 20px} No newline at end of file
16 16 No newline at end of file
17 17 .cleardivs {clear: both; border: 0px solid #400; height: 0px} No newline at end of file
18 18 /****************************************************************************************/ No newline at end of file
19 19 /****** ESTILOS GENERALES *****************/ No newline at end of file
20 20 /****************************************************************************************/ No newline at end of file
21 21 .mnu{ height: 22px; border: 0px solid #c55 !important;} No newline at end of file
22 22 .mnu li{ display:inline;} No newline at end of file
23 23 .MnuVertical, .MnuHorizontal { font-family: 'Droid Sans', sans-serif; font-size: 1.2em; font-style: italic; text-shadow: 2px 2px #eee} No newline at end of file
24 24 .MnuHorizontal ul{ list-style: none; list-style-type: none; margin: 0;} No newline at end of file
25 25 No newline at end of file
26 26 /*.MnuHorizontal{ display: -webkit-box; -webkit-box-orient:horizontal;}*/ No newline at end of file
27 27 /*.MnuHorizontal a{ display:block; padding:10px; -webkit-box-flex:1; text-align:center; }*/ No newline at end of file
28 28 No newline at end of file
29 29 /****************************************************************************************/ No newline at end of file
30 30 /****** MENU DE NAVEGACION DE PERFILES **********************************/ No newline at end of file
31 31 /****************************************************************************************/ No newline at end of file
32 32 #content #infoProfiles {border: 1px solid #d00 !important; width: 140px; margin: 0px; padding-top: 2px; padding-bottom: 2px} No newline at end of file
33 33 .lblInfo {padding-left: 12px; line-height: 20px;} No newline at end of file
34 34 #infoProfiles select {padding-left: 12px; line-height: 20px;margin-left: 12px} No newline at end of file
35 35 #content nav {border: 0px solid #c55 !important; margin: 0px;} No newline at end of file
36 36 No newline at end of file
37 37 #leftcolumn #mnuProfiles{ margin: 5px 0px; border: 0px solid #1494F6 !important; } No newline at end of file
38 38 #mnuProfiles ul{list-style: none; list-style-type: none; margin: 0; padding-left: 20px; border: 0px solid #f00 !important} No newline at end of file
39 39 #mnuProfiles li{ width: 80px; padding: 2px; border: 0px solid #c55 !important; line-height: 22px} No newline at end of file
40 40 #mnuProfiles a{ font-weight: normal; color: #1494F6; display: block; border: 0px solid #1cc !important; text-align: left} No newline at end of file
41 41 No newline at end of file
42 42 /****************************************************************************************/ No newline at end of file
43 43 /******** FORMULARIO DE PERFILES *************************************/ No newline at end of file
44 44 /****************************************************************************************/ No newline at end of file
45 45 #divProfile { border: 0px solid #dff; margin: 10px 0px; padding: 10px 10px; width: 500px } No newline at end of file
46 46 .flsAntenna { margin: 10px 0px; width: 750px; padding: 10px 10px }
47 No newline at end of file
47 #divPattern textarea,input[type=text],label{ font-family: Monaco; font-size: inherit; } No newline at end of file
48 48 No newline at end of file
49 49 #divPattern textarea {resize: none; overflow: hidden} No newline at end of file
50 50 No newline at end of file
51 51 .divAntenna { float: left; margin: 10px; height: 160px; border: 0px solid #fcc !important; width: 260px } No newline at end of file
52 52 .divAntenna label{ display: block }
53 No newline at end of file
53 .txtAntenna { max-width: 250px; max-height: 125px; width: 250px; height: 125px }
No newline at end of file
54 No newline at end of file
54 .divAntenna p{ max-width: 250px; max-height: 125px; width: 250px; height: 125px } No newline at end of file
55 55 No newline at end of file
56 56 .divTx { display: block; float: left; margin: 10px; height: 150px } No newline at end of file
57 57 .divTx label{ display: block }
58 No newline at end of file
58 .divTx textarea{ width: 135px; max-width: 135px; height: 125px; max-height: 125px; text-align: justify }
No newline at end of file
59 No newline at end of file
59 .divTx p{ width: 135px; max-width: 135px; height: 125px; max-height: 125px; text-align: justify } No newline at end of file
60 60 No newline at end of file
61 61 .divUes { display: block; margin: 10px} No newline at end of file
62 62 .divUes input[type=text] { width: 240px; max-width: 240px;} No newline at end of file
63 63 No newline at end of file
64 64 /****************************************************************************************/ No newline at end of file
65 65 /****** MENU DE NAVEGACION DE PATRONES **********************************/ No newline at end of file
66 66 /****************************************************************************************/ No newline at end of file
67 67 #divMnuPattern{ width: 280px; height: 25px; display: block; border: 0px solid #1cc !important; float: left; margin-left: 500px} No newline at end of file
68 68 #divMnuPattern li{ float: left; display: block; width: 60px; border: 0px solid #2cc !important} No newline at end of file
69 69 #divMnuPattern a{ display: block; line-height: 22px; text-decoration: none; padding: 0px 5px; No newline at end of file
70 70 border-bottom: 1px solid #1494F6 !important; margin: 0px 2px; text-align: center; color: #1494F6 No newline at end of file
71 71 } No newline at end of file
72 72 #infoPattern{ display: block; border: 1px solid #1494f6 !important, margin: 5px 2px; } No newline at end of file
73 73 No newline at end of file
74 74 #navPatterns{ margin: 10px auto; border: 0px solid #d00 !important; width: 500px; height: 30px; font-family: 'Ubuntu', sans-serif; font-size: 14px; No newline at end of file
75 75 padding: 10px 0px} No newline at end of file
76 76 #navPatternList{ margin: 0px auto; border: 1px solid #ecc !important} No newline at end of file
77 77 #navPatternList ul{ list-style: none; list-style-type: none; margin: 0;} No newline at end of file
78 78 #navPatternList ul li{ float: left; width: 50px; border: 1px solid #eee !important; } No newline at end of file
79 79 #navPatternList a{ width: 50px; border: 0px solid #1cc !important; display: block; text-align: center; line-height: 25px} No newline at end of file
80 80 .lnkPattern{ background-color: #ccc !important; color: #eee;} No newline at end of file
81 81 .lnkPatternSelected{ background-color: #2cc !important; color: #fff;} No newline at end of file
82
No newline at end of file
83 .divListofPatterns{ width: 650px; display: block; border: 1px solid #1cc !important; margin: 0 auto}
No newline at end of file
84 .divPattern{ width: 600px; display: block; border: 1px solid #f00 !important; margin: 2px auto; }
No newline at end of file
85 No newline at end of file
@@ -1,36 +1,37
1 1 {% extends "abscontrol/index.html" %} No newline at end of file
2 2 {% block title %}ABS CONTROL:::::IMPORT PROFILE{% endblock %} No newline at end of file
3 3 No newline at end of file
4 4 {% block content %} No newline at end of file
5 5 <div id="content"> No newline at end of file
6 6 <div id="divPattern"> No newline at end of file
7 7 <div class="divUes">
8 No newline at end of file
8 <label for="lblFile">File:</label>
No newline at end of file
9 <label for="lblFilename">{{ txtFilename }}</label> No newline at end of file
10 9 </div> No newline at end of file
11 10 <div class="divUes">
11 No newline at end of file
12 <label for="lblExperiment">Experiment:</label>
No newline at end of file
12 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 13 </div> No newline at end of file
17 14 {% if patterns %}
15 No newline at end of file
18 <div> No newline at end of file
19 16 {% for element in patterns %} No newline at end of file
17 <div class="divPattern"> No newline at end of file
20 18 <div> No newline at end of file
21 19 <label for="lblNumber">Pattern: {{ element.number }}</label> No newline at end of file
22 20 </div>
21 No newline at end of file
23 <div> No newline at end of file
24 22 <label for="lblAntennaUp">Antenna Up:</label> No newline at end of file
25 23 <p>{{ element.up }}</p> No newline at end of file
26 24 </div>
25 No newline at end of file
27 <div> No newline at end of file
28 26 <label for="lblAntennaDown">Antenna Down:</label> No newline at end of file
29 27 <p>{{ element.down }}</p> No newline at end of file
30 28 </div> No newline at end of file
29 <div class="cleardivs"></div>
No newline at end of file
30 </div>
No newline at end of file
31 <div class="cleardivs"></div> No newline at end of file
31 32 {% endfor %} No newline at end of file
32 33 </div> No newline at end of file
33 34 {% endif %} No newline at end of file
34 35 </div> No newline at end of file
35 36 </div> No newline at end of file
36 37 {% endblock %} No newline at end of file
@@ -1,50 +1,70
1 1 ''' No newline at end of file
2 2 Created on May 2, 2013 No newline at end of file
3 3 No newline at end of file
4 4 @author: Jose Antonio Sal y Rosas Celi No newline at end of file
5 5 @contact: jose.salyrosas@jro.igp.gob.pe No newline at end of file
6 6 ''' No newline at end of file
7 7 No newline at end of file
8 8 class readABSFile(object): No newline at end of file
9 9 No newline at end of file
10 10 __scriptName = "readABSFile.py" No newline at end of file
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 14 self.content = "" No newline at end of file
15 15 self.exp_name = "" No newline at end of file
16 16 self.number_patterns = 0 No newline at end of file
17 17 self.patterns = {} No newline at end of file
18 18 No newline at end of file
19 19 def readFile(self): No newline at end of file
20 20 f = open(self.fileName, 'r') No newline at end of file
21 21 self.content = f.readlines() No newline at end of file
22 22 f.close() No newline at end of file
23 23 No newline at end of file
24 24 def getMetadata(self): No newline at end of file
25 25 self.readFile() No newline at end of file
26 26 No newline at end of file
27 27 newLine = self.content[0].replace("'","") No newline at end of file
28 28 pos = newLine.find("=") No newline at end of file
29 29 self.exp_name = newLine[pos+1:].strip() No newline at end of file
30 30 No newline at end of file
31 31 pos = self.content[2].find("=") No newline at end of file
32 32 self.number_patterns = int(self.content[2][pos+1:].strip()) No newline at end of file
33 33 No newline at end of file
34 34 self.patterns = self.getPatterns(self.content[3:]) No newline at end of file
35 35 No newline at end of file
36 36 return self.exp_name, self.number_patterns, self.patterns No newline at end of file
37 37 No newline at end of file
38 38 def getPatterns(self, content): No newline at end of file
39 39 lsPattern = []
40 No newline at end of file
40 index = 8
No newline at end of file
41 No newline at end of file
41
No newline at end of file
42 No newline at end of file
42 for i in range(0, self.number_patterns):
No newline at end of file
43 No newline at end of file
43 first = i+index
No newline at end of file
44 No newline at end of file
44 second = first+index
No newline at end of file
45 No newline at end of file
45 antennaUp = content[i:first]
No newline at end of file
46 antennaDown = content[first+1:second]
No newline at end of file
47 dicPattern = {"number" : content[i], "up" : antennaUp, "down" : antennaDown} No newline at end of file
48 46 lsPattern.append(dicPattern) No newline at end of file
49 47 No newline at end of file
50 48 return lsPattern No newline at end of file
49
No newline at end of file
50 def getValueofPattern(self, content):
No newline at end of file
51 strValue = "".join(element.replace("\n","+").strip() for element in content)
No newline at end of file
52 strValue = strValue.replace("\r","+")
No newline at end of file
53 strValue = strValue.replace("$","")
No newline at end of file
54 strValue = strValue.replace("]]+++[[","]]/[[")
No newline at end of file
55 strValue = strValue.replace("]]++[[","]]/[[")
No newline at end of file
56 strValue = strValue.replace("]]+[[","]]/[[")
No newline at end of file
57 strValue = strValue.replace("],++[","],[")
No newline at end of file
58 strValue = strValue.replace("],+[","],[")
No newline at end of file
59 strValue = strValue.replace("]]+++","]]|")
No newline at end of file
60 strValue = strValue.replace("]]++","]]|")
No newline at end of file
61 strValue = strValue.replace("]]+","]]|")
No newline at end of file
62 strValue = strValue.replace(" =++[[","=[[")
No newline at end of file
63 strValue = strValue.replace("=++[[","=[[")
No newline at end of file
64 strValue = strValue.replace(" =+[[","=[[")
No newline at end of file
65 strValue = strValue.replace("=+[[","=[[")
No newline at end of file
66 strValue = strValue.replace("+","").strip()
No newline at end of file
67 #print strValue
No newline at end of file
68 lsPatterns = strValue.split("|")
No newline at end of file
69
No newline at end of file
70 return lsPatterns No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now