##// END OF EJS Templates
Task #559: Vista de Summary (main: urls, views, experiment.html, experiment_summary.html)...
Fiorella Quino -
r151:7532782126ca
parent child
Show More
@@ -0,0 +1,125
1 {% extends "base.html" %}
2 {% load bootstrap3 %}
3 {% load static %}
4 {% load main_tags %}
5 {% block extra-head %}
6 <link href="{% static 'css/bootstrap-datetimepicker.min.css' %}" media="screen" rel="stylesheet">
7 {% endblock %}
8
9 {% block exp-active %}active{% endblock %}
10
11 {% block content-title %}{{title}}{% endblock %}
12 {% block content-suptitle %}{{suptitle}}{% endblock %}
13
14 {% block content %}
15
16 {% block menu-actions %}
17 <!-- <span class=" dropdown pull-right">
18 <a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-menu-hamburger gi-2x" aria-hidden="true"></span></a>
19 <ul class="dropdown-menu" role="menu">
20 <li><a href="{% url 'url_edit_experiment' experiment.id %}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Edit</a></li>
21 <li><a href="{% url 'url_delete_experiment' experiment.id %}"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Delete</a></li>
22 <li><a href="{{ experiment.get_absolute_url_import }}"><span class="glyphicon glyphicon-import" aria-hidden="true"></span> Import </a></li>
23 <li><a href="{{ experiment.get_absolute_url_export }}"><span class="glyphicon glyphicon-export" aria-hidden="true"></span> Export </a></li>
24 {% block extra-menu-actions %}
25 {% endblock %}
26 <li><a>----------------</a></li>
27 <li><a href="{% url 'url_mix_experiment' experiment.id %}"><span class="glyphicon glyphicon-random" aria-hidden="true"></span> Mix RC Configurations </a></li>
28 <li><a href="{% url 'url_add_dev_conf' experiment.id %}"><span class="glyphicon glyphicon-plus-sign" aria-hidden="true"></span> Add Configuration</a></li>
29 <li><a href=#><span class="glyphicon glyphicon-check" aria-hidden="true"></span> Verify Parameters</a></li>
30
31 </ul>
32 </span> -->
33 {% endblock %}
34
35 <table class="table table-bordered">
36 {% for key in experiment_keys %}
37 <tr><th>{{key|title}}</th><td>{{experiment|attr:key}}</td></tr>
38 {% endfor %}
39 </table>
40
41 <div class="">
42 <h4 class="panel-title"><b> Parameters </b></h4>
43 <br>
44 </div>
45
46 <table class="table table-bordered">
47 {% for configuration in configurations %}
48 {% if configuration.device.device_type.name == 'dds' %}
49 <!--<h4 class="panel-title"> </h4>-->
50 <tr><th>dds</th><td>(=</td></tr>
51 {% endif %}
52
53 {% if configuration.device.device_type.name == 'rc' %}
54 <!--<h4 class="panel-title"> </h4>-->
55 <tr><th>IPP(km)</th><td>{{experiment_data.configurations.rc.ipp}}</td></tr>
56 <tr><th>NTX</th><td>{{experiment_data.configurations.rc.ntx}}</td></tr>
57 <tr><th>TX</th><td>{{tx}}</td></tr>
58 <tr><th>Code</th><td>{{code}}</td></tr>
59 <tr><th>Sampling Window</th><td>{{window|linebreaks}}</td></tr>
60 {% endif %}
61
62 {% if configuration.device.device_type.name == 'rc_mix' %}
63 <!--<h4 class="panel-title"> </h4>-->
64 <tr><th>rc_mix</th><td>(=</td></tr>
65 {% endif %}
66
67 {% if configuration.device.device_type.name == 'jars' %}
68 <!--<h4 class="panel-title"> JARS </h4>-->
69 <tr><th>Data Type</th><td>{{exp_type}}</td></tr>
70 <tr><th># Channels</th><td>{{configuration.channels_number}}</td></tr>
71 <tr><th>Coh Int</th><td>{{configuration.cohe_integr}}</td></tr>
72 <tr><th>FFT Points</th><td>{{configuration.fftpoints}}</td></tr>
73 {% if exp_type == 'PDATA'%}
74 <tr><th>Inc Int</th><td>{{configuration.incohe_integr}}</td></tr>
75 <tr><th>Spec. Comb.</th><td>{{configuration.spectral}}</td></tr>
76 {% endif %}
77 <tr><th>Acq Prof</th><td>{{configuration.acq_profiles}}</td></tr>
78 <tr><th>Prof x Block</th><td>{{configuration.profiles_block}}</td></tr>
79 <tr><th>Block x File</th><td>(=</td></tr>
80 {% endif %}
81
82 {% if configuration.device.device_type.name == 'usrp' %}
83 <!--<h4 class="panel-title"> </h4>-->
84 <tr><th>usrp</th><td>(=</td></tr>
85 {% endif %}
86
87 {% if configuration.device.device_type.name == 'cgs' %}
88 <!--<h4 class="panel-title"> CGS </h4>-->
89 <!--<tr><th>Frequency 0</th><td>{{configuration.freq0}}</td></tr>-->
90 <!--<tr><th>Frequency 1</th><td>{{configuration.freq1}}</td></tr>-->
91 <!--<tr><th>Frequency 2</th><td>{{configuration.freq2}}</td></tr>-->
92 <!--<tr><th>Frequency 3</th><td>{{configuration.freq3}}</td></tr>-->
93 {% endif %}
94
95 {% if configuration.device.device_type.name == 'abs' %}
96 <!--<h4 class="panel-title"> </h4>-->
97 <tr><th>abs</th><td>(=</td></tr>
98 {% endif %}
99 {% endfor %}
100 </table>
101
102 <div class="pull-right">
103 <button type="button" class="btn btn-primary" id="bt_back">Back</button>
104 <button type="button" class="btn btn-primary" id="bt_verify">Verify Parameters</button>
105 </div>
106
107 {% endblock %}
108
109 {% block sidebar%}
110 {% include "sidebar_devices.html" %}
111 {% endblock %}
112
113 {% block extra-js%}
114 <script type="text/javascript">
115
116 $(".clickable-row").click(function() {
117 document.location = $(this).data("href");
118 });
119
120 $("#bt_back").click(function() {
121 document.location = "{% url 'url_experiment' experiment.id%}";
122 });
123
124 </script>
125 {% endblock %} No newline at end of file
@@ -26,6 +26,7
26 26 <li><a>----------------</a></li>
27 27 <li><a href="{% url 'url_mix_experiment' experiment.id %}"><span class="glyphicon glyphicon-random" aria-hidden="true"></span> Mix RC Configurations </a></li>
28 28 <li><a href="{% url 'url_add_dev_conf' experiment.id %}"><span class="glyphicon glyphicon-plus-sign" aria-hidden="true"></span> Add Configuration</a></li>
29 <li><a href="{% url 'url_sum_experiment' experiment.id %}"><span class="glyphicon glyphicon-list-alt" aria-hidden="true"></span> Summary</a></li>
29 30
30 31 </ul>
31 32 </span>
@@ -30,6 +30,7 urlpatterns = (
30 30 url(r'^experiment/(?P<id_exp>-?\d+)/import/$', 'apps.main.views.experiment_import', name='url_import_experiment'),
31 31 url(r'^experiment/(?P<id_exp>-?\d+)/mix/$', 'apps.main.views.experiment_mix', name='url_mix_experiment'),
32 32 url(r'^experiment/(?P<id_exp>-?\d+)/mix/delete/$', 'apps.main.views.experiment_mix_delete', name='url_delete_mix_experiment'),
33 url(r'^experiment/(?P<id_exp>-?\d+)/summary/$', 'apps.main.views.experiment_summary', name='url_sum_experiment'),
33 34
34 35 url(r'^experiment/(?P<id_exp>-?\d+)/new_dev_conf/$', 'apps.main.views.dev_conf_new', name='url_add_dev_conf'),
35 36 url(r'^experiment/(?P<id_exp>-?\d+)/new_dev_conf/(?P<id_dev>-?\d+)/$', 'apps.main.views.dev_conf_new', name='url_add_dev_conf'),
@@ -19,7 +19,7 from apps.dds.forms import DDSConfigurationForm
19 19
20 20 from .models import Campaign, Experiment, Device, Configuration, Location, RunningExperiment
21 21 from apps.cgs.models import CGSConfiguration
22 from apps.jars.models import JARSConfiguration
22 from apps.jars.models import JARSConfiguration, EXPERIMENT_TYPE
23 23 from apps.usrp.models import USRPConfiguration
24 24 from apps.abs.models import ABSConfiguration
25 25 from apps.rc.models import RCConfiguration, RCLine, RCLineType
@@ -753,6 +753,60 def experiment_mix_delete(request, id_exp):
753 753 return redirect('url_mix_experiment', id_exp=id_exp)
754 754
755 755
756 def experiment_summary(request, id_exp):
757
758 import json
759
760 experiment = get_object_or_404(Experiment, pk=id_exp)
761 experiment_data = json.loads(experiment.parms_to_dict())
762 configurations = Configuration.objects.filter(experiment=experiment, type=0)
763
764 kwargs = {}
765
766 kwargs['experiment_keys'] = ['template', 'radar_system', 'name', 'start_time', 'end_time']
767 kwargs['experiment'] = experiment
768
769 kwargs['configuration_keys'] = ['name', 'device__ip_address', 'device__port_address', 'device__status']
770 kwargs['configurations'] = configurations
771 kwargs['experiment_data'] = experiment_data
772
773 kwargs['title'] = 'Experiment Summary'
774 kwargs['suptitle'] = 'Details'
775
776 kwargs['button'] = 'Verify Parameters'
777
778 for configuration in configurations:
779 if configuration.device.device_type.name == 'jars':
780 kwargs['exp_type'] = EXPERIMENT_TYPE[configuration.exp_type][1]
781
782 if configuration.device.device_type.name == 'rc':
783 rc_lines = experiment_data['configurations']['rc']['lines']
784 code = rc_lines[3]['code']
785
786 window_data = rc_lines[6]['params'][0]
787 h0 = str(window_data['first_height'])
788 dh = str(window_data['resolution'])
789 nsa = str(window_data['number_of_samples'])
790 window = 'Ho='+h0+'km\nDH='+dh+'km\nNSA='+nsa
791
792 tx = ''
793 if float(rc_lines[1]['delays']) == 0:
794 tx = rc_lines[2]['pulse_width']
795 elif float(rc_lines[2]['delays']) == 0:
796 tx = rc_lines[1]['pulse_width']
797 else:
798 tx = rc_lines[1]['pulse_width']+' | '+rc_lines[2]['pulse_width']
799
800 kwargs['tx'] = tx
801 kwargs['code'] = code
802 kwargs['window'] = window
803
804 ###### SIDEBAR ######
805 kwargs.update(sidebar(experiment=experiment))
806
807 return render(request, 'experiment_summary.html', kwargs)
808
809
756 810 def parse_mix_result(s):
757 811
758 812 values = s.split('-')
@@ -1426,4 +1480,3 def radar_refresh(request, id_camp, id_radar):
1426 1480 return HttpResponseRedirect(reverse('url_operation_search', args=[id_camp]))
1427 1481 else:
1428 1482 return HttpResponseRedirect(reverse('url_operation', args=[id_camp]))
1429
General Comments 0
You need to be logged in to leave comments. Login now