@@ -1,342 +1,342 | |||||
1 | {% extends "dev_conf.html" %} {% load static %} {% load bootstrap3 %} {% load main_tags %} |
|
1 | {% extends "dev_conf.html" %} {% load static %} {% load bootstrap3 %} {% load main_tags %} | |
2 | {% block extra-head %} |
|
2 | {% block extra-head %} | |
3 | <style> |
|
3 | <style> | |
4 | .abs { |
|
4 | .abs { | |
5 | width: auto; |
|
5 | width: auto; | |
6 | display: inline-block; |
|
6 | display: inline-block; | |
7 | text-align: center; |
|
7 | text-align: center; | |
8 | } |
|
8 | } | |
9 |
|
9 | |||
10 | .abs td { |
|
10 | .abs td { | |
11 | padding: 4px; |
|
11 | padding: 4px; | |
12 | } |
|
12 | } | |
13 |
|
13 | |||
14 | .module td { |
|
14 | .module td { | |
15 | padding: 4px 15px 4px 15px; |
|
15 | padding: 4px 15px 4px 15px; | |
16 | font-weight: bold; |
|
16 | font-weight: bold; | |
17 | border: 1px solid |
|
17 | border: 1px solid | |
18 | } |
|
18 | } | |
19 |
|
19 | |||
20 | .legend { |
|
20 | .legend { | |
21 | margin-left: 15px; |
|
21 | margin-left: 15px; | |
22 | display: inline-block; |
|
22 | display: inline-block; | |
23 | border: 2px solid; |
|
23 | border: 2px solid; | |
24 | vertical-align: top; |
|
24 | vertical-align: top; | |
25 | } |
|
25 | } | |
26 |
|
26 | |||
27 | .legend th { |
|
27 | .legend th { | |
28 | border-bottom: 1px dashed; |
|
28 | border-bottom: 1px dashed; | |
29 | font-weight: bold; |
|
29 | font-weight: bold; | |
30 | vertical-align: center; |
|
30 | vertical-align: center; | |
31 | text-align: center; |
|
31 | text-align: center; | |
32 | } |
|
32 | } | |
33 |
|
33 | |||
34 | .legend td { |
|
34 | .legend td { | |
35 | padding: 2px; |
|
35 | padding: 2px; | |
36 | text-align: center; |
|
36 | text-align: center; | |
37 | } |
|
37 | } | |
38 |
|
38 | |||
39 | </style> |
|
39 | </style> | |
40 | {% endblock %} |
|
40 | {% endblock %} | |
41 | {% block extra-menu-actions %} |
|
41 | {% block extra-menu-actions %} | |
42 | <li> |
|
42 | <li> | |
43 | <a href="{{ dev_conf.get_absolute_url_plot }}" target="_blank"> |
|
43 | <a href="{{ dev_conf.get_absolute_url_plot }}" target="_blank"> | |
44 | <span class="glyphicon glyphicon-picture" aria-hidden="true"></span> View Patterns </a> |
|
44 | <span class="glyphicon glyphicon-picture" aria-hidden="true"></span> View Patterns </a> | |
45 | </li> |
|
45 | </li> | |
46 | {% endblock %} |
|
46 | {% endblock %} | |
47 | {% block extra-content %} |
|
47 | {% block extra-content %} | |
48 | {% if beams %} |
|
48 | {% if beams %} | |
49 | <h4>Beams:</h4> |
|
49 | <h4>Beams:</h4> | |
50 | <div class="container"> |
|
50 | <div class="container"> | |
51 | <ul class="nav nav-pills"> |
|
51 | <ul class="nav nav-pills"> | |
52 | {% for beam in beams %} |
|
52 | {% for beam in beams %} | |
53 | <li {%if beam.pk == active_beam %} class="active" {% endif %}> |
|
53 | <li {%if beam.pk == active_beam %} class="active" {% endif %}> | |
54 | <a data-toggle="pill" href="#menu{{forloop.counter}}">{{forloop.counter}}</a> |
|
54 | <a data-toggle="pill" href="#menu{{forloop.counter}}">{{forloop.counter}}</a> | |
55 | </li> |
|
55 | </li> | |
56 | {% endfor %} |
|
56 | {% endfor %} | |
57 | </ul> |
|
57 | </ul> | |
58 |
|
58 | |||
59 | <div class="tab-content"> |
|
59 | <div class="tab-content"> | |
60 | {% for beam in beams %} |
|
60 | {% for beam in beams %} | |
61 | <div id="menu{{forloop.counter}}" class="tab-pane fade {%if beam.pk == active_beam %}active in{% endif %}"> |
|
61 | <div id="menu{{forloop.counter}}" class="tab-pane fade {%if beam.pk == active_beam %}active in{% endif %}"> | |
62 | <h3>{%if beam.pk == active_beam %}Active Beam: {%endif%}{{beam.name}}</h3> |
|
62 | <h3>{%if beam.pk == active_beam %}Active Beam: {%endif%}{{beam.name}}</h3> | |
63 | <table id="abs_pattern{{forloop.counter}}" class="abs"> |
|
63 | <table id="abs_pattern{{forloop.counter}}" class="abs"> | |
64 | <tr> |
|
64 | <tr> | |
65 | <td> |
|
65 | <td> | |
66 | <b>North Quarter</b> |
|
66 | <b>North Quarter</b> | |
67 | <table class="module"> |
|
67 | <table class="module"> | |
68 | <tr> |
|
68 | <tr> | |
69 |
<td {%if beam.pk == active_beam %} {{color_status.1}} |
|
69 | <td title='{{module_messages.1}}'><span {%if beam.pk == active_beam %} {{color_status.1}} {%endif%}>{{beam.get_upvalues.0}}</span></td> | |
70 |
<td {%if beam.pk == active_beam %} {{color_status.2}} |
|
70 | <td title='{{module_messages.2}}'><span {%if beam.pk == active_beam %} {{color_status.2}} {%endif%}>{{beam.get_upvalues.1}}</span></td> | |
71 |
<td {%if beam.pk == active_beam %} {{color_status.3}} |
|
71 | <td title='{{module_messages.3}}'><span {%if beam.pk == active_beam %} {{color_status.3}} {%endif%}>{{beam.get_upvalues.2}}</span></td> | |
72 |
<td {%if beam.pk == active_beam %} {{color_status.4}} |
|
72 | <td title='{{module_messages.4}}'><span {%if beam.pk == active_beam %} {{color_status.4}} {%endif%}>{{beam.get_upvalues.3}}</span></td> | |
73 | </tr> |
|
73 | </tr> | |
74 | <tr> |
|
74 | <tr> | |
75 |
<td {%if beam.pk == active_beam %} {{color_status.1}} |
|
75 | <td title='{{module_messages.1}}'><span {%if beam.pk == active_beam %} {{color_status.1}} {%endif%}>{{beam.get_downvalues.0}}</span></td> | |
76 |
<td {%if beam.pk == active_beam %} {{color_status.2}} |
|
76 | <td title='{{module_messages.2}}'><span {%if beam.pk == active_beam %} {{color_status.2}} {%endif%}>{{beam.get_downvalues.1}}</span></td> | |
77 |
<td {%if beam.pk == active_beam %} {{color_status.3}} |
|
77 | <td title='{{module_messages.3}}'> <span {%if beam.pk == active_beam %} {{color_status.3}} {%endif%}>{{beam.get_downvalues.2}}</span></td> | |
78 |
<td {%if beam.pk == active_beam %} {{color_status.4}} |
|
78 | <td title='{{module_messages.4}}'> <span {%if beam.pk == active_beam %} {{color_status.4}} {%endif%}>{{beam.get_downvalues.3}}</span></td> | |
79 | </tr> |
|
79 | </tr> | |
80 | <tr> |
|
80 | <tr> | |
81 |
<td {%if beam.pk == active_beam %} {{color_status.9}} |
|
81 | <td title='{{module_messages.9}}'> <span {%if beam.pk == active_beam %} {{color_status.9}} {%endif%}>{{beam.get_upvalues.8}}</span></td> | |
82 |
<td {%if beam.pk == active_beam %} {{color_status.10}} {%endif%} |
|
82 | <td title='{{module_messages.10}}'><span {%if beam.pk == active_beam %} {{color_status.10}} {%endif%}>{{beam.get_upvalues.9}}</span></td> | |
83 |
<td {%if beam.pk == active_beam %} {{color_status.11}} {%endif%} |
|
83 | <td title='{{module_messages.11}}'><span {%if beam.pk == active_beam %} {{color_status.11}} {%endif%}>{{beam.get_upvalues.10}}</span></td> | |
84 |
<td {%if beam.pk == active_beam %} {{color_status.12}} {%endif%} |
|
84 | <td title='{{module_messages.12}}'><span {%if beam.pk == active_beam %} {{color_status.12}} {%endif%}>{{beam.get_upvalues.11}}</span></td> | |
85 | </tr> |
|
85 | </tr> | |
86 | <tr> |
|
86 | <tr> | |
87 |
<td {%if beam.pk == active_beam %} {{color_status.9}} |
|
87 | <td title='{{module_messages.9}}'> <span {%if beam.pk == active_beam %} {{color_status.9}} {%endif%}>{{beam.get_downvalues.8}}</span></td> | |
88 |
<td {%if beam.pk == active_beam %} {{color_status.10}} {%endif%} |
|
88 | <td title='{{module_messages.10}}'><span {%if beam.pk == active_beam %} {{color_status.10}} {%endif%}>{{beam.get_downvalues.9}}</span></td> | |
89 |
<td {%if beam.pk == active_beam %} {{color_status.11}} {%endif%} |
|
89 | <td title='{{module_messages.11}}'><span {%if beam.pk == active_beam %} {{color_status.11}} {%endif%}>{{beam.get_downvalues.10}}</span></td> | |
90 |
<td {%if beam.pk == active_beam %} {{color_status.12}} {%endif%} |
|
90 | <td title='{{module_messages.12}}'><span {%if beam.pk == active_beam %} {{color_status.12}} {%endif%}>{{beam.get_downvalues.11}}</span></td> | |
91 | </tr> |
|
91 | </tr> | |
92 | <tr> |
|
92 | <tr> | |
93 |
<td {%if beam.pk == active_beam %} {{color_status.17}} {%endif%} |
|
93 | <td title='{{module_messages.17}}'><span {%if beam.pk == active_beam %} {{color_status.17}} {%endif%}>{{beam.get_upvalues.16}}</span></td> | |
94 |
<td {%if beam.pk == active_beam %} {{color_status.18}} {%endif%} |
|
94 | <td title='{{module_messages.18}}'><span {%if beam.pk == active_beam %} {{color_status.18}} {%endif%}>{{beam.get_upvalues.17}}</span></td> | |
95 |
<td {%if beam.pk == active_beam %} {{color_status.19}} {%endif%} |
|
95 | <td title='{{module_messages.19}}'><span {%if beam.pk == active_beam %} {{color_status.19}} {%endif%}>{{beam.get_upvalues.18}}</span></td> | |
96 |
<td {%if beam.pk == active_beam %} {{color_status.20}} {%endif%} |
|
96 | <td title='{{module_messages.20}}'><span {%if beam.pk == active_beam %} {{color_status.20}} {%endif%}>{{beam.get_upvalues.19}}</span></td> | |
97 | </tr> |
|
97 | </tr> | |
98 | <tr> |
|
98 | <tr> | |
99 |
<td {%if beam.pk == active_beam %} {{color_status.17}} {%endif%} |
|
99 | <td title='{{module_messages.17}}'><span {%if beam.pk == active_beam %} {{color_status.17}} {%endif%}>{{beam.get_downvalues.16}}</span></td> | |
100 |
<td {%if beam.pk == active_beam %} {{color_status.18}} {%endif%} |
|
100 | <td title='{{module_messages.18}}'><span {%if beam.pk == active_beam %} {{color_status.18}} {%endif%}>{{beam.get_downvalues.17}}</span></td> | |
101 |
<td {%if beam.pk == active_beam %} {{color_status.19}} {%endif%} |
|
101 | <td title='{{module_messages.19}}'><span {%if beam.pk == active_beam %} {{color_status.19}} {%endif%}>{{beam.get_downvalues.18}}</span></td> | |
102 |
<td {%if beam.pk == active_beam %} {{color_status.20}} {%endif%} |
|
102 | <td title='{{module_messages.20}}'><span {%if beam.pk == active_beam %} {{color_status.20}} {%endif%}>{{beam.get_downvalues.19}}</span></td> | |
103 | </tr> |
|
103 | </tr> | |
104 | <tr> |
|
104 | <tr> | |
105 |
<td {%if beam.pk == active_beam %} {{color_status.25}} {%endif%} |
|
105 | <td title='{{module_messages.25}}'><span {%if beam.pk == active_beam %} {{color_status.25}} {%endif%}>{{beam.get_upvalues.24}}</span></td> | |
106 |
<td {%if beam.pk == active_beam %} {{color_status.26}} {%endif%} |
|
106 | <td title='{{module_messages.26}}'><span {%if beam.pk == active_beam %} {{color_status.26}} {%endif%}>{{beam.get_upvalues.25}}</span></td> | |
107 |
<td {%if beam.pk == active_beam %} {{color_status.27}} {%endif%} |
|
107 | <td title='{{module_messages.27}}'><span {%if beam.pk == active_beam %} {{color_status.27}} {%endif%}>{{beam.get_upvalues.26}}</span></td> | |
108 |
<td {%if beam.pk == active_beam %} {{color_status.28}} {%endif%} |
|
108 | <td title='{{module_messages.28}}'><span {%if beam.pk == active_beam %} {{color_status.28}} {%endif%}>{{beam.get_upvalues.27}}</span></td> | |
109 | </tr> |
|
109 | </tr> | |
110 | <tr> |
|
110 | <tr> | |
111 |
<td {%if beam.pk == active_beam %} {{color_status.25}} {%endif%} |
|
111 | <td title='{{module_messages.25}}'><span {%if beam.pk == active_beam %} {{color_status.25}} {%endif%}>{{beam.get_downvalues.24}}</span></td> | |
112 |
<td {%if beam.pk == active_beam %} {{color_status.26}} {%endif%} |
|
112 | <td title='{{module_messages.26}}'><span {%if beam.pk == active_beam %} {{color_status.26}} {%endif%}>{{beam.get_downvalues.25}}</span></td> | |
113 |
<td {%if beam.pk == active_beam %} {{color_status.27}} {%endif%} |
|
113 | <td title='{{module_messages.27}}'><span {%if beam.pk == active_beam %} {{color_status.27}} {%endif%}>{{beam.get_downvalues.26}}</span></td> | |
114 |
<td {%if beam.pk == active_beam %} {{color_status.28}} {%endif%} |
|
114 | <td title='{{module_messages.28}}'><span {%if beam.pk == active_beam %} {{color_status.28}} {%endif%}>{{beam.get_downvalues.27}}</span></td> | |
115 | </tr> |
|
115 | </tr> | |
116 | </table> |
|
116 | </table> | |
117 | </td> |
|
117 | </td> | |
118 | <td> |
|
118 | <td> | |
119 | <b>East Quarter</b> |
|
119 | <b>East Quarter</b> | |
120 | <table class="module"> |
|
120 | <table class="module"> | |
121 | <tr> |
|
121 | <tr> | |
122 |
<td {%if beam.pk == active_beam %} {{color_status.5}} |
|
122 | <td title='{{module_messages.5}}'> <span {%if beam.pk == active_beam %} {{color_status.5}} {%endif%}>{{beam.get_upvalues.4}}</span></td> | |
123 |
<td {%if beam.pk == active_beam %} {{color_status.6}} |
|
123 | <td title='{{module_messages.6}}'> <span {%if beam.pk == active_beam %} {{color_status.6}} {%endif%}>{{beam.get_upvalues.5}}</span></td> | |
124 |
<td {%if beam.pk == active_beam %} {{color_status.7}} |
|
124 | <td title='{{module_messages.7}}'> <span {%if beam.pk == active_beam %} {{color_status.7}} {%endif%}>{{beam.get_upvalues.6}}</span></td> | |
125 |
<td {%if beam.pk == active_beam %} {{color_status.8}} |
|
125 | <td title='{{module_messages.8}}'> <span {%if beam.pk == active_beam %} {{color_status.8}} {%endif%}>{{beam.get_upvalues.7}}</span></td> | |
126 | </tr> |
|
126 | </tr> | |
127 | <tr> |
|
127 | <tr> | |
128 |
<td {%if beam.pk == active_beam %} {{color_status.5}} |
|
128 | <td title='{{module_messages.5}}'> <span {%if beam.pk == active_beam %} {{color_status.5}} {%endif%}>{{beam.get_downvalues.4}}</span></td> | |
129 |
<td {%if beam.pk == active_beam %} {{color_status.6}} |
|
129 | <td title='{{module_messages.6}}'> <span {%if beam.pk == active_beam %} {{color_status.6}} {%endif%}>{{beam.get_downvalues.5}}</span></td> | |
130 |
<td {%if beam.pk == active_beam %} {{color_status.7}} |
|
130 | <td title='{{module_messages.7}}'> <span {%if beam.pk == active_beam %} {{color_status.7}} {%endif%}>{{beam.get_downvalues.6}}</span></td> | |
131 |
<td {%if beam.pk == active_beam %} {{color_status.8}} |
|
131 | <td title='{{module_messages.8}}'> <span {%if beam.pk == active_beam %} {{color_status.8}} {%endif%}>{{beam.get_downvalues.7}}</span></td> | |
132 | </tr> |
|
132 | </tr> | |
133 | <tr> |
|
133 | <tr> | |
134 |
<td {%if beam.pk == active_beam %} {{color_status.13}} {%endif%} |
|
134 | <td title='{{module_messages.13}}'><span {%if beam.pk == active_beam %} {{color_status.13}} {%endif%}>{{beam.get_upvalues.12}}</span></td> | |
135 |
<td {%if beam.pk == active_beam %} {{color_status.14}} {%endif%} |
|
135 | <td title='{{module_messages.14}}'><span {%if beam.pk == active_beam %} {{color_status.14}} {%endif%}>{{beam.get_upvalues.13}}</span></td> | |
136 |
<td {%if beam.pk == active_beam %} {{color_status.15}} {%endif%} |
|
136 | <td title='{{module_messages.15}}'><span {%if beam.pk == active_beam %} {{color_status.15}} {%endif%}>{{beam.get_upvalues.14}}</span></td> | |
137 |
<td {%if beam.pk == active_beam %} {{color_status.16}} {%endif%} |
|
137 | <td title='{{module_messages.16}}'><span {%if beam.pk == active_beam %} {{color_status.16}} {%endif%}>{{beam.get_upvalues.15}}</span></td> | |
138 | </tr> |
|
138 | </tr> | |
139 | <tr> |
|
139 | <tr> | |
140 |
<td {%if beam.pk == active_beam %} {{color_status.13}} {%endif%} |
|
140 | <td title='{{module_messages.13}}'><span {%if beam.pk == active_beam %} {{color_status.13}} {%endif%}>{{beam.get_downvalues.12}}</span></td> | |
141 |
<td {%if beam.pk == active_beam %} {{color_status.14}} {%endif%} |
|
141 | <td title='{{module_messages.14}}'><span {%if beam.pk == active_beam %} {{color_status.14}} {%endif%}>{{beam.get_downvalues.13}}</span></td> | |
142 |
<td {%if beam.pk == active_beam %} {{color_status.15}} {%endif%} |
|
142 | <td title='{{module_messages.15}}'><span {%if beam.pk == active_beam %} {{color_status.15}} {%endif%}>{{beam.get_downvalues.14}}</span></td> | |
143 |
<td {%if beam.pk == active_beam %} {{color_status.16}} {%endif%} |
|
143 | <td title='{{module_messages.16}}'><span {%if beam.pk == active_beam %} {{color_status.16}} {%endif%}>{{beam.get_downvalues.15}}</span></td> | |
144 | </tr> |
|
144 | </tr> | |
145 | <tr> |
|
145 | <tr> | |
146 |
<td {%if beam.pk == active_beam %} {{color_status.21}} {%endif%} |
|
146 | <td title='{{module_messages.21}}'><span {%if beam.pk == active_beam %} {{color_status.21}} {%endif%}>{{beam.get_upvalues.20}}</span></td> | |
147 |
<td {%if beam.pk == active_beam %} {{color_status.22}} {%endif%} |
|
147 | <td title='{{module_messages.22}}'><span {%if beam.pk == active_beam %} {{color_status.22}} {%endif%}>{{beam.get_upvalues.21}}</span></td> | |
148 |
<td {%if beam.pk == active_beam %} {{color_status.23}} {%endif%} |
|
148 | <td title='{{module_messages.23}}'><span {%if beam.pk == active_beam %} {{color_status.23}} {%endif%}>{{beam.get_upvalues.22}}</span></td> | |
149 |
<td {%if beam.pk == active_beam %} {{color_status.24}} {%endif%} |
|
149 | <td title='{{module_messages.24}}'><span {%if beam.pk == active_beam %} {{color_status.24}} {%endif%}>{{beam.get_upvalues.23}}</span></td> | |
150 | </tr> |
|
150 | </tr> | |
151 | <tr> |
|
151 | <tr> | |
152 |
<td {%if beam.pk == active_beam %} {{color_status.21}} {%endif%} |
|
152 | <td title='{{module_messages.21}}'><span {%if beam.pk == active_beam %} {{color_status.21}} {%endif%}>{{beam.get_downvalues.20}}</span></td> | |
153 |
<td {%if beam.pk == active_beam %} {{color_status.22}} {%endif%} |
|
153 | <td title='{{module_messages.22}}'><span {%if beam.pk == active_beam %} {{color_status.22}} {%endif%}>{{beam.get_downvalues.21}}</span></td> | |
154 |
<td {%if beam.pk == active_beam %} {{color_status.23}} {%endif%} |
|
154 | <td title='{{module_messages.23}}'><span {%if beam.pk == active_beam %} {{color_status.23}} {%endif%}>{{beam.get_downvalues.22}}</span></td> | |
155 |
<td {%if beam.pk == active_beam %} {{color_status.24}} {%endif%} |
|
155 | <td title='{{module_messages.24}}'><span {%if beam.pk == active_beam %} {{color_status.24}} {%endif%}>{{beam.get_downvalues.23}}</span></td> | |
156 | </tr> |
|
156 | </tr> | |
157 | <tr> |
|
157 | <tr> | |
158 |
<td {%if beam.pk == active_beam %} {{color_status.29}} {%endif%} |
|
158 | <td title='{{module_messages.29}}'><span {%if beam.pk == active_beam %} {{color_status.29}} {%endif%}>{{beam.get_upvalues.28}}</span></td> | |
159 |
<td {%if beam.pk == active_beam %} {{color_status.30}} {%endif%} |
|
159 | <td title='{{module_messages.30}}'><span {%if beam.pk == active_beam %} {{color_status.30}} {%endif%}>{{beam.get_upvalues.29}}</span></td> | |
160 |
<td {%if beam.pk == active_beam %} {{color_status.31}} {%endif%} |
|
160 | <td title='{{module_messages.31}}'><span {%if beam.pk == active_beam %} {{color_status.31}} {%endif%}>{{beam.get_upvalues.30}}</span></td> | |
161 |
<td {%if beam.pk == active_beam %} {{color_status.32}} {%endif%} |
|
161 | <td title='{{module_messages.32}}'><span {%if beam.pk == active_beam %} {{color_status.32}} {%endif%}>{{beam.get_upvalues.31}}</span></td> | |
162 | </tr> |
|
162 | </tr> | |
163 | <tr> |
|
163 | <tr> | |
164 |
<td {%if beam.pk == active_beam %} {{color_status.29}} {%endif%} |
|
164 | <td title='{{module_messages.29}}'><span {%if beam.pk == active_beam %} {{color_status.29}} {%endif%}>{{beam.get_downvalues.28}}</span></td> | |
165 |
<td {%if beam.pk == active_beam %} {{color_status.30}} {%endif%} |
|
165 | <td title='{{module_messages.30}}'><span {%if beam.pk == active_beam %} {{color_status.30}} {%endif%}>{{beam.get_downvalues.29}}</span></td> | |
166 |
<td {%if beam.pk == active_beam %} {{color_status.31}} {%endif%} |
|
166 | <td title='{{module_messages.31}}'><span {%if beam.pk == active_beam %} {{color_status.31}} {%endif%}>{{beam.get_downvalues.30}}</span></td> | |
167 |
<td {%if beam.pk == active_beam %} {{color_status.32}} {%endif%} |
|
167 | <td title='{{module_messages.32}}'><span {%if beam.pk == active_beam %} {{color_status.32}} {%endif%}>{{beam.get_downvalues.31}}</span></td> | |
168 | </tr> |
|
168 | </tr> | |
169 | </table> |
|
169 | </table> | |
170 | </td> |
|
170 | </td> | |
171 | </tr> |
|
171 | </tr> | |
172 | <tr> |
|
172 | <tr> | |
173 | <td> |
|
173 | <td> | |
174 | <b>West Quarter</b> |
|
174 | <b>West Quarter</b> | |
175 | <table class="module"> |
|
175 | <table class="module"> | |
176 | <tr> |
|
176 | <tr> | |
177 |
<td {%if beam.pk == active_beam %} {{color_status.33}} {%endif%} |
|
177 | <td title='{{module_messages.33}}'><span {%if beam.pk == active_beam %} {{color_status.33}} {%endif%}>{{beam.get_upvalues.32}}</span></td> | |
178 |
<td {%if beam.pk == active_beam %} {{color_status.34}} {%endif%} |
|
178 | <td title='{{module_messages.34}}'><span {%if beam.pk == active_beam %} {{color_status.34}} {%endif%}>{{beam.get_upvalues.33}}</span></td> | |
179 |
<td {%if beam.pk == active_beam %} {{color_status.35}} {%endif%} |
|
179 | <td title='{{module_messages.35}}'><span {%if beam.pk == active_beam %} {{color_status.35}} {%endif%}>{{beam.get_upvalues.34}}</span></td> | |
180 |
<td {%if beam.pk == active_beam %} {{color_status.36}} {%endif%} |
|
180 | <td title='{{module_messages.36}}'><span {%if beam.pk == active_beam %} {{color_status.36}} {%endif%}>{{beam.get_upvalues.35}}</span></td> | |
181 | </tr> |
|
181 | </tr> | |
182 | <tr> |
|
182 | <tr> | |
183 |
<td {%if beam.pk == active_beam %} {{color_status.33}} {%endif%} |
|
183 | <td title='{{module_messages.33}}'><span {%if beam.pk == active_beam %} {{color_status.33}} {%endif%}>{{beam.get_downvalues.32}}</span></td> | |
184 |
<td {%if beam.pk == active_beam %} {{color_status.34}} {%endif%} |
|
184 | <td title='{{module_messages.34}}'><span {%if beam.pk == active_beam %} {{color_status.34}} {%endif%}>{{beam.get_downvalues.33}}</span></td> | |
185 |
<td {%if beam.pk == active_beam %} {{color_status.35}} {%endif%} |
|
185 | <td title='{{module_messages.35}}'><span {%if beam.pk == active_beam %} {{color_status.35}} {%endif%}>{{beam.get_downvalues.34}}</span></td> | |
186 |
<td {%if beam.pk == active_beam %} {{color_status.36}} {%endif%} |
|
186 | <td title='{{module_messages.36}}'><span {%if beam.pk == active_beam %} {{color_status.36}} {%endif%}>{{beam.get_downvalues.35}}</span></td> | |
187 | </tr> |
|
187 | </tr> | |
188 | <tr> |
|
188 | <tr> | |
189 |
<td {%if beam.pk == active_beam %} {{color_status.41}} {%endif%} |
|
189 | <td title='{{module_messages.41}}'><span {%if beam.pk == active_beam %} {{color_status.41}} {%endif%}>{{beam.get_upvalues.40}}</span></td> | |
190 |
<td {%if beam.pk == active_beam %} {{color_status.42}} {%endif%} |
|
190 | <td title='{{module_messages.42}}'><span {%if beam.pk == active_beam %} {{color_status.42}} {%endif%}>{{beam.get_upvalues.41}}</span></td> | |
191 |
<td {%if beam.pk == active_beam %} {{color_status.43}} {%endif%} |
|
191 | <td title='{{module_messages.43}}'><span {%if beam.pk == active_beam %} {{color_status.43}} {%endif%}>{{beam.get_upvalues.42}}</span></td> | |
192 |
<td {%if beam.pk == active_beam %} {{color_status.44}} {%endif%} |
|
192 | <td title='{{module_messages.44}}'><span {%if beam.pk == active_beam %} {{color_status.44}} {%endif%}>{{beam.get_upvalues.43}}</span></td> | |
193 | </tr> |
|
193 | </tr> | |
194 | <tr> |
|
194 | <tr> | |
195 |
<td {%if beam.pk == active_beam %} {{color_status.41}} {%endif%} |
|
195 | <td title='{{module_messages.41}}'><span {%if beam.pk == active_beam %} {{color_status.41}} {%endif%}>{{beam.get_downvalues.40}}</span></td> | |
196 |
<td {%if beam.pk == active_beam %} {{color_status.42}} {%endif%} |
|
196 | <td title='{{module_messages.42}}'><span {%if beam.pk == active_beam %} {{color_status.42}} {%endif%}>{{beam.get_downvalues.41}}</span></td> | |
197 |
<td {%if beam.pk == active_beam %} {{color_status.43}} {%endif%} |
|
197 | <td title='{{module_messages.43}}'><span {%if beam.pk == active_beam %} {{color_status.43}} {%endif%}>{{beam.get_downvalues.42}}</span></td> | |
198 |
<td {%if beam.pk == active_beam %} {{color_status.44}} {%endif%} |
|
198 | <td title='{{module_messages.44}}'><span {%if beam.pk == active_beam %} {{color_status.44}} {%endif%}>{{beam.get_downvalues.43}}</span></td> | |
199 | </tr> |
|
199 | </tr> | |
200 | <tr> |
|
200 | <tr> | |
201 |
<td {%if beam.pk == active_beam %} {{color_status.49}} {%endif%} |
|
201 | <td title='{{module_messages.49}}'><span {%if beam.pk == active_beam %} {{color_status.49}} {%endif%}>{{beam.get_upvalues.48}}</span></td> | |
202 |
<td {%if beam.pk == active_beam %} {{color_status.50}} {%endif%} |
|
202 | <td title='{{module_messages.51}}'><span {%if beam.pk == active_beam %} {{color_status.50}} {%endif%}>{{beam.get_upvalues.49}}</span></td> | |
203 |
<td {%if beam.pk == active_beam %} {{color_status.51}} {%endif%} |
|
203 | <td title='{{module_messages.52}}'><span {%if beam.pk == active_beam %} {{color_status.51}} {%endif%}>{{beam.get_upvalues.50}}</span></td> | |
204 |
<td {%if beam.pk == active_beam %} {{color_status.52}} {%endif%} |
|
204 | <td title='{{module_messages.53}}'><span {%if beam.pk == active_beam %} {{color_status.52}} {%endif%}>{{beam.get_upvalues.51}}</span></td> | |
205 | </tr> |
|
205 | </tr> | |
206 | <tr> |
|
206 | <tr> | |
207 |
<td {%if beam.pk == active_beam %} {{color_status.49}} {%endif%} |
|
207 | <td title='{{module_messages.49}}'><span {%if beam.pk == active_beam %} {{color_status.49}} {%endif%}>{{beam.get_downvalues.48}}</span></td> | |
208 |
<td {%if beam.pk == active_beam %} {{color_status.50}} {%endif%} |
|
208 | <td title='{{module_messages.50}}'><span {%if beam.pk == active_beam %} {{color_status.50}} {%endif%}>{{beam.get_downvalues.49}}</span></td> | |
209 |
<td {%if beam.pk == active_beam %} {{color_status.51}} {%endif%} |
|
209 | <td title='{{module_messages.51}}'><span {%if beam.pk == active_beam %} {{color_status.51}} {%endif%}>{{beam.get_downvalues.50}}</span></td> | |
210 |
<td {%if beam.pk == active_beam %} {{color_status.52}} {%endif%} |
|
210 | <td title='{{module_messages.52}}'><span {%if beam.pk == active_beam %} {{color_status.52}} {%endif%}>{{beam.get_downvalues.51}}</span></td> | |
211 | </tr> |
|
211 | </tr> | |
212 | <tr> |
|
212 | <tr> | |
213 |
<td {%if beam.pk == active_beam %} {{color_status.57}} {%endif%} |
|
213 | <td title='{{module_messages.57}}'><span {%if beam.pk == active_beam %} {{color_status.57}} {%endif%}>{{beam.get_upvalues.56}}</span></td> | |
214 |
<td {%if beam.pk == active_beam %} {{color_status.58}} {%endif%} |
|
214 | <td title='{{module_messages.58}}'><span {%if beam.pk == active_beam %} {{color_status.58}} {%endif%}>{{beam.get_upvalues.57}}</span></td> | |
215 |
<td {%if beam.pk == active_beam %} {{color_status.59}} {%endif%} |
|
215 | <td title='{{module_messages.59}}'><span {%if beam.pk == active_beam %} {{color_status.59}} {%endif%}>{{beam.get_upvalues.58}}</span></td> | |
216 |
<td {%if beam.pk == active_beam %} {{color_status.60}} {%endif%} |
|
216 | <td title='{{module_messages.60}}'><span {%if beam.pk == active_beam %} {{color_status.60}} {%endif%}>{{beam.get_upvalues.59}}</span></td> | |
217 | </tr> |
|
217 | </tr> | |
218 | <tr> |
|
218 | <tr> | |
219 |
<td {%if beam.pk == active_beam %} {{color_status.57}} {%endif%} |
|
219 | <td title='{{module_messages.57}}'><span {%if beam.pk == active_beam %} {{color_status.57}} {%endif%}>{{beam.get_downvalues.56}}</span></td> | |
220 |
<td {%if beam.pk == active_beam %} {{color_status.58}} {%endif%} |
|
220 | <td title='{{module_messages.58}}'><span {%if beam.pk == active_beam %} {{color_status.58}} {%endif%}>{{beam.get_downvalues.57}}</span></td> | |
221 |
<td {%if beam.pk == active_beam %} {{color_status.59}} {%endif%} |
|
221 | <td title='{{module_messages.59}}'><span {%if beam.pk == active_beam %} {{color_status.59}} {%endif%}>{{beam.get_downvalues.58}}</span></td> | |
222 |
<td {%if beam.pk == active_beam %} {{color_status.60}} {%endif%} |
|
222 | <td title='{{module_messages.60}}'><span {%if beam.pk == active_beam %} {{color_status.60}} {%endif%}>{{beam.get_downvalues.59}}</span></td> | |
223 | </tr> |
|
223 | </tr> | |
224 | </table> |
|
224 | </table> | |
225 | </td> |
|
225 | </td> | |
226 | <td> |
|
226 | <td> | |
227 | <b>South Quarter</b> |
|
227 | <b>South Quarter</b> | |
228 | <table class="module"> |
|
228 | <table class="module"> | |
229 | <tr> |
|
229 | <tr> | |
230 |
<td {%if beam.pk == active_beam %} {{color_status.37}} {%endif%} |
|
230 | <td title='{{module_messages.37}}'><span {%if beam.pk == active_beam %} {{color_status.37}} {%endif%}>{{beam.get_upvalues.36}}</span></td> | |
231 |
<td {%if beam.pk == active_beam %} {{color_status.38}} {%endif%} |
|
231 | <td title='{{module_messages.38}}'><span {%if beam.pk == active_beam %} {{color_status.38}} {%endif%}>{{beam.get_upvalues.37}}</span></td> | |
232 |
<td {%if beam.pk == active_beam %} {{color_status.39}} {%endif%} |
|
232 | <td title='{{module_messages.39}}'><span {%if beam.pk == active_beam %} {{color_status.39}} {%endif%}>{{beam.get_upvalues.38}}</span></td> | |
233 |
<td {%if beam.pk == active_beam %} {{color_status.40}} {%endif%} |
|
233 | <td title='{{module_messages.40}}'><span {%if beam.pk == active_beam %} {{color_status.40}} {%endif%}>{{beam.get_upvalues.39}}</span></td> | |
234 | </tr> |
|
234 | </tr> | |
235 | <tr> |
|
235 | <tr> | |
236 |
<td {%if beam.pk == active_beam %} {{color_status.37}} {%endif%} |
|
236 | <td title='{{module_messages.37}}'><span {%if beam.pk == active_beam %} {{color_status.37}} {%endif%}>{{beam.get_downvalues.36}}</span></td> | |
237 |
<td {%if beam.pk == active_beam %} {{color_status.38}} {%endif%} |
|
237 | <td title='{{module_messages.38}}'><span {%if beam.pk == active_beam %} {{color_status.38}} {%endif%}>{{beam.get_downvalues.37}}</span></td> | |
238 |
<td {%if beam.pk == active_beam %} {{color_status.39}} {%endif%} |
|
238 | <td title='{{module_messages.39}}'><span {%if beam.pk == active_beam %} {{color_status.39}} {%endif%}>{{beam.get_downvalues.38}}</span></td> | |
239 |
<td {%if beam.pk == active_beam %} {{color_status.40}} {%endif%} |
|
239 | <td title='{{module_messages.40}}'><span {%if beam.pk == active_beam %} {{color_status.40}} {%endif%}>{{beam.get_downvalues.39}}</span></td> | |
240 | </tr> |
|
240 | </tr> | |
241 | <tr> |
|
241 | <tr> | |
242 |
<td {%if beam.pk == active_beam %} {{color_status.45}} {%endif%} |
|
242 | <td title='{{module_messages.45}}'><span {%if beam.pk == active_beam %} {{color_status.45}} {%endif%}>{{beam.get_upvalues.44}}</span></td> | |
243 |
<td {%if beam.pk == active_beam %} {{color_status.46}} {%endif%} |
|
243 | <td title='{{module_messages.46}}'><span {%if beam.pk == active_beam %} {{color_status.46}} {%endif%}>{{beam.get_upvalues.45}}</span></td> | |
244 |
<td {%if beam.pk == active_beam %} {{color_status.47}} {%endif%} |
|
244 | <td title='{{module_messages.47}}'><span {%if beam.pk == active_beam %} {{color_status.47}} {%endif%}>{{beam.get_upvalues.46}}</span></td> | |
245 |
<td {%if beam.pk == active_beam %} {{color_status.48}} {%endif%} |
|
245 | <td title='{{module_messages.48}}'><span {%if beam.pk == active_beam %} {{color_status.48}} {%endif%}>{{beam.get_upvalues.47}}</span></td> | |
246 | </tr> |
|
246 | </tr> | |
247 | <tr> |
|
247 | <tr> | |
248 |
<td {%if beam.pk == active_beam %} {{color_status.45}} {%endif%} |
|
248 | <td title='{{module_messages.45}}'><span {%if beam.pk == active_beam %} {{color_status.45}} {%endif%}>{{beam.get_downvalues.44}}</span></td> | |
249 |
<td {%if beam.pk == active_beam %} {{color_status.46}} {%endif%} |
|
249 | <td title='{{module_messages.46}}'><span {%if beam.pk == active_beam %} {{color_status.46}} {%endif%}>{{beam.get_downvalues.45}}</span></td> | |
250 |
<td {%if beam.pk == active_beam %} {{color_status.47}} {%endif%} |
|
250 | <td title='{{module_messages.47}}'><span {%if beam.pk == active_beam %} {{color_status.47}} {%endif%}>{{beam.get_downvalues.46}}</span></td> | |
251 |
<td {%if beam.pk == active_beam %} {{color_status.48}} {%endif%} |
|
251 | <td title='{{module_messages.48}}'><span {%if beam.pk == active_beam %} {{color_status.48}} {%endif%}>{{beam.get_downvalues.47}}</span></td> | |
252 | </tr> |
|
252 | </tr> | |
253 | <tr> |
|
253 | <tr> | |
254 |
<td {%if beam.pk == active_beam %} {{color_status.53}} {%endif%} |
|
254 | <td title='{{module_messages.53}}'><span {%if beam.pk == active_beam %} {{color_status.53}} {%endif%}>{{beam.get_upvalues.52}}</span></td> | |
255 |
<td {%if beam.pk == active_beam %} {{color_status.54}} {%endif%} |
|
255 | <td title='{{module_messages.54}}'><span {%if beam.pk == active_beam %} {{color_status.54}} {%endif%}>{{beam.get_upvalues.53}}</span></td> | |
256 |
<td {%if beam.pk == active_beam %} {{color_status.55}} {%endif%} |
|
256 | <td title='{{module_messages.55}}'><span {%if beam.pk == active_beam %} {{color_status.55}} {%endif%}>{{beam.get_upvalues.54}}</span></td> | |
257 |
<td {%if beam.pk == active_beam %} {{color_status.56}} {%endif%} |
|
257 | <td title='{{module_messages.56}}'><span {%if beam.pk == active_beam %} {{color_status.56}} {%endif%}>{{beam.get_upvalues.55}}</span></td> | |
258 | </tr> |
|
258 | </tr> | |
259 | <tr> |
|
259 | <tr> | |
260 |
<td {%if beam.pk == active_beam %} {{color_status.53}} {%endif%} |
|
260 | <td title='{{module_messages.53}}'><span {%if beam.pk == active_beam %} {{color_status.53}} {%endif%}>{{beam.get_downvalues.52}}</span></td> | |
261 |
<td {%if beam.pk == active_beam %} {{color_status.54}} {%endif%} |
|
261 | <td title='{{module_messages.54}}'><span {%if beam.pk == active_beam %} {{color_status.54}} {%endif%}>{{beam.get_downvalues.53}}</span></td> | |
262 |
<td {%if beam.pk == active_beam %} {{color_status.55}} {%endif%} |
|
262 | <td title='{{module_messages.55}}'><span {%if beam.pk == active_beam %} {{color_status.55}} {%endif%}>{{beam.get_downvalues.54}}</span></td> | |
263 |
<td {%if beam.pk == active_beam %} {{color_status.56}} {%endif%} |
|
263 | <td title='{{module_messages.56}}'><span {%if beam.pk == active_beam %} {{color_status.56}} {%endif%}>{{beam.get_downvalues.55}}</span></td> | |
264 | </tr> |
|
264 | </tr> | |
265 | <tr> |
|
265 | <tr> | |
266 |
<td {%if beam.pk == active_beam %} {{color_status.61}} {%endif%} |
|
266 | <td title='{{module_messages.61}}'><span {%if beam.pk == active_beam %} {{color_status.61}} {%endif%}>{{beam.get_upvalues.60}}</span></td> | |
267 |
<td {%if beam.pk == active_beam %} {{color_status.62}} {%endif%} |
|
267 | <td title='{{module_messages.62}}'><span {%if beam.pk == active_beam %} {{color_status.62}} {%endif%}>{{beam.get_upvalues.61}}</span></td> | |
268 |
<td {%if beam.pk == active_beam %} {{color_status.63}} {%endif%} |
|
268 | <td title='{{module_messages.63}}'><span {%if beam.pk == active_beam %} {{color_status.63}} {%endif%}>{{beam.get_upvalues.62}}</span></td> | |
269 |
<td {%if beam.pk == active_beam %} {{color_status.64}} {%endif%} |
|
269 | <td title='{{module_messages.64}}'><span {%if beam.pk == active_beam %} {{color_status.64}} {%endif%}>{{beam.get_upvalues.63}}</span></td> | |
270 | </tr> |
|
270 | </tr> | |
271 | <tr> |
|
271 | <tr> | |
272 |
<td {%if beam.pk == active_beam %} {{color_status.61}} {%endif%} |
|
272 | <td title='{{module_messages.61}}'><span {%if beam.pk == active_beam %} {{color_status.61}} {%endif%}>{{beam.get_downvalues.60}}</span></td> | |
273 |
<td {%if beam.pk == active_beam %} {{color_status.62}} {%endif%} |
|
273 | <td title='{{module_messages.62}}'><span {%if beam.pk == active_beam %} {{color_status.62}} {%endif%}>{{beam.get_downvalues.61}}</span></td> | |
274 |
<td {%if beam.pk == active_beam %} {{color_status.63}} {%endif%} |
|
274 | <td title='{{module_messages.63}}'><span {%if beam.pk == active_beam %} {{color_status.63}} {%endif%}>{{beam.get_downvalues.62}}</span></td> | |
275 |
<td {%if beam.pk == active_beam %} {{color_status.64}} {%endif%} |
|
275 | <td title='{{module_messages.64}}'><span {%if beam.pk == active_beam %} {{color_status.64}} {%endif%}>{{beam.get_downvalues.63}}</span></td> | |
276 | </tr> |
|
276 | </tr> | |
277 | </table> |
|
277 | </table> | |
278 | </td> |
|
278 | </td> | |
279 | </tr> |
|
279 | </tr> | |
280 | </table> |
|
280 | </table> | |
281 |
|
281 | |||
282 | {% if beam.id == active_beam %} |
|
282 | {% if beam.id == active_beam %} | |
283 | <table class="legend"> |
|
283 | <table class="legend"> | |
284 | <tr> |
|
284 | <tr> | |
285 | <th colspan="2">Legend</th> |
|
285 | <th colspan="2">Legend</th> | |
286 | </tr> |
|
286 | </tr> | |
287 | <tr> |
|
287 | <tr> | |
288 | <td class="text-danger"> |
|
288 | <td class="text-danger"> | |
289 | <i>RED</i> |
|
289 | <i>RED</i> | |
290 | </td> |
|
290 | </td> | |
291 | <td>Disconnected</td> |
|
291 | <td>Disconnected</td> | |
292 | </tr> |
|
292 | </tr> | |
293 | <tr> |
|
293 | <tr> | |
294 | <td class="text-warning"> |
|
294 | <td class="text-warning"> | |
295 | <i>ORANGE</i> |
|
295 | <i>ORANGE</i> | |
296 | </td> |
|
296 | </td> | |
297 | <td>Connected</td> |
|
297 | <td>Connected</td> | |
298 | </tr> |
|
298 | </tr> | |
299 | <tr> |
|
299 | <tr> | |
300 | <td class="text-success"> |
|
300 | <td class="text-success"> | |
301 | <i>GREEN</i> |
|
301 | <i>GREEN</i> | |
302 | </td> |
|
302 | </td> | |
303 | <td>Running |
|
303 | <td>Running | |
304 | </td> |
|
304 | </td> | |
305 | </tr> |
|
305 | </tr> | |
306 | </table> |
|
306 | </table> | |
307 | {% else %} |
|
307 | {% else %} | |
308 | <div style="vertical-align: top; display:inline-block;"> |
|
308 | <div style="vertical-align: top; display:inline-block;"> | |
309 | <button id="send_beam{{forloop.counter}}" type="button" class="btn btn-default"> |
|
309 | <button id="send_beam{{forloop.counter}}" type="button" class="btn btn-default"> | |
310 | <span class="glyphicon glyphicon-export" aria-hidden="true"></span> |
|
310 | <span class="glyphicon glyphicon-export" aria-hidden="true"></span> | |
311 | Change Beam</button> |
|
311 | Change Beam</button> | |
312 | </div> |
|
312 | </div> | |
313 | {% endif %} |
|
313 | {% endif %} | |
314 | </div> |
|
314 | </div> | |
315 | {% endfor %} |
|
315 | {% endfor %} | |
316 | </div> |
|
316 | </div> | |
317 | </div> |
|
317 | </div> | |
318 |
|
318 | |||
319 |
|
319 | |||
320 | {% else %} |
|
320 | {% else %} | |
321 | <p style="color:#b4bcc2; margin-left: 5%;"> |
|
321 | <p style="color:#b4bcc2; margin-left: 5%;"> | |
322 | <i>No Beams...</i> |
|
322 | <i>No Beams...</i> | |
323 | </p> |
|
323 | </p> | |
324 | {% endif %} {% endblock extra-content %} {% block extra-js%} |
|
324 | {% endif %} {% endblock extra-content %} {% block extra-js%} | |
325 | <script> |
|
325 | <script> | |
326 | $(document).ready(function () { |
|
326 | $(document).ready(function () { | |
327 |
|
327 | |||
328 | {% for beam in beams %} |
|
328 | {% for beam in beams %} | |
329 |
|
329 | |||
330 | {% if dev_conf.operation_mode == 1 %} |
|
330 | {% if dev_conf.operation_mode == 1 %} | |
331 | $("#send_beam{{forloop.counter}}").prop('disabled', true) |
|
331 | $("#send_beam{{forloop.counter}}").prop('disabled', true) | |
332 | {% else %} |
|
332 | {% else %} | |
333 | $("#send_beam{{forloop.counter}}").click(function () { |
|
333 | $("#send_beam{{forloop.counter}}").click(function () { | |
334 | document.location = "{% url 'url_send_beam' dev_conf.id beam.id %}"; |
|
334 | document.location = "{% url 'url_send_beam' dev_conf.id beam.id %}"; | |
335 | }); |
|
335 | }); | |
336 | {% endif %} |
|
336 | {% endif %} | |
337 |
|
337 | |||
338 | {% endfor %} |
|
338 | {% endfor %} | |
339 |
|
339 | |||
340 |
|
340 | |||
341 | }); |
|
341 | }); | |
342 | </script> {% endblock %} No newline at end of file |
|
342 | </script> {% endblock %} |
@@ -1,389 +1,389 | |||||
1 | import json |
|
1 | import json | |
2 | import requests |
|
2 | import requests | |
3 |
|
3 | |||
4 | from django.db import models |
|
4 | from django.db import models | |
5 | from django.core.validators import MinValueValidator, MaxValueValidator |
|
5 | from django.core.validators import MinValueValidator, MaxValueValidator | |
6 | from django.core.urlresolvers import reverse |
|
6 | from django.core.urlresolvers import reverse | |
7 |
|
7 | |||
8 | from apps.main.models import Configuration |
|
8 | from apps.main.models import Configuration | |
9 | from apps.main.utils import Params |
|
9 | from apps.main.utils import Params | |
10 | from .utils import create_jarsfiles |
|
10 | from .utils import create_jarsfiles | |
11 |
|
11 | |||
12 | # Create your models here. |
|
12 | # Create your models here. | |
13 |
|
13 | |||
14 | EXPERIMENT_TYPE = ( |
|
14 | EXPERIMENT_TYPE = ( | |
15 | (0, 'RAW_DATA'), |
|
15 | (0, 'RAW_DATA'), | |
16 | (1, 'PDATA'), |
|
16 | (1, 'PDATA'), | |
17 | ) |
|
17 | ) | |
18 |
|
18 | |||
19 | DATA_TYPE = ( |
|
19 | DATA_TYPE = ( | |
20 | (0, 'SHORT'), |
|
20 | (0, 'SHORT'), | |
21 | (1, 'FLOAT'), |
|
21 | (1, 'FLOAT'), | |
22 | ) |
|
22 | ) | |
23 |
|
23 | |||
24 | DECODE_TYPE = ( |
|
24 | DECODE_TYPE = ( | |
25 | (0, 'None'), |
|
25 | (0, 'None'), | |
26 | (1, 'TimeDomain'), |
|
26 | (1, 'TimeDomain'), | |
27 | (2, 'FreqDomain'), |
|
27 | (2, 'FreqDomain'), | |
28 | (3, 'InvFreqDomain'), |
|
28 | (3, 'InvFreqDomain'), | |
29 | ) |
|
29 | ) | |
30 |
|
30 | |||
31 | FILTER = '{"id":1, "clock": 60, "multiplier": 5, "frequency": 49.92, "f_decimal": 721554506, "fir": 2, "cic_2": 12, "cic_5": 25}' |
|
31 | FILTER = '{"id":1, "clock": 60, "multiplier": 5, "frequency": 49.92, "f_decimal": 721554506, "fir": 2, "cic_2": 12, "cic_5": 25}' | |
32 |
|
32 | |||
33 | class JARSFilter(models.Model): |
|
33 | class JARSFilter(models.Model): | |
34 |
|
34 | |||
35 | JARS_NBITS = 32 |
|
35 | JARS_NBITS = 32 | |
36 |
|
36 | |||
37 | name = models.CharField(verbose_name='Name', max_length=60, unique=True, default='') |
|
37 | name = models.CharField(verbose_name='Name', max_length=60, unique=True, default='') | |
38 | clock = models.FloatField(verbose_name='Clock In (MHz)', validators=[ |
|
38 | clock = models.FloatField(verbose_name='Clock In (MHz)', validators=[ | |
39 | MinValueValidator(5), MaxValueValidator(75)], null=True, default=60) |
|
39 | MinValueValidator(5), MaxValueValidator(75)], null=True, default=60) | |
40 | multiplier = models.PositiveIntegerField(verbose_name='Multiplier', validators=[ |
|
40 | multiplier = models.PositiveIntegerField(verbose_name='Multiplier', validators=[ | |
41 | MinValueValidator(1), MaxValueValidator(20)], default=5) |
|
41 | MinValueValidator(1), MaxValueValidator(20)], default=5) | |
42 | frequency = models.FloatField(verbose_name='Frequency (MHz)', validators=[ |
|
42 | frequency = models.FloatField(verbose_name='Frequency (MHz)', validators=[ | |
43 | MaxValueValidator(150)], null=True, default=49.9200) |
|
43 | MaxValueValidator(150)], null=True, default=49.9200) | |
44 | f_decimal = models.BigIntegerField(verbose_name='Frequency (Decimal)', validators=[ |
|
44 | f_decimal = models.BigIntegerField(verbose_name='Frequency (Decimal)', validators=[ | |
45 | MinValueValidator(-9223372036854775808), MaxValueValidator(2**JARS_NBITS-1)], null=True, default=721554505) |
|
45 | MinValueValidator(-9223372036854775808), MaxValueValidator(2**JARS_NBITS-1)], null=True, default=721554505) | |
46 | cic_2 = models.PositiveIntegerField(verbose_name='CIC2', validators=[ |
|
46 | cic_2 = models.PositiveIntegerField(verbose_name='CIC2', validators=[ | |
47 | MinValueValidator(2), MaxValueValidator(100)], default=10) |
|
47 | MinValueValidator(2), MaxValueValidator(100)], default=10) | |
48 | scale_cic_2 = models.PositiveIntegerField(verbose_name='Scale CIC2', validators=[ |
|
48 | scale_cic_2 = models.PositiveIntegerField(verbose_name='Scale CIC2', validators=[ | |
49 | MinValueValidator(0), MaxValueValidator(6)], default=1) |
|
49 | MinValueValidator(0), MaxValueValidator(6)], default=1) | |
50 | cic_5 = models.PositiveIntegerField(verbose_name='CIC5', validators=[ |
|
50 | cic_5 = models.PositiveIntegerField(verbose_name='CIC5', validators=[ | |
51 | MinValueValidator(1), MaxValueValidator(100)], default=1) |
|
51 | MinValueValidator(1), MaxValueValidator(100)], default=1) | |
52 | scale_cic_5 = models.PositiveIntegerField(verbose_name='Scale CIC5', validators=[ |
|
52 | scale_cic_5 = models.PositiveIntegerField(verbose_name='Scale CIC5', validators=[ | |
53 | MinValueValidator(0), MaxValueValidator(20)], default=5) |
|
53 | MinValueValidator(0), MaxValueValidator(20)], default=5) | |
54 | fir = models.PositiveIntegerField(verbose_name='FIR', validators=[ |
|
54 | fir = models.PositiveIntegerField(verbose_name='FIR', validators=[ | |
55 | MinValueValidator(1), MaxValueValidator(100)], default=6) |
|
55 | MinValueValidator(1), MaxValueValidator(100)], default=6) | |
56 | scale_fir = models.PositiveIntegerField(verbose_name='Scale FIR', validators=[ |
|
56 | scale_fir = models.PositiveIntegerField(verbose_name='Scale FIR', validators=[ | |
57 | MinValueValidator(0), MaxValueValidator(7)], default=3) |
|
57 | MinValueValidator(0), MaxValueValidator(7)], default=3) | |
58 | number_taps = models.PositiveIntegerField(verbose_name='Number of taps', validators=[ |
|
58 | number_taps = models.PositiveIntegerField(verbose_name='Number of taps', validators=[ | |
59 | MinValueValidator(1), MaxValueValidator(256)], default=4) |
|
59 | MinValueValidator(1), MaxValueValidator(256)], default=4) | |
60 |
taps = models.CharField(verbose_name='Taps', max_length= |
|
60 | taps = models.CharField(verbose_name='Taps', max_length=1600, default='0') | |
61 |
|
61 | |||
62 | class Meta: |
|
62 | class Meta: | |
63 | db_table = 'jars_filters' |
|
63 | db_table = 'jars_filters' | |
64 |
|
64 | |||
65 | def __unicode__(self): |
|
65 | def __unicode__(self): | |
66 | return u'%s' % (self.name) |
|
66 | return u'%s' % (self.name) | |
67 |
|
67 | |||
68 | def jsonify(self): |
|
68 | def jsonify(self): | |
69 |
|
69 | |||
70 | data = {} |
|
70 | data = {} | |
71 | ignored = () |
|
71 | ignored = () | |
72 |
|
72 | |||
73 | for field in self._meta.fields: |
|
73 | for field in self._meta.fields: | |
74 | if field.name in ignored: |
|
74 | if field.name in ignored: | |
75 | continue |
|
75 | continue | |
76 | data[field.name] = field.value_from_object(self) |
|
76 | data[field.name] = field.value_from_object(self) | |
77 |
|
77 | |||
78 | return data |
|
78 | return data | |
79 |
|
79 | |||
80 | def parms_to_dict(self): |
|
80 | def parms_to_dict(self): | |
81 |
|
81 | |||
82 | parameters = {} |
|
82 | parameters = {} | |
83 |
|
83 | |||
84 | parameters['name'] = self.name |
|
84 | parameters['name'] = self.name | |
85 | parameters['clock'] = float(self.clock) |
|
85 | parameters['clock'] = float(self.clock) | |
86 | parameters['multiplier'] = int(self.multiplier) |
|
86 | parameters['multiplier'] = int(self.multiplier) | |
87 | parameters['frequency'] = float(self.frequency) |
|
87 | parameters['frequency'] = float(self.frequency) | |
88 | parameters['f_decimal'] = int(self.frequency) |
|
88 | parameters['f_decimal'] = int(self.frequency) | |
89 | parameters['fir'] = int(self.fir) |
|
89 | parameters['fir'] = int(self.fir) | |
90 | parameters['cic_2'] = int(self.cic_2) |
|
90 | parameters['cic_2'] = int(self.cic_2) | |
91 | parameters['cic_5'] = int(self.cic_5) |
|
91 | parameters['cic_5'] = int(self.cic_5) | |
92 |
|
92 | |||
93 | return parameters |
|
93 | return parameters | |
94 |
|
94 | |||
95 | def dict_to_parms(self, parameters): |
|
95 | def dict_to_parms(self, parameters): | |
96 |
|
96 | |||
97 | self.name = parameters['name'] |
|
97 | self.name = parameters['name'] | |
98 | self.clock = parameters['clock'] |
|
98 | self.clock = parameters['clock'] | |
99 | self.multiplier = parameters['multiplier'] |
|
99 | self.multiplier = parameters['multiplier'] | |
100 | self.frequency = parameters['frequency'] |
|
100 | self.frequency = parameters['frequency'] | |
101 | self.f_decimal = parameters['f_decimal'] |
|
101 | self.f_decimal = parameters['f_decimal'] | |
102 | self.fir = parameters['fir'] |
|
102 | self.fir = parameters['fir'] | |
103 | self.cic_2 = parameters['cic_2'] |
|
103 | self.cic_2 = parameters['cic_2'] | |
104 | self.cic_5 = parameters['cic_5'] |
|
104 | self.cic_5 = parameters['cic_5'] | |
105 |
|
105 | |||
106 |
|
106 | |||
107 | class JARSConfiguration(Configuration): |
|
107 | class JARSConfiguration(Configuration): | |
108 |
|
108 | |||
109 | ADC_RESOLUTION = 8 |
|
109 | ADC_RESOLUTION = 8 | |
110 | PCI_DIO_BUSWIDTH = 32 |
|
110 | PCI_DIO_BUSWIDTH = 32 | |
111 | HEADER_VERSION = 1103 |
|
111 | HEADER_VERSION = 1103 | |
112 | BEGIN_ON_START = True |
|
112 | BEGIN_ON_START = True | |
113 | REFRESH_RATE = 1 |
|
113 | REFRESH_RATE = 1 | |
114 |
|
114 | |||
115 | exp_type = models.PositiveIntegerField( |
|
115 | exp_type = models.PositiveIntegerField( | |
116 | verbose_name='Experiment Type', choices=EXPERIMENT_TYPE, default=0) |
|
116 | verbose_name='Experiment Type', choices=EXPERIMENT_TYPE, default=0) | |
117 | cards_number = models.PositiveIntegerField(verbose_name='Number of Cards', validators=[ |
|
117 | cards_number = models.PositiveIntegerField(verbose_name='Number of Cards', validators=[ | |
118 | MinValueValidator(1), MaxValueValidator(4)], default=1) |
|
118 | MinValueValidator(1), MaxValueValidator(4)], default=1) | |
119 | channels_number = models.PositiveIntegerField(verbose_name='Number of Channels', validators=[ |
|
119 | channels_number = models.PositiveIntegerField(verbose_name='Number of Channels', validators=[ | |
120 | MinValueValidator(1), MaxValueValidator(8)], default=5) |
|
120 | MinValueValidator(1), MaxValueValidator(8)], default=5) | |
121 | channels = models.CharField( |
|
121 | channels = models.CharField( | |
122 | verbose_name='Channels', max_length=15, default='1,2,3,4,5') |
|
122 | verbose_name='Channels', max_length=15, default='1,2,3,4,5') | |
123 | data_type = models.PositiveIntegerField( |
|
123 | data_type = models.PositiveIntegerField( | |
124 | verbose_name='Data Type', choices=DATA_TYPE, default=0) |
|
124 | verbose_name='Data Type', choices=DATA_TYPE, default=0) | |
125 | raw_data_blocks = models.PositiveIntegerField( |
|
125 | raw_data_blocks = models.PositiveIntegerField( | |
126 | verbose_name='Raw Data Blocks', validators=[MaxValueValidator(5000)], default=60) |
|
126 | verbose_name='Raw Data Blocks', validators=[MaxValueValidator(5000)], default=60) | |
127 | profiles_block = models.PositiveIntegerField( |
|
127 | profiles_block = models.PositiveIntegerField( | |
128 | verbose_name='Profiles Per Block', default=400) |
|
128 | verbose_name='Profiles Per Block', default=400) | |
129 | acq_profiles = models.PositiveIntegerField( |
|
129 | acq_profiles = models.PositiveIntegerField( | |
130 | verbose_name='Acquired Profiles', default=400) |
|
130 | verbose_name='Acquired Profiles', default=400) | |
131 | ftp_interval = models.PositiveIntegerField( |
|
131 | ftp_interval = models.PositiveIntegerField( | |
132 | verbose_name='FTP Interval', default=60) |
|
132 | verbose_name='FTP Interval', default=60) | |
133 | fftpoints = models.PositiveIntegerField( |
|
133 | fftpoints = models.PositiveIntegerField( | |
134 | verbose_name='FFT Points', default=16) |
|
134 | verbose_name='FFT Points', default=16) | |
135 | cohe_integr_str = models.PositiveIntegerField( |
|
135 | cohe_integr_str = models.PositiveIntegerField( | |
136 | verbose_name='Coh. Int. Stride', validators=[MinValueValidator(1)], default=30) |
|
136 | verbose_name='Coh. Int. Stride', validators=[MinValueValidator(1)], default=30) | |
137 | cohe_integr = models.PositiveIntegerField( |
|
137 | cohe_integr = models.PositiveIntegerField( | |
138 | verbose_name='Coherent Integrations', validators=[MinValueValidator(1)], default=30) |
|
138 | verbose_name='Coherent Integrations', validators=[MinValueValidator(1)], default=30) | |
139 | incohe_integr = models.PositiveIntegerField( |
|
139 | incohe_integr = models.PositiveIntegerField( | |
140 | verbose_name='Incoherent Integrations', validators=[MinValueValidator(1)], default=30) |
|
140 | verbose_name='Incoherent Integrations', validators=[MinValueValidator(1)], default=30) | |
141 | decode_data = models.PositiveIntegerField( |
|
141 | decode_data = models.PositiveIntegerField( | |
142 | verbose_name='Decode Data', choices=DECODE_TYPE, default=0) |
|
142 | verbose_name='Decode Data', choices=DECODE_TYPE, default=0) | |
143 | post_coh_int = models.BooleanField( |
|
143 | post_coh_int = models.BooleanField( | |
144 | verbose_name='Post Coherent Integration', default=False) |
|
144 | verbose_name='Post Coherent Integration', default=False) | |
145 | spectral_number = models.PositiveIntegerField( |
|
145 | spectral_number = models.PositiveIntegerField( | |
146 | verbose_name='# Spectral Combinations', validators=[MinValueValidator(1)], default=1) |
|
146 | verbose_name='# Spectral Combinations', validators=[MinValueValidator(1)], default=1) | |
147 | spectral = models.CharField( |
|
147 | spectral = models.CharField( | |
148 | verbose_name='Combinations', max_length=5000, default='[0, 0],') |
|
148 | verbose_name='Combinations', max_length=5000, default='[0, 0],') | |
149 | create_directory = models.BooleanField( |
|
149 | create_directory = models.BooleanField( | |
150 | verbose_name='Create Directory Per Day', default=True) |
|
150 | verbose_name='Create Directory Per Day', default=True) | |
151 | include_expname = models.BooleanField( |
|
151 | include_expname = models.BooleanField( | |
152 | verbose_name='Experiment Name in Directory', default=False) |
|
152 | verbose_name='Experiment Name in Directory', default=False) | |
153 | #view_raw_data = models.BooleanField(verbose_name='View Raw Data', default=True) |
|
153 | #view_raw_data = models.BooleanField(verbose_name='View Raw Data', default=True) | |
154 | save_ch_dc = models.BooleanField( |
|
154 | save_ch_dc = models.BooleanField( | |
155 | verbose_name='Save Channels DC', default=True) |
|
155 | verbose_name='Save Channels DC', default=True) | |
156 | save_data = models.BooleanField(verbose_name='Save Data', default=True) |
|
156 | save_data = models.BooleanField(verbose_name='Save Data', default=True) | |
157 | filter_parms = models.CharField( |
|
157 | filter_parms = models.CharField( | |
158 | max_length=10000, default=FILTER) |
|
158 | max_length=10000, default=FILTER) | |
159 | filter = models.ForeignKey( |
|
159 | filter = models.ForeignKey( | |
160 | 'JARSFilter', verbose_name='Filter', null=True, blank=True, on_delete=models.CASCADE) |
|
160 | 'JARSFilter', verbose_name='Filter', null=True, blank=True, on_delete=models.CASCADE) | |
161 |
|
161 | |||
162 | class Meta: |
|
162 | class Meta: | |
163 | db_table = 'jars_configurations' |
|
163 | db_table = 'jars_configurations' | |
164 |
|
164 | |||
165 | def filter_resolution(self): |
|
165 | def filter_resolution(self): | |
166 | filter_parms = json.loads(self.filter_parms) |
|
166 | filter_parms = json.loads(self.filter_parms) | |
167 | clock = float(filter_parms['clock']) |
|
167 | clock = float(filter_parms['clock']) | |
168 | cic_2 = filter_parms['cic_2'] |
|
168 | cic_2 = filter_parms['cic_2'] | |
169 | cic_5 = filter_parms['cic_5'] |
|
169 | cic_5 = filter_parms['cic_5'] | |
170 | fir = filter_parms['fir'] |
|
170 | fir = filter_parms['fir'] | |
171 | resolution = round((clock/(cic_2*cic_5*fir)), 2) |
|
171 | resolution = round((clock/(cic_2*cic_5*fir)), 2) | |
172 | return resolution |
|
172 | return resolution | |
173 |
|
173 | |||
174 | def dict_to_parms(self, params, id=None): |
|
174 | def dict_to_parms(self, params, id=None): | |
175 |
|
175 | |||
176 | if id is not None: |
|
176 | if id is not None: | |
177 | data = Params(params).get_conf(id_conf=id) |
|
177 | data = Params(params).get_conf(id_conf=id) | |
178 | else: |
|
178 | else: | |
179 | data = Params(params).get_conf(dtype='jars') |
|
179 | data = Params(params).get_conf(dtype='jars') | |
180 | data['filter_parms'] = params['filter_parms'] |
|
180 | data['filter_parms'] = params['filter_parms'] | |
181 |
|
181 | |||
182 | # self.name = data['name'] |
|
182 | # self.name = data['name'] | |
183 | self.exp_type = data['exp_type'] |
|
183 | self.exp_type = data['exp_type'] | |
184 | #----PDATA---- |
|
184 | #----PDATA---- | |
185 | if self.exp_type == 1: |
|
185 | if self.exp_type == 1: | |
186 | self.incohe_integr = data['incohe_integr'] |
|
186 | self.incohe_integr = data['incohe_integr'] | |
187 | self.spectral_number = data['spectral_number'] |
|
187 | self.spectral_number = data['spectral_number'] | |
188 | self.spectral = data['spectral'] |
|
188 | self.spectral = data['spectral'] | |
189 | self.fftpoints = data['fftpoints'] |
|
189 | self.fftpoints = data['fftpoints'] | |
190 | self.save_ch_dc = data['save_ch_dc'] |
|
190 | self.save_ch_dc = data['save_ch_dc'] | |
191 | else: |
|
191 | else: | |
192 | self.raw_data_blocks = data['raw_data_blocks'] |
|
192 | self.raw_data_blocks = data['raw_data_blocks'] | |
193 | #----PDATA---- |
|
193 | #----PDATA---- | |
194 | self.cards_number = data['cards_number'] |
|
194 | self.cards_number = data['cards_number'] | |
195 | self.channels_number = data['channels_number'] |
|
195 | self.channels_number = data['channels_number'] | |
196 | self.channels = data['channels'] |
|
196 | self.channels = data['channels'] | |
197 | self.data_type = data['data_type'] |
|
197 | self.data_type = data['data_type'] | |
198 | self.profiles_block = data['profiles_block'] |
|
198 | self.profiles_block = data['profiles_block'] | |
199 | self.acq_profiles = data['acq_profiles'] |
|
199 | self.acq_profiles = data['acq_profiles'] | |
200 | self.ftp_interval = data['ftp_interval'] |
|
200 | self.ftp_interval = data['ftp_interval'] | |
201 | self.cohe_integr_str = data['cohe_integr_str'] |
|
201 | self.cohe_integr_str = data['cohe_integr_str'] | |
202 | self.cohe_integr = data['cohe_integr'] |
|
202 | self.cohe_integr = data['cohe_integr'] | |
203 | #----DECODE---- |
|
203 | #----DECODE---- | |
204 | self.decode_data = data['decode_data'] |
|
204 | self.decode_data = data['decode_data'] | |
205 | self.post_coh_int = data['post_coh_int'] |
|
205 | self.post_coh_int = data['post_coh_int'] | |
206 | #----DECODE---- |
|
206 | #----DECODE---- | |
207 | self.create_directory = data['create_directory'] |
|
207 | self.create_directory = data['create_directory'] | |
208 | self.include_expname = data['include_expname'] |
|
208 | self.include_expname = data['include_expname'] | |
209 | self.save_data = data['save_data'] |
|
209 | self.save_data = data['save_data'] | |
210 | self.filter_parms = json.dumps(data['filter_parms']) |
|
210 | self.filter_parms = json.dumps(data['filter_parms']) | |
211 |
|
211 | |||
212 | self.save() |
|
212 | self.save() | |
213 |
|
213 | |||
214 | def parms_to_text(self, file_format='jars'): |
|
214 | def parms_to_text(self, file_format='jars'): | |
215 |
|
215 | |||
216 | data = self.experiment.parms_to_dict() |
|
216 | data = self.experiment.parms_to_dict() | |
217 |
|
217 | |||
218 | for key in data['configurations']['allIds']: |
|
218 | for key in data['configurations']['allIds']: | |
219 | if data['configurations']['byId'][key]['device_type'] in ('dds', 'cgs'): |
|
219 | if data['configurations']['byId'][key]['device_type'] in ('dds', 'cgs'): | |
220 | data['configurations']['allIds'].remove(key) |
|
220 | data['configurations']['allIds'].remove(key) | |
221 | data['configurations']['byId'].pop(key) |
|
221 | data['configurations']['byId'].pop(key) | |
222 | elif data['configurations']['byId'][key]['device_type'] == 'jars': |
|
222 | elif data['configurations']['byId'][key]['device_type'] == 'jars': | |
223 | data['configurations']['byId'][key] = self.parms_to_dict( |
|
223 | data['configurations']['byId'][key] = self.parms_to_dict( | |
224 | )['configurations']['byId'][str(self.pk)] |
|
224 | )['configurations']['byId'][str(self.pk)] | |
225 | elif data['configurations']['byId'][key]['device_type'] == 'rc': |
|
225 | elif data['configurations']['byId'][key]['device_type'] == 'rc': | |
226 | data['configurations']['byId'][key]['pulses'] = '' |
|
226 | data['configurations']['byId'][key]['pulses'] = '' | |
227 | data['configurations']['byId'][key]['delays'] = '' |
|
227 | data['configurations']['byId'][key]['delays'] = '' | |
228 | rc_ids = [pk for pk in data['configurations']['allIds'] |
|
228 | rc_ids = [pk for pk in data['configurations']['allIds'] | |
229 | if data['configurations']['byId'][pk]['device_type'] == 'rc'] |
|
229 | if data['configurations']['byId'][pk]['device_type'] == 'rc'] | |
230 | mix_ids = [pk for pk in rc_ids if data['configurations'] |
|
230 | mix_ids = [pk for pk in rc_ids if data['configurations'] | |
231 | ['byId'][pk]['mix']] |
|
231 | ['byId'][pk]['mix']] | |
232 |
|
232 | |||
233 | if mix_ids: |
|
233 | if mix_ids: | |
234 | params = data['configurations']['byId'][mix_ids[0]]['parameters'] |
|
234 | params = data['configurations']['byId'][mix_ids[0]]['parameters'] | |
235 | rc = data['configurations']['byId'][params.split( |
|
235 | rc = data['configurations']['byId'][params.split( | |
236 | '-')[0].split('|')[0]] |
|
236 | '-')[0].split('|')[0]] | |
237 | rc['mix'] = True |
|
237 | rc['mix'] = True | |
238 | data['configurations']['byId'][rc['id']] = rc |
|
238 | data['configurations']['byId'][rc['id']] = rc | |
239 | elif len(rc_ids) == 0: |
|
239 | elif len(rc_ids) == 0: | |
240 | self.message = 'File needs RC configuration' |
|
240 | self.message = 'File needs RC configuration' | |
241 | return '' |
|
241 | return '' | |
242 |
|
242 | |||
243 | json_data = json.dumps(data) |
|
243 | json_data = json.dumps(data) | |
244 | racp_file, filter_file = create_jarsfiles(json_data) |
|
244 | racp_file, filter_file = create_jarsfiles(json_data) | |
245 | if file_format == 'racp': |
|
245 | if file_format == 'racp': | |
246 | return racp_file |
|
246 | return racp_file | |
247 |
|
247 | |||
248 | return filter_file |
|
248 | return filter_file | |
249 |
|
249 | |||
250 | def request(self, cmd, method='get', **kwargs): |
|
250 | def request(self, cmd, method='get', **kwargs): | |
251 |
|
251 | |||
252 | req = getattr(requests, method)(self.device.url(cmd), **kwargs) |
|
252 | req = getattr(requests, method)(self.device.url(cmd), **kwargs) | |
253 | payload = req.json() |
|
253 | payload = req.json() | |
254 | return payload |
|
254 | return payload | |
255 |
|
255 | |||
256 | def status_device(self): |
|
256 | def status_device(self): | |
257 |
|
257 | |||
258 | try: |
|
258 | try: | |
259 | payload = self.request('status', |
|
259 | payload = self.request('status', | |
260 | params={'name': self.experiment.name}) |
|
260 | params={'name': self.experiment.name}) | |
261 | self.device.status = payload['status'] |
|
261 | self.device.status = payload['status'] | |
262 | self.device.save() |
|
262 | self.device.save() | |
263 | self.message = payload['message'] |
|
263 | self.message = payload['message'] | |
264 | except Exception as e: |
|
264 | except Exception as e: | |
265 | self.device.status = 0 |
|
265 | self.device.status = 0 | |
266 | self.message = str(e) |
|
266 | self.message = str(e) | |
267 | self.device.save() |
|
267 | self.device.save() | |
268 | return False |
|
268 | return False | |
269 |
|
269 | |||
270 | return True |
|
270 | return True | |
271 |
|
271 | |||
272 | def stop_device(self): |
|
272 | def stop_device(self): | |
273 |
|
273 | |||
274 | try: |
|
274 | try: | |
275 | payload = self.request('stop', 'post') |
|
275 | payload = self.request('stop', 'post') | |
276 | self.device.status = payload['status'] |
|
276 | self.device.status = payload['status'] | |
277 | self.device.save() |
|
277 | self.device.save() | |
278 | self.message = payload['message'] |
|
278 | self.message = payload['message'] | |
279 | except Exception as e: |
|
279 | except Exception as e: | |
280 | self.device.status = 0 |
|
280 | self.device.status = 0 | |
281 | self.message = str(e) |
|
281 | self.message = str(e) | |
282 | self.device.save() |
|
282 | self.device.save() | |
283 | return False |
|
283 | return False | |
284 |
|
284 | |||
285 | return True |
|
285 | return True | |
286 |
|
286 | |||
287 | def read_device(self): |
|
287 | def read_device(self): | |
288 |
|
288 | |||
289 | try: |
|
289 | try: | |
290 | payload = self.request( |
|
290 | payload = self.request( | |
291 | 'read', params={'name': self.experiment.name}) |
|
291 | 'read', params={'name': self.experiment.name}) | |
292 | self.message = 'Configuration loaded' |
|
292 | self.message = 'Configuration loaded' | |
293 | except: |
|
293 | except: | |
294 | self.device.status = 0 |
|
294 | self.device.status = 0 | |
295 | self.device.save() |
|
295 | self.device.save() | |
296 | self.message = 'Could not read JARS configuration.' |
|
296 | self.message = 'Could not read JARS configuration.' | |
297 | return False |
|
297 | return False | |
298 |
|
298 | |||
299 | return payload |
|
299 | return payload | |
300 |
|
300 | |||
301 | def write_device(self): |
|
301 | def write_device(self): | |
302 |
|
302 | |||
303 | if self.device.status == 3: |
|
303 | if self.device.status == 3: | |
304 | self.message = 'Could not configure device. Software Acquisition is running' |
|
304 | self.message = 'Could not configure device. Software Acquisition is running' | |
305 | return False |
|
305 | return False | |
306 |
|
306 | |||
307 | data = self.experiment.parms_to_dict() |
|
307 | data = self.experiment.parms_to_dict() | |
308 |
|
308 | |||
309 | for key in data['configurations']['allIds']: |
|
309 | for key in data['configurations']['allIds']: | |
310 | if data['configurations']['byId'][key]['device_type'] in ('dds', 'cgs'): |
|
310 | if data['configurations']['byId'][key]['device_type'] in ('dds', 'cgs'): | |
311 | data['configurations']['allIds'].remove(key) |
|
311 | data['configurations']['allIds'].remove(key) | |
312 | data['configurations']['byId'].pop(key) |
|
312 | data['configurations']['byId'].pop(key) | |
313 | elif data['configurations']['byId'][key]['device_type'] == 'rc': |
|
313 | elif data['configurations']['byId'][key]['device_type'] == 'rc': | |
314 | data['configurations']['byId'][key]['pulses'] = '' |
|
314 | data['configurations']['byId'][key]['pulses'] = '' | |
315 | data['configurations']['byId'][key]['delays'] = '' |
|
315 | data['configurations']['byId'][key]['delays'] = '' | |
316 | rc_ids = [pk for pk in data['configurations']['allIds'] |
|
316 | rc_ids = [pk for pk in data['configurations']['allIds'] | |
317 | if data['configurations']['byId'][pk]['device_type'] == 'rc'] |
|
317 | if data['configurations']['byId'][pk]['device_type'] == 'rc'] | |
318 | if len(rc_ids) == 0: |
|
318 | if len(rc_ids) == 0: | |
319 | self.message = 'Missing RC configuration' |
|
319 | self.message = 'Missing RC configuration' | |
320 | return False |
|
320 | return False | |
321 |
|
321 | |||
322 | json_data = json.dumps(data) |
|
322 | json_data = json.dumps(data) | |
323 |
|
323 | |||
324 | try: |
|
324 | try: | |
325 | payload = self.request('write', 'post', json=json_data) |
|
325 | payload = self.request('write', 'post', json=json_data) | |
326 | self.device.status = payload['status'] |
|
326 | self.device.status = payload['status'] | |
327 | self.message = payload['message'] |
|
327 | self.message = payload['message'] | |
328 | self.device.save() |
|
328 | self.device.save() | |
329 | if self.device.status == 1: |
|
329 | if self.device.status == 1: | |
330 | return False |
|
330 | return False | |
331 |
|
331 | |||
332 | except Exception as e: |
|
332 | except Exception as e: | |
333 | self.device.status = 0 |
|
333 | self.device.status = 0 | |
334 | self.message = str(e) |
|
334 | self.message = str(e) | |
335 | self.device.save() |
|
335 | self.device.save() | |
336 | return False |
|
336 | return False | |
337 |
|
337 | |||
338 | return True |
|
338 | return True | |
339 |
|
339 | |||
340 | def start_device(self): |
|
340 | def start_device(self): | |
341 |
|
341 | |||
342 | try: |
|
342 | try: | |
343 | payload = self.request('start', 'post', |
|
343 | payload = self.request('start', 'post', | |
344 | json={'name': self.experiment.name}) |
|
344 | json={'name': self.experiment.name}) | |
345 | self.device.status = payload['status'] |
|
345 | self.device.status = payload['status'] | |
346 | self.message = payload['message'] |
|
346 | self.message = payload['message'] | |
347 | self.device.save() |
|
347 | self.device.save() | |
348 | if self.device.status == 1: |
|
348 | if self.device.status == 1: | |
349 | return False |
|
349 | return False | |
350 |
|
350 | |||
351 | except Exception as e: |
|
351 | except Exception as e: | |
352 | self.device.status = 0 |
|
352 | self.device.status = 0 | |
353 | self.message = str(e) |
|
353 | self.message = str(e) | |
354 | self.device.save() |
|
354 | self.device.save() | |
355 | return False |
|
355 | return False | |
356 |
|
356 | |||
357 | return True |
|
357 | return True | |
358 |
|
358 | |||
359 | def get_log(self): |
|
359 | def get_log(self): | |
360 |
|
360 | |||
361 | payload = None |
|
361 | payload = None | |
362 |
|
362 | |||
363 | try: |
|
363 | try: | |
364 | payload = requests.get(self.device.url('get_log'), params={ |
|
364 | payload = requests.get(self.device.url('get_log'), params={ | |
365 | 'name': self.experiment.name}) |
|
365 | 'name': self.experiment.name}) | |
366 | except: |
|
366 | except: | |
367 | self.device.status = 0 |
|
367 | self.device.status = 0 | |
368 | self.device.save() |
|
368 | self.device.save() | |
369 | self.message = 'Jars API is not running.' |
|
369 | self.message = 'Jars API is not running.' | |
370 | return False |
|
370 | return False | |
371 |
|
371 | |||
372 | self.message = 'Jars API is running' |
|
372 | self.message = 'Jars API is running' | |
373 |
|
373 | |||
374 | return payload |
|
374 | return payload | |
375 |
|
375 | |||
376 | def update_from_file(self, filename): |
|
376 | def update_from_file(self, filename): | |
377 |
|
377 | |||
378 | f = JARSFile(filename) |
|
378 | f = JARSFile(filename) | |
379 | self.dict_to_parms(f.data) |
|
379 | self.dict_to_parms(f.data) | |
380 | self.save() |
|
380 | self.save() | |
381 |
|
381 | |||
382 | def get_absolute_url_import(self): |
|
382 | def get_absolute_url_import(self): | |
383 | return reverse('url_import_jars_conf', args=[str(self.id)]) |
|
383 | return reverse('url_import_jars_conf', args=[str(self.id)]) | |
384 |
|
384 | |||
385 | def get_absolute_url_read(self): |
|
385 | def get_absolute_url_read(self): | |
386 | return reverse('url_read_jars_conf', args=[str(self.id)]) |
|
386 | return reverse('url_read_jars_conf', args=[str(self.id)]) | |
387 |
|
387 | |||
388 | def get_absolute_url_log(self): |
|
388 | def get_absolute_url_log(self): | |
389 | return reverse('url_get_jars_log', args=[str(self.id)]) |
|
389 | return reverse('url_get_jars_log', args=[str(self.id)]) |
General Comments 0
You need to be logged in to leave comments.
Login now