@@ -2,8 +2,7 | |||
|
2 | 2 | |
|
3 | 3 | The Integrated Radar System (SIR) is a web application that allows the configuration of the radar devices as required by the experiment, |
|
4 | 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. | |
|
6 | Special attention with the bokeh 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. | |
|
7 | 6 | For more information visit: http://jro-dev.igp.gob.pe:3000/projects/sistema-integrado-de-radar/wiki |
|
8 | 7 | |
|
9 | 8 | ## Installation |
@@ -325,14 +325,13 def add_beam(request, id_conf): | |||
|
325 | 325 | |
|
326 | 326 | #kwargs['dev_conf'] = conf.device |
|
327 | 327 | #kwargs['id_dev'] = conf.device |
|
328 | #kwargs['previous'] = conf.get_absolute_url_edit() | |
|
328 | 329 | kwargs['id_conf'] = conf.id |
|
329 | 330 | kwargs['form'] = form |
|
330 | 331 | kwargs['title'] = 'ABS Beams' |
|
331 | 332 | kwargs['suptitle'] = 'Add Beam' |
|
332 | 333 | kwargs['button'] = 'Add' |
|
333 | 334 | kwargs['no_sidebar'] = True |
|
334 | ||
|
335 | #kwargs['previous'] = conf.get_absolute_url_edit() | |
|
336 | 335 | kwargs['edit'] = True |
|
337 | 336 | |
|
338 | 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 | 11 | #instance = globals()[model] |
|
12 | 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 | 14 | return choices |
|
15 | 15 | |
|
16 | 16 | class JARSConfigurationForm(forms.ModelForm): |
@@ -65,6 +65,15 class JARSFilterForm(forms.ModelForm): | |||
|
65 | 65 | model = JARSFilter |
|
66 | 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 | 78 | class ExtFileField(forms.FileField): |
|
70 | 79 | """ |
@@ -103,6 +103,21 class JARSFilter(models.Model): | |||
|
103 | 103 | self.cic_2 = parameters['cic_2'] |
|
104 | 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 | 122 | class JARSConfiguration(Configuration): |
|
108 | 123 | |
@@ -305,7 +320,7 class JARSConfiguration(Configuration): | |||
|
305 | 320 | return False |
|
306 | 321 | |
|
307 | 322 | data = self.experiment.parms_to_dict() |
|
308 | ||
|
323 | #print(data) | |
|
309 | 324 | for key in data['configurations']['allIds']: |
|
310 | 325 | if data['configurations']['byId'][key]['device_type'] in ('dds', 'cgs'): |
|
311 | 326 | data['configurations']['allIds'].remove(key) |
@@ -1,5 +1,5 | |||
|
1 | 1 | {% extends "base.html" %} |
|
2 |
{% load bootstrap |
|
|
2 | {% load bootstrap4 %} | |
|
3 | 3 | {% block mainactive %}active{% endblock %} |
|
4 | 4 | |
|
5 | 5 | {% block content-title %}Acquisition System{% endblock %} |
@@ -1,6 +1,6 | |||
|
1 | 1 | {% extends "dev_conf.html" %} |
|
2 | 2 | {% load static %} |
|
3 |
{% load bootstrap |
|
|
3 | {% load bootstrap4 %} | |
|
4 | 4 | {% load main_tags %} |
|
5 | 5 | |
|
6 | 6 | {% block extra-menu-actions %} |
@@ -1,5 +1,5 | |||
|
1 | 1 | {% extends "dev_conf_edit.html" %} |
|
2 |
{% load bootstrap |
|
|
2 | {% load bootstrap4 %} | |
|
3 | 3 | {% load static %} |
|
4 | 4 | {% load main_tags %} |
|
5 | 5 | |
@@ -33,7 +33,10 | |||
|
33 | 33 | }); |
|
34 | 34 | |
|
35 | 35 | $("#id_filter_template").change(function () { |
|
36 | if($("#id_filter_template").val()!=0) | |
|
36 | 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 | 42 | </script> |
@@ -7,6 +7,7 urlpatterns = ( | |||
|
7 | 7 | path('<int:id_conf>/edit/', views.jars_conf_edit, name='url_edit_jars_conf'), |
|
8 | 8 | path('<int:conf_id>/change_filter/', views.change_filter, name='url_change_jars_filter'), |
|
9 | 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 | 11 | path('<int:conf_id>/import/', views.import_file, name='url_import_jars_conf'), |
|
11 | 12 | path('<int:conf_id>/read/', views.read_conf, name='url_read_jars_conf'), |
|
12 | 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 | 8 | from apps.main.views import sidebar |
|
9 | 9 | |
|
10 | 10 | from .models import JARSConfiguration, JARSFilter |
|
11 | from .forms import JARSConfigurationForm, JARSFilterForm, JARSImportForm | |
|
11 | from .forms import JARSConfigurationForm, JARSFilterForm, JARSImportForm,JARSFilterFormNew | |
|
12 | 12 | |
|
13 | 13 | import json |
|
14 | 14 | # Create your views here. |
@@ -60,7 +60,6 def jars_conf(request, id_conf): | |||
|
60 | 60 | def jars_conf_edit(request, id_conf): |
|
61 | 61 | |
|
62 | 62 | conf = get_object_or_404(JARSConfiguration, pk=id_conf) |
|
63 | ||
|
64 | 63 | filter_parms = json.loads(conf.filter_parms) |
|
65 | 64 | |
|
66 | 65 | if request.method=='GET': |
@@ -160,6 +159,34 def read_conf(request, conf_id): | |||
|
160 | 159 | |
|
161 | 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 | 190 | def change_filter(request, conf_id, filter_id): |
|
164 | 191 | |
|
165 | 192 | conf = get_object_or_404(JARSConfiguration, pk=conf_id) |
@@ -184,7 +211,7 def get_log(request, conf_id): | |||
|
184 | 211 | messages.error(request, message) |
|
185 | 212 | return redirect('url_jars_conf', id_conf=conf.id) |
|
186 | 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 | 216 | content = response |
|
190 | 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 | 11 | class SpectralWidget(forms.widgets.TextInput): |
|
12 | 12 | |
|
13 |
def render(self, |
|
|
14 | ||
|
13 | def render(self, name, value, attrs=None, renderer=None): | |
|
14 | label = name | |
|
15 | 15 | readonly = 'readonly' if attrs.get('readonly', False) else '' |
|
16 | 16 | name = attrs.get('name', label) |
|
17 | 17 | if value == None: |
@@ -638,6 +638,14 class Configuration(PolymorphicModel): | |||
|
638 | 638 | data['phaseA'] = dds_data.phase_to_binary(data['phaseA_degrees']) |
|
639 | 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 | 649 | return data |
|
642 | 650 | |
|
643 | 651 | def clone(self, **kwargs): |
@@ -258,8 +258,6 class DefaultWidget(forms.widgets.TextInput): | |||
|
258 | 258 | else: |
|
259 | 259 | return mark_safe(html+script) |
|
260 | 260 | |
|
261 | ||
|
262 | ||
|
263 | 261 | return mark_safe(html) |
|
264 | 262 | |
|
265 | 263 |
|
1 | NO CONTENT: modified file |
General Comments 0
You need to be logged in to leave comments.
Login now