@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | {% endblock %} |
|
18 | {% endblock %} | |
19 |
|
19 | |||
20 |
|
20 | <form action="" method="post" class="form login">{% csrf_token %} | ||
21 |
|
21 | |||
22 | <table class="table table-bordered" style="text-align:center;"> |
|
22 | <table class="table table-bordered" style="text-align:center;"> | |
23 | <!--<h4 class="panel-title"> </h4>--> |
|
23 | <!--<h4 class="panel-title"> </h4>--> | |
@@ -26,44 +26,44 | |||||
26 | <th style="text-align:center;">DDS</th> |
|
26 | <th style="text-align:center;">DDS</th> | |
27 | <th style="text-align:center;">RC</th> |
|
27 | <th style="text-align:center;">RC</th> | |
28 | <th style="text-align:center;">JARS</th> |
|
28 | <th style="text-align:center;">JARS</th> | |
29 |
<th style="text-align:center;"> |
|
29 | <th style="text-align:center;">Insert New Value</th> | |
30 | </tr> |
|
30 | </tr> | |
31 |
|
31 | |||
32 | <tr> |
|
32 | <tr> | |
33 | <th>Clock In</th> |
|
33 | <th>Clock In</th> | |
34 | <td id="dds_clock">{{ dds.clock }}</td> |
|
34 | <td id="dds_clock">{{ dds.clock }}</td> | |
35 | <td id="rc_clock">{{ rc.clock_in }}</td> |
|
35 | <td id="rc_clock">{{ rc.clock_in }}</td> | |
36 | <td id="filter_clock">{{ filter_parms.clock }}</td> |
|
36 | <td id="filter_clock">{{ filter_parms.clock }}</td> | |
37 | <td><input id="suggest_clock"></input></td> |
|
37 | <td><input id="suggest_clock" name="suggest_clock"></input></td> | |
38 | </tr> |
|
38 | </tr> | |
39 |
|
39 | |||
40 | <tr> |
|
40 | <tr> | |
41 | <th>Frequency A (Mhz)</th> |
|
41 | <th>Frequency A (Mhz)</th> | |
42 | <td>{{ dds.frequencyA_Mhz }}</td> |
|
42 | <td id="dds_frequencyA">{{ dds.frequencyA_Mhz }}</td> | |
43 | <td>x</td> |
|
43 | <td>x</td> | |
44 | <td>{{ filter_parms.fch }}</td> |
|
44 | <td id="filter_frequencyA">{{ filter_parms.fch }}</td> | |
45 | <td><input></input></td> |
|
45 | <td><input id="suggest_frequencyA" name="suggest_frequencyA"></input></td> | |
46 | </tr> |
|
46 | </tr> | |
47 |
|
47 | |||
48 | <tr> |
|
48 | <!--<tr> | |
49 | <th>Frequency A (Decimal)</th> |
|
49 | <th>Frequency A (Decimal)</th> | |
50 | <td>{{ dds.frequencyA }}</td> |
|
50 | <td>{{ dds.frequencyA }}</td> | |
51 | <td>x</td> |
|
51 | <td>x</td> | |
52 | <td>{{ filter_parms.fch_decimal }}</td> |
|
52 | <td>{{ filter_parms.fch_decimal }}</td> | |
53 | <td><input></input></td> |
|
53 | <td><input id="suggest_frequencyAdec"></input></td> | |
54 | </tr> |
|
54 | </tr>--> | |
55 |
|
55 | |||
56 | <tr> |
|
56 | <!--<tr> | |
57 | <th>Sampling Frequency (MHz)</th> |
|
57 | <th>Sampling Frequency (MHz)</th> | |
58 | <td id="dds_sampfreq">{{ dds.frequencyA }}</td> |
|
58 | <td id="dds_sampfreq">{{ dds.frequencyA }}</td> | |
59 | <td id="rc_sampfreq">{{ samp_freq_rc }}</td> |
|
59 | <td id="rc_sampfreq">{{ samp_freq_rc }}</td> | |
60 | <td id="jars_sampfreq">{{ samp_freq_jars }}</td> |
|
60 | <td id="jars_sampfreq">{{ samp_freq_jars }}</td> | |
61 | <td><input id="suggest_sampfreq"></input></td> |
|
61 | <td><input id="suggest_sampfreq" name="suggest_sampfreq"></input></td> | |
62 | </tr> |
|
62 | </tr>--> | |
63 | </table> |
|
63 | </table> | |
64 |
|
64 | |||
65 |
|
65 | |||
66 |
|
66 | <!-- | ||
67 | <div class=""> |
|
67 | <div class=""> | |
68 | <h4 class="panel-title"><b> Extra Parameters </b></h4> |
|
68 | <h4 class="panel-title"><b> Extra Parameters </b></h4> | |
69 | <br> |
|
69 | <br> | |
@@ -76,13 +76,15 | |||||
76 | {% endif %} |
|
76 | {% endif %} | |
77 | {% endfor %} |
|
77 | {% endfor %} | |
78 | </table> |
|
78 | </table> | |
79 |
|
79 | --> | ||
80 |
|
80 | |||
81 | <div class="pull-right"> |
|
81 | <div class="pull-right"> | |
82 | <button type="button" class="btn btn-primary" id="bt_back">Back</button> |
|
|||
83 | <button type="button" class="btn btn-primary" id="bt_update">{{ button }}</button> |
|
|||
84 | </div> |
|
|||
85 |
|
82 | |||
|
83 | <button type="button" class="btn btn-primary" id="bt_back">Back</button> | |||
|
84 | <button type="submit" class="btn btn-primary" id="bt_update">{{ button }}</button> | |||
|
85 | ||||
|
86 | </div> | |||
|
87 | </form> | |||
86 | {% endblock %} |
|
88 | {% endblock %} | |
87 |
|
89 | |||
88 | {% block sidebar%} |
|
90 | {% block sidebar%} | |
@@ -90,56 +92,70 | |||||
90 | {% endblock %} |
|
92 | {% endblock %} | |
91 |
|
93 | |||
92 | {% block extra-js%} |
|
94 | {% block extra-js%} | |
|
95 | <script src="{% static 'js/dds_conversion.js' %}"></script> | |||
93 | <script type="text/javascript"> |
|
96 | <script type="text/javascript"> | |
94 |
|
97 | |||
95 | {% if dds_conf %} |
|
98 | {% if dds_conf %} | |
96 | $(document).ready(function() { |
|
99 | $(document).ready(function() { | |
|
100 | $("#suggest_frequencyA").on('change', function() { | |||
|
101 | updateBinaryFrequencies(); | |||
|
102 | }); | |||
|
103 | ||||
97 | $('#dds_clock').click(function(event) { |
|
104 | $('#dds_clock').click(function(event) { | |
98 | clock = $("#dds_clock").text(); |
|
105 | clock = $("#dds_clock").text(); | |
99 | $("#suggest_clock").val(clock); |
|
106 | $("#suggest_clock").val(clock); | |
100 | }); |
|
107 | }); | |
101 |
$('#dds_ |
|
108 | $('#dds_frequencyA').click(function(event) { | |
102 |
sampfreq = $("#dds_ |
|
109 | sampfreq = $("#dds_frequencyA").text(); | |
103 |
$("#suggest_ |
|
110 | $("#suggest_frequencyA").val(sampfreq); | |
104 | }); |
|
111 | }); | |
105 | }); |
|
112 | }); | |
106 | {% endif %} |
|
113 | {% endif %} | |
|
114 | ||||
107 | {% if rc_conf %} |
|
115 | {% if rc_conf %} | |
108 | $(document).ready(function() { |
|
116 | $(document).ready(function() { | |
109 | $('#rc_clock').click(function(event) { |
|
117 | $('#rc_clock').click(function(event) { | |
110 | clock = $("#rc_clock").text(); |
|
118 | clock = $("#rc_clock").text(); | |
111 | $("#suggest_clock").val(clock); |
|
119 | $("#suggest_clock").val(clock); | |
112 | }); |
|
120 | }); | |
113 | $('#rc_sampfreq').click(function(event) { |
|
121 | //$('#rc_sampfreq').click(function(event) { | |
114 |
|
|
122 | // sampfreq = $("#rc_sampfreq").text(); | |
115 |
|
|
123 | // $("#suggest_sampfreq").val(sampfreq); | |
116 | }); |
|
124 | //}); | |
117 |
|
|
125 | }); | |
118 | {% endif %} |
|
126 | {% endif %} | |
119 |
{% if jars_conf %} |
|
127 | {% if jars_conf %} | |
120 | $(document).ready(function() { |
|
128 | $(document).ready(function() { | |
121 | $('#filter_clock').click(function(event) { |
|
129 | $('#filter_clock').click(function(event) { | |
122 | clock = $("#filter_clock").text(); |
|
130 | clock = $("#filter_clock").text(); | |
123 | $("#suggest_clock").val(clock); |
|
131 | $("#suggest_clock").val(clock); | |
124 | }); |
|
132 | }); | |
125 |
$('# |
|
133 | $('#filter_frequencyA').click(function(event) { | |
126 |
sampfreq = $("# |
|
134 | sampfreq = $("#filter_frequencyA").text(); | |
127 |
$("#suggest_ |
|
135 | $("#suggest_frequencyA").val(sampfreq); | |
|
136 | updateBinaryFrequencies() | |||
128 | }); |
|
137 | }); | |
129 |
|
|
138 | }); | |
130 | {% endif %} |
|
139 | {% endif %} | |
131 |
|
140 | |||
|
141 | function updateBinaryFrequencies() { | |||
|
142 | var clock = {{dds.clock}}; | |||
|
143 | var multiplier = {{dds.multiplier}}; | |||
|
144 | var freq = $("#suggest_frequencyA").val(); | |||
|
145 | var mclock = clock*multiplier; | |||
|
146 | var freq_bin = freq2Binary(mclock, freq); | |||
|
147 | freq = binary2Freq(mclock, freq_bin); | |||
|
148 | $("#suggest_frequencyA").val(freq); | |||
|
149 | } | |||
132 |
|
150 | |||
133 |
|
||||
134 |
|
||||
135 | $(".clickable-row").click(function() { |
|
151 | $(".clickable-row").click(function() { | |
136 | document.location = $(this).data("href"); |
|
152 | document.location = $(this).data("href"); | |
137 | }); |
|
153 | }); | |
138 |
|
154 | |||
139 | $("#bt_back").click(function() { |
|
155 | $("#bt_back").click(function() { | |
140 | document.location = "{% url 'url_experiment' experiment.id%}"; |
|
156 | document.location = "{% url 'url_experiment' experiment.id%}"; | |
141 | }); |
|
157 | }); | |
142 |
|
158 | |||
143 |
|
159 | |||
144 | </script> |
|
160 | </script> | |
145 | {% endblock %} No newline at end of file |
|
161 | {% endblock %} |
@@ -1009,6 +1009,7 def experiment_verify(request, id_exp): | |||||
1009 | #-------------------- JARS -----------------------: |
|
1009 | #-------------------- JARS -----------------------: | |
1010 | if configuration.device.device_type.name == 'jars': |
|
1010 | if configuration.device.device_type.name == 'jars': | |
1011 | jars_conf = True |
|
1011 | jars_conf = True | |
|
1012 | jars = configuration | |||
1012 | kwargs['jars_conf'] = jars_conf |
|
1013 | kwargs['jars_conf'] = jars_conf | |
1013 | filter_parms = configuration.filter_parms |
|
1014 | filter_parms = configuration.filter_parms | |
1014 | filter_parms = ast.literal_eval(filter_parms) |
|
1015 | filter_parms = ast.literal_eval(filter_parms) | |
@@ -1026,6 +1027,7 def experiment_verify(request, id_exp): | |||||
1026 | #--------------------- RC ----------------------: |
|
1027 | #--------------------- RC ----------------------: | |
1027 | if configuration.device.device_type.name == 'rc': |
|
1028 | if configuration.device.device_type.name == 'rc': | |
1028 | rc_conf = True |
|
1029 | rc_conf = True | |
|
1030 | rc = configuration | |||
1029 | rc_parms = configuration.parms_to_dict() |
|
1031 | rc_parms = configuration.parms_to_dict() | |
1030 | if rc_parms['mix'] == 'True': |
|
1032 | if rc_parms['mix'] == 'True': | |
1031 | pass |
|
1033 | pass | |
@@ -1042,6 +1044,7 def experiment_verify(request, id_exp): | |||||
1042 | #-------------------- DDS ----------------------: |
|
1044 | #-------------------- DDS ----------------------: | |
1043 | if configuration.device.device_type.name == 'dds': |
|
1045 | if configuration.device.device_type.name == 'dds': | |
1044 | dds_conf = True |
|
1046 | dds_conf = True | |
|
1047 | dds = configuration | |||
1045 | dds_parms = configuration.parms_to_dict() |
|
1048 | dds_parms = configuration.parms_to_dict() | |
1046 |
|
1049 | |||
1047 | kwargs['dds_conf'] = dds_conf |
|
1050 | kwargs['dds_conf'] = dds_conf | |
@@ -1051,18 +1054,62 def experiment_verify(request, id_exp): | |||||
1051 | #------------Validation------------: |
|
1054 | #------------Validation------------: | |
1052 | #Clock |
|
1055 | #Clock | |
1053 | if dds_conf and rc_conf and jars_conf: |
|
1056 | if dds_conf and rc_conf and jars_conf: | |
1054 | if filter_parms['clock'] != rc_parms['clock_in'] and rc_parms['clock_in'] != dds_parms['clock']: |
|
1057 | if float(filter_parms['clock']) != float(rc_parms['clock_in']) and float(rc_parms['clock_in']) != float(dds_parms['clock']): | |
1055 | messages.warning(request, "Devices don't have the same clock.") |
|
1058 | messages.warning(request, "Devices don't have the same clock.") | |
1056 | elif rc_conf and jars_conf: |
|
1059 | elif rc_conf and jars_conf: | |
1057 | if filter_parms['clock'] != rc_parms['clock_in']: |
|
1060 | if float(filter_parms['clock']) != float(rc_parms['clock_in']): | |
1058 | messages.warning(request, "Devices don't have the same clock.") |
|
1061 | messages.warning(request, "Devices don't have the same clock.") | |
1059 | elif rc_conf and dds_conf: |
|
1062 | elif rc_conf and dds_conf: | |
1060 | if rc_parms['clock_in'] != dds_parms['clock']: |
|
1063 | if float(rc_parms['clock_in']) != float(dds_parms['clock']): | |
1061 | messages.warning(request, "Devices don't have the same clock.") |
|
1064 | messages.warning(request, "Devices don't have the same clock.") | |
1062 | if float(samp_freq_rc) != float(dds_parms['frequencyA']): |
|
1065 | if float(samp_freq_rc) != float(dds_parms['frequencyA']): | |
1063 | messages.warning(request, "Devices don't have the same Frequency A.") |
|
1066 | messages.warning(request, "Devices don't have the same Frequency A.") | |
1064 |
|
1067 | |||
1065 |
|
1068 | |||
|
1069 | #------------POST METHOD------------: | |||
|
1070 | if request.method == 'POST': | |||
|
1071 | if request.POST['suggest_clock']: | |||
|
1072 | try: | |||
|
1073 | suggest_clock = float(request.POST['suggest_clock']) | |||
|
1074 | except: | |||
|
1075 | messages.warning(request, "Invalid value in CLOCK IN.") | |||
|
1076 | return redirect('url_verify_experiment', id_exp=experiment.id) | |||
|
1077 | else: | |||
|
1078 | suggest_clock = "" | |||
|
1079 | if suggest_clock: | |||
|
1080 | if rc_conf: | |||
|
1081 | rc.clock_in = suggest_clock | |||
|
1082 | rc.save() | |||
|
1083 | if jars_conf: | |||
|
1084 | filter_parms = jars.filter_parms | |||
|
1085 | filter_parms = ast.literal_eval(filter_parms) | |||
|
1086 | filter_parms['clock'] = suggest_clock | |||
|
1087 | jars.filter_parms = json.dumps(filter_parms) | |||
|
1088 | jars.save() | |||
|
1089 | kwargs['filter_parms'] = filter_parms | |||
|
1090 | if dds_conf: | |||
|
1091 | dds.clock = suggest_clock | |||
|
1092 | dds.save() | |||
|
1093 | ||||
|
1094 | if request.POST['suggest_frequencyA']: | |||
|
1095 | try: | |||
|
1096 | suggest_frequencyA = float(request.POST['suggest_frequencyA']) | |||
|
1097 | except: | |||
|
1098 | messages.warning(request, "Invalid value in FREQUENCY A.") | |||
|
1099 | return redirect('url_verify_experiment', id_exp=experiment.id) | |||
|
1100 | else: | |||
|
1101 | suggest_frequencyA = "" | |||
|
1102 | if suggest_frequencyA: | |||
|
1103 | if jars_conf: | |||
|
1104 | filter_parms = jars.filter_parms | |||
|
1105 | filter_parms = ast.literal_eval(filter_parms) | |||
|
1106 | filter_parms['fch'] = suggest_frequencyA | |||
|
1107 | jars.filter_parms = json.dumps(filter_parms) | |||
|
1108 | jars.save() | |||
|
1109 | kwargs['filter_parms'] = filter_parms | |||
|
1110 | if dds_conf: | |||
|
1111 | dds.frequencyA_Mhz = request.POST['suggest_frequencyA'] | |||
|
1112 | dds.save() | |||
1066 |
|
1113 | |||
1067 | ###### SIDEBAR ###### |
|
1114 | ###### SIDEBAR ###### | |
1068 | kwargs.update(sidebar(experiment=experiment)) |
|
1115 | kwargs.update(sidebar(experiment=experiment)) |
General Comments 0
You need to be logged in to leave comments.
Login now