The requested changes are too big and content was truncated. Show full diff
@@ -8,5 +8,5 POSTGRES_PASSWORD=docker | |||||
8 | PGDATA=/var/lib/postgresql/data |
|
8 | PGDATA=/var/lib/postgresql/data | |
9 | LC_ALL=C.UTF-8 |
|
9 | LC_ALL=C.UTF-8 | |
10 | TZ=America/Lima |
|
10 | TZ=America/Lima | |
11 |
DOCKER_DATA=/ |
|
11 | DOCKER_DATA=/Volumes/dockers/radarsys/ | |
12 | LOCAL_IP=192.168.1.128 |
|
12 | LOCAL_IP=192.168.1.128 |
@@ -10,7 +10,9 class ABSConfigurationForm(forms.ModelForm): | |||||
10 |
|
10 | |||
11 | class Meta: |
|
11 | class Meta: | |
12 | model = ABSConfiguration |
|
12 | model = ABSConfiguration | |
13 |
exclude = ('type', 'status', 'parameters', 'active_beam', |
|
13 | exclude = ('type', 'status', 'parameters', 'active_beam', | |
|
14 | 'module_status', 'module_messages', 'module_mode', | |||
|
15 | 'author', 'hash') | |||
14 |
|
16 | |||
15 |
|
17 | |||
16 | class ABSBeamAddForm(forms.Form): |
|
18 | class ABSBeamAddForm(forms.Form): |
@@ -227,7 +227,7 class ABSConfiguration(Configuration): | |||||
227 | parameters = {} |
|
227 | parameters = {} | |
228 |
|
228 | |||
229 | parameters['device_id'] = self.device.id |
|
229 | parameters['device_id'] = self.device.id | |
230 |
parameters[' |
|
230 | parameters['label'] = self.label | |
231 | parameters['device_type'] = self.device.device_type.name |
|
231 | parameters['device_type'] = self.device.device_type.name | |
232 | parameters['beams'] = {} |
|
232 | parameters['beams'] = {} | |
233 |
|
233 | |||
@@ -243,7 +243,7 class ABSConfiguration(Configuration): | |||||
243 |
|
243 | |||
244 | def dict_to_parms(self, parameters): |
|
244 | def dict_to_parms(self, parameters): | |
245 |
|
245 | |||
246 |
self. |
|
246 | self.label = parameters['label'] | |
247 |
|
247 | |||
248 | absbeams = ABSBeam.objects.filter(abs_conf=self) |
|
248 | absbeams = ABSBeam.objects.filter(abs_conf=self) | |
249 | beams = parameters['beams'] |
|
249 | beams = parameters['beams'] |
@@ -1,36 +1,31 | |||||
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 | border: 2px solid #00334d; |
|
5 | width: auto; | |
6 | vertical-align: center; |
|
|||
7 | display: inline-block; |
|
6 | display: inline-block; | |
8 | } |
|
7 | text-align: center; | |
9 |
|
||||
10 | .abs tr:nth-child(1) { |
|
|||
11 | border-bottom: 1px dashed #00334d; |
|
|||
12 | } |
|
|||
13 |
|
||||
14 | .abs tr { |
|
|||
15 | border-bottom: 0px solid #00334d; |
|
|||
16 | } |
|
8 | } | |
17 |
|
9 | |||
18 | .abs td { |
|
10 | .abs td { | |
19 | border-right: 1px dashed #00334d; |
|
11 | padding: 4px; | |
20 | text-align: center; |
|
|||
21 | padding: 5px; |
|
|||
22 | } |
|
12 | } | |
23 |
|
13 | |||
|
14 | .module td { | |||
|
15 | padding: 4px 15px 4px 15px; | |||
|
16 | font-weight: bold; | |||
|
17 | border: 1px solid | |||
|
18 | } | |||
24 |
|
19 | |||
25 | .legend { |
|
20 | .legend { | |
26 | margin-left: 15px; |
|
21 | margin-left: 15px; | |
27 | display: inline-block; |
|
22 | display: inline-block; | |
28 |
border: 2px solid |
|
23 | border: 2px solid; | |
29 | vertical-align: top; |
|
24 | vertical-align: top; | |
30 | } |
|
25 | } | |
31 |
|
26 | |||
32 | .legend th { |
|
27 | .legend th { | |
33 |
border-bottom: 1px dashed |
|
28 | border-bottom: 1px dashed; | |
34 | font-weight: bold; |
|
29 | font-weight: bold; | |
35 | vertical-align: center; |
|
30 | vertical-align: center; | |
36 | text-align: center; |
|
31 | text-align: center; | |
@@ -41,135 +36,6 | |||||
41 | text-align: center; |
|
36 | text-align: center; | |
42 | } |
|
37 | } | |
43 |
|
38 | |||
44 |
|
||||
45 | .north { |
|
|||
46 | border: 2px solid #00334d; |
|
|||
47 | vertical-align: center; |
|
|||
48 | font-weight: bold; |
|
|||
49 | } |
|
|||
50 |
|
||||
51 | .north tr { |
|
|||
52 | border: 1px solid #ffffff; |
|
|||
53 |
|
||||
54 | } |
|
|||
55 |
|
||||
56 | .north td { |
|
|||
57 | border: 2px solid #e2e2e7; |
|
|||
58 | text-align: center; |
|
|||
59 | padding: 1px 15px 1px 15px; |
|
|||
60 | } |
|
|||
61 |
|
||||
62 | .north tr:nth-child(even) td:nth-child(n) { |
|
|||
63 | border-bottom: 12px solid #e2e2e7; |
|
|||
64 | } |
|
|||
65 |
|
||||
66 | .north td:nth-child(n) { |
|
|||
67 | border-right: 12px solid #e2e2e7; |
|
|||
68 | } |
|
|||
69 |
|
||||
70 | .north td:nth-last-child(4n+1) { |
|
|||
71 | border-right: 2px solid #e2e2e7; |
|
|||
72 | } |
|
|||
73 |
|
||||
74 | .north tr:nth-last-child(1) td:nth-child(n) { |
|
|||
75 | border-bottom: 3px solid #e2e2e7; |
|
|||
76 | } |
|
|||
77 |
|
||||
78 | .east { |
|
|||
79 | border: 2px solid #00334d; |
|
|||
80 | vertical-align: center; |
|
|||
81 | font-weight: bold; |
|
|||
82 | } |
|
|||
83 |
|
||||
84 | .east tr { |
|
|||
85 | border: 1px solid #ffffff; |
|
|||
86 | } |
|
|||
87 |
|
||||
88 | .east td { |
|
|||
89 | border: 2px solid #e2e2e7; |
|
|||
90 | text-align: center; |
|
|||
91 | padding: 1px 15px 1px 15px; |
|
|||
92 | } |
|
|||
93 |
|
||||
94 | .east tr:nth-child(even) td:nth-child(n) { |
|
|||
95 | border-bottom: 12px solid #e2e2e7; |
|
|||
96 | } |
|
|||
97 |
|
||||
98 | .east td:nth-child(n) { |
|
|||
99 | border-right: 12px solid #e2e2e7; |
|
|||
100 | } |
|
|||
101 |
|
||||
102 | .east td:nth-last-child(4n+1) { |
|
|||
103 | border-right: 2px solid #e2e2e7; |
|
|||
104 | } |
|
|||
105 |
|
||||
106 | .east tr:nth-last-child(1) td:nth-child(n) { |
|
|||
107 | border-bottom: 3px solid #e2e2e7; |
|
|||
108 | } |
|
|||
109 |
|
||||
110 | .west { |
|
|||
111 | border: 2px solid #00334d; |
|
|||
112 | vertical-align: center; |
|
|||
113 | font-weight: bold; |
|
|||
114 | } |
|
|||
115 |
|
||||
116 | .west tr { |
|
|||
117 | border: 1px solid #ffffff; |
|
|||
118 | } |
|
|||
119 |
|
||||
120 | .west td { |
|
|||
121 | border: 2px solid #e2e2e7; |
|
|||
122 | text-align: center; |
|
|||
123 | padding: 1px 15px 1px 15px; |
|
|||
124 | } |
|
|||
125 |
|
||||
126 | .west tr:nth-child(even) td:nth-child(n) { |
|
|||
127 | border-bottom: 12px solid #e2e2e7; |
|
|||
128 | } |
|
|||
129 |
|
||||
130 | .west td:nth-child(n) { |
|
|||
131 | border-right: 12px solid #e2e2e7; |
|
|||
132 | } |
|
|||
133 |
|
||||
134 | .west td:nth-last-child(4n+1) { |
|
|||
135 | border-right: 2px solid #e2e2e7; |
|
|||
136 | } |
|
|||
137 |
|
||||
138 | .west tr:nth-last-child(1) td:nth-child(n) { |
|
|||
139 | border-bottom: 3px solid #e2e2e7; |
|
|||
140 | } |
|
|||
141 |
|
||||
142 | .south { |
|
|||
143 | border: 2px solid #00334d; |
|
|||
144 | vertical-align: center; |
|
|||
145 | font-weight: bold; |
|
|||
146 | } |
|
|||
147 |
|
||||
148 | .south tr { |
|
|||
149 | border: 1px solid #ffffff; |
|
|||
150 | } |
|
|||
151 |
|
||||
152 | .south td { |
|
|||
153 | border: 2px solid #e2e2e7; |
|
|||
154 | text-align: center; |
|
|||
155 | padding: 1px 15px 1px 15px; |
|
|||
156 | } |
|
|||
157 |
|
||||
158 | .south tr:nth-child(even) td:nth-child(n) { |
|
|||
159 | border-bottom: 12px solid #e2e2e7; |
|
|||
160 | } |
|
|||
161 |
|
||||
162 | .south td:nth-child(n) { |
|
|||
163 | border-right: 12px solid #e2e2e7; |
|
|||
164 | } |
|
|||
165 |
|
||||
166 | .south td:nth-last-child(4n+1) { |
|
|||
167 | border-right: 2px solid #e2e2e7; |
|
|||
168 | } |
|
|||
169 |
|
||||
170 | .south tr:nth-last-child(1) td:nth-child(n) { |
|
|||
171 | border-bottom: 3px solid #e2e2e7; |
|
|||
172 | } |
|
|||
173 | </style> |
|
39 | </style> | |
174 | {% endblock %} |
|
40 | {% endblock %} | |
175 | {% block extra-menu-actions %} |
|
41 | {% block extra-menu-actions %} | |
@@ -177,7 +43,7 | |||||
177 | <a href="{{ dev_conf.get_absolute_url_plot }}" target="_blank"> |
|
43 | <a href="{{ dev_conf.get_absolute_url_plot }}" target="_blank"> | |
178 | <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> | |
179 | </li> |
|
45 | </li> | |
180 |
{% endblock %} |
|
46 | {% endblock %} | |
181 | {% block extra-content %} |
|
47 | {% block extra-content %} | |
182 | {% if beams %} |
|
48 | {% if beams %} | |
183 | <h4>Beams:</h4> |
|
49 | <h4>Beams:</h4> | |
@@ -198,7 +64,7 | |||||
198 | <tr> |
|
64 | <tr> | |
199 | <td> |
|
65 | <td> | |
200 | <b>North Quarter</b> |
|
66 | <b>North Quarter</b> | |
201 |
<table class=" |
|
67 | <table class="module"> | |
202 | <tr> |
|
68 | <tr> | |
203 | <td {%if beam.pk == active_beam %} {{color_status.1}} t{%endif%} itle='{{module_messages.1}}'>{{beam.get_upvalues.0}}</td> |
|
69 | <td {%if beam.pk == active_beam %} {{color_status.1}} t{%endif%} itle='{{module_messages.1}}'>{{beam.get_upvalues.0}}</td> | |
204 | <td {%if beam.pk == active_beam %} {{color_status.2}} t{%endif%} itle='{{module_messages.2}}'>{{beam.get_upvalues.1}}</td> |
|
70 | <td {%if beam.pk == active_beam %} {{color_status.2}} t{%endif%} itle='{{module_messages.2}}'>{{beam.get_upvalues.1}}</td> | |
@@ -251,7 +117,7 | |||||
251 | </td> |
|
117 | </td> | |
252 | <td> |
|
118 | <td> | |
253 | <b>East Quarter</b> |
|
119 | <b>East Quarter</b> | |
254 |
<table class="e |
|
120 | <table class="module"> | |
255 | <tr> |
|
121 | <tr> | |
256 | <td {%if beam.pk == active_beam %} {{color_status.5}} t{%endif%} itle='{{module_messages.5}}'>{{beam.get_upvalues.4}}</td> |
|
122 | <td {%if beam.pk == active_beam %} {{color_status.5}} t{%endif%} itle='{{module_messages.5}}'>{{beam.get_upvalues.4}}</td> | |
257 | <td {%if beam.pk == active_beam %} {{color_status.6}} t{%endif%} itle='{{module_messages.6}}'>{{beam.get_upvalues.5}}</td> |
|
123 | <td {%if beam.pk == active_beam %} {{color_status.6}} t{%endif%} itle='{{module_messages.6}}'>{{beam.get_upvalues.5}}</td> | |
@@ -306,7 +172,7 | |||||
306 | <tr> |
|
172 | <tr> | |
307 | <td> |
|
173 | <td> | |
308 | <b>West Quarter</b> |
|
174 | <b>West Quarter</b> | |
309 |
<table class=" |
|
175 | <table class="module"> | |
310 | <tr> |
|
176 | <tr> | |
311 | <td {%if beam.pk == active_beam %} {{color_status.33}} {%endif%} title='{{module_messages.33}}'>{{beam.get_upvalues.32}}</td> |
|
177 | <td {%if beam.pk == active_beam %} {{color_status.33}} {%endif%} title='{{module_messages.33}}'>{{beam.get_upvalues.32}}</td> | |
312 | <td {%if beam.pk == active_beam %} {{color_status.34}} {%endif%} title='{{module_messages.34}}'>{{beam.get_upvalues.33}}</td> |
|
178 | <td {%if beam.pk == active_beam %} {{color_status.34}} {%endif%} title='{{module_messages.34}}'>{{beam.get_upvalues.33}}</td> | |
@@ -359,7 +225,7 | |||||
359 | </td> |
|
225 | </td> | |
360 | <td> |
|
226 | <td> | |
361 | <b>South Quarter</b> |
|
227 | <b>South Quarter</b> | |
362 |
<table class=" |
|
228 | <table class="module"> | |
363 | <tr> |
|
229 | <tr> | |
364 | <td {%if beam.pk == active_beam %} {{color_status.37}} {%endif%} title='{{module_messages.37}}'>{{beam.get_upvalues.36}}</td> |
|
230 | <td {%if beam.pk == active_beam %} {{color_status.37}} {%endif%} title='{{module_messages.37}}'>{{beam.get_upvalues.36}}</td> | |
365 | <td {%if beam.pk == active_beam %} {{color_status.38}} {%endif%} title='{{module_messages.38}}'>{{beam.get_upvalues.37}}</td> |
|
231 | <td {%if beam.pk == active_beam %} {{color_status.38}} {%endif%} title='{{module_messages.38}}'>{{beam.get_upvalues.37}}</td> |
@@ -146,9 +146,9 def abs_conf(request, id_conf): | |||||
146 | kwargs['dev_conf'] = conf |
|
146 | kwargs['dev_conf'] = conf | |
147 |
|
147 | |||
148 | if conf.operation_mode == 0: |
|
148 | if conf.operation_mode == 0: | |
149 |
kwargs['dev_conf_keys'] = [' |
|
149 | kwargs['dev_conf_keys'] = ['label', 'operation_mode'] | |
150 | else: |
|
150 | else: | |
151 |
kwargs['dev_conf_keys'] = [' |
|
151 | kwargs['dev_conf_keys'] = ['label', 'operation_mode', 'operation_value'] | |
152 |
|
152 | |||
153 | kwargs['title'] = 'ABS Configuration' |
|
153 | kwargs['title'] = 'ABS Configuration' | |
154 | kwargs['suptitle'] = 'Details' |
|
154 | kwargs['suptitle'] = 'Details' |
@@ -24,8 +24,7 class CGSConfigurationForm(forms.ModelForm): | |||||
24 |
|
24 | |||
25 | class Meta: |
|
25 | class Meta: | |
26 | model = CGSConfiguration |
|
26 | model = CGSConfiguration | |
27 | exclude = ('type', 'parameters', 'status') |
|
27 | exclude = ('type', 'parameters', 'status', 'author', 'hash') | |
28 | #fields = ('experiment', 'device', 'freq0', 'freq1', 'freq2', 'freq3') |
|
|||
29 |
|
28 | |||
30 |
|
29 | |||
31 | class UploadFileForm(forms.Form): |
|
30 | class UploadFileForm(forms.Form): |
@@ -24,4 +24,4 class DDSConfigurationForm(forms.ModelForm): | |||||
24 |
|
24 | |||
25 | class Meta: |
|
25 | class Meta: | |
26 | model = DDSConfiguration |
|
26 | model = DDSConfiguration | |
27 | exclude = ('type', 'parameters', 'status') No newline at end of file |
|
27 | exclude = ('type', 'parameters', 'status', 'author', 'hash') No newline at end of file |
@@ -20,7 +20,7 def dds_conf(request, id_conf): | |||||
20 | # messages.error(request, message=answer) |
|
20 | # messages.error(request, message=answer) | |
21 |
|
21 | |||
22 | kwargs['dev_conf'] = conf |
|
22 | kwargs['dev_conf'] = conf | |
23 |
kwargs['dev_conf_keys'] = [ |
|
23 | kwargs['dev_conf_keys'] = [ | |
24 | 'clock', |
|
24 | 'clock', | |
25 | 'multiplier', |
|
25 | 'multiplier', | |
26 | 'frequencyA_Mhz', |
|
26 | 'frequencyA_Mhz', |
@@ -1,7 +1,7 | |||||
1 | from django.contrib import admin |
|
1 | from django.contrib import admin | |
2 |
from .models import JARSConfiguration, JARS |
|
2 | from .models import JARSConfiguration, JARSFilter | |
3 |
|
3 | |||
4 | # Register your models here. |
|
4 | # Register your models here. | |
5 |
|
5 | |||
6 | admin.site.register(JARSConfiguration) |
|
6 | admin.site.register(JARSConfiguration) | |
7 |
admin.site.register(JARS |
|
7 | admin.site.register(JARSFilter) |
@@ -1,3 +1,30 | |||||
1 | [{"fields": {"name": "49_92MHz_clock60MHz_F1KHz_12_25_2", "clock": 60, "mult": 5, "fch": 49.92, "fch_decimal": 721554506, "filter_fir": 2, "filter_2": 12, "filter_5": 25}, "model": "jars.jarsfilter", "pk": 1}, |
|
1 | [ | |
2 | {"fields": {"name": "49_920MHz_clock60MHz_F1MHz_10_1_6", "clock": 60, "mult": 5, "fch": 49.92, "fch_decimal": 721554506, "filter_fir": 6, "filter_2": 10, "filter_5": 1}, "model": "jars.jarsfilter", "pk": 2} |
|
2 | { | |
3 | ] |
|
3 | "fields": { | |
|
4 | "name": "49_92MHz_clock60MHz_F1KHz_12_25_2", | |||
|
5 | "clock": 60, | |||
|
6 | "multiplier": 5, | |||
|
7 | "frequency": 49.92, | |||
|
8 | "f_decimal": 721554506, | |||
|
9 | "fir": 2, | |||
|
10 | "cic_2": 12, | |||
|
11 | "cic_5": 25 | |||
|
12 | }, | |||
|
13 | "model": "jars.jarsfilter", | |||
|
14 | "pk": 1 | |||
|
15 | }, | |||
|
16 | { | |||
|
17 | "fields": { | |||
|
18 | "name": "49_920MHz_clock60MHz_F1MHz_10_1_6", | |||
|
19 | "clock": 60, | |||
|
20 | "multiplier": 5, | |||
|
21 | "frequency": 49.92, | |||
|
22 | "f_decimal": 721554506, | |||
|
23 | "fir": 6, | |||
|
24 | "cic_2": 10, | |||
|
25 | "cic_5": 1 | |||
|
26 | }, | |||
|
27 | "model": "jars.jarsfilter", | |||
|
28 | "pk": 2 | |||
|
29 | } | |||
|
30 | ] No newline at end of file |
@@ -2,7 +2,7 import os | |||||
2 |
|
2 | |||
3 | from django import forms |
|
3 | from django import forms | |
4 | from apps.main.models import Device, Experiment |
|
4 | from apps.main.models import Device, Experiment | |
5 |
from .models import JARSConfiguration, JARS |
|
5 | from .models import JARSConfiguration, JARSFilter | |
6 | from .widgets import SpectralWidget |
|
6 | from .widgets import SpectralWidget | |
7 | from apps.main.forms import add_empty_choice |
|
7 | from apps.main.forms import add_empty_choice | |
8 |
|
8 | |||
@@ -20,63 +20,50 class JARSConfigurationForm(forms.ModelForm): | |||||
20 |
|
20 | |||
21 | if instance and instance.pk: |
|
21 | if instance and instance.pk: | |
22 | devices = Device.objects.filter(device_type__name='jars') |
|
22 | devices = Device.objects.filter(device_type__name='jars') | |
23 |
|
||||
24 | #if instance.experiment: |
|
|||
25 | # experiments = Experiment.objects.filter(pk=instance.experiment.id) |
|
|||
26 | # self.fields['experiment'].widget.choices = [(experiment.id, experiment) for experiment in experiments] |
|
|||
27 |
|
||||
28 | self.fields['device'].widget.choices = [(device.id, device) for device in devices] |
|
23 | self.fields['device'].widget.choices = [(device.id, device) for device in devices] | |
29 | #self.fields['spectral'].widget = SpectralWidget() |
|
|||
30 | self.fields['spectral_number'].widget.attrs['readonly'] = True |
|
24 | self.fields['spectral_number'].widget.attrs['readonly'] = True | |
31 | self.fields['spectral'].widget = SpectralWidget() |
|
25 | self.fields['spectral'].widget = SpectralWidget() | |
32 |
|
26 | |||
33 | #-------------JARS Configuration needs an Experiment----------------- |
|
|||
34 | #def clean(self): |
|
|||
35 | # cleaned_data = super(JARSConfigurationForm, self).clean() |
|
|||
36 | # experiment = cleaned_data.get('experiment') |
|
|||
37 | # if not experiment: |
|
|||
38 | # msg = "Error: Jars Configuration needs an Experiment" |
|
|||
39 | # self.add_error('experiment', msg) |
|
|||
40 |
|
||||
41 | class Meta: |
|
27 | class Meta: | |
42 | model = JARSConfiguration |
|
28 | model = JARSConfiguration | |
43 | exclude = ('type', 'parameters', 'status', 'filter_parms') |
|
29 | exclude = ('type', 'parameters', 'status', 'filter_parms', 'author', 'hash', 'filter') | |
44 |
|
||||
45 |
|
30 | |||
46 |
class JARS |
|
31 | class JARSFilterForm(forms.ModelForm): | |
47 | def __init__(self, *args, **kwargs): |
|
32 | def __init__(self, *args, **kwargs): | |
48 |
super(JARS |
|
33 | super(JARSFilterForm, self).__init__(*args, **kwargs) | |
49 | instance = getattr(self, 'instance', None) |
|
34 | instance = getattr(self, 'instance', None) | |
50 |
|
35 | |||
51 |
self.fields['f |
|
36 | self.fields['f_decimal'].widget.attrs['readonly'] = True | |
52 |
|
37 | |||
53 | if 'initial' in kwargs: |
|
38 | if 'initial' in kwargs: | |
54 | if 'filter_id' not in kwargs['initial']: |
|
39 | self.fields['filter_template'] = forms.ChoiceField( | |
55 | self.fields.pop('name') |
|
40 | choices=create_choices_from_model(JARSFilter), | |
56 | else: |
|
41 | initial = kwargs['initial']['id'] | |
57 | self.fields['name'] = forms.ChoiceField(choices=create_choices_from_model(JARSfilter)) |
|
42 | ) | |
58 |
|
|
43 | # self.fields['name'].initial = kwargs['initial']['id'] | |
59 |
|
44 | |||
60 |
|
|
45 | # filter_id = kwargs['initial']['filter_id'] | |
61 | for value in self.fields: |
|
46 | ||
62 |
|
|
47 | # if filter_id == 0: | |
63 |
|
|
48 | # for value in self.fields: | |
64 | self.fields['name'].label = "Filter Template Name" |
|
49 | # if value != 'name': | |
65 | else: |
|
50 | # self.fields.pop(value) | |
66 | self.fields['name'] = forms.ChoiceField(choices=create_choices_from_model(JARSfilter, kwargs['initial']['filter_id'])) |
|
51 | # self.fields['name'].label = "Filter Template Name" | |
67 | jars_filter = JARSfilter.objects.get(pk=kwargs['initial']['filter_id']) |
|
52 | # else: | |
68 | labels = [f.name for f in jars_filter._meta.get_fields()] |
|
53 | # self.fields['name'] = forms.ChoiceField(choices=create_choices_from_model(JARSFilter, kwargs['initial']['filter_id'])) | |
69 |
|
54 | # jars_filter = JARSFilter.objects.get(pk=kwargs['initial']['filter_id']) | ||
70 | for label in ['id']: |
|
55 | # labels = [f.name for f in jars_filter._meta.get_fields()] | |
71 | labels.remove(label) |
|
56 | ||
72 |
for label in |
|
57 | # for label in ['id']: | |
73 | self.fields['name'].initial = kwargs['initial']['filter_id'] |
|
58 | # labels.remove(label) | |
74 | self.fields[label].initial = getattr(jars_filter,label) |
|
59 | # for label in labels: | |
75 |
self.fields['name']. |
|
60 | # self.fields['name'].initial = kwargs['initial']['filter_id'] | |
|
61 | # self.fields[label].initial = getattr(jars_filter,label) | |||
|
62 | # self.fields['name'].label = "Filter Template Name" | |||
76 |
|
63 | |||
77 | class Meta: |
|
64 | class Meta: | |
78 |
model = JARS |
|
65 | model = JARSFilter | |
79 |
exclude = (' |
|
66 | exclude = ('name', ) | |
80 |
|
67 | |||
81 |
|
68 | |||
82 | class ExtFileField(forms.FileField): |
|
69 | class ExtFileField(forms.FileField): |
@@ -12,34 +12,52 from .utils import create_jarsfiles | |||||
12 | # Create your models here. |
|
12 | # Create your models here. | |
13 |
|
13 | |||
14 | EXPERIMENT_TYPE = ( |
|
14 | EXPERIMENT_TYPE = ( | |
15 |
|
|
15 | (0, 'RAW_DATA'), | |
16 |
|
|
16 | (1, 'PDATA'), | |
17 | ) |
|
17 | ) | |
18 |
|
18 | |||
19 | DATA_TYPE = ( |
|
19 | DATA_TYPE = ( | |
20 |
|
|
20 | (0, 'SHORT'), | |
21 |
|
|
21 | (1, 'FLOAT'), | |
22 | ) |
|
22 | ) | |
23 |
|
23 | |||
24 | DECODE_TYPE = ( |
|
24 | DECODE_TYPE = ( | |
25 |
|
|
25 | (0, 'None'), | |
26 |
|
|
26 | (1, 'TimeDomain'), | |
27 |
|
|
27 | (2, 'FreqDomain'), | |
28 |
|
|
28 | (3, 'InvFreqDomain'), | |
29 | ) |
|
29 | ) | |
30 |
|
30 | |||
31 | class JARSfilter(models.Model): |
|
31 | FILTER = '{"id":1, "clock": 60, "multiplier": 5, "frequency": 49.92, "f_decimal": 721554506, "fir": 2, "cic_2": 12, "cic_5": 25}' | |
|
32 | ||||
|
33 | class JARSFilter(models.Model): | |||
32 |
|
34 | |||
33 | JARS_NBITS = 32 |
|
35 | JARS_NBITS = 32 | |
34 |
|
36 | |||
35 |
name |
|
37 | name = models.CharField(verbose_name='Name', max_length=60, unique=True, default='') | |
36 |
clock |
|
38 | clock = models.FloatField(verbose_name='Clock In (MHz)', validators=[ | |
37 | mult = models.PositiveIntegerField(verbose_name='Multiplier',validators=[MinValueValidator(1), MaxValueValidator(20)], default=5) |
|
39 | MinValueValidator(5), MaxValueValidator(75)], null=True, default=60) | |
38 | fch = models.FloatField(verbose_name='Frequency (MHz)', validators=[MaxValueValidator(150)], null=True, default=49.9200) |
|
40 | multiplier = models.PositiveIntegerField(verbose_name='Multiplier', validators=[ | |
39 | fch_decimal = models.BigIntegerField(verbose_name='Frequency (Decimal)',validators=[MinValueValidator(-9223372036854775808), MaxValueValidator(2**JARS_NBITS-1)], null=True, default=721554505) |
|
41 | MinValueValidator(1), MaxValueValidator(20)], default=5) | |
40 | filter_2 = models.PositiveIntegerField(verbose_name='Filter 2',validators=[MinValueValidator(2), MaxValueValidator(100)], default = 10) |
|
42 | frequency = models.FloatField(verbose_name='Frequency (MHz)', validators=[ | |
41 | filter_5 = models.PositiveIntegerField(verbose_name='Filter 5',validators=[MinValueValidator(1), MaxValueValidator(100)], default = 1) |
|
43 | MaxValueValidator(150)], null=True, default=49.9200) | |
42 | filter_fir = models.PositiveIntegerField(verbose_name='FIR Filter',validators=[MinValueValidator(1), MaxValueValidator(100)], default = 6) |
|
44 | f_decimal = models.BigIntegerField(verbose_name='Frequency (Decimal)', validators=[ | |
|
45 | MinValueValidator(-9223372036854775808), MaxValueValidator(2**JARS_NBITS-1)], null=True, default=721554505) | |||
|
46 | cic_2 = models.PositiveIntegerField(verbose_name='CIC2', validators=[ | |||
|
47 | MinValueValidator(2), MaxValueValidator(100)], default=10) | |||
|
48 | scale_cic_2 = models.PositiveIntegerField(verbose_name='Scale CIC2', validators=[ | |||
|
49 | MinValueValidator(0), MaxValueValidator(6)], default=1) | |||
|
50 | cic_5 = models.PositiveIntegerField(verbose_name='CIC5', validators=[ | |||
|
51 | MinValueValidator(1), MaxValueValidator(100)], default=1) | |||
|
52 | scale_cic_5 = models.PositiveIntegerField(verbose_name='Scale CIC5', validators=[ | |||
|
53 | MinValueValidator(0), MaxValueValidator(20)], default=5) | |||
|
54 | fir = models.PositiveIntegerField(verbose_name='FIR', validators=[ | |||
|
55 | MinValueValidator(1), MaxValueValidator(100)], default=6) | |||
|
56 | scale_fir = models.PositiveIntegerField(verbose_name='Scale FIR', validators=[ | |||
|
57 | MinValueValidator(0), MaxValueValidator(7)], default=3) | |||
|
58 | number_taps = models.PositiveIntegerField(verbose_name='Number of taps', validators=[ | |||
|
59 | MinValueValidator(1), MaxValueValidator(256)], default=4) | |||
|
60 | taps = models.CharField(verbose_name='Taps', max_length=256, default='') | |||
43 |
|
61 | |||
44 | class Meta: |
|
62 | class Meta: | |
45 | db_table = 'jars_filters' |
|
63 | db_table = 'jars_filters' | |
@@ -47,119 +65,150 class JARSfilter(models.Model): | |||||
47 | def __unicode__(self): |
|
65 | def __unicode__(self): | |
48 | return u'%s' % (self.name) |
|
66 | return u'%s' % (self.name) | |
49 |
|
67 | |||
|
68 | def jsonify(self): | |||
|
69 | ||||
|
70 | data = {} | |||
|
71 | ignored = () | |||
|
72 | ||||
|
73 | for field in self._meta.fields: | |||
|
74 | if field.name in ignored: | |||
|
75 | continue | |||
|
76 | data[field.name] = field.value_from_object(self) | |||
|
77 | ||||
|
78 | return data | |||
|
79 | ||||
50 | def parms_to_dict(self): |
|
80 | def parms_to_dict(self): | |
51 |
|
81 | |||
52 | parameters = {} |
|
82 | parameters = {} | |
53 |
|
83 | |||
54 |
|
|
84 | parameters['name'] = self.name | |
55 |
parameters['clock'] |
|
85 | parameters['clock'] = float(self.clock) | |
56 |
parameters['mult'] |
|
86 | parameters['multiplier'] = int(self.multiplier) | |
57 |
parameters['f |
|
87 | parameters['frequency'] = float(self.frequency) | |
58 |
parameters['f |
|
88 | parameters['f_decimal'] = int(self.frequency) | |
59 |
parameters[' |
|
89 | parameters['fir'] = int(self.fir) | |
60 |
parameters[' |
|
90 | parameters['cic_2'] = int(self.cic_2) | |
61 |
parameters[' |
|
91 | parameters['cic_5'] = int(self.cic_5) | |
62 |
|
92 | |||
63 | return parameters |
|
93 | return parameters | |
64 |
|
94 | |||
65 | def dict_to_parms(self, parameters): |
|
95 | def dict_to_parms(self, parameters): | |
66 |
|
96 | |||
67 |
|
|
97 | self.name = parameters['name'] | |
68 |
self.clock |
|
98 | self.clock = parameters['clock'] | |
69 |
self.mult |
|
99 | self.multiplier = parameters['multiplier'] | |
70 |
self.f |
|
100 | self.frequency = parameters['frequency'] | |
71 |
self.f |
|
101 | self.f_decimal = parameters['f_decimal'] | |
72 |
self.fi |
|
102 | self.fir = parameters['fir'] | |
73 |
self. |
|
103 | self.cic_2 = parameters['cic_2'] | |
74 |
self. |
|
104 | self.cic_5 = parameters['cic_5'] | |
75 |
|
105 | |||
76 |
|
106 | |||
77 | class JARSConfiguration(Configuration): |
|
107 | class JARSConfiguration(Configuration): | |
78 |
|
108 | |||
79 |
ADC_RESOLUTION |
|
109 | ADC_RESOLUTION = 8 | |
80 | PCI_DIO_BUSWIDTH = 32 |
|
110 | PCI_DIO_BUSWIDTH = 32 | |
81 |
HEADER_VERSION |
|
111 | HEADER_VERSION = 1103 | |
82 |
BEGIN_ON_START |
|
112 | BEGIN_ON_START = True | |
83 |
REFRESH_RATE |
|
113 | REFRESH_RATE = 1 | |
84 |
|
114 | |||
85 | exp_type = models.PositiveIntegerField(verbose_name='Experiment Type', choices=EXPERIMENT_TYPE, default=0) |
|
115 | exp_type = models.PositiveIntegerField( | |
86 | cards_number = models.PositiveIntegerField(verbose_name='Number of Cards', validators=[MinValueValidator(1), MaxValueValidator(4)], default = 1) |
|
116 | verbose_name='Experiment Type', choices=EXPERIMENT_TYPE, default=0) | |
87 |
c |
|
117 | cards_number = models.PositiveIntegerField(verbose_name='Number of Cards', validators=[ | |
88 | channels = models.CharField(verbose_name='Channels', max_length=15, default = '1,2,3,4,5') |
|
118 | MinValueValidator(1), MaxValueValidator(4)], default=1) | |
89 | data_type = models.PositiveIntegerField(verbose_name='Data Type', choices=DATA_TYPE, default=0) |
|
119 | channels_number = models.PositiveIntegerField(verbose_name='Number of Channels', validators=[ | |
90 | raw_data_blocks = models.PositiveIntegerField(verbose_name='Raw Data Blocks', validators=[MaxValueValidator(5000)], default=60) |
|
120 | MinValueValidator(1), MaxValueValidator(8)], default=5) | |
91 | profiles_block = models.PositiveIntegerField(verbose_name='Profiles Per Block', default=400) |
|
121 | channels = models.CharField( | |
92 | acq_profiles = models.PositiveIntegerField(verbose_name='Acquired Profiles', default=400) |
|
122 | verbose_name='Channels', max_length=15, default='1,2,3,4,5') | |
93 | ftp_interval = models.PositiveIntegerField(verbose_name='FTP Interval', default=60) |
|
123 | data_type = models.PositiveIntegerField( | |
94 | fftpoints = models.PositiveIntegerField(verbose_name='FFT Points',default=16) |
|
124 | verbose_name='Data Type', choices=DATA_TYPE, default=0) | |
95 | cohe_integr_str = models.PositiveIntegerField(verbose_name='Coh. Int. Stride',validators=[MinValueValidator(1)], default=30) |
|
125 | raw_data_blocks = models.PositiveIntegerField( | |
96 |
|
|
126 | verbose_name='Raw Data Blocks', validators=[MaxValueValidator(5000)], default=60) | |
97 | incohe_integr = models.PositiveIntegerField(verbose_name='Incoherent Integrations',validators=[MinValueValidator(1)], default=30) |
|
127 | profiles_block = models.PositiveIntegerField( | |
98 | decode_data = models.PositiveIntegerField(verbose_name='Decode Data', choices=DECODE_TYPE, default=0) |
|
128 | verbose_name='Profiles Per Block', default=400) | |
99 | post_coh_int = models.BooleanField(verbose_name='Post Coherent Integration', default=False) |
|
129 | acq_profiles = models.PositiveIntegerField( | |
100 | spectral_number = models.PositiveIntegerField(verbose_name='# Spectral Combinations',validators=[MinValueValidator(1)], default=1) |
|
130 | verbose_name='Acquired Profiles', default=400) | |
101 | spectral = models.CharField(verbose_name='Combinations', max_length=5000, default = '[0, 0],') |
|
131 | ftp_interval = models.PositiveIntegerField( | |
102 | create_directory = models.BooleanField(verbose_name='Create Directory Per Day', default=True) |
|
132 | verbose_name='FTP Interval', default=60) | |
103 | include_expname = models.BooleanField(verbose_name='Experiment Name in Directory', default=False) |
|
133 | fftpoints = models.PositiveIntegerField( | |
|
134 | verbose_name='FFT Points', default=16) | |||
|
135 | cohe_integr_str = models.PositiveIntegerField( | |||
|
136 | verbose_name='Coh. Int. Stride', validators=[MinValueValidator(1)], default=30) | |||
|
137 | cohe_integr = models.PositiveIntegerField( | |||
|
138 | verbose_name='Coherent Integrations', validators=[MinValueValidator(1)], default=30) | |||
|
139 | incohe_integr = models.PositiveIntegerField( | |||
|
140 | verbose_name='Incoherent Integrations', validators=[MinValueValidator(1)], default=30) | |||
|
141 | decode_data = models.PositiveIntegerField( | |||
|
142 | verbose_name='Decode Data', choices=DECODE_TYPE, default=0) | |||
|
143 | post_coh_int = models.BooleanField( | |||
|
144 | verbose_name='Post Coherent Integration', default=False) | |||
|
145 | spectral_number = models.PositiveIntegerField( | |||
|
146 | verbose_name='# Spectral Combinations', validators=[MinValueValidator(1)], default=1) | |||
|
147 | spectral = models.CharField( | |||
|
148 | verbose_name='Combinations', max_length=5000, default='[0, 0],') | |||
|
149 | create_directory = models.BooleanField( | |||
|
150 | verbose_name='Create Directory Per Day', default=True) | |||
|
151 | include_expname = models.BooleanField( | |||
|
152 | verbose_name='Experiment Name in Directory', default=False) | |||
104 | #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) | |
105 | save_ch_dc = models.BooleanField(verbose_name='Save Channels DC', default=True) |
|
154 | save_ch_dc = models.BooleanField( | |
106 |
|
|
155 | verbose_name='Save Channels DC', default=True) | |
107 | filter_parms = models.CharField(max_length=10000, default='{"clock": 60, "mult": 5, "fch": 49.92, "fch_decimal": 721554506, "filter_fir": 2, "filter_2": 12, "filter_5": 25}') |
|
156 | save_data = models.BooleanField(verbose_name='Save Data', default=True) | |
|
157 | filter_parms = models.CharField( | |||
|
158 | max_length=10000, default=FILTER) | |||
|
159 | filter = models.ForeignKey( | |||
|
160 | 'JARSFilter', verbose_name='Filter', null=True, blank=True, on_delete=models.CASCADE) | |||
108 |
|
161 | |||
109 | class Meta: |
|
162 | class Meta: | |
110 | db_table = 'jars_configurations' |
|
163 | db_table = 'jars_configurations' | |
111 |
|
164 | |||
112 | def filter_resolution(self): |
|
165 | def filter_resolution(self): | |
113 |
filter_parms = |
|
166 | filter_parms = json.loads(self.filter_parms) | |
114 | if filter_parms.__class__.__name__=='str': |
|
167 | clock = float(filter_parms['clock']) | |
115 | filter_parms = eval(filter_parms) |
|
168 | cic_2 = filter_parms['cic_2'] | |
116 |
|
169 | cic_5 = filter_parms['cic_5'] | ||
117 |
fi |
|
170 | fir = filter_parms['fir'] | |
118 | filter_2 = filter_parms['filter_2'] |
|
171 | resolution = round((clock/(cic_2*cic_5*fir)), 2) | |
119 | filter_5 = filter_parms['filter_5'] |
|
|||
120 | filter_fir = filter_parms['filter_fir'] |
|
|||
121 |
|
||||
122 | resolution = round((filter_clock/(filter_2*filter_5*filter_fir)),2) |
|
|||
123 | return resolution |
|
172 | return resolution | |
124 |
|
173 | |||
125 | def dict_to_parms(self, params, id=None): |
|
174 | def dict_to_parms(self, params, id=None): | |
126 |
|
175 | |||
127 | if id is not None: |
|
176 | if id is not None: | |
128 | data = Params(params).get_conf(id_conf=id) |
|
177 | data = Params(params).get_conf(id_conf=id) | |
129 | else: |
|
178 | else: | |
130 | data = Params(params).get_conf(dtype='jars') |
|
179 | data = Params(params).get_conf(dtype='jars') | |
131 | data['filter_parms'] = params['filter_parms'] |
|
180 | data['filter_parms'] = params['filter_parms'] | |
132 |
|
181 | |||
133 |
self.name |
|
182 | # self.name = data['name'] | |
134 |
self.exp_type |
|
183 | self.exp_type = data['exp_type'] | |
135 | #----PDATA---- |
|
184 | #----PDATA---- | |
136 | if self.exp_type == 1: |
|
185 | if self.exp_type == 1: | |
137 |
self.incohe_integr |
|
186 | self.incohe_integr = data['incohe_integr'] | |
138 | self.spectral_number = data['spectral_number'] |
|
187 | self.spectral_number = data['spectral_number'] | |
139 |
self.spectral |
|
188 | self.spectral = data['spectral'] | |
140 |
self.fftpoints |
|
189 | self.fftpoints = data['fftpoints'] | |
141 |
self.save_ch_dc |
|
190 | self.save_ch_dc = data['save_ch_dc'] | |
142 | else: |
|
191 | else: | |
143 | self.raw_data_blocks = data['raw_data_blocks'] |
|
192 | self.raw_data_blocks = data['raw_data_blocks'] | |
144 |
#----PDATA---- |
|
193 | #----PDATA---- | |
145 |
self.cards_number |
|
194 | self.cards_number = data['cards_number'] | |
146 | self.channels_number = data['channels_number'] |
|
195 | self.channels_number = data['channels_number'] | |
147 |
self.channels |
|
196 | self.channels = data['channels'] | |
148 |
self.data_type |
|
197 | self.data_type = data['data_type'] | |
149 |
self.profiles_block |
|
198 | self.profiles_block = data['profiles_block'] | |
150 |
self.acq_profiles |
|
199 | self.acq_profiles = data['acq_profiles'] | |
151 |
self.ftp_interval |
|
200 | self.ftp_interval = data['ftp_interval'] | |
152 | self.cohe_integr_str = data['cohe_integr_str'] |
|
201 | self.cohe_integr_str = data['cohe_integr_str'] | |
153 |
self.cohe_integr |
|
202 | self.cohe_integr = data['cohe_integr'] | |
154 | #----DECODE---- |
|
203 | #----DECODE---- | |
155 |
self.decode_data |
|
204 | self.decode_data = data['decode_data'] | |
156 |
self.post_coh_int |
|
205 | self.post_coh_int = data['post_coh_int'] | |
157 | #----DECODE---- |
|
206 | #----DECODE---- | |
158 | self.create_directory = data['create_directory'] |
|
207 | self.create_directory = data['create_directory'] | |
159 |
self.include_expname |
|
208 | self.include_expname = data['include_expname'] | |
160 |
self.save_data |
|
209 | self.save_data = data['save_data'] | |
161 |
self.filter_parms |
|
210 | self.filter_parms = json.dumps(data['filter_parms']) | |
162 |
|
211 | |||
163 | self.save() |
|
212 | self.save() | |
164 |
|
213 | |||
165 | def parms_to_text(self, file_format='jars'): |
|
214 | def parms_to_text(self, file_format='jars'): | |
@@ -171,25 +220,29 class JARSConfiguration(Configuration): | |||||
171 | data['configurations']['allIds'].remove(key) |
|
220 | data['configurations']['allIds'].remove(key) | |
172 | data['configurations']['byId'].pop(key) |
|
221 | data['configurations']['byId'].pop(key) | |
173 | elif data['configurations']['byId'][key]['device_type'] == 'jars': |
|
222 | elif data['configurations']['byId'][key]['device_type'] == 'jars': | |
174 |
data['configurations']['byId'][key] = self.parms_to_dict( |
|
223 | data['configurations']['byId'][key] = self.parms_to_dict( | |
|
224 | )['configurations']['byId'][str(self.pk)] | |||
175 | elif data['configurations']['byId'][key]['device_type'] == 'rc': |
|
225 | elif data['configurations']['byId'][key]['device_type'] == 'rc': | |
176 | data['configurations']['byId'][key]['pulses'] = '' |
|
226 | data['configurations']['byId'][key]['pulses'] = '' | |
177 | data['configurations']['byId'][key]['delays'] = '' |
|
227 | data['configurations']['byId'][key]['delays'] = '' | |
178 |
rc_ids = [pk for pk in data['configurations']['allIds'] |
|
228 | rc_ids = [pk for pk in data['configurations']['allIds'] | |
179 |
|
|
229 | if data['configurations']['byId'][pk]['device_type'] == 'rc'] | |
180 |
|
230 | mix_ids = [pk for pk in rc_ids if data['configurations'] | ||
|
231 | ['byId'][pk]['mix']] | |||
|
232 | ||||
181 | if mix_ids: |
|
233 | if mix_ids: | |
182 | params = data['configurations']['byId'][mix_ids[0]]['parameters'] |
|
234 | params = data['configurations']['byId'][mix_ids[0]]['parameters'] | |
183 |
rc = data['configurations']['byId'][params.split( |
|
235 | rc = data['configurations']['byId'][params.split( | |
|
236 | '-')[0].split('|')[0]] | |||
184 | rc['mix'] = True |
|
237 | rc['mix'] = True | |
185 | data['configurations']['byId'][rc['id']] = rc |
|
238 | data['configurations']['byId'][rc['id']] = rc | |
186 | elif len(rc_ids)==0: |
|
239 | elif len(rc_ids) == 0: | |
187 | self.message = 'File needs RC configuration' |
|
240 | self.message = 'File needs RC configuration' | |
188 | return '' |
|
241 | return '' | |
189 |
|
242 | |||
190 | json_data = json.dumps(data) |
|
243 | json_data = json.dumps(data) | |
191 | racp_file, filter_file = create_jarsfiles(json_data) |
|
244 | racp_file, filter_file = create_jarsfiles(json_data) | |
192 | if file_format=='racp': |
|
245 | if file_format == 'racp': | |
193 | return racp_file |
|
246 | return racp_file | |
194 |
|
247 | |||
195 | return filter_file |
|
248 | return filter_file | |
@@ -234,7 +287,8 class JARSConfiguration(Configuration): | |||||
234 | def read_device(self): |
|
287 | def read_device(self): | |
235 |
|
288 | |||
236 | try: |
|
289 | try: | |
237 |
payload = self.request( |
|
290 | payload = self.request( | |
|
291 | 'read', params={'name': self.experiment.name}) | |||
238 | self.message = 'Configuration loaded' |
|
292 | self.message = 'Configuration loaded' | |
239 | except: |
|
293 | except: | |
240 | self.device.status = 0 |
|
294 | self.device.status = 0 | |
@@ -259,13 +313,14 class JARSConfiguration(Configuration): | |||||
259 | elif data['configurations']['byId'][key]['device_type'] == 'rc': |
|
313 | elif data['configurations']['byId'][key]['device_type'] == 'rc': | |
260 | data['configurations']['byId'][key]['pulses'] = '' |
|
314 | data['configurations']['byId'][key]['pulses'] = '' | |
261 | data['configurations']['byId'][key]['delays'] = '' |
|
315 | data['configurations']['byId'][key]['delays'] = '' | |
262 |
rc_ids = [pk for pk in data['configurations']['allIds'] |
|
316 | rc_ids = [pk for pk in data['configurations']['allIds'] | |
263 | if len(rc_ids)==0: |
|
317 | if data['configurations']['byId'][pk]['device_type'] == 'rc'] | |
|
318 | if len(rc_ids) == 0: | |||
264 | self.message = 'Missing RC configuration' |
|
319 | self.message = 'Missing RC configuration' | |
265 | return False |
|
320 | return False | |
266 |
|
321 | |||
267 | json_data = json.dumps(data) |
|
322 | json_data = json.dumps(data) | |
268 |
|
323 | |||
269 | try: |
|
324 | try: | |
270 | payload = self.request('write', 'post', json=json_data) |
|
325 | payload = self.request('write', 'post', json=json_data) | |
271 | self.device.status = payload['status'] |
|
326 | self.device.status = payload['status'] | |
@@ -301,24 +356,23 class JARSConfiguration(Configuration): | |||||
301 |
|
356 | |||
302 | return True |
|
357 | return True | |
303 |
|
358 | |||
304 |
|
||||
305 | def get_log(self): |
|
359 | def get_log(self): | |
306 |
|
360 | |||
307 | payload = None |
|
361 | payload = None | |
308 |
|
362 | |||
309 | try: |
|
363 | try: | |
310 |
payload = requests.get(self.device.url('get_log'), params={ |
|
364 | payload = requests.get(self.device.url('get_log'), params={ | |
|
365 | 'name': self.experiment.name}) | |||
311 | except: |
|
366 | except: | |
312 | self.device.status = 0 |
|
367 | self.device.status = 0 | |
313 | self.device.save() |
|
368 | self.device.save() | |
314 | self.message = 'Jars API is not running.' |
|
369 | self.message = 'Jars API is not running.' | |
315 | return False |
|
370 | return False | |
316 |
|
371 | |||
317 | self.message = 'Jars API is running' |
|
372 | self.message = 'Jars API is running' | |
318 |
|
373 | |||
319 | return payload |
|
374 | return payload | |
320 |
|
375 | |||
321 |
|
||||
322 | def update_from_file(self, filename): |
|
376 | def update_from_file(self, filename): | |
323 |
|
377 | |||
324 | f = JARSFile(filename) |
|
378 | f = JARSFile(filename) |
@@ -1,4 +1,4 | |||||
1 |
$("#id_f |
|
1 | $("#id_frequency").change(function() { | |
2 | updateParameters() |
|
2 | updateParameters() | |
3 | }); |
|
3 | }); | |
4 |
|
4 | |||
@@ -6,25 +6,24 $("#id_clock").change(function() { | |||||
6 | updateParameters() |
|
6 | updateParameters() | |
7 | }); |
|
7 | }); | |
8 |
|
8 | |||
9 | $("#id_mult").change(function() { |
|
9 | $("#id_multiplier").change(function() { | |
10 | updateParameters() |
|
10 | updateParameters() | |
11 | }); |
|
11 | }); | |
12 |
|
12 | |||
13 | function updateParameters(){ |
|
13 | function updateParameters(){ | |
14 |
var |
|
14 | var clock = $("#id_clock").val(); // clock frequency (MHz) | |
15 |
var fch = $("#id_f |
|
15 | var fch = $("#id_frequency").val(); // RF frequency (MHz) | |
16 |
var m_dds = $("#id_mult").val(); |
|
16 | var m_dds = $("#id_multiplier").val(); // DDS multiplier | |
17 |
|
17 | |||
18 |
if (Math.abs(fch) < |
|
18 | if (Math.abs(fch) < clock/2){ // Si se cumple nyquist | |
19 |
var nco = Math.pow(2,32)*((fch/ |
|
19 | var nco = Math.pow(2,32)*((fch/clock)%1); | |
20 | //var nco_i = Math.round(nco/m_dds)*m_dds; |
|
20 | //var nco_i = Math.round(nco/m_dds)*m_dds; | |
21 | var nco_i = Math.round(nco) |
|
21 | var nco_i = Math.round(nco) | |
22 | } |
|
22 | } | |
23 | else { |
|
23 | else { | |
24 |
nco = Math.pow(2,32)*( |
|
24 | nco = Math.pow(2,32)*(clock-fch)/(clock); | |
25 | //nco_i = Math.round(nco/m_dds)*m_dds; |
|
25 | //nco_i = Math.round(nco/m_dds)*m_dds; | |
26 | var nco_i = Math.round(nco) |
|
26 | var nco_i = Math.round(nco) | |
27 | } |
|
27 | } | |
28 | fch_decimal = $("#id_fch_decimal") |
|
28 | $("#id_f_decimal").val(nco_i) | |
29 | $(fch_decimal).val(nco_i) |
|
|||
30 | } |
|
29 | } |
@@ -4,16 +4,22 | |||||
4 | {% load main_tags %} |
|
4 | {% load main_tags %} | |
5 |
|
5 | |||
6 | {% block extra-menu-actions %} |
|
6 | {% block extra-menu-actions %} | |
7 |
<li><a href="{{ dev_conf.get_absolute_url_log }}"><span class="glyphicon glyphicon-save-file" aria-hidden="true"></span> |
|
7 | <li><a href="{{ dev_conf.get_absolute_url_log }}"><span class="glyphicon glyphicon-save-file" aria-hidden="true"></span> | |
|
8 | Get Log File</a></li> | |||
8 | {% endblock %} |
|
9 | {% endblock %} | |
9 |
|
10 | |||
10 | {% block extra-content %} |
|
11 | {% block extra-content %} | |
11 |
|
12 | |||
12 | <div class="clearfix"></div> |
|
13 | <div class="clearfix"></div> | |
13 |
<h2> |
|
14 | <h2>Filter: {{resolution}}</h2> | |
14 |
< |
|
15 | <br> | |
15 | <div class="panel-group" id="div_lines" role="tablist" aria-multiselectable="true"> |
|
16 | <table class="table table-bordered"> | |
16 | {% include "jars_filter.html" %} |
|
17 | {% for key in filter_keys %} | |
17 | </div> |
|
18 | <tr> | |
|
19 | <th>{% get_verbose_field_name filter_obj key %}</th> | |||
|
20 | <td>{{filter|attr:key}}</td> | |||
|
21 | </tr> | |||
|
22 | {% endfor %} | |||
|
23 | </table> | |||
18 |
|
24 | |||
19 | {% endblock extra-content%} |
|
25 | {% endblock extra-content%} No newline at end of file |
@@ -8,25 +8,33 | |||||
8 | {% csrf_token %} |
|
8 | {% csrf_token %} | |
9 | {% bootstrap_form form layout='horizontal' size='medium' %} |
|
9 | {% bootstrap_form form layout='horizontal' size='medium' %} | |
10 | <div style="clear: both;"></div> |
|
10 | <div style="clear: both;"></div> | |
11 | <h2>JARS filter</h2> |
|
11 | <h2>Filter <small>{{filter_name}}</small></h2> | |
12 |
< |
|
12 | <br> | |
13 | <div class="panel-group" id="div_lines" role="tablist" aria-multiselectable="true"> |
|
13 | {% bootstrap_form filter_form layout='horizontal' size='medium' %} | |
14 | {% include "jars_filter_edit.html" %} |
|
14 | <div style="clear: both;"></div> | |
|
15 | <br> | |||
|
16 | <div class="pull-right"> | |||
|
17 | <button type="button" class="btn btn-primary" onclick="{% if previous %}window.location.replace('{{ previous }}');{% else %}history.go(-1);{% endif %}">Cancel</button> | |||
|
18 | <button type="submit" class="btn btn-primary">{{button}}</button> | |||
15 | </div> |
|
19 | </div> | |
|
20 | ||||
16 | <div style="clear: both;"></div> |
|
21 | <div style="clear: both;"></div> | |
17 | <br> |
|
22 | <br> | |
18 | </form> |
|
23 | </form> | |
19 | {% endblock %} |
|
24 | {% endblock %} | |
20 |
|
25 | |||
21 |
|
||||
22 | {% block extra-js%} |
|
26 | {% block extra-js%} | |
23 | <script src="{% static 'js/jars.js' %}"></script> |
|
27 | <script src="{% static 'js/jars.js' %}"></script> | |
24 |
|
28 | <script src="{% static 'js/filters.js' %}"></script> | ||
25 | <script type="text/javascript"> |
|
29 | <script type="text/javascript"> | |
26 |
|
30 | |||
27 | $("#bt_cancel").click(function() { |
|
31 | $("#bt_cancel").click(function () { | |
28 | document.location = "{% url 'url_jars_conf' id_dev %}"; |
|
32 | document.location = "{% url 'url_jars_conf' id_dev %}"; | |
29 | }); |
|
33 | }); | |
|
34 | ||||
|
35 | $("#id_filter_template").change(function () { | |||
|
36 | document.location = "{% url 'url_change_jars_filter' id_dev %}" + $("#id_filter_template").val(); | |||
|
37 | }); | |||
30 |
|
38 | |||
31 | </script> |
|
39 | </script> | |
32 | {% endblock %} |
|
40 | {% endblock %} No newline at end of file |
@@ -7,8 +7,8 from django.http import HttpResponse | |||||
7 | from apps.main.models import Device |
|
7 | from apps.main.models import Device | |
8 | from apps.main.views import sidebar |
|
8 | from apps.main.views import sidebar | |
9 |
|
9 | |||
10 |
from .models import JARSConfiguration, JARS |
|
10 | from .models import JARSConfiguration, JARSFilter | |
11 |
from .forms import JARSConfigurationForm, JARS |
|
11 | from .forms import JARSConfigurationForm, JARSFilterForm, JARSImportForm | |
12 |
|
12 | |||
13 | import json |
|
13 | import json | |
14 | # Create your views here. |
|
14 | # Create your views here. | |
@@ -17,26 +17,23 def jars_conf(request, id_conf): | |||||
17 |
|
17 | |||
18 | conf = get_object_or_404(JARSConfiguration, pk=id_conf) |
|
18 | conf = get_object_or_404(JARSConfiguration, pk=id_conf) | |
19 |
|
19 | |||
20 |
filter_parms = |
|
20 | filter_parms = json.loads(conf.filter_parms) | |
21 | if filter_parms.__class__.__name__=='str': |
|
|||
22 | filter_parms = eval(filter_parms) |
|
|||
23 |
|
21 | |||
24 | kwargs = {} |
|
22 | kwargs = {} | |
25 | kwargs['filter'] = filter_parms |
|
23 | kwargs['filter'] = filter_parms | |
26 | kwargs['filter_keys'] = ['clock', 'mult', 'fch', 'fch_decimal', |
|
24 | kwargs['filter_obj'] = JARSFilter.objects.get(pk=1) | |
27 | 'filter_fir', 'filter_2', 'filter_5'] |
|
25 | kwargs['filter_keys'] = ['clock', 'multiplier', 'frequency', 'f_decimal', | |
|
26 | 'cic_2', 'scale_cic_2', 'cic_5', 'scale_cic_5', 'fir', | |||
|
27 | 'scale_fir', 'number_taps', 'taps'] | |||
28 |
|
28 | |||
29 | filter_resolution=conf.filter_resolution() |
|
29 | filter_resolution = conf.filter_resolution() | |
30 | kwargs['resolution'] = '{} (MHz)'.format(filter_resolution) |
|
30 | kwargs['resolution'] = '{} (MHz)'.format(filter_resolution) | |
31 | if filter_resolution < 1: |
|
31 | if filter_resolution < 1: | |
32 | kwargs['resolution'] = '{} (kHz)'.format(filter_resolution*1000) |
|
32 | kwargs['resolution'] = '{} (kHz)'.format(filter_resolution*1000) | |
33 |
|
33 | |||
34 | kwargs['status'] = conf.device.get_status_display() |
|
34 | kwargs['status'] = conf.device.get_status_display() | |
35 |
|
||||
36 |
|
||||
37 | kwargs['dev_conf'] = conf |
|
35 | kwargs['dev_conf'] = conf | |
38 | kwargs['dev_conf_keys'] = ['name', |
|
36 | kwargs['dev_conf_keys'] = ['cards_number', 'channels_number', 'channels', | |
39 | 'cards_number', 'channels_number', 'channels', |
|
|||
40 | 'ftp_interval', 'data_type','acq_profiles', |
|
37 | 'ftp_interval', 'data_type','acq_profiles', | |
41 | 'profiles_block', 'raw_data_blocks', 'ftp_interval', |
|
38 | 'profiles_block', 'raw_data_blocks', 'ftp_interval', | |
42 | 'cohe_integr_str', 'cohe_integr', 'decode_data', 'post_coh_int', |
|
39 | 'cohe_integr_str', 'cohe_integr', 'decode_data', 'post_coh_int', | |
@@ -55,12 +52,6 def jars_conf(request, id_conf): | |||||
55 | kwargs['title'] = 'JARS Configuration' |
|
52 | kwargs['title'] = 'JARS Configuration' | |
56 | kwargs['suptitle'] = 'Details' |
|
53 | kwargs['suptitle'] = 'Details' | |
57 |
|
54 | |||
58 | kwargs['button'] = 'Edit Configuration' |
|
|||
59 |
|
||||
60 | #kwargs['no_play'] = True |
|
|||
61 |
|
||||
62 | #kwargs['only_stop'] = True |
|
|||
63 |
|
||||
64 | ###### SIDEBAR ###### |
|
55 | ###### SIDEBAR ###### | |
65 | kwargs.update(sidebar(conf=conf)) |
|
56 | kwargs.update(sidebar(conf=conf)) | |
66 |
|
57 | |||
@@ -70,24 +61,21 def jars_conf_edit(request, id_conf): | |||||
70 |
|
61 | |||
71 | conf = get_object_or_404(JARSConfiguration, pk=id_conf) |
|
62 | conf = get_object_or_404(JARSConfiguration, pk=id_conf) | |
72 |
|
63 | |||
73 |
filter_parms = |
|
64 | filter_parms = json.loads(conf.filter_parms) | |
74 | if filter_parms.__class__.__name__=='str': |
|
65 | ||
75 | filter_parms = eval(filter_parms) |
|
|||
76 |
|
||||
77 | if request.method=='GET': |
|
66 | if request.method=='GET': | |
78 | form = JARSConfigurationForm(instance=conf) |
|
67 | form = JARSConfigurationForm(instance=conf) | |
79 |
filter_form = JARS |
|
68 | filter_form = JARSFilterForm(initial=filter_parms) | |
80 |
|
69 | |||
81 | if request.method=='POST': |
|
70 | if request.method=='POST': | |
82 | form = JARSConfigurationForm(request.POST, instance=conf) |
|
71 | form = JARSConfigurationForm(request.POST, instance=conf) | |
83 |
filter_form = JARS |
|
72 | filter_form = JARSFilterForm(request.POST) | |
84 |
|
73 | |||
85 | if filter_form.is_valid(): |
|
74 | if filter_form.is_valid(): | |
86 |
|
|
75 | jars_filter = filter_form.cleaned_data | |
87 | try: |
|
76 | jars_filter['id'] = request.POST['filter_template'] | |
88 | jars_filter.pop('name') |
|
77 | else: | |
89 | except: |
|
78 | messages.error(request, filter_form.errors) | |
90 | pass |
|
|||
91 |
|
79 | |||
92 | if form.is_valid(): |
|
80 | if form.is_valid(): | |
93 | conf = form.save(commit=False) |
|
81 | conf = form.save(commit=False) | |
@@ -100,6 +88,7 def jars_conf_edit(request, id_conf): | |||||
100 | kwargs['id_dev'] = conf.id |
|
88 | kwargs['id_dev'] = conf.id | |
101 | kwargs['form'] = form |
|
89 | kwargs['form'] = form | |
102 | kwargs['filter_form'] = filter_form |
|
90 | kwargs['filter_form'] = filter_form | |
|
91 | kwargs['filter_name'] = JARSFilter.objects.get(pk=filter_parms['id']).name | |||
103 | kwargs['title'] = 'Device Configuration' |
|
92 | kwargs['title'] = 'Device Configuration' | |
104 | kwargs['suptitle'] = 'Edit' |
|
93 | kwargs['suptitle'] = 'Edit' | |
105 | kwargs['button'] = 'Save' |
|
94 | kwargs['button'] = 'Save' | |
@@ -171,49 +160,14 def read_conf(request, conf_id): | |||||
171 |
|
160 | |||
172 | return render(request, 'jars_conf_edit.html', kwargs) |
|
161 | return render(request, 'jars_conf_edit.html', kwargs) | |
173 |
|
162 | |||
174 |
|
163 | def change_filter(request, conf_id, filter_id): | ||
175 |
|
||||
176 | def change_filter(request, conf_id, filter_id=None): |
|
|||
177 |
|
164 | |||
178 | conf = get_object_or_404(JARSConfiguration, pk=conf_id) |
|
165 | conf = get_object_or_404(JARSConfiguration, pk=conf_id) | |
|
166 | filter = get_object_or_404(JARSFilter, pk=filter_id) | |||
|
167 | conf.filter_parms = json.dumps(filter.jsonify()) | |||
|
168 | conf.save() | |||
179 |
|
169 | |||
180 | if filter_id: |
|
170 | return redirect('url_edit_jars_conf', id_conf=conf.id) | |
181 | if filter_id.__class__.__name__ not in ['int', 'float']: |
|
|||
182 | filter_id = eval(filter_id) |
|
|||
183 |
|
||||
184 | if filter_id == 0: |
|
|||
185 | return redirect('url_change_jars_filter', conf_id=conf.id) |
|
|||
186 |
|
||||
187 | if request.method=='GET': |
|
|||
188 | if not filter_id: |
|
|||
189 | form = JARSfilterForm(initial={'filter_id': 0}) |
|
|||
190 | else: |
|
|||
191 | form = JARSfilterForm(initial={'filter_id': filter_id}) |
|
|||
192 |
|
||||
193 | if request.method=='POST': |
|
|||
194 | form = JARSfilterForm(request.POST) |
|
|||
195 | if form.is_valid(): |
|
|||
196 | jars_filter = form.cleaned_data |
|
|||
197 | try: |
|
|||
198 | jars_filter.pop('name') |
|
|||
199 | except: |
|
|||
200 | pass |
|
|||
201 | conf.filter_parms = json.dumps(jars_filter) |
|
|||
202 | conf.save() |
|
|||
203 | return redirect('url_edit_jars_conf', id_conf=conf.id) |
|
|||
204 | else: |
|
|||
205 | messages.error(request, "Select a Filter Template") |
|
|||
206 | return redirect('url_change_jars_filter', conf_id=conf.id) |
|
|||
207 |
|
||||
208 | kwargs = {} |
|
|||
209 | kwargs['title'] = 'JARS Configuration' |
|
|||
210 | kwargs['suptitle'] = 'Change Filter' |
|
|||
211 | kwargs['form'] = form |
|
|||
212 | kwargs['button'] = 'Change' |
|
|||
213 | kwargs['conf_id'] = conf.id |
|
|||
214 | kwargs['filter_id'] = filter_id |
|
|||
215 | return render(request, 'change_jars_filter.html', kwargs) |
|
|||
216 |
|
||||
217 |
|
171 | |||
218 | def get_log(request, conf_id): |
|
172 | def get_log(request, conf_id): | |
219 |
|
173 |
@@ -14,11 +14,8 class SpectralWidget(forms.widgets.TextInput): | |||||
14 |
|
14 | |||
15 | readonly = 'readonly' if attrs.get('readonly', False) else '' |
|
15 | readonly = 'readonly' if attrs.get('readonly', False) else '' | |
16 | name = attrs.get('name', label) |
|
16 | name = attrs.get('name', label) | |
17 | print 'ESTO!' |
|
|||
18 | print value |
|
|||
19 | if value == None: |
|
17 | if value == None: | |
20 | value = '[0, 0],' |
|
18 | value = '[0, 0],' | |
21 | print readonly |
|
|||
22 | if '[' in value: |
|
19 | if '[' in value: | |
23 | if value[len(value)-1] == ",": |
|
20 | if value[len(value)-1] == ",": | |
24 | value = ast.literal_eval(value) |
|
21 | value = ast.literal_eval(value) |
@@ -1,13 +1,122 | |||||
1 | [ |
|
1 | [ | |
2 | {"fields": {"name": "JRO", "description": ""}, "model": "main.location", "pk": 1}, |
|
2 | { | |
3 | {"fields": {"name": "JASMET", "description": ""}, "model": "main.location", "pk": 2}, |
|
3 | "fields": { | |
4 | {"fields": {"name": "SOUSY", "description": ""}, "model": "main.location", "pk": 3}, |
|
4 | "name": "JRO", | |
5 | {"fields": {"name": "JULIA", "description": ""}, "model": "main.location", "pk": 4}, |
|
5 | "description": "" | |
6 | {"fields": {"name": "CLAIRE", "description": ""}, "model": "main.location", "pk": 4}, |
|
6 | }, | |
7 | {"fields": {"name": "rc", "description": ""}, "model": "main.devicetype", "pk": 1}, |
|
7 | "model": "main.location", | |
8 | {"fields": {"name": "dds", "description": ""}, "model": "main.devicetype", "pk": 2}, |
|
8 | "pk": 1 | |
9 | {"fields": {"name": "cgs", "description": ""}, "model": "main.devicetype", "pk": 3}, |
|
9 | }, | |
10 | {"fields": {"name": "jars", "description": ""}, "model": "main.devicetype", "pk": 4}, |
|
10 | { | |
11 | {"fields": {"name": "abs", "description": ""}, "model": "main.devicetype", "pk": 5}, |
|
11 | "fields": { | |
12 | {"fields": {"password": "pbkdf2_sha256$24000$6RRL7xETgdgN$ORRPhrITZKzTTZHCm8T+Er6ght415kYKeU7QP3rry5M=", "last_login": null, "is_superuser": true, "username": "admin", "first_name": "", "last_name": "", "email": "admin@admin.com", "is_staff": true, "is_active": true, "date_joined": "2017-01-12T16:10:24.383", "groups": [], "user_permissions": []}, "model": "auth.user", "pk": 1} |
|
12 | "name": "JASMET", | |
13 | ] |
|
13 | "description": "" | |
|
14 | }, | |||
|
15 | "model": "main.location", | |||
|
16 | "pk": 2 | |||
|
17 | }, | |||
|
18 | { | |||
|
19 | "fields": { | |||
|
20 | "name": "SOUSY", | |||
|
21 | "description": "" | |||
|
22 | }, | |||
|
23 | "model": "main.location", | |||
|
24 | "pk": 3 | |||
|
25 | }, | |||
|
26 | { | |||
|
27 | "fields": { | |||
|
28 | "name": "JULIA", | |||
|
29 | "description": "" | |||
|
30 | }, | |||
|
31 | "model": "main.location", | |||
|
32 | "pk": 4 | |||
|
33 | }, | |||
|
34 | { | |||
|
35 | "fields": { | |||
|
36 | "name": "CLAIRE", | |||
|
37 | "description": "" | |||
|
38 | }, | |||
|
39 | "model": "main.location", | |||
|
40 | "pk": 5 | |||
|
41 | }, | |||
|
42 | { | |||
|
43 | "fields": { | |||
|
44 | "name": "IDI", | |||
|
45 | "description": "" | |||
|
46 | }, | |||
|
47 | "model": "main.location", | |||
|
48 | "pk": 6 | |||
|
49 | }, | |||
|
50 | { | |||
|
51 | "fields": { | |||
|
52 | "name": "rc", | |||
|
53 | "description": "" | |||
|
54 | }, | |||
|
55 | "model": "main.devicetype", | |||
|
56 | "pk": 1 | |||
|
57 | }, | |||
|
58 | { | |||
|
59 | "fields": { | |||
|
60 | "name": "dds", | |||
|
61 | "description": "" | |||
|
62 | }, | |||
|
63 | "model": "main.devicetype", | |||
|
64 | "pk": 2 | |||
|
65 | }, | |||
|
66 | { | |||
|
67 | "fields": { | |||
|
68 | "name": "cgs", | |||
|
69 | "description": "" | |||
|
70 | }, | |||
|
71 | "model": "main.devicetype", | |||
|
72 | "pk": 3 | |||
|
73 | }, | |||
|
74 | { | |||
|
75 | "fields": { | |||
|
76 | "name": "jars", | |||
|
77 | "description": "" | |||
|
78 | }, | |||
|
79 | "model": "main.devicetype", | |||
|
80 | "pk": 4 | |||
|
81 | }, | |||
|
82 | { | |||
|
83 | "fields": { | |||
|
84 | "name": "abs", | |||
|
85 | "description": "" | |||
|
86 | }, | |||
|
87 | "model": "main.devicetype", | |||
|
88 | "pk": 5 | |||
|
89 | }, | |||
|
90 | { | |||
|
91 | "fields": { | |||
|
92 | "name": "Operator" | |||
|
93 | }, | |||
|
94 | "model": "auth.group", | |||
|
95 | "pk": 1 | |||
|
96 | }, | |||
|
97 | { | |||
|
98 | "fields": { | |||
|
99 | "name": "Developer" | |||
|
100 | }, | |||
|
101 | "model": "auth.group", | |||
|
102 | "pk": 2 | |||
|
103 | }, | |||
|
104 | { | |||
|
105 | "fields": { | |||
|
106 | "password": "pbkdf2_sha256$24000$6RRL7xETgdgN$ORRPhrITZKzTTZHCm8T+Er6ght415kYKeU7QP3rry5M=", | |||
|
107 | "last_login": null, | |||
|
108 | "is_superuser": true, | |||
|
109 | "username": "admin", | |||
|
110 | "first_name": "Administrador", | |||
|
111 | "last_name": "IDI", | |||
|
112 | "email": "admin@admin.com", | |||
|
113 | "is_staff": true, | |||
|
114 | "is_active": true, | |||
|
115 | "date_joined": "2017-01-12T16:10:24.383", | |||
|
116 | "groups": [], | |||
|
117 | "user_permissions": [] | |||
|
118 | }, | |||
|
119 | "model": "auth.user", | |||
|
120 | "pk": 1 | |||
|
121 | } | |||
|
122 | ] No newline at end of file |
@@ -75,7 +75,7 class CampaignForm(forms.ModelForm): | |||||
75 |
|
75 | |||
76 | class Meta: |
|
76 | class Meta: | |
77 | model = Campaign |
|
77 | model = Campaign | |
78 | exclude = [''] |
|
78 | exclude = ['author'] | |
79 |
|
79 | |||
80 |
|
80 | |||
81 | class ExperimentForm(forms.ModelForm): |
|
81 | class ExperimentForm(forms.ModelForm): | |
@@ -85,15 +85,15 class ExperimentForm(forms.ModelForm): | |||||
85 | self.fields['start_time'].widget = TimepickerWidget(self.fields['start_time'].widget.attrs) |
|
85 | self.fields['start_time'].widget = TimepickerWidget(self.fields['start_time'].widget.attrs) | |
86 | self.fields['end_time'].widget = TimepickerWidget(self.fields['end_time'].widget.attrs) |
|
86 | self.fields['end_time'].widget = TimepickerWidget(self.fields['end_time'].widget.attrs) | |
87 |
|
87 | |||
88 | def save(self): |
|
88 | def save(self, *args, **kwargs): | |
89 | exp = super(ExperimentForm, self).save() |
|
89 | exp = super(ExperimentForm, self).save(*args, **kwargs) | |
90 | exp.name = exp.name.replace(' ', '') |
|
90 | exp.name = exp.name.replace(' ', '') | |
91 | exp.save() |
|
91 | exp.save() | |
92 | return exp |
|
92 | return exp | |
93 |
|
93 | |||
94 | class Meta: |
|
94 | class Meta: | |
95 | model = Experiment |
|
95 | model = Experiment | |
96 | exclude = ['task', 'status'] |
|
96 | exclude = ['task', 'status', 'author', 'hash'] | |
97 |
|
97 | |||
98 | class LocationForm(forms.ModelForm): |
|
98 | class LocationForm(forms.ModelForm): | |
99 | class Meta: |
|
99 | class Meta: | |
@@ -115,7 +115,7 class ConfigurationForm(forms.ModelForm): | |||||
115 |
|
115 | |||
116 | class Meta: |
|
116 | class Meta: | |
117 | model = Configuration |
|
117 | model = Configuration | |
118 | exclude = ['type', 'created_date', 'programmed_date', 'parameters'] |
|
118 | exclude = ['type', 'created_date', 'programmed_date', 'parameters', 'author', 'hash'] | |
119 |
|
119 | |||
120 | class UploadFileForm(forms.Form): |
|
120 | class UploadFileForm(forms.Form): | |
121 |
|
121 | |||
@@ -188,7 +188,7 class FilterForm(forms.Form): | |||||
188 | if 'initial' in kwargs: |
|
188 | if 'initial' in kwargs: | |
189 | self.fields[field].widget.attrs = {'start_date':kwargs['initial'].get('start_date', ''), |
|
189 | self.fields[field].widget.attrs = {'start_date':kwargs['initial'].get('start_date', ''), | |
190 | 'end_date':kwargs['initial'].get('end_date', '')} |
|
190 | 'end_date':kwargs['initial'].get('end_date', '')} | |
191 | elif field in ('template', 'historical'): |
|
191 | elif field in ('template', 'historical') or 'my ' in field: | |
192 | self.fields[field] = forms.BooleanField(required=False) |
|
192 | self.fields[field] = forms.BooleanField(required=False) | |
193 | else: |
|
193 | else: | |
194 | self.fields[field] = forms.CharField(required=False) |
|
194 | self.fields[field] = forms.CharField(required=False) |
@@ -15,6 +15,7 from django.db import models | |||||
15 | from django.core.urlresolvers import reverse |
|
15 | from django.core.urlresolvers import reverse | |
16 | from django.core.validators import MinValueValidator, MaxValueValidator |
|
16 | from django.core.validators import MinValueValidator, MaxValueValidator | |
17 | from django.shortcuts import get_object_or_404 |
|
17 | from django.shortcuts import get_object_or_404 | |
|
18 | from django.contrib.auth.models import User | |||
18 |
|
19 | |||
19 | from apps.main.utils import Params |
|
20 | from apps.main.utils import Params | |
20 | from apps.rc.utils import RCFile |
|
21 | from apps.rc.utils import RCFile | |
@@ -114,8 +115,6 class Device(models.Model): | |||||
114 |
|
115 | |||
115 | device_type = models.ForeignKey(DeviceType, on_delete=models.CASCADE) |
|
116 | device_type = models.ForeignKey(DeviceType, on_delete=models.CASCADE) | |
116 | location = models.ForeignKey(Location, on_delete=models.CASCADE) |
|
117 | location = models.ForeignKey(Location, on_delete=models.CASCADE) | |
117 |
|
||||
118 | name = models.CharField(max_length=40, default='') |
|
|||
119 | ip_address = models.GenericIPAddressField(protocol='IPv4', default='0.0.0.0') |
|
118 | ip_address = models.GenericIPAddressField(protocol='IPv4', default='0.0.0.0') | |
120 | port_address = models.PositiveSmallIntegerField(default=2000) |
|
119 | port_address = models.PositiveSmallIntegerField(default=2000) | |
121 | description = models.TextField(blank=True, null=True) |
|
120 | description = models.TextField(blank=True, null=True) | |
@@ -125,8 +124,13 class Device(models.Model): | |||||
125 | db_table = 'db_devices' |
|
124 | db_table = 'db_devices' | |
126 |
|
125 | |||
127 | def __str__(self): |
|
126 | def __str__(self): | |
128 |
ret |
|
127 | ret = u'{} [{}]'.format(self.device_type.name.upper(), self.location.name) | |
129 | self.name) |
|
128 | ||
|
129 | return ret | |||
|
130 | ||||
|
131 | @property | |||
|
132 | def name(self): | |||
|
133 | return str(self) | |||
130 |
|
134 | |||
131 | def get_status(self): |
|
135 | def get_status(self): | |
132 | return self.status |
|
136 | return self.status | |
@@ -153,9 +157,14 class Device(models.Model): | |||||
153 | return 'http://{}:{}/'.format(self.ip_address, self.port_address) |
|
157 | return 'http://{}:{}/'.format(self.ip_address, self.port_address) | |
154 |
|
158 | |||
155 | def get_absolute_url(self): |
|
159 | def get_absolute_url(self): | |
156 |
|
||||
157 | return reverse('url_device', args=[str(self.id)]) |
|
160 | return reverse('url_device', args=[str(self.id)]) | |
158 |
|
161 | |||
|
162 | def get_absolute_url_edit(self): | |||
|
163 | return reverse('url_edit_device', args=[str(self.id)]) | |||
|
164 | ||||
|
165 | def get_absolute_url_delete(self): | |||
|
166 | return reverse('url_delete_device', args=[str(self.id)]) | |||
|
167 | ||||
159 | def change_ip(self, ip_address, mask, gateway, dns, **kwargs): |
|
168 | def change_ip(self, ip_address, mask, gateway, dns, **kwargs): | |
160 |
|
169 | |||
161 | if self.device_type.name=='dds': |
|
170 | if self.device_type.name=='dds': | |
@@ -216,10 +225,11 class Campaign(models.Model): | |||||
216 | name = models.CharField(max_length=60, unique=True) |
|
225 | name = models.CharField(max_length=60, unique=True) | |
217 | start_date = models.DateTimeField(blank=True, null=True) |
|
226 | start_date = models.DateTimeField(blank=True, null=True) | |
218 | end_date = models.DateTimeField(blank=True, null=True) |
|
227 | end_date = models.DateTimeField(blank=True, null=True) | |
219 | tags = models.CharField(max_length=40) |
|
228 | tags = models.CharField(max_length=40, blank=True, null=True) | |
220 | description = models.TextField(blank=True, null=True) |
|
229 | description = models.TextField(blank=True, null=True) | |
221 | experiments = models.ManyToManyField('Experiment', blank=True) |
|
230 | experiments = models.ManyToManyField('Experiment', blank=True) | |
222 |
|
231 | author = models.ForeignKey(User, null=True, blank=True) | ||
|
232 | ||||
223 | class Meta: |
|
233 | class Meta: | |
224 | db_table = 'db_campaigns' |
|
234 | db_table = 'db_campaigns' | |
225 | ordering = ('name',) |
|
235 | ordering = ('name',) | |
@@ -312,6 +322,9 class Campaign(models.Model): | |||||
312 | def get_absolute_url_edit(self): |
|
322 | def get_absolute_url_edit(self): | |
313 | return reverse('url_edit_campaign', args=[str(self.id)]) |
|
323 | return reverse('url_edit_campaign', args=[str(self.id)]) | |
314 |
|
324 | |||
|
325 | def get_absolute_url_delete(self): | |||
|
326 | return reverse('url_delete_campaign', args=[str(self.id)]) | |||
|
327 | ||||
315 | def get_absolute_url_export(self): |
|
328 | def get_absolute_url_export(self): | |
316 | return reverse('url_export_campaign', args=[str(self.id)]) |
|
329 | return reverse('url_export_campaign', args=[str(self.id)]) | |
317 |
|
330 | |||
@@ -319,7 +332,6 class Campaign(models.Model): | |||||
319 | return reverse('url_import_campaign', args=[str(self.id)]) |
|
332 | return reverse('url_import_campaign', args=[str(self.id)]) | |
320 |
|
333 | |||
321 |
|
334 | |||
322 |
|
||||
323 | class RunningExperiment(models.Model): |
|
335 | class RunningExperiment(models.Model): | |
324 | radar = models.OneToOneField('Location', on_delete=models.CASCADE) |
|
336 | radar = models.OneToOneField('Location', on_delete=models.CASCADE) | |
325 | running_experiment = models.ManyToManyField('Experiment', blank = True) |
|
337 | running_experiment = models.ManyToManyField('Experiment', blank = True) | |
@@ -336,6 +348,8 class Experiment(models.Model): | |||||
336 | end_time = models.TimeField(default='23:59:59') |
|
348 | end_time = models.TimeField(default='23:59:59') | |
337 | task = models.CharField(max_length=36, default='', blank=True, null=True) |
|
349 | task = models.CharField(max_length=36, default='', blank=True, null=True) | |
338 | status = models.PositiveSmallIntegerField(default=4, choices=EXP_STATES) |
|
350 | status = models.PositiveSmallIntegerField(default=4, choices=EXP_STATES) | |
|
351 | author = models.ForeignKey(User, null=True, blank=True) | |||
|
352 | hash = models.CharField(default='', max_length=64, null=True, blank=True) | |||
339 |
|
353 | |||
340 | class Meta: |
|
354 | class Meta: | |
341 | db_table = 'db_experiments' |
|
355 | db_table = 'db_experiments' | |
@@ -343,9 +357,9 class Experiment(models.Model): | |||||
343 |
|
357 | |||
344 | def __str__(self): |
|
358 | def __str__(self): | |
345 | if self.template: |
|
359 | if self.template: | |
346 | return u'%s (template)' % (self.name) |
|
360 | return u'%s (template)' % (self.name[:8]) | |
347 | else: |
|
361 | else: | |
348 | return u'%s' % (self.name) |
|
362 | return u'%s' % (self.name[:10]) | |
349 |
|
363 | |||
350 | def jsonify(self): |
|
364 | def jsonify(self): | |
351 |
|
365 | |||
@@ -374,7 +388,7 class Experiment(models.Model): | |||||
374 |
|
388 | |||
375 | confs = Configuration.objects.filter(experiment=self, type=0) |
|
389 | confs = Configuration.objects.filter(experiment=self, type=0) | |
376 | self.pk = None |
|
390 | self.pk = None | |
377 |
self.name = '{} |
|
391 | self.name = '{}_{:%y%m%d}'.format(self.name, datetime.now()) | |
378 | for attr, value in kwargs.items(): |
|
392 | for attr, value in kwargs.items(): | |
379 | setattr(self, attr, value) |
|
393 | setattr(self, attr, value) | |
380 |
|
394 | |||
@@ -524,6 +538,9 class Experiment(models.Model): | |||||
524 | def get_absolute_url_edit(self): |
|
538 | def get_absolute_url_edit(self): | |
525 | return reverse('url_edit_experiment', args=[str(self.id)]) |
|
539 | return reverse('url_edit_experiment', args=[str(self.id)]) | |
526 |
|
540 | |||
|
541 | def get_absolute_url_delete(self): | |||
|
542 | return reverse('url_delete_experiment', args=[str(self.id)]) | |||
|
543 | ||||
527 | def get_absolute_url_import(self): |
|
544 | def get_absolute_url_import(self): | |
528 | return reverse('url_import_experiment', args=[str(self.id)]) |
|
545 | return reverse('url_import_experiment', args=[str(self.id)]) | |
529 |
|
546 | |||
@@ -540,30 +557,43 class Experiment(models.Model): | |||||
540 | class Configuration(PolymorphicModel): |
|
557 | class Configuration(PolymorphicModel): | |
541 |
|
558 | |||
542 | template = models.BooleanField(default=False) |
|
559 | template = models.BooleanField(default=False) | |
543 | name = models.CharField(verbose_name="Configuration Name", max_length=40, default='') |
|
560 | # name = models.CharField(verbose_name="Configuration Name", max_length=40, default='') | |
|
561 | label = models.CharField(verbose_name="Label", max_length=40, default='', blank=True, null=True) | |||
544 | experiment = models.ForeignKey('Experiment', verbose_name='Experiment', null=True, blank=True, on_delete=models.CASCADE) |
|
562 | experiment = models.ForeignKey('Experiment', verbose_name='Experiment', null=True, blank=True, on_delete=models.CASCADE) | |
545 | device = models.ForeignKey('Device', verbose_name='Device', null=True, on_delete=models.CASCADE) |
|
563 | device = models.ForeignKey('Device', verbose_name='Device', null=True, on_delete=models.CASCADE) | |
546 | type = models.PositiveSmallIntegerField(default=0, choices=CONF_TYPES) |
|
564 | type = models.PositiveSmallIntegerField(default=0, choices=CONF_TYPES) | |
547 | created_date = models.DateTimeField(auto_now_add=True) |
|
565 | created_date = models.DateTimeField(auto_now_add=True) | |
548 | programmed_date = models.DateTimeField(auto_now=True) |
|
566 | programmed_date = models.DateTimeField(auto_now=True) | |
549 | parameters = models.TextField(default='{}') |
|
567 | parameters = models.TextField(default='{}') | |
|
568 | author = models.ForeignKey(User, null=True, blank=True) | |||
|
569 | hash = models.CharField(default='', max_length=64, null=True, blank=True) | |||
550 | message = "" |
|
570 | message = "" | |
551 |
|
571 | |||
552 | class Meta: |
|
572 | class Meta: | |
553 | db_table = 'db_configurations' |
|
573 | db_table = 'db_configurations' | |
|
574 | ordering = ('device__device_type__name',) | |||
554 |
|
575 | |||
555 | def __str__(self): |
|
576 | def __str__(self): | |
556 |
|
577 | |||
557 |
|
|
578 | ret = u'{} '.format(self.device.device_type.name.upper()) | |
558 |
|
579 | |||
559 | if 'mix' in [f.name for f in self._meta.get_fields()]: |
|
580 | if 'mix' in [f.name for f in self._meta.get_fields()]: | |
560 | if self.mix: |
|
581 | if self.mix: | |
561 |
|
|
582 | ret = '{} MIX '.format(self.device.device_type.name.upper()) | |
|
583 | ||||
|
584 | if 'label' in [f.name for f in self._meta.get_fields()]: | |||
|
585 | ret += '{}'.format(self.label[:8]) | |||
562 |
|
586 | |||
|
587 | #ret += '[ {} ]'.format(self.device.location.name) | |||
563 | if self.template: |
|
588 | if self.template: | |
564 |
ret |
|
589 | ret += ' (template)' | |
565 |
|
|
590 | ||
566 | return u'{} {}'.format(device, self.name) |
|
591 | return ret | |
|
592 | ||||
|
593 | @property | |||
|
594 | def name(self): | |||
|
595 | ||||
|
596 | return str(self) | |||
567 |
|
597 | |||
568 | def jsonify(self): |
|
598 | def jsonify(self): | |
569 |
|
599 | |||
@@ -739,6 +769,9 class Configuration(PolymorphicModel): | |||||
739 | def get_absolute_url_edit(self): |
|
769 | def get_absolute_url_edit(self): | |
740 | return reverse('url_edit_%s_conf' % self.device.device_type.name, args=[str(self.id)]) |
|
770 | return reverse('url_edit_%s_conf' % self.device.device_type.name, args=[str(self.id)]) | |
741 |
|
771 | |||
|
772 | def get_absolute_url_delete(self): | |||
|
773 | return reverse('url_delete_dev_conf', args=[str(self.id)]) | |||
|
774 | ||||
742 | def get_absolute_url_import(self): |
|
775 | def get_absolute_url_import(self): | |
743 | return reverse('url_import_dev_conf', args=[str(self.id)]) |
|
776 | return reverse('url_import_dev_conf', args=[str(self.id)]) | |
744 |
|
777 |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file | ||
The requested commit or file is too big and content was truncated. Show full diff |
@@ -9,7 +9,7 | |||||
9 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
|
9 | <meta name="viewport" content="width=device-width, initial-scale=1"> | |
10 | {# bootstrap_css #} |
|
10 | {# bootstrap_css #} | |
11 |
|
11 | |||
12 |
<link href="{% static 'css/bootstrap- |
|
12 | <link href="{% static 'css/bootstrap-yeti.min.css' %}" media="all" rel="stylesheet"> | |
13 | <link href="{% static 'css/bootcards-desktop.min.css' %}" media="all" rel="stylesheet"> |
|
13 | <link href="{% static 'css/bootcards-desktop.min.css' %}" media="all" rel="stylesheet"> | |
14 | <link href="{% static 'css/font-awesome.min.css' %}" media="all" rel="stylesheet"> |
|
14 | <link href="{% static 'css/font-awesome.min.css' %}" media="all" rel="stylesheet"> | |
15 | <!--link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"--> |
|
15 | <!--link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"--> | |
@@ -58,27 +58,20 | |||||
58 | </div> |
|
58 | </div> | |
59 | <div class="collapse navbar-collapse" id="navigationbar"> |
|
59 | <div class="collapse navbar-collapse" id="navigationbar"> | |
60 | <ul class="nav navbar-nav"> |
|
60 | <ul class="nav navbar-nav"> | |
61 |
<li class=" dropdown {% block operation-active %}{% endblock %}"> |
|
61 | <li class=" dropdown {% block operation-active %}{% endblock %}"> | |
|
62 | <a href="{% url 'url_operation'%}">Operation</a> | |||
62 | </li> |
|
63 | </li> | |
63 |
<li class=" dropdown {% block n |
|
64 | <li class=" dropdown {% block campaign-active %}{% endblock %}"> | |
64 | <a href="#" class="dropdown-toggle" data-toggle="dropdown">New<span class="caret"></span></a> |
|
65 | <a href="{% url 'url_campaigns'%}">Campaigns</a> | |
65 | <ul class="dropdown-menu" role="menu"> |
|
|||
66 | <li><a href="{% url 'url_add_campaign' %}">Campaign</a></li> |
|
|||
67 | <li><a href="{% url 'url_add_experiment' %}">Experiment</a></li> |
|
|||
68 | <li><a href="{% url 'url_add_dev_conf' 0%}">Device Configuration</a></li> |
|
|||
69 | <li><a href="{% url 'url_add_device'%}">Device</a></li> |
|
|||
70 | <li><a href="{% url 'url_add_location'%}">Radar System</a></li> |
|
|||
71 | </ul> |
|
|||
72 | </li> |
|
66 | </li> | |
73 |
<li class=" dropdown {% block |
|
67 | <li class=" dropdown {% block experiment-active %}{% endblock %}"> | |
74 | <a href="#" class="dropdown-toggle" data-toggle="dropdown">Search<span class="caret"></span></a> |
|
68 | <a href="{% url 'url_experiments'%}">Experiments</a> | |
75 | <ul class="dropdown-menu" role="menu"> |
|
69 | </li> | |
76 | <li><a href="{% url 'url_campaigns' %}">Campaigns</a></li> |
|
70 | <li class=" dropdown {% block configuration-active %}{% endblock %}"> | |
77 |
|
|
71 | <a href="{% url 'url_dev_confs'%}">Configurations</a> | |
78 | <li><a href="{% url 'url_dev_confs' %}">Configurations</a></li> |
|
72 | </li> | |
79 | <li><a href="{% url 'url_devices' %}">Devices</a></li> |
|
73 | <li class=" dropdown {% block device-active %}{% endblock %}"> | |
80 |
|
|
74 | <a href="{% url 'url_devices'%}">Devices</a> | |
81 | </ul> |
|
|||
82 | </li> |
|
75 | </li> | |
83 | </ul> |
|
76 | </ul> | |
84 | <ul class="nav navbar-nav navbar-right"> |
|
77 | <ul class="nav navbar-nav navbar-right"> | |
@@ -87,7 +80,7 | |||||
87 | <li class="dropdown"> |
|
80 | <li class="dropdown"> | |
88 | <a href="#" class="dropdown-toggle" data-toggle="dropdown">Hi {{ user.username }}<span class="caret"></span></a> |
|
81 | <a href="#" class="dropdown-toggle" data-toggle="dropdown">Hi {{ user.username }}<span class="caret"></span></a> | |
89 | <ul class="dropdown-menu" role="menu"> |
|
82 | <ul class="dropdown-menu" role="menu"> | |
90 | <li><a href="/admin">Control Panel</a></li> |
|
83 | <li><a href="/admin" target="_blank">Control Panel</a></li> | |
91 | <li><a href="{% url 'url_logout' %}">Logout</a></li> |
|
84 | <li><a href="{% url 'url_logout' %}">Logout</a></li> | |
92 | </ul> |
|
85 | </ul> | |
93 | </li> |
|
86 | </li> |
@@ -7,7 +7,7 | |||||
7 | <link href="{% static 'css/bootstrap-datetimepicker.min.css' %}" media="screen" rel="stylesheet"> |
|
7 | <link href="{% static 'css/bootstrap-datetimepicker.min.css' %}" media="screen" rel="stylesheet"> | |
8 | {% endblock %} |
|
8 | {% endblock %} | |
9 |
|
9 | |||
10 |
{% block |
|
10 | {% block {{menu}}-active %}active{% endblock %} | |
11 | {% block content-title %}{{title}}{% endblock %} |
|
11 | {% block content-title %}{{title}}{% endblock %} | |
12 | {% block content-suptitle %}{{suptitle}}{% endblock %} |
|
12 | {% block content-suptitle %}{{suptitle}}{% endblock %} | |
13 |
|
13 | |||
@@ -18,9 +18,13 | |||||
18 | <form class="form" method="get"> |
|
18 | <form class="form" method="get"> | |
19 | {% bootstrap_form form layout='horizontal' size='medium' %} |
|
19 | {% bootstrap_form form layout='horizontal' size='medium' %} | |
20 | <div class="pull-right"> |
|
20 | <div class="pull-right"> | |
|
21 | <br> | |||
21 | <button type="button" class="btn btn-primary btn-sm" onclick="window.location.replace('?');"><span class="glyphicon glyphicon-refresh" aria-hidden="true"></span></button> |
|
22 | <button type="button" class="btn btn-primary btn-sm" onclick="window.location.replace('?');"><span class="glyphicon glyphicon-refresh" aria-hidden="true"></span></button> | |
22 | <button type="submit" class="btn btn-primary btn-sm"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></button> |
|
23 | <button type="submit" class="btn btn-primary btn-sm"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></button> | |
23 | </div> |
|
24 | {% if add_url %} | |
|
25 | <a class="btn btn-sm btn-info" href="{{add_url}}"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></a> | |||
|
26 | {% endif %} | |||
|
27 | </div> | |||
24 | </form> |
|
28 | </form> | |
25 | {% endif %} |
|
29 | {% endif %} | |
26 | {% endblock %} |
|
30 | {% endblock %} | |
@@ -37,7 +41,14 | |||||
37 | <tr class="clickable-row" data-href="{{object.get_absolute_url}}"> |
|
41 | <tr class="clickable-row" data-href="{{object.get_absolute_url}}"> | |
38 | <td>{{ forloop.counter|add:offset }}</td> |
|
42 | <td>{{ forloop.counter|add:offset }}</td> | |
39 | {% for key in keys %} |
|
43 | {% for key in keys %} | |
|
44 | {% if key == 'actions' %} | |||
|
45 | <td> | |||
|
46 | <a class="btn btn-sm btn-danger" href="{{object.get_absolute_url_delete}}"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></a> | |||
|
47 | <a class="btn btn-sm btn-primary" href="{{object.get_absolute_url_edit}}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></a> | |||
|
48 | </td> | |||
|
49 | {% else %} | |||
40 | <td>{{ object|attr:key }}</td> |
|
50 | <td>{{ object|attr:key }}</td> | |
|
51 | {% endif %} | |||
41 | {% endfor %} |
|
52 | {% endfor %} | |
42 | </tr> |
|
53 | </tr> | |
43 | {% endfor %} |
|
54 | {% endfor %} |
@@ -15,7 +15,7 | |||||
15 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-menu-hamburger gi-2x" aria-hidden="true"></span></a> |
|
15 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-menu-hamburger gi-2x" aria-hidden="true"></span></a> | |
16 | <ul class="dropdown-menu" role="menu"> |
|
16 | <ul class="dropdown-menu" role="menu"> | |
17 | <li><a href="{{ dev_conf.get_absolute_url_edit }}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Edit</a></li> |
|
17 | <li><a href="{{ dev_conf.get_absolute_url_edit }}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Edit</a></li> | |
18 |
<li><a href="{ |
|
18 | <li><a href="{{ dev_conf.get_absolute_url_delete }}"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Delete</a></li> | |
19 | <li><a href="{{ dev_conf.get_absolute_url_import }}"><span class="glyphicon glyphicon-import" aria-hidden="true"></span> Import </a></li> |
|
19 | <li><a href="{{ dev_conf.get_absolute_url_import }}"><span class="glyphicon glyphicon-import" aria-hidden="true"></span> Import </a></li> | |
20 | <li><a href="{{ dev_conf.get_absolute_url_export }}"><span class="glyphicon glyphicon-export" aria-hidden="true"></span> Export </a></li> |
|
20 | <li><a href="{{ dev_conf.get_absolute_url_export }}"><span class="glyphicon glyphicon-export" aria-hidden="true"></span> Export </a></li> | |
21 | {% block extra-menu-actions %} |
|
21 | {% block extra-menu-actions %} | |
@@ -55,8 +55,6 | |||||
55 |
|
55 | |||
56 | {% endblock %} |
|
56 | {% endblock %} | |
57 |
|
57 | |||
58 |
|
||||
59 |
|
||||
60 | {% block extra-js%} |
|
58 | {% block extra-js%} | |
61 | <script type="text/javascript"> |
|
59 | <script type="text/javascript"> | |
62 |
|
60 |
@@ -21,61 +21,18 | |||||
21 | </table> |
|
21 | </table> | |
22 |
|
22 | |||
23 |
|
23 | |||
24 |
{% for conf |
|
24 | {% for conf in configurations %} | |
25 |
|
25 | |||
26 | <div class=""> |
|
26 | <div class=""> | |
27 |
<h4 class="panel-title"><b> {{conf |
|
27 | <h4 class="panel-title"><b> {{conf.conf}}</b></h4> | |
28 | <br> |
|
28 | <br> | |
29 | </div> |
|
29 | </div> | |
30 |
|
30 | |||
31 | {% if configuration.device.device_type.name == 'dds' %} |
|
31 | <table class="table table-bordered"> | |
32 | <table class="table table-bordered"> |
|
32 | {% for key in conf.keys %} | |
33 |
|
|
33 | <tr><th>{{key}}</th><td>{{conf|attr:key}}</td></tr> | |
34 | <tr><th>Multiplier</th><td>{{configuration.multiplier}}</td></tr> |
|
34 | {% endfor %} | |
35 |
|
|
35 | </table> | |
36 | {% endif %} |
|
|||
37 |
|
||||
38 | {% if configuration.device.device_type.name == 'rc' %} |
|
|||
39 |
|
||||
40 | <table class="table table-bordered"> |
|
|||
41 | <!--<h4 class="panel-title"> </h4>--> |
|
|||
42 | <tr><th>NTXs</th><td>{{configuration.ntx}}</td></tr> |
|
|||
43 | <tr><th>IPP(km)</th><td>{{configuration.ipp}}</td></tr> |
|
|||
44 | <tr><th>DC</th><td>{{duty_cycle}}%</td></tr> |
|
|||
45 |
|
||||
46 | {% for tx_line in configuration.tx_lines %} |
|
|||
47 | <tr><th colspan="2">{{tx_line.name}}</th></tr> |
|
|||
48 | <tr><th>Width(km)</th><td>{{tx_line.width}}</td></tr> |
|
|||
49 | <tr><th>Taus</th><td>{{tx_line.taus}}</td></tr> |
|
|||
50 | <tr><th>codes</th><td>{{tx_line.codes}}</td></tr> |
|
|||
51 | <tr><th>Sample Windows</th><td>{{tx_line.windows}}</td></tr> |
|
|||
52 | {% endfor %} |
|
|||
53 |
|
||||
54 | </table> |
|
|||
55 | {% endif %} |
|
|||
56 |
|
||||
57 | {% if configuration.device.device_type.name == 'jars' %} |
|
|||
58 |
|
||||
59 | <table class="table table-bordered"> |
|
|||
60 | <!--<h4 class="panel-title"> JARS </h4>--> |
|
|||
61 | <tr><th>Data Type</th><td>{{exp_type}}</td></tr> |
|
|||
62 | <tr><th># Channels</th><td>{{configuration.channels_number}}</td></tr> |
|
|||
63 | <tr><th>Coh Int</th><td>{{configuration.cohe_integr}}</td></tr> |
|
|||
64 | <tr><th>FFT Points</th><td>{{configuration.fftpoints}}</td></tr> |
|
|||
65 | {% if exp_type == 'PDATA'%} |
|
|||
66 | <tr><th>Inc Int</th><td>{{configuration.incohe_integr}}</td></tr> |
|
|||
67 | <tr><th>Spec. Comb.</th><td>{{configuration.spectral}}</td></tr> |
|
|||
68 | {% endif %} |
|
|||
69 | <tr><th>Acq Prof</th><td>{{configuration.acq_profiles}}</td></tr> |
|
|||
70 | <tr><th>Prof x Block</th><td>{{configuration.profiles_block}}</td></tr> |
|
|||
71 | <tr><th>Block x File</th><td>{{ configuration.raw_data_blocks }}</td></tr> |
|
|||
72 | <tr><th>Time per Block (s)</th><td>{{ time_per_block }}</td></tr> |
|
|||
73 | <tr><th>Acqtime (s)</th><td>{{ acqtime }}</td></tr> |
|
|||
74 | <tr><th>Rate </th><td>{{ rate_bh }} || {{ rate_gh }}</td></tr> |
|
|||
75 | <tr><th>Va (m/s)</th><td>{{ va }}</td></tr> |
|
|||
76 | <tr><th>Vrange (m/s)</th><td>{{ vrange }}</td></tr> |
|
|||
77 | </table> |
|
|||
78 | {% endif %} |
|
|||
79 |
|
36 | |||
80 | {% endfor %} |
|
37 | {% endfor %} | |
81 |
|
38 | |||
@@ -93,10 +50,6 | |||||
93 | {% block extra-js%} |
|
50 | {% block extra-js%} | |
94 | <script type="text/javascript"> |
|
51 | <script type="text/javascript"> | |
95 |
|
52 | |||
96 | $(".clickable-row").click(function() { |
|
|||
97 | document.location = $(this).data("href"); |
|
|||
98 | }); |
|
|||
99 |
|
||||
100 | $("#bt_back").click(function() { |
|
53 | $("#bt_back").click(function() { | |
101 | document.location = "{% url 'url_experiment' experiment.id%}"; |
|
54 | document.location = "{% url 'url_experiment' experiment.id%}"; | |
102 | }); |
|
55 | }); |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file | ||
The requested commit or file is too big and content was truncated. Show full diff |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file | ||
The requested commit or file is too big and content was truncated. Show full diff |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file | ||
The requested commit or file is too big and content was truncated. Show full diff |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file | ||
The requested commit or file is too big and content was truncated. Show full diff |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file | ||
The requested commit or file is too big and content was truncated. Show full diff |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file | ||
The requested commit or file is too big and content was truncated. Show full diff |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file | ||
The requested commit or file is too big and content was truncated. Show full diff |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file | ||
The requested commit or file is too big and content was truncated. Show full diff |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file | ||
The requested commit or file is too big and content was truncated. Show full diff |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed | ||
The requested commit or file is too big and content was truncated. Show full diff |
General Comments 0
You need to be logged in to leave comments.
Login now