@@ -2,8 +2,7 | |||||
2 |
|
2 | |||
3 | The Integrated Radar System (SIR) is a web application that allows the configuration of the radar devices as required by the experiment, |
|
3 | The Integrated Radar System (SIR) is a web application that allows the configuration of the radar devices as required by the experiment, | |
4 | This app allows the creation of Campaigns, Experiment and Device Configurations. |
|
4 | This app allows the creation of Campaigns, Experiment and Device Configurations. | |
5 | For the python3.0 update please check the requeriments vrsion for each package. It depends on the python 3.7 or 3.8 version. |
|
5 | For the python3.0 update please check the requeriments vrsion for each package. It depends on the python 3.7 or 3.8 version. Special attention with the bokeh version. | |
6 | Special attention with the bokeh version. |
|
|||
7 | For more information visit: http://jro-dev.igp.gob.pe:3000/projects/sistema-integrado-de-radar/wiki |
|
6 | For more information visit: http://jro-dev.igp.gob.pe:3000/projects/sistema-integrado-de-radar/wiki | |
8 |
|
7 | |||
9 | ## Installation |
|
8 | ## Installation |
@@ -325,14 +325,13 def add_beam(request, id_conf): | |||||
325 |
|
325 | |||
326 | #kwargs['dev_conf'] = conf.device |
|
326 | #kwargs['dev_conf'] = conf.device | |
327 | #kwargs['id_dev'] = conf.device |
|
327 | #kwargs['id_dev'] = conf.device | |
|
328 | #kwargs['previous'] = conf.get_absolute_url_edit() | |||
328 | kwargs['id_conf'] = conf.id |
|
329 | kwargs['id_conf'] = conf.id | |
329 | kwargs['form'] = form |
|
330 | kwargs['form'] = form | |
330 | kwargs['title'] = 'ABS Beams' |
|
331 | kwargs['title'] = 'ABS Beams' | |
331 | kwargs['suptitle'] = 'Add Beam' |
|
332 | kwargs['suptitle'] = 'Add Beam' | |
332 | kwargs['button'] = 'Add' |
|
333 | kwargs['button'] = 'Add' | |
333 | kwargs['no_sidebar'] = True |
|
334 | kwargs['no_sidebar'] = True | |
334 |
|
||||
335 | #kwargs['previous'] = conf.get_absolute_url_edit() |
|
|||
336 | kwargs['edit'] = True |
|
335 | kwargs['edit'] = True | |
337 |
|
336 | |||
338 | return render(request, 'abs_add_beam.html', kwargs) |
|
337 | return render(request, 'abs_add_beam.html', kwargs) |
@@ -10,7 +10,7 def create_choices_from_model(model, filter_id=None): | |||||
10 |
|
10 | |||
11 | #instance = globals()[model] |
|
11 | #instance = globals()[model] | |
12 | choices = model.objects.all().values_list('pk', 'name') |
|
12 | choices = model.objects.all().values_list('pk', 'name') | |
13 | choices = add_empty_choice(choices) |
|
13 | choices = add_empty_choice(choices,label="New Choice") | |
14 | return choices |
|
14 | return choices | |
15 |
|
15 | |||
16 | class JARSConfigurationForm(forms.ModelForm): |
|
16 | class JARSConfigurationForm(forms.ModelForm): | |
@@ -65,6 +65,15 class JARSFilterForm(forms.ModelForm): | |||||
65 | model = JARSFilter |
|
65 | model = JARSFilter | |
66 | exclude = ('name', ) |
|
66 | exclude = ('name', ) | |
67 |
|
67 | |||
|
68 | class JARSFilterFormNew(forms.ModelForm): | |||
|
69 | def __init__(self, *args, **kwargs): | |||
|
70 | super(JARSFilterFormNew, self).__init__(*args, **kwargs) | |||
|
71 | ||||
|
72 | self.fields['f_decimal'].widget.attrs['readonly'] = True | |||
|
73 | ||||
|
74 | class Meta: | |||
|
75 | model = JARSFilter | |||
|
76 | exclude = () | |||
68 |
|
77 | |||
69 | class ExtFileField(forms.FileField): |
|
78 | class ExtFileField(forms.FileField): | |
70 | """ |
|
79 | """ |
@@ -103,6 +103,21 class JARSFilter(models.Model): | |||||
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 | def dict_to_parms_new(self, parameters): | |||
|
107 | ||||
|
108 | self.name = parameters['name'] | |||
|
109 | self.clock = parameters['clock'] | |||
|
110 | self.multiplier = parameters['multiplier'] | |||
|
111 | self.frequency = parameters['frequency'] | |||
|
112 | self.f_decimal = parameters['f_decimal'] | |||
|
113 | self.fir = parameters['fir'] | |||
|
114 | self.cic_2 = parameters['cic_2'] | |||
|
115 | self.cic_5 = parameters['cic_5'] | |||
|
116 | self.scale_fir = parameters['scale_fir'] | |||
|
117 | self.scale_cic_2 = parameters['scale_cic_2'] | |||
|
118 | self.scale_cic_5 = parameters['scale_cic_5'] | |||
|
119 | self.number_taps = parameters['number_taps'] | |||
|
120 | self.taps = parameters['taps'] | |||
106 |
|
121 | |||
107 | class JARSConfiguration(Configuration): |
|
122 | class JARSConfiguration(Configuration): | |
108 |
|
123 | |||
@@ -305,7 +320,7 class JARSConfiguration(Configuration): | |||||
305 | return False |
|
320 | return False | |
306 |
|
321 | |||
307 | data = self.experiment.parms_to_dict() |
|
322 | data = self.experiment.parms_to_dict() | |
308 |
|
323 | #print(data) | ||
309 | for key in data['configurations']['allIds']: |
|
324 | for key in data['configurations']['allIds']: | |
310 | if data['configurations']['byId'][key]['device_type'] in ('dds', 'cgs'): |
|
325 | if data['configurations']['byId'][key]['device_type'] in ('dds', 'cgs'): | |
311 | data['configurations']['allIds'].remove(key) |
|
326 | data['configurations']['allIds'].remove(key) |
@@ -1,5 +1,5 | |||||
1 | {% extends "base.html" %} |
|
1 | {% extends "base.html" %} | |
2 |
{% load bootstrap |
|
2 | {% load bootstrap4 %} | |
3 | {% block mainactive %}active{% endblock %} |
|
3 | {% block mainactive %}active{% endblock %} | |
4 |
|
4 | |||
5 | {% block content-title %}Acquisition System{% endblock %} |
|
5 | {% block content-title %}Acquisition System{% endblock %} |
@@ -1,6 +1,6 | |||||
1 | {% extends "dev_conf.html" %} |
|
1 | {% extends "dev_conf.html" %} | |
2 | {% load static %} |
|
2 | {% load static %} | |
3 |
{% load bootstrap |
|
3 | {% load bootstrap4 %} | |
4 | {% load main_tags %} |
|
4 | {% load main_tags %} | |
5 |
|
5 | |||
6 | {% block extra-menu-actions %} |
|
6 | {% block extra-menu-actions %} |
@@ -1,5 +1,5 | |||||
1 | {% extends "dev_conf_edit.html" %} |
|
1 | {% extends "dev_conf_edit.html" %} | |
2 |
{% load bootstrap |
|
2 | {% load bootstrap4 %} | |
3 | {% load static %} |
|
3 | {% load static %} | |
4 | {% load main_tags %} |
|
4 | {% load main_tags %} | |
5 |
|
5 | |||
@@ -33,7 +33,10 | |||||
33 | }); |
|
33 | }); | |
34 |
|
34 | |||
35 | $("#id_filter_template").change(function () { |
|
35 | $("#id_filter_template").change(function () { | |
|
36 | if($("#id_filter_template").val()!=0) | |||
36 | document.location = "{% url 'url_change_jars_filter' id_dev %}" + $("#id_filter_template").val(); |
|
37 | document.location = "{% url 'url_change_jars_filter' id_dev %}" + $("#id_filter_template").val(); | |
|
38 | else | |||
|
39 | document.location = "{% url 'url_new_jars_filter' id_dev %}" | |||
37 | }); |
|
40 | }); | |
38 |
|
41 | |||
39 | </script> |
|
42 | </script> |
@@ -7,6 +7,7 urlpatterns = ( | |||||
7 | path('<int:id_conf>/edit/', views.jars_conf_edit, name='url_edit_jars_conf'), |
|
7 | path('<int:id_conf>/edit/', views.jars_conf_edit, name='url_edit_jars_conf'), | |
8 | path('<int:conf_id>/change_filter/', views.change_filter, name='url_change_jars_filter'), |
|
8 | path('<int:conf_id>/change_filter/', views.change_filter, name='url_change_jars_filter'), | |
9 | path('<int:conf_id>/change_filter/<int:filter_id>/', views.change_filter, name='url_change_jars_filter'), |
|
9 | path('<int:conf_id>/change_filter/<int:filter_id>/', views.change_filter, name='url_change_jars_filter'), | |
|
10 | path('<int:conf_id>/new_filter/', views.new_filter, name='url_new_jars_filter'), | |||
10 | path('<int:conf_id>/import/', views.import_file, name='url_import_jars_conf'), |
|
11 | path('<int:conf_id>/import/', views.import_file, name='url_import_jars_conf'), | |
11 | path('<int:conf_id>/read/', views.read_conf, name='url_read_jars_conf'), |
|
12 | path('<int:conf_id>/read/', views.read_conf, name='url_read_jars_conf'), | |
12 | path('<int:conf_id>/get_log/', views.get_log, name='url_get_jars_log'), |
|
13 | path('<int:conf_id>/get_log/', views.get_log, name='url_get_jars_log'), |
@@ -8,7 +8,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, JARSFilter |
|
10 | from .models import JARSConfiguration, JARSFilter | |
11 | from .forms import JARSConfigurationForm, JARSFilterForm, JARSImportForm |
|
11 | from .forms import JARSConfigurationForm, JARSFilterForm, JARSImportForm,JARSFilterFormNew | |
12 |
|
12 | |||
13 | import json |
|
13 | import json | |
14 | # Create your views here. |
|
14 | # Create your views here. | |
@@ -60,7 +60,6 def jars_conf(request, id_conf): | |||||
60 | def jars_conf_edit(request, id_conf): |
|
60 | def jars_conf_edit(request, id_conf): | |
61 |
|
61 | |||
62 | conf = get_object_or_404(JARSConfiguration, pk=id_conf) |
|
62 | conf = get_object_or_404(JARSConfiguration, pk=id_conf) | |
63 |
|
||||
64 | filter_parms = json.loads(conf.filter_parms) |
|
63 | filter_parms = json.loads(conf.filter_parms) | |
65 |
|
64 | |||
66 | if request.method=='GET': |
|
65 | if request.method=='GET': | |
@@ -160,6 +159,34 def read_conf(request, conf_id): | |||||
160 |
|
159 | |||
161 | return render(request, 'jars_conf_edit.html', kwargs) |
|
160 | return render(request, 'jars_conf_edit.html', kwargs) | |
162 |
|
161 | |||
|
162 | def new_filter(request, conf_id): | |||
|
163 | conf = get_object_or_404(JARSConfiguration, pk=conf_id) | |||
|
164 | form = JARSFilterFormNew() | |||
|
165 | ||||
|
166 | if request.method=='POST': | |||
|
167 | filter_form = JARSFilterFormNew(request.POST) | |||
|
168 | ||||
|
169 | if filter_form.is_valid(): | |||
|
170 | jars_filter = filter_form.cleaned_data | |||
|
171 | jars_filter['id'] = request.POST['name'] | |||
|
172 | else: | |||
|
173 | messages.error(request, filter_form.errors) | |||
|
174 | ||||
|
175 | #print(json.dumps(jars_filter)) | |||
|
176 | jars_filter_obj = JARSFilter() | |||
|
177 | jars_filter_obj.dict_to_parms_new(request.POST) | |||
|
178 | jars_filter_obj.save() | |||
|
179 | return redirect('url_edit_jars_conf', id_conf=conf.id) | |||
|
180 | ||||
|
181 | kwargs = {} | |||
|
182 | kwargs['id_dev'] = conf.id | |||
|
183 | kwargs['form'] = form | |||
|
184 | kwargs['title'] = 'New JARS Filter' | |||
|
185 | kwargs['suptitle'] = 'Parameters' | |||
|
186 | kwargs['button'] = 'Save' | |||
|
187 | ||||
|
188 | return render(request, 'jars_new_filter.html', kwargs) | |||
|
189 | ||||
163 | def change_filter(request, conf_id, filter_id): |
|
190 | def change_filter(request, conf_id, filter_id): | |
164 |
|
191 | |||
165 | conf = get_object_or_404(JARSConfiguration, pk=conf_id) |
|
192 | conf = get_object_or_404(JARSConfiguration, pk=conf_id) | |
@@ -184,7 +211,7 def get_log(request, conf_id): | |||||
184 | messages.error(request, message) |
|
211 | messages.error(request, message) | |
185 | return redirect('url_jars_conf', id_conf=conf.id) |
|
212 | return redirect('url_jars_conf', id_conf=conf.id) | |
186 | except Exception as e: |
|
213 | except Exception as e: | |
187 | message = 'Restarting Report.txt has been downloaded successfully.' |
|
214 | message = 'Restarting Report.txt has been downloaded successfully.'+e | |
188 |
|
215 | |||
189 | content = response |
|
216 | content = response | |
190 | filename = 'Log_%s_%s.txt' %(conf.experiment.name, conf.experiment.id) |
|
217 | filename = 'Log_%s_%s.txt' %(conf.experiment.name, conf.experiment.id) |
@@ -10,8 +10,8 from django.utils.html import conditional_escape | |||||
10 |
|
10 | |||
11 | class SpectralWidget(forms.widgets.TextInput): |
|
11 | class SpectralWidget(forms.widgets.TextInput): | |
12 |
|
12 | |||
13 |
def render(self, |
|
13 | def render(self, name, value, attrs=None, renderer=None): | |
14 |
|
14 | label = name | ||
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 | if value == None: |
|
17 | if value == None: |
@@ -638,6 +638,14 class Configuration(PolymorphicModel): | |||||
638 | data['phaseA'] = dds_data.phase_to_binary(data['phaseA_degrees']) |
|
638 | data['phaseA'] = dds_data.phase_to_binary(data['phaseA_degrees']) | |
639 | data['phaseB'] = dds_data.phase_to_binary(data['phaseB_degrees']) |
|
639 | data['phaseB'] = dds_data.phase_to_binary(data['phaseB_degrees']) | |
640 |
|
640 | |||
|
641 | elif self.device.device_type.name == 'dds_rest': | |||
|
642 | data['frequencyA_Mhz'] = float(data['frequencyA_Mhz']) | |||
|
643 | data['frequencyB_Mhz'] = float(data['frequencyB_Mhz']) | |||
|
644 | data['phaseA'] = dds_data.phase_to_binary(data['phaseA_degrees']) | |||
|
645 | data['phaseB'] = dds_data.phase_to_binary(data['phaseB_degrees']) | |||
|
646 | data['delta_frequency_Mhz'] = float(data['delta_frequency_Mhz'] or 0.00) | |||
|
647 | data['update_clock_Mhz'] = float(data['update_clock_Mhz'] or 0.00) | |||
|
648 | data['ramp_rate_clock_Mhz'] = float(data['ramp_rate_clock_Mhz'] or 0.0) | |||
641 | return data |
|
649 | return data | |
642 |
|
650 | |||
643 | def clone(self, **kwargs): |
|
651 | def clone(self, **kwargs): |
@@ -258,8 +258,6 class DefaultWidget(forms.widgets.TextInput): | |||||
258 | else: |
|
258 | else: | |
259 | return mark_safe(html+script) |
|
259 | return mark_safe(html+script) | |
260 |
|
260 | |||
261 |
|
||||
262 |
|
||||
263 | return mark_safe(html) |
|
261 | return mark_safe(html) | |
264 |
|
262 | |||
265 |
|
263 |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file |
General Comments 0
You need to be logged in to leave comments.
Login now