##// END OF EJS Templates
Se resolvió plot pattern de ABS
Renato Huallpa -
r390:5670a70fd8d1
parent child
Show More
@@ -18,8 +18,8 TZ=America/Lima
18 DOCKER_DATA=/data/dockers/radarsys/
18 DOCKER_DATA=/data/dockers/radarsys/
19 LOCAL_IP=192.168.1.128
19 LOCAL_IP=192.168.1.128
20
20
21 MQTT_SERVER=10.10.10.200
21 # MQTT_SERVER=10.10.10.200
22 # MQTT_SERVER = 192.168.100.5
22 MQTT_SERVER = 192.168.100.5
23 MQTT_PORT = 1883
23 MQTT_PORT = 1883
24 MQTT_KEEPALIVE = 3660
24 MQTT_KEEPALIVE = 3660
25
25
@@ -339,6 +339,7 class ABSConfiguration(Configuration):
339 try:
339 try:
340 #self.write_device()
340 #self.write_device()
341 send_task('task_change_beam', [self.id],)
341 send_task('task_change_beam', [self.id],)
342 print("*************************RUNNING ABS**************************",flush=True)
342 self.message = 'ABS running'
343 self.message = 'ABS running'
343
344
344 except Exception as e:
345 except Exception as e:
@@ -356,6 +357,7 class ABSConfiguration(Configuration):
356 self.device.status = 2
357 self.device.status = 2
357 self.device.save()
358 self.device.save()
358 self.message = 'ABS has been stopped.'
359 self.message = 'ABS has been stopped.'
360 print("*************************STOPPED ABS**************************",flush=True)
359 self.save()
361 self.save()
360
362
361 return True
363 return True
@@ -2,10 +2,6
2 {% load django_bootstrap5 %}
2 {% load django_bootstrap5 %}
3 {% load main_tags %}
3 {% load main_tags %}
4
4
5 {% block content %}
5 <img id="imgMainDown" src="{% url 'url_plot_beam' beam.abs_conf.id beam.id 'down' %}" alt="Error ploting..." style="width: 250px;height:250px; background-image: url({% static 'images/loader.gif' %});background-repeat: no-repeat;background-position: 50% 50%;">
6
6
7 <div id="PictureOverJRODown" style="float: right">
8 <img id="imgMainDown" src="{% url 'url_plot_beam' beam.abs_conf.id beam.id 'down' %}" alt="Error ploting..." style="width:340px;height:340px; background-image: url({% static 'images/loader.gif' %});background-repeat: no-repeat;background-position: 50% 50%;">
9 </div>
10
7
11 {% endblock %}
@@ -122,7 +122,12
122 font-size: 95%;
122 font-size: 95%;
123 }
123 }
124
124
125
125 .image_plot {
126 border: 2px solid #00334d;
127 display: inline-block;
128 vertical-align: 50px;
129 margin-left: 10px;
130 }
126
131
127 .abs_rx tr:nth-last-child(1){
132 .abs_rx tr:nth-last-child(1){
128 border-bottom: 0px solid #00334d;
133 border-bottom: 0px solid #00334d;
@@ -373,9 +378,16
373 </tr>
378 </tr>
374 </table>
379 </table>
375
380
376 {% if not edit %}
381 <table class="image_plot">
377 {% include "abs_uppattern_img.html" %}
382 <tr>
378 {% endif %}
383 <td>
384 {% if not edit %}
385 {% include "abs_uppattern_img.html" %}
386 {% endif %}
387 <!-- <img id="imgMains" src="{% url 'url_plot_beam' beam.abs_conf.id beam.id 'up' %}" alt="Error ploting..." style="width: 250px;height:250px; background-image: url({% static 'images/loader.gif' %});background-repeat: no-repeat;background-position: 50% 50%;"> -->
388 </td>
389 </tr>
390 </table>
379
391
380 <br>
392 <br>
381
393
@@ -597,9 +609,15
597 </tr>
609 </tr>
598 </table>
610 </table>
599
611
600 {% if not edit %}
612 <table class="image_plot">
601 {% include "abs_downpattern_img.html" %}
613 <tr>
602 {% endif %}
614 <td>
615 {% if not edit %}
616 {% include "abs_downpattern_img.html" %}
617 {% endif %}
618 </td>
619 </tr>
620 </table>
603
621
604 <br>
622 <br>
605
623
@@ -36,7 +36,7
36 <script>
36 <script>
37 {% for abs_beam in abs_beams %}
37 {% for abs_beam in abs_beams %}
38 $("#bt_beam{{ forloop.counter }}").click(function() {
38 $("#bt_beam{{ forloop.counter }}").click(function() {
39 document.location = "{% url 'url_plot_abs_patterns' abs_beam.abs_conf.id abs_beam.id %}";
39 document.location = "{% url 'url_plot_abs_patterns2' abs_beam.abs_conf.id abs_beam.id %}";
40 });
40 });
41 {% endfor %}
41 {% endfor %}
42 //function ChangeColor() {
42 //function ChangeColor() {
@@ -2,10 +2,4
2 {% load django_bootstrap5 %}
2 {% load django_bootstrap5 %}
3 {% load main_tags %}
3 {% load main_tags %}
4
4
5 {% block content %}
5 <img id="imgMainUp" src="{% url 'url_plot_beam' beam.abs_conf.id beam.id 'up' %}" alt="Error ploting..." style="width: 250px;height:250px; background-image: url({% static 'images/loader.gif' %});background-repeat: no-repeat;background-position: 50% 50%;">
6
7 <div id="PictureOverJROUp" style="float: right">
8 <img id="imgMain" src="{% url 'url_plot_beam' beam.abs_conf.id beam.id 'up' %}" alt="Error ploting..." style="width:340px;height:340px; background-image: url({% static 'images/loader.gif' %});background-repeat: no-repeat;background-position: 50% 50%;">
9 </div>
10
11 {% endblock %}
@@ -10,8 +10,8 urlpatterns = (
10 #url(r'^(?P<id_conf>-?\d+)/status/', views.abs_conf, {'status_request':True},name='url_status_abs_conf'),
10 #url(r'^(?P<id_conf>-?\d+)/status/', views.abs_conf, {'status_request':True},name='url_status_abs_conf'),
11 path('<int:id_conf>/change_beam/<int:id_beam>/', views.send_beam, name='url_send_beam'),
11 path('<int:id_conf>/change_beam/<int:id_beam>/', views.send_beam, name='url_send_beam'),
12 path('<int:id_conf>/plot/', views.plot_patterns, name='url_plot_abs_patterns'),
12 path('<int:id_conf>/plot/', views.plot_patterns, name='url_plot_abs_patterns'),
13 path('<int:id_conf>/plot/<int:id_beam>/', views.plot_patterns, name='url_plot_abs_patterns'),
13 path('<int:id_conf>/plot/<int:id_beam>/', views.plot_patterns, name='url_plot_abs_patterns2'),
14 path('<int:id_conf>/plot/<int:id_beam>/<int:antenna>/pattern.png', views.plot_pattern, name='url_plot_beam'),
14 path('<int:id_conf>/plot/<int:id_beam>/<slug:antenna>/pattern.png/', views.plot_pattern, name='url_plot_beam'),
15 path('<int:id_conf>/add_beam/', views.add_beam, name='url_add_abs_beam'),
15 path('<int:id_conf>/add_beam/', views.add_beam, name='url_add_abs_beam'),
16 path('<int:id_conf>/beam/<int:id_beam>/delete/', views.remove_beam, name='url_remove_abs_beam'),
16 path('<int:id_conf>/beam/<int:id_beam>/delete/', views.remove_beam, name='url_remove_abs_beam'),
17 path('<int:id_conf>/beam/<int:id_beam>/edit/', views.edit_beam, name='url_edit_abs_beam'),
17 path('<int:id_conf>/beam/<int:id_beam>/edit/', views.edit_beam, name='url_edit_abs_beam'),
@@ -79,7 +79,7 class AntPatternPlot:
79 levels = numpy.array([1e-3,1e-2,1e-1,0.5,1.0])
79 levels = numpy.array([1e-3,1e-2,1e-1,0.5,1.0])
80 tmp = numpy.round(10*numpy.log10(levels),decimals=1)
80 tmp = numpy.round(10*numpy.log10(levels),decimals=1)
81 labels = []
81 labels = []
82 for i in numpy.arange(5):labels.append(str(numpy.int(tmp[i])))
82 for i in numpy.arange(5):labels.append(str(int(tmp[i])))
83
83
84
84
85 colors = ((0,0,1.),(0,170/255.,0),(127/255.,1.,0),(1.,109/255.,0),(128/255.,0,0))
85 colors = ((0,0,1.),(0,170/255.,0),(127/255.,1.,0),(1.,109/255.,0),(128/255.,0,0))
@@ -137,10 +137,10 class AntPatternPlot:
137
137
138 # Getting HA and DEC axes
138 # Getting HA and DEC axes
139 mindec = -28; maxdec = 4; incdec = 2.
139 mindec = -28; maxdec = 4; incdec = 2.
140 ndec = numpy.int((maxdec - mindec)/incdec) + 1
140 ndec = int((maxdec - mindec)/incdec) + 1
141
141
142 minha = -20; maxha = 20; incha = 2.
142 minha = -20; maxha = 20; incha = 2.
143 nha = numpy.int((maxha - minha)/incha) + 1
143 nha = int((maxha - minha)/incha) + 1
144
144
145 #mcosx = numpy.zeros((nha,ndec))
145 #mcosx = numpy.zeros((nha,ndec))
146 #mcosy = numpy.zeros((nha,ndec))
146 #mcosy = numpy.zeros((nha,ndec))
@@ -184,8 +184,8 class AntPatternPlot:
184 if noval[0].size>0:mcosy[noval] = numpy.nan
184 if noval[0].size>0:mcosy[noval] = numpy.nan
185
185
186 # Plotting HA and declination grid.
186 # Plotting HA and declination grid.
187 iha0 = numpy.int((0 - minha)/incha)
187 iha0 = int((0 - minha)/incha)
188 idec0 = numpy.int((-14 - mindec)/incdec)
188 idec0 = int((-14 - mindec)/incdec)
189
189
190 colorgrid = (1.,109/255.,0)
190 colorgrid = (1.,109/255.,0)
191 self.ax.plot(mcosx.transpose(),mcosy.transpose(),color=colorgrid,linestyle='--')
191 self.ax.plot(mcosx.transpose(),mcosy.transpose(),color=colorgrid,linestyle='--')
@@ -194,7 +194,7 class AntPatternPlot:
194 valx = (mcosx[idec,iha0]<=xmax) & (mcosx[idec,iha0]>=xmin)
194 valx = (mcosx[idec,iha0]<=xmax) & (mcosx[idec,iha0]>=xmin)
195 valy = (mcosy[idec,iha0]<=ymax) & (mcosy[idec,iha0]>=ymin)
195 valy = (mcosy[idec,iha0]<=ymax) & (mcosy[idec,iha0]>=ymin)
196 if valx & valy:
196 if valx & valy:
197 text = str(numpy.int(mindec + incdec*idec))+'$^o$'
197 text = str(int(mindec + incdec*idec))+'$^o$'
198 self.ax.text(mcosx[idec,iha0],mcosy[idec,iha0],text)
198 self.ax.text(mcosx[idec,iha0],mcosy[idec,iha0],text)
199
199
200 matplotlib.pyplot.plot(mcosx,mcosy,color=colorgrid,linestyle='--')
200 matplotlib.pyplot.plot(mcosx,mcosy,color=colorgrid,linestyle='--')
@@ -203,7 +203,7 class AntPatternPlot:
203 valx = (mcosx[idec0,iha]<=xmax) & (mcosx[idec0,iha]>=xmin)
203 valx = (mcosx[idec0,iha]<=xmax) & (mcosx[idec0,iha]>=xmin)
204 valy = (mcosy[idec0,iha]<=ymax) & (mcosy[idec0,iha]>=ymin)
204 valy = (mcosy[idec0,iha]<=ymax) & (mcosy[idec0,iha]>=ymin)
205 if valx & valy:
205 if valx & valy:
206 text = str(4*numpy.int(minha + incha*iha))+"'"
206 text = str(4*int(minha + incha*iha))+"'"
207 self.ax.text(mcosx[idec0,iha],mcosy[idec0,iha],text)
207 self.ax.text(mcosx[idec0,iha],mcosy[idec0,iha],text)
208
208
209 if save:
209 if save:
@@ -257,9 +257,9 class AntPatternPlot:
257
257
258
258
259 ObjFig, = self.ax.plot(alpha_location[:,0,ih],alpha_location[:,1,ih],
259 ObjFig, = self.ax.plot(alpha_location[:,0,ih],alpha_location[:,1,ih],
260 marker[ih % 8],color=colors[numpy.int(ih/8)],ms=4.5,lw=0.5)
260 marker[ih % 8],color=colors[int(ih/8)],ms=4.5,lw=0.5)
261 handles.append(ObjFig)
261 handles.append(ObjFig)
262 objects.append(numpy.str(heights[ih]) + ' km')
262 objects.append(str(heights[ih]) + ' km')
263
263
264 self.ax.legend(handles,objects,loc="lower right", numpoints=1, handlelength=0.3,
264 self.ax.legend(handles,objects,loc="lower right", numpoints=1, handlelength=0.3,
265 handletextpad=0.02, borderpad=0.3, labelspacing=0.1)
265 handletextpad=0.02, borderpad=0.3, labelspacing=0.1)
@@ -329,9 +329,9 class BFieldPlot:
329
329
330
330
331 ObjFig, = matplotlib.pyplot.plot(alpha_location[:,0,ih],alpha_location[:,1,ih], \
331 ObjFig, = matplotlib.pyplot.plot(alpha_location[:,0,ih],alpha_location[:,1,ih], \
332 marker[ih % 8],color=colors[numpy.int(ih/8)],ms=4.5,lw=0.5)
332 marker[ih % 8],color=colors[int(ih/8)],ms=4.5,lw=0.5)
333 handles.append(ObjFig)
333 handles.append(ObjFig)
334 objects.append(numpy.str(heights[ih]) + ' km')
334 objects.append(str(heights[ih]) + ' km')
335
335
336 matplotlib.pyplot.xlim(dcosxrange[0],dcosxrange[1])
336 matplotlib.pyplot.xlim(dcosxrange[0],dcosxrange[1])
337 matplotlib.pyplot.ylim(dcosyrange[0],dcosyrange[1])
337 matplotlib.pyplot.ylim(dcosyrange[0],dcosyrange[1])
@@ -468,7 +468,7 class CelestialObjectsPlot:
468
468
469 index = numpy.mean(tod_0[val]) - minlev
469 index = numpy.mean(tod_0[val]) - minlev
470 index = (index*(maxcol - mincol)/(maxlev - minlev)) + mincol
470 index = (index*(maxcol - mincol)/(maxlev - minlev)) + mincol
471 index = numpy.int(index)
471 index = int(index)
472 figobjects, = matplotlib.pyplot.plot(dcosx[val],dcosy[val],marker[io-1],\
472 figobjects, = matplotlib.pyplot.plot(dcosx[val],dcosy[val],marker[io-1],\
473 lw=1,ms=7,mew=0,color=tuple(colortable[:,index]))
473 lw=1,ms=7,mew=0,color=tuple(colortable[:,index]))
474 handles.append(figobjects)
474 handles.append(figobjects)
@@ -235,6 +235,7 class JroPattern():
235 --------------------
235 --------------------
236 Developed by Jorge L. Chau.
236 Developed by Jorge L. Chau.
237 Converted to Python by Freddy R. Galindo, ROJ, 20 September 2009.
237 Converted to Python by Freddy R. Galindo, ROJ, 20 September 2009.
238 Updated to Django 4.1.5 and Python 3.9.16 by Renato Huallpa M. March 2023.
238 """
239 """
239
240
240 if rx==1:
241 if rx==1:
@@ -290,7 +291,7 class JroPattern():
290
291
291 fft_phase = fft_phase*CoFactors.d2r
292 fft_phase = fft_phase*CoFactors.d2r
292
293
293 pattern = numpy.abs(numpy.fft.fft2(fft_gain*numpy.exp(numpy.complex(0,1)*fft_phase)))**2
294 pattern = numpy.abs(numpy.fft.fft2(fft_gain*numpy.exp(complex(0,1)*fft_phase)))**2
294 pattern = numpy.fft.fftshift(pattern)
295 pattern = numpy.fft.fftshift(pattern)
295
296
296 xvals = numpy.where((dcosx>=(numpy.min(self.dcosx))) & (dcosx<=(numpy.max(self.dcosx))))
297 xvals = numpy.where((dcosx>=(numpy.min(self.dcosx))) & (dcosx<=(numpy.max(self.dcosx))))
@@ -416,6 +417,7 class JroPattern():
416 --------------------
417 --------------------
417 Developed by Jorge L. Chau.
418 Developed by Jorge L. Chau.
418 Converted to Python by Freddy R. Galindo, ROJ, 20 September 2009.
419 Converted to Python by Freddy R. Galindo, ROJ, 20 September 2009.
420 Updated to Django 4.1.5 and Python 3.9.16 by Renato Huallpa M. March 2023.
419 """
421 """
420
422
421 pos = self.eomwl*self.__readAttenuation()
423 pos = self.eomwl*self.__readAttenuation()
@@ -429,7 +431,7 class JroPattern():
429 yindex = iy*(self.getcut==0) + ix*(self.getcut==1)
431 yindex = iy*(self.getcut==0) + ix*(self.getcut==1)
430 phasex = posx*self.dcosx[ix]
432 phasex = posx*self.dcosx[ix]
431 phasey = posy*self.dcosy[yindex]
433 phasey = posy*self.dcosy[yindex]
432 tmp = gain*numpy.exp(numpy.complex(0,1.)*(self.kk*(phasex+phasey)+phase))
434 tmp = gain*numpy.exp(complex(0,1.)*(self.kk*(phasex+phasey)+phase))
433 module[ix,iy] = tmp.sum()
435 module[ix,iy] = tmp.sum()
434
436
435 return module
437 return module
@@ -468,8 +470,9 class JroPattern():
468 yy1 = self.dcosy[numpy.min(nny):numpy.max(nny)+1]
470 yy1 = self.dcosy[numpy.min(nny):numpy.max(nny)+1]
469
471
470 # fitting data into the main beam.
472 # fitting data into the main beam.
471 import gaussfit
473 #import apps.abs.utils.gaussfit as gaussfit
472 params = gaussfit.fitgaussian(mm1)
474 from .gaussfit import fitgaussian
475 params = fitgaussian(mm1)
473
476
474 # Tranforming from indexes to axis' values
477 # Tranforming from indexes to axis' values
475 xcenter = xx1[0] + (((xx1[xx1.size-1] - xx1[0])/(xx1.size -1))*(params[1]))
478 xcenter = xx1[0] + (((xx1[xx1.size-1] - xx1[0])/(xx1.size -1))*(params[1]))
@@ -569,8 +572,8 class BField():
569 nfields = 1
572 nfields = 1
570
573
571 grid_res = 0.5
574 grid_res = 0.5
572 nlon = int(numpy.int(maglimits[2] - maglimits[0])/grid_res + 1)
575 nlon = int(int(maglimits[2] - maglimits[0])/grid_res + 1)
573 nlat = int(numpy.int(maglimits[3] - maglimits[1])/grid_res + 1)
576 nlat = int(int(maglimits[3] - maglimits[1])/grid_res + 1)
574
577
575 location = numpy.zeros((nlon,nlat,2))
578 location = numpy.zeros((nlon,nlat,2))
576 mlon = numpy.atleast_2d(numpy.arange(nlon)*grid_res + maglimits[0])
579 mlon = numpy.atleast_2d(numpy.arange(nlon)*grid_res + maglimits[0])
@@ -629,7 +632,7 class BField():
629 rr = numpy.zeros((heights.size,3))
632 rr = numpy.zeros((heights.size,3))
630 rgc = numpy.zeros((heights.size,3))
633 rgc = numpy.zeros((heights.size,3))
631
634
632 ObjGeodetic = Astro_Coords.Geodetic(gdlat,gdalt)
635 ObjGeodetic = Geodetic(gdlat,gdalt)
633 [gclat,gcalt] = ObjGeodetic.change2geocentric()
636 [gclat,gcalt] = ObjGeodetic.change2geocentric()
634
637
635 gclat = gclat*numpy.pi/180.
638 gclat = gclat*numpy.pi/180.
@@ -1362,7 +1365,7 class overJroShow:
1362
1365
1363 vect_polar = Misc_Routines.Vector(numpy.array(vect_geo),direction=1).Polar2Rect()
1366 vect_polar = Misc_Routines.Vector(numpy.array(vect_geo),direction=1).Polar2Rect()
1364
1367
1365 [ra,dec,ha] = Astro_Coords.AltAz(vect_polar[1],vect_polar[0],self.junkjd).change2equatorial()
1368 [ra,dec,ha] = AltAz(vect_polar[1],vect_polar[0],self.junkjd).change2equatorial()
1366
1369
1367 print('Main beam position (HA(min), DEC(degrees)): %f %f')%(ha*4.,dec)
1370 print('Main beam position (HA(min), DEC(degrees)): %f %f')%(ha*4.,dec)
1368
1371
@@ -1421,7 +1424,7 class overJroShow:
1421
1424
1422 vect_polar = Misc_Routines.Vector(vect_geo,direction=1).Polar2Rect()
1425 vect_polar = Misc_Routines.Vector(vect_geo,direction=1).Polar2Rect()
1423
1426
1424 [ra,dec,ha] = Astro_Coords.AltAz(vect_polar[1,:],vect_polar[0,:],self.junkjd).change2equatorial()
1427 [ra,dec,ha] = AltAz(vect_polar[1,:],vect_polar[0,:],self.junkjd).change2equatorial()
1425
1428
1426 val = numpy.where(ha>=180)
1429 val = numpy.where(ha>=180)
1427
1430
@@ -1609,7 +1612,7 class overJroShow:
1609
1612
1610 julian = Time(year,month,dom).change2julday()
1613 julian = Time(year,month,dom).change2julday()
1611
1614
1612 [powr,time, lst] = Astro_Coords.CelestialBodies().skyNoise(julian)
1615 [powr,time, lst] = CelestialBodies().skyNoise(julian)
1613
1616
1614 SkyNoisePlot([year,month,dom],powr,time,lst).getPlot(self.path4plotname,self.plotname2)
1617 SkyNoisePlot([year,month,dom],powr,time,lst).getPlot(self.path4plotname,self.plotname2)
1615
1618
@@ -291,12 +291,13 class JARSConfiguration(Configuration):
291 self.device.status = payload['status']
291 self.device.status = payload['status']
292 self.device.save()
292 self.device.save()
293 self.message = payload['message']
293 self.message = payload['message']
294 print("------STOP JARS------",flush=True)
294 except Exception as e:
295 except Exception as e:
295 self.device.status = 0
296 self.device.status = 0
296 self.message = str(e)
297 self.message = str(e)
297 self.device.save()
298 self.device.save()
298 return False
299 return False
299
300
300 return True
301 return True
301
302
302 def read_device(self):
303 def read_device(self):
@@ -318,6 +319,10 class JARSConfiguration(Configuration):
318 if self.device.status == 3:
319 if self.device.status == 3:
319 self.message = 'Could not configure device. Software Acquisition is running'
320 self.message = 'Could not configure device. Software Acquisition is running'
320 return False
321 return False
322
323 print("------ JARS WRITING ------",flush=True)
324 self.device.status = 5 #Busy
325 print("STATUS:", self.device.status,flush=True)
321
326
322 data = self.experiment.parms_to_dict()
327 data = self.experiment.parms_to_dict()
323 #print(data)
328 #print(data)
@@ -335,6 +340,7 class JARSConfiguration(Configuration):
335 return False
340 return False
336
341
337 json_data = json.dumps(data)
342 json_data = json.dumps(data)
343 print("STATUS:", self.device.status,flush=True)
338
344
339 try:
345 try:
340 payload = self.request('write', 'post', json=json_data)
346 payload = self.request('write', 'post', json=json_data)
@@ -343,13 +349,14 class JARSConfiguration(Configuration):
343 self.device.save()
349 self.device.save()
344 if self.device.status == 1:
350 if self.device.status == 1:
345 return False
351 return False
352 print("------ JARS WRITED ------",flush=True)
346
353
347 except Exception as e:
354 except Exception as e:
348 self.device.status = 0
355 self.device.status = 0
349 self.message = str(e)
356 self.message = str(e)
350 self.device.save()
357 self.device.save()
351 return False
358 return False
352
359 print("FINAL STATUS:", self.device.status,flush=True)
353 return True
360 return True
354
361
355 def start_device(self):
362 def start_device(self):
@@ -368,7 +375,7 class JARSConfiguration(Configuration):
368 self.message = str(e)
375 self.message = str(e)
369 self.device.save()
376 self.device.save()
370 return False
377 return False
371
378 print("------START JARS------",flush=True)
372 return True
379 return True
373
380
374 def get_log(self):
381 def get_log(self):
@@ -30,7 +30,7 class Command(BaseCommand):
30 # print("RADR", rad)
30 # print("RADR", rad)
31 radar_id=rad["id"]
31 radar_id=rad["id"]
32 # print("RADR_",radar_id)
32 # print("RADR_",radar_id)
33 radar_start_scheduler(campaign.id,radar_id)
33 radar_write_start_scheduler(campaign.id,radar_id)
34 print(campaign.name, "\t\t Campaign already running")
34 print(campaign.name, "\t\t Campaign already running")
35
35
36 else:
36 else:
@@ -43,10 +43,9 class Command(BaseCommand):
43 else:
43 else:
44 print(campaign.name,"\t\t\t Campaign already stooped")
44 print(campaign.name,"\t\t\t Campaign already stooped")
45
45
46 def radar_start_scheduler(id_camp,id_radar):
46 def radar_write_start_scheduler(id_camp,id_radar):
47 campaign = get_object_or_404(Campaign, pk=id_camp)
47 campaign = get_object_or_404(Campaign, pk=id_camp)
48 experiments = campaign.get_experiments_by_radar(id_radar)[0]['experiments']
48 experiments = campaign.get_experiments_by_radar(id_radar)[0]['experiments']
49 now = datetime.now()
50 # print(campaign)
49 # print(campaign)
51 # print(experiments)
50 # print(experiments)
52 for exp in experiments:
51 for exp in experiments:
@@ -62,7 +61,7 def radar_start_scheduler(id_camp,id_radar):
62 if exp.status == 2:
61 if exp.status == 2:
63 print('\t\t\t {} \t\tExperiment started'.format(exp))
62 print('\t\t\t {} \t\tExperiment started'.format(exp))
64 if exp.status == 4:
63 if exp.status == 4:
65 print('\t\t\t {} \t\tExperiment with state uknown, please reset'.format(exp))
64 print('\t\t\t {} \t\tExperiment with state uknown, please reset (Stop and start manually)'.format(exp))
66 exp.save()
65 exp.save()
67
66
68 def radar_stop_scheduler(id_camp,id_radar,id_experiment):
67 def radar_stop_scheduler(id_camp,id_radar,id_experiment):
@@ -62,6 +62,7 DEV_STATES = (
62 (2, 'Configured'),
62 (2, 'Configured'),
63 (3, 'Running'),
63 (3, 'Running'),
64 (4, 'Unknown'),
64 (4, 'Unknown'),
65 (5, 'Busy')
65 )
66 )
66
67
67 DEV_TYPES = (
68 DEV_TYPES = (
@@ -766,18 +767,21 class Configuration(PolymorphicModel):
766 def stop_device(self):
767 def stop_device(self):
767
768
768 self.message = 'Function not implemented'
769 self.message = 'Function not implemented'
770 print("BUENAS SEÑALES??? NO LO CREO2",flush=True)
769 return False
771 return False
770
772
771
773
772 def start_device(self):
774 def start_device(self):
773
775
774 self.message = 'Function not implemented'
776 self.message = 'Function not implemented'
777 print("BUENAS SEÑALES??? NO LO CREO",flush=True)
775 return False
778 return False
776
779
777
780
778 def write_device(self, parms):
781 def write_device(self, parms):
779
782
780 self.message = 'Function not implemented'
783 self.message = 'Function not implemented'
784 print("BUENAS SEÑALES??? NO LO CREO3",flush=True)
781 return False
785 return False
782
786
783 def write_device_mqtt(self, parms):
787 def write_device_mqtt(self, parms):
General Comments 0
You need to be logged in to leave comments. Login now