##// END OF EJS Templates
Fix abs plotting patterns
Juan C. Espinoza -
r309:7f11f3361375
parent child
Show More
@@ -5,7 +5,7
5 {% block content %}
5 {% block content %}
6
6
7 <div id="PictureOverJRODown" style="float: right">
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:360px;height:360px; background-image: url({% static 'images/loader.gif' %});background-repeat: no-repeat;background-position: 50% 50%;">
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>
9 </div>
10
10
11 {% endblock %}
11 {% endblock %}
@@ -4,11 +4,6
4 {% load main_tags %}
4 {% load main_tags %}
5
5
6 {% block content %}
6 {% block content %}
7 <style>
8
9 </style>
10
11
12
7
13 {% if abs_beams %}
8 {% if abs_beams %}
14 <div>
9 <div>
@@ -30,7 +25,6
30 {% include "abs_pattern.html" %}
25 {% include "abs_pattern.html" %}
31 {% endif %}
26 {% endif %}
32
27
33
34 {% else %}
28 {% else %}
35 <div>
29 <div>
36 <h4>Beams:</h4>
30 <h4>Beams:</h4>
@@ -5,7 +5,7
5 {% block content %}
5 {% block content %}
6
6
7 <div id="PictureOverJROUp" style="float: right">
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:360px;height:360px; background-image: url({% static 'images/loader.gif' %});background-repeat: no-repeat;background-position: 50% 50%;">
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>
9 </div>
10
10
11 {% endblock %}
11 {% endblock %}
@@ -9,6 +9,7 from django.core.urlresolvers import reverse
9 from datetime import datetime
9 from datetime import datetime
10 from time import sleep
10 from time import sleep
11 import os
11 import os
12 import io
12
13
13 from apps.main.models import Device, Configuration, Experiment
14 from apps.main.models import Device, Configuration, Experiment
14 from apps.main.views import sidebar
15 from apps.main.views import sidebar
@@ -369,8 +370,7 def plot_patterns(request, id_conf, id_beam=None):
369
370
370 if id_beam:
371 if id_beam:
371 beam = get_object_or_404(ABSBeam, pk=id_beam)
372 beam = get_object_or_404(ABSBeam, pk=id_beam)
372 kwargs['beam'] = beam
373 kwargs['beam'] = beam
373
374
374
375 ###### SIDEBAR ######
375 ###### SIDEBAR ######
376
376
@@ -392,20 +392,15 def plot_pattern(request, id_conf, id_beam, antenna):
392
392
393 conf = get_object_or_404(ABSConfiguration, pk=id_conf)
393 conf = get_object_or_404(ABSConfiguration, pk=id_conf)
394 beam = get_object_or_404(ABSBeam, pk=id_beam)
394 beam = get_object_or_404(ABSBeam, pk=id_beam)
395
396 name = conf.experiment.name
397
398 just_rx = 1 if json.loads(beam.only_rx)[antenna] else 0
395 just_rx = 1 if json.loads(beam.only_rx)[antenna] else 0
399 phases = json.loads(beam.antenna)['antenna_{}'.format(antenna)]
396 phases = json.loads(beam.antenna)['antenna_{}'.format(antenna)]
400 gain_tx = json.loads(beam.tx)[antenna]
397 gain_tx = json.loads(beam.tx)[antenna]
401 gain_rx = json.loads(beam.rx)[antenna]
398 gain_rx = json.loads(beam.rx)[antenna]
402 ues = json.loads(beam.ues)[antenna]
399 ues = json.loads(beam.ues)[antenna]
403
400 newOverJro = overJroShow(beam.name)
404 newOverJro = overJroShow(name)
405 fig = newOverJro.plotPattern2(datetime.today(), phases, gain_tx, gain_rx, ues, just_rx)
401 fig = newOverJro.plotPattern2(datetime.today(), phases, gain_tx, gain_rx, ues, just_rx)
406
402 buf = io.BytesIO()
407 response=HttpResponse(content_type='image/png')
403 fig.savefig(buf, format='png')
408
404 response = HttpResponse(buf.getvalue(), content_type='image/png')
409 fig.canvas.print_png(response)
410
411 return response
405 return response
406 No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now