The requested changes are too big and content was truncated. Show full diff
1 | NO CONTENT: new file 100644 |
|
NO CONTENT: new file 100644 | ||
The requested commit or file is too big and content was truncated. Show full diff |
@@ -1,13 +1,15 | |||||
1 | from django.conf.urls import url |
|
1 | from django.conf.urls import url | |
2 |
|
2 | |||
|
3 | import views | |||
|
4 | ||||
3 | urlpatterns = ( |
|
5 | urlpatterns = ( | |
4 |
url(r'^(?P<id_conf>-?\d+)/$', |
|
6 | url(r'^(?P<id_conf>-?\d+)/$', views.abs_conf, name='url_abs_conf'), | |
5 |
url(r'^(?P<id_conf>-?\d+)/edit/$', |
|
7 | url(r'^(?P<id_conf>-?\d+)/edit/$', views.abs_conf_edit, name='url_edit_abs_conf'), | |
6 |
url(r'^(?P<id_conf>-?\d+)/read/$', |
|
8 | url(r'^(?P<id_conf>-?\d+)/read/$', views.dev_conf_read, name='url_read_abs_conf'), | |
7 |
url(r'^(?P<id_conf>-?\d+)/import/$', |
|
9 | url(r'^(?P<id_conf>-?\d+)/import/$', views.dev_conf_import, name='url_import_abs_conf'), | |
8 |
url(r'^(?P<id_conf>-?\d+)/export/$', |
|
10 | url(r'^(?P<id_conf>-?\d+)/export/$', views.dev_conf_export, name='url_export_abs_conf'), | |
9 |
url(r'^(?P<id_conf>-?\d+)/plot/$', |
|
11 | url(r'^(?P<id_conf>-?\d+)/plot/$', views.plot_patterns, name='url_plot_abs_patterns'), | |
10 |
url(r'^(?P<id_conf>-?\d+)/add_beam/$', |
|
12 | url(r'^(?P<id_conf>-?\d+)/add_beam/$', views.add_beam, name='url_add_abs_beam'), | |
11 |
url(r'^(?P<id_conf>-?\d+)/beam/(?P<id_beam>-?\d+)/delete/$', |
|
13 | url(r'^(?P<id_conf>-?\d+)/beam/(?P<id_beam>-?\d+)/delete/$', views.remove_beam, name='url_remove_abs_beam'), | |
12 |
url(r'^(?P<id_conf>-?\d+)/beam/(?P<id_beam>-?\d+)/edit/$', |
|
14 | url(r'^(?P<id_conf>-?\d+)/beam/(?P<id_beam>-?\d+)/edit/$', views.edit_beam, name='url_edit_abs_beam'), | |
13 | ) |
|
15 | ) |
@@ -7,7 +7,7 | |||||
7 |
|
7 | |||
8 | {% block content %} |
|
8 | {% block content %} | |
9 | <div class='col-md-8'> |
|
9 | <div class='col-md-8'> | |
10 |
<form class="form" method="post" action="{% url ' |
|
10 | <form class="form" method="post" action="{% url 'url_login' %}"> | |
11 | {% csrf_token %} |
|
11 | {% csrf_token %} | |
12 | {% bootstrap_form form %} |
|
12 | {% bootstrap_form form %} | |
13 | <input type="hidden" name="next" value="{{ next }}" /> |
|
13 | <input type="hidden" name="next" value="{{ next }}" /> |
@@ -1,7 +1,7 | |||||
1 |
from django.conf.urls import |
|
1 | from django.conf.urls import url | |
2 | from django.contrib.auth import views as auth_views |
|
2 | from django.contrib.auth import views as auth_views | |
3 |
|
3 | |||
4 |
urlpatterns = |
|
4 | urlpatterns = ( | |
5 |
url(r'^logout/$', |
|
5 | url(r'^logout/$', auth_views.logout, {'next_page': '/'}, name='url_logout'), | |
6 | url(r'^login/$', auth_views.login, {'template_name': 'login.html'}), |
|
6 | url(r'^login/$', auth_views.login, {'template_name': 'login.html'}, name='url_login'), | |
7 | ) |
|
7 | ) |
@@ -2,10 +2,7 from django.db import models | |||||
2 | from apps.main.models import Configuration |
|
2 | from apps.main.models import Configuration | |
3 | from django.core.validators import MinValueValidator, MaxValueValidator |
|
3 | from django.core.validators import MinValueValidator, MaxValueValidator | |
4 |
|
4 | |||
5 |
|
5 | from .files import read_json_file | ||
6 | from apps.main.models import Device, Experiment |
|
|||
7 |
|
||||
8 | from files import read_json_file |
|
|||
9 | # Create your models here. validators=[MinValueValidator(62.5e6), MaxValueValidator(450e6)] |
|
6 | # Create your models here. validators=[MinValueValidator(62.5e6), MaxValueValidator(450e6)] | |
10 |
|
7 | |||
11 | class CGSConfiguration(Configuration): |
|
8 | class CGSConfiguration(Configuration): | |
@@ -91,7 +88,7 class CGSConfiguration(Configuration): | |||||
91 | icon = response[0] |
|
88 | icon = response[0] | |
92 |
status = response[-1] |
|
89 | status = response[-1] | |
93 |
|
90 | |||
94 |
|
|
91 | #print(icon, status) | |
95 | #"icon" could be: "alert" or "okay" |
|
92 | #"icon" could be: "alert" or "okay" | |
96 | if "alert" in icon: |
|
93 | if "alert" in icon: | |
97 | if "Starting Up" in status: #No Esta conectado |
|
94 | if "Starting Up" in status: #No Esta conectado |
@@ -1,14 +1,8 | |||||
1 | from django.conf.urls import url |
|
1 | from django.conf.urls import url | |
2 |
|
2 | |||
|
3 | from apps.cgs import views | |||
|
4 | ||||
3 | urlpatterns = ( |
|
5 | urlpatterns = ( | |
4 |
url(r'^(?P<id_conf>-?\d+)/$', |
|
6 | url(r'^(?P<id_conf>-?\d+)/$', views.cgs_conf, name='url_cgs_conf'), | |
5 |
url(r'^(?P<id_conf>-?\d+)/edit/$', |
|
7 | url(r'^(?P<id_conf>-?\d+)/edit/$', views.cgs_conf_edit, name='url_edit_cgs_conf'), | |
6 | #url(r'^(?P<id_conf>-?\d+)/(?P<message>-?\d+)/$', 'apps.cgs.views.cgs_conf', name='url_cgs_conf'), |
|
|||
7 | # url(r'^(?P<id_conf>-?\d+)/edit/$', 'apps.cgs.views.cgs_conf_edit', name='url_edit_cgs_conf'), |
|
|||
8 | # url(r'^(?P<id_conf>-?\d+)/write/$', 'apps.cgs.views.cgs_conf_write', name='url_write_cgs_conf'), |
|
|||
9 | # url(r'^(?P<id_conf>-?\d+)/read/$', 'apps.cgs.views.cgs_conf_read', name='url_read_cgs_conf'), |
|
|||
10 | # url(r'^(?P<id_conf>-?\d+)/import/$', 'apps.cgs.views.cgs_conf_import', name='url_import_cgs_conf'), |
|
|||
11 | # url(r'^(?P<id_conf>-?\d+)/export/$', 'apps.cgs.views.cgs_conf_export', name='url_export_cgs_conf'), |
|
|||
12 | #url(r'^(?P<id_conf>-?\d+)/export/$', 'apps.main.views.dev_conf_export', name='url_export_cgs_conf'), |
|
|||
13 | ) |
|
8 | ) | |
14 |
|
@@ -2,7 +2,7 from django.shortcuts import redirect, render, get_object_or_404 | |||||
2 | from django.contrib import messages |
|
2 | from django.contrib import messages | |
3 | from django.http import HttpResponse |
|
3 | from django.http import HttpResponse | |
4 |
|
4 | |||
5 |
from apps.main.models import Experiment |
|
5 | from apps.main.models import Experiment | |
6 | from .models import CGSConfiguration |
|
6 | from .models import CGSConfiguration | |
7 |
|
7 | |||
8 | from .forms import CGSConfigurationForm, UploadFileForm |
|
8 | from .forms import CGSConfigurationForm, UploadFileForm |
@@ -227,4 +227,3 class DDSConfiguration(Configuration): | |||||
227 |
|
227 | |||
228 | class Meta: |
|
228 | class Meta: | |
229 | db_table = 'dds_configurations' |
|
229 | db_table = 'dds_configurations' | |
230 | No newline at end of file |
|
@@ -1,14 +1,9 | |||||
1 | from django.conf.urls import url |
|
1 | from django.conf.urls import url | |
2 |
|
2 | |||
|
3 | from apps.dds import views | |||
|
4 | ||||
3 | urlpatterns = ( |
|
5 | urlpatterns = ( | |
4 |
url(r'^(?P<id_conf>-?\d+)/$', |
|
6 | url(r'^(?P<id_conf>-?\d+)/$', views.dds_conf, name='url_dds_conf'), | |
5 |
url(r'^(?P<id_conf>-?\d+)/(?P<message>-?\d+)/$', |
|
7 | url(r'^(?P<id_conf>-?\d+)/(?P<message>-?\d+)/$', views.dds_conf, name='url_dds_conf'), | |
6 |
url(r'^(?P<id_conf>-?\d+)/edit/$', |
|
8 | url(r'^(?P<id_conf>-?\d+)/edit/$', views.dds_conf_edit, name='url_edit_dds_conf'), | |
7 | # url(r'^(?P<id_conf>-?\d+)/write/$', 'apps.dds.views.dds_conf_write', name='url_write_dds_conf'), |
|
|||
8 | # url(r'^(?P<id_conf>-?\d+)/read/$', 'apps.dds.views.dds_conf_read', name='url_read_dds_conf'), |
|
|||
9 | # url(r'^(?P<id_conf>-?\d+)/import/$', 'apps.dds.views.dds_conf_import', name='url_import_dds_conf'), |
|
|||
10 | # url(r'^(?P<id_conf>-?\d+)/export/$', 'apps.dds.views.dds_conf_export', name='url_export_dds_conf'), |
|
|||
11 | # url(r'^(?P<id_conf>-?\d+)/start/$', 'apps.dds.views.dds_conf_start', name='url_start_dds_conf'), |
|
|||
12 | # url(r'^(?P<id_conf>-?\d+)/stop/$', 'apps.dds.views.dds_conf_stop', name='url_stop_dds_conf'), |
|
|||
13 | # url(r'^(?P<id_conf>-?\d+)/status/$', 'apps.dds.views.dds_conf_status', name='url_status_dds_conf'), |
|
|||
14 | ) |
|
9 | ) |
@@ -1,2 +1,2 | |||||
1 |
[{"fields": {"name": "49_920MHz_clock60MHz_F0MHz_12_25_2", "clock": "60", "mult": 5, "fch": 49.92, "fch_decimal": 721554505, "filter_fir": 6, "filter_2": 10, "filter_5": 1, "speed": 0}, "model": "jars.jarsfilter", "pk": 1} |
|
1 | [{"fields": {"name": "49_920MHz_clock60MHz_F0MHz_12_25_2", "clock": "60", "mult": 5, "fch": 49.92, "fch_decimal": 721554505, "filter_fir": 6, "filter_2": 10, "filter_5": 1, "speed": 0}, "model": "jars.jarsfilter", "pk": 1} | |
2 | ] |
|
2 | ] |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file |
@@ -1,11 +1,13 | |||||
1 | from django.conf.urls import url |
|
1 | from django.conf.urls import url | |
2 |
|
2 | |||
|
3 | from apps.jars import views | |||
|
4 | ||||
3 | urlpatterns = ( |
|
5 | urlpatterns = ( | |
4 |
url(r'^(?P<id_conf>-?\d+)/$', |
|
6 | url(r'^(?P<id_conf>-?\d+)/$', views.jars_conf, name='url_jars_conf'), | |
5 |
url(r'^(?P<id_conf>-?\d+)/edit/$', |
|
7 | url(r'^(?P<id_conf>-?\d+)/edit/$', views.jars_conf_edit, name='url_edit_jars_conf'), | |
6 |
url(r'^(?P<conf_id>-?\d+)/new_filter/$', |
|
8 | url(r'^(?P<conf_id>-?\d+)/new_filter/$', views.new_filter, name='url_new_jars_filter'), | |
7 |
url(r'^(?P<conf_id>-?\d+)/view_filter/(?P<filter_id>-?\d+)/$', |
|
9 | url(r'^(?P<conf_id>-?\d+)/view_filter/(?P<filter_id>-?\d+)/$', views.view_filter, name='url_jars_filter'), | |
8 |
url(r'^(?P<conf_id>-?\d+)/view_filter/(?P<filter_id>-?\d+)/edit$', |
|
10 | url(r'^(?P<conf_id>-?\d+)/view_filter/(?P<filter_id>-?\d+)/edit$', views.edit_filter, name='url_edit_jars_filter'), | |
9 |
url(r'^(?P<conf_id>-?\d+)/import/$', |
|
11 | url(r'^(?P<conf_id>-?\d+)/import/$', views.import_file, name='url_import_jars_conf'), | |
10 |
url(r'^(?P<conf_id>-?\d+)/read/$', |
|
12 | url(r'^(?P<conf_id>-?\d+)/read/$', views.read_conf, name='url_read_jars_conf'), | |
11 | ) |
|
13 | ) |
@@ -5,7 +5,6 from itertools import chain | |||||
5 |
|
5 | |||
6 | from django import forms |
|
6 | from django import forms | |
7 | from django.utils.safestring import mark_safe |
|
7 | from django.utils.safestring import mark_safe | |
8 | from django.utils.encoding import force_unicode |
|
|||
9 | from django.utils.html import conditional_escape |
|
8 | from django.utils.html import conditional_escape | |
10 |
|
9 | |||
11 |
|
10 |
@@ -1,10 +1,11 | |||||
1 | [ |
|
1 | [ | |
2 |
{"fields": {"name": "JRO |
|
2 | {"fields": {"name": "JRO", "description": ""}, "model": "main.location", "pk": 1}, | |
3 | {"fields": {"name": "JASMET", "description": ""}, "model": "main.location", "pk": 2}, |
|
3 | {"fields": {"name": "JASMET", "description": ""}, "model": "main.location", "pk": 2}, | |
4 | {"fields": {"name": "SOUSY", "description": ""}, "model": "main.location", "pk": 3}, |
|
4 | {"fields": {"name": "SOUSY", "description": ""}, "model": "main.location", "pk": 3}, | |
5 | {"fields": {"name": "JULIA", "description": ""}, "model": "main.location", "pk": 4}, |
|
5 | {"fields": {"name": "JULIA", "description": ""}, "model": "main.location", "pk": 4}, | |
6 |
{"fields": {"name": "rc", "description": ""}, "model": "main.devicetype", "pk": 1}, |
|
6 | {"fields": {"name": "rc", "description": ""}, "model": "main.devicetype", "pk": 1}, | |
7 |
{"fields": {"name": "dds", "description": ""}, "model": "main.devicetype", "pk": 2}, |
|
7 | {"fields": {"name": "dds", "description": ""}, "model": "main.devicetype", "pk": 2}, | |
8 |
{"fields": {"name": "cgs", "description": ""}, "model": "main.devicetype", "pk": 3}, |
|
8 | {"fields": {"name": "cgs", "description": ""}, "model": "main.devicetype", "pk": 3}, | |
9 | {"fields": {"name": "jars", "description": ""}, "model": "main.devicetype", "pk": 4} |
|
9 | {"fields": {"name": "jars", "description": ""}, "model": "main.devicetype", "pk": 4}, | |
|
10 | {"fields": {"name": "abs", "description": ""}, "model": "main.devicetype", "pk": 5} | |||
10 | ] |
|
11 | ] |
@@ -1,7 +1,7 | |||||
1 | from django import forms |
|
1 | from django import forms | |
2 | from django.utils.safestring import mark_safe |
|
2 | from django.utils.safestring import mark_safe | |
3 |
|
3 | from .models import Device, Experiment, Campaign, Location | ||
4 | from .models import DeviceType, Device, Experiment, Campaign, Configuration, Location |
|
4 | from apps.main.models import Configuration | |
5 |
|
5 | |||
6 | FILE_FORMAT = ( |
|
6 | FILE_FORMAT = ( | |
7 | ('json', 'json'), |
|
7 | ('json', 'json'), | |
@@ -105,8 +105,8 class ConfigurationForm(forms.ModelForm): | |||||
105 | model = Configuration |
|
105 | model = Configuration | |
106 | exclude = ['type', 'created_date', 'programmed_date', 'parameters'] |
|
106 | exclude = ['type', 'created_date', 'programmed_date', 'parameters'] | |
107 |
|
107 | |||
108 | class DeviceTypeForm(forms.Form): |
|
108 | #class DeviceTypeForm(forms.Form): | |
109 | device_type = forms.ChoiceField(choices=add_empty_choice(DeviceType.objects.all().order_by('name').values_list('id', 'name'))) |
|
109 | # device_type = forms.ChoiceField(choices=add_empty_choice(DeviceType.objects.all().order_by('name').values_list('id', 'name'))) | |
110 |
|
110 | |||
111 |
|
111 | |||
112 | class UploadFileForm(forms.Form): |
|
112 | class UploadFileForm(forms.Form): | |
@@ -130,21 +130,14 class DownloadFileForm(forms.Form): | |||||
130 | self.fields['format'].choices = RC_FILE_FORMAT |
|
130 | self.fields['format'].choices = RC_FILE_FORMAT | |
131 |
|
131 | |||
132 | class OperationForm(forms.Form): |
|
132 | class OperationForm(forms.Form): | |
133 | # today = datetime.today() |
|
133 | ||
134 | # -----Campaigns from this month------[:5] |
|
|||
135 | campaign = forms.ChoiceField(label="Campaign") |
|
134 | campaign = forms.ChoiceField(label="Campaign") | |
136 |
|
135 | |||
137 | def __init__(self, *args, **kwargs): |
|
136 | def __init__(self, *args, **kwargs): | |
138 |
|
137 | |||
139 | if 'length' not in kwargs.keys(): |
|
138 | campaigns = kwargs.pop('campaigns') | |
140 | length = None |
|
|||
141 | else: |
|
|||
142 | length = kwargs['length'] |
|
|||
143 |
|
||||
144 | kwargs.pop('length') |
|
|||
145 |
|
||||
146 | super(OperationForm, self).__init__(*args, **kwargs) |
|
139 | super(OperationForm, self).__init__(*args, **kwargs) | |
147 |
self.fields['campaign'].choices= |
|
140 | self.fields['campaign'].choices=add_empty_choice(campaigns.values_list('id', 'name')) | |
148 |
|
141 | |||
149 |
|
142 | |||
150 | class OperationSearchForm(forms.Form): |
|
143 | class OperationSearchForm(forms.Form): | |
@@ -187,4 +180,3 class FilterForm(forms.Form): | |||||
187 | self.fields['template'] = forms.BooleanField(required=False) |
|
180 | self.fields['template'] = forms.BooleanField(required=False) | |
188 | else: |
|
181 | else: | |
189 | self.fields[field] = forms.CharField(required=False) |
|
182 | self.fields[field] = forms.CharField(required=False) | |
190 | No newline at end of file |
|
@@ -2,7 +2,7 from django.shortcuts import render, redirect, get_object_or_404, HttpResponse | |||||
2 | from datetime import datetime |
|
2 | from datetime import datetime | |
3 |
|
3 | |||
4 | from django.db import models |
|
4 | from django.db import models | |
5 | from polymorphic import PolymorphicModel |
|
5 | from polymorphic.models import PolymorphicModel | |
6 |
|
6 | |||
7 | from django.core.urlresolvers import reverse |
|
7 | from django.core.urlresolvers import reverse | |
8 |
|
8 | |||
@@ -71,7 +71,7 class Location(models.Model): | |||||
71 | class Meta: |
|
71 | class Meta: | |
72 | db_table = 'db_location' |
|
72 | db_table = 'db_location' | |
73 |
|
73 | |||
74 |
def __ |
|
74 | def __str__(self): | |
75 | return u'%s' % self.name |
|
75 | return u'%s' % self.name | |
76 |
|
76 | |||
77 | def get_absolute_url(self): |
|
77 | def get_absolute_url(self): | |
@@ -86,7 +86,7 class DeviceType(models.Model): | |||||
86 | class Meta: |
|
86 | class Meta: | |
87 | db_table = 'db_device_types' |
|
87 | db_table = 'db_device_types' | |
88 |
|
88 | |||
89 |
def __ |
|
89 | def __str__(self): | |
90 | return u'%s' % self.get_name_display() |
|
90 | return u'%s' % self.get_name_display() | |
91 |
|
91 | |||
92 | class Device(models.Model): |
|
92 | class Device(models.Model): | |
@@ -103,7 +103,7 class Device(models.Model): | |||||
103 | class Meta: |
|
103 | class Meta: | |
104 | db_table = 'db_devices' |
|
104 | db_table = 'db_devices' | |
105 |
|
105 | |||
106 |
def __ |
|
106 | def __str__(self): | |
107 | return u'[{}]: {}'.format(self.device_type.name.upper(), |
|
107 | return u'[{}]: {}'.format(self.device_type.name.upper(), | |
108 | self.name) |
|
108 | self.name) | |
109 |
|
109 | |||
@@ -142,13 +142,12 class Campaign(models.Model): | |||||
142 | db_table = 'db_campaigns' |
|
142 | db_table = 'db_campaigns' | |
143 | ordering = ('name',) |
|
143 | ordering = ('name',) | |
144 |
|
144 | |||
145 |
def __ |
|
145 | def __str__(self): | |
146 | if self.template: |
|
146 | if self.template: | |
147 | return u'{} (template)'.format(self.name) |
|
147 | return u'{} (template)'.format(self.name) | |
148 | else: |
|
148 | else: | |
149 | return u'{}'.format(self.name) |
|
149 | return u'{}'.format(self.name) | |
150 |
|
150 | |||
151 |
|
||||
152 | def parms_to_dict(self): |
|
151 | def parms_to_dict(self): | |
153 |
|
152 | |||
154 | import json |
|
153 | import json | |
@@ -166,7 +165,7 class Campaign(models.Model): | |||||
166 | parameters['experiments'] = exp_parameters |
|
165 | parameters['experiments'] = exp_parameters | |
167 | parameters['end_date'] = self.end_date.strftime("%Y-%m-%d") |
|
166 | parameters['end_date'] = self.end_date.strftime("%Y-%m-%d") | |
168 | parameters['start_date'] = self.start_date.strftime("%Y-%m-%d") |
|
167 | parameters['start_date'] = self.start_date.strftime("%Y-%m-%d") | |
169 |
parameters['campaign'] = self.__ |
|
168 | parameters['campaign'] = self.__str__() | |
170 | parameters['tags'] =self.tags |
|
169 | parameters['tags'] =self.tags | |
171 |
|
170 | |||
172 | parameters = json.dumps(parameters, indent=2, sort_keys=False) |
|
171 | parameters = json.dumps(parameters, indent=2, sort_keys=False) | |
@@ -182,7 +181,7 class Campaign(models.Model): | |||||
182 | path, ext = os.path.splitext(fp.name) |
|
181 | path, ext = os.path.splitext(fp.name) | |
183 |
|
182 | |||
184 | if ext == '.json': |
|
183 | if ext == '.json': | |
185 | parms = json.load(fp) |
|
184 | parms = json.loads(fp.read()) | |
186 |
|
185 | |||
187 | return parms |
|
186 | return parms | |
188 |
|
187 | |||
@@ -220,6 +219,19 class Campaign(models.Model): | |||||
220 |
|
219 | |||
221 | return self |
|
220 | return self | |
222 |
|
221 | |||
|
222 | def get_experiments_by_location(self): | |||
|
223 | ||||
|
224 | ret = [] | |||
|
225 | locations = set([e.location for e in self.experiments.all()]) | |||
|
226 | for loc in locations: | |||
|
227 | dum = {} | |||
|
228 | dum['name'] = loc.name | |||
|
229 | dum['id'] = loc.pk | |||
|
230 | dum['experiments'] = [e for e in self.experiments.all() if e.location==loc] | |||
|
231 | ret.append(dum) | |||
|
232 | ||||
|
233 | return ret | |||
|
234 | ||||
223 | def get_absolute_url(self): |
|
235 | def get_absolute_url(self): | |
224 | return reverse('url_campaign', args=[str(self.id)]) |
|
236 | return reverse('url_campaign', args=[str(self.id)]) | |
225 |
|
237 | |||
@@ -253,7 +265,7 class Experiment(models.Model): | |||||
253 | db_table = 'db_experiments' |
|
265 | db_table = 'db_experiments' | |
254 | ordering = ('template', 'name') |
|
266 | ordering = ('template', 'name') | |
255 |
|
267 | |||
256 |
def __ |
|
268 | def __str__(self): | |
257 | if self.template: |
|
269 | if self.template: | |
258 | return u'%s (template)' % (self.name) |
|
270 | return u'%s (template)' % (self.name) | |
259 | else: |
|
271 | else: | |
@@ -282,7 +294,6 class Experiment(models.Model): | |||||
282 | configurations = Configuration.objects.filter(experiment=self) |
|
294 | configurations = Configuration.objects.filter(experiment=self) | |
283 | exp_status=[] |
|
295 | exp_status=[] | |
284 | for conf in configurations: |
|
296 | for conf in configurations: | |
285 | print conf.status_device() |
|
|||
286 | exp_status.append(conf.status_device()) |
|
297 | exp_status.append(conf.status_device()) | |
287 |
|
298 | |||
288 | if not exp_status: #No Configuration |
|
299 | if not exp_status: #No Configuration | |
@@ -360,7 +371,7 class Experiment(models.Model): | |||||
360 | path, ext = os.path.splitext(fp.name) |
|
371 | path, ext = os.path.splitext(fp.name) | |
361 |
|
372 | |||
362 | if ext == '.json': |
|
373 | if ext == '.json': | |
363 | parms = json.load(fp) |
|
374 | parms = json.loads(fp.read().decode('utf-8')) | |
364 |
|
375 | |||
365 | return parms |
|
376 | return parms | |
366 |
|
377 | |||
@@ -460,11 +471,11 class Configuration(PolymorphicModel): | |||||
460 | class Meta: |
|
471 | class Meta: | |
461 | db_table = 'db_configurations' |
|
472 | db_table = 'db_configurations' | |
462 |
|
473 | |||
463 |
def __ |
|
474 | def __str__(self): | |
464 |
|
475 | |||
465 | device = '{}:'.format(self.device.device_type.name.upper()) |
|
476 | device = '{}:'.format(self.device.device_type.name.upper()) | |
466 |
|
477 | |||
467 |
if 'mix' in self._meta.get_ |
|
478 | if 'mix' in [f.name for f in self._meta.get_fields()]: | |
468 | if self.mix: |
|
479 | if self.mix: | |
469 | device = '{} MIXED:'.format(self.device.device_type.name.upper()) |
|
480 | device = '{} MIXED:'.format(self.device.device_type.name.upper()) | |
470 |
|
481 | |||
@@ -495,15 +506,13 class Configuration(PolymorphicModel): | |||||
495 |
|
506 | |||
496 | def parms_to_text(self): |
|
507 | def parms_to_text(self): | |
497 |
|
508 | |||
498 |
raise NotImplementedError |
|
509 | raise NotImplementedError("This method should be implemented in %s Configuration model" %str(self.device.device_type.name).upper()) | |
499 |
|
510 | |||
500 | return '' |
|
|||
501 |
|
511 | |||
502 | def parms_to_binary(self): |
|
512 | def parms_to_binary(self): | |
503 |
|
513 | |||
504 |
raise NotImplementedError |
|
514 | raise NotImplementedError("This method should be implemented in %s Configuration model" %str(self.device.device_type.name).upper()) | |
505 |
|
515 | |||
506 | return '' |
|
|||
507 |
|
516 | |||
508 | def dict_to_parms(self, parameters): |
|
517 | def dict_to_parms(self, parameters): | |
509 |
|
518 | |||
@@ -556,33 +565,28 class Configuration(PolymorphicModel): | |||||
556 |
|
565 | |||
557 | def status_device(self): |
|
566 | def status_device(self): | |
558 |
|
567 | |||
559 |
raise NotImplementedError |
|
568 | raise NotImplementedError("This method should be implemented in %s Configuration model" %str(self.device.device_type.name).upper()) | |
560 |
|
569 | |||
561 | return None |
|
|||
562 |
|
570 | |||
563 | def stop_device(self): |
|
571 | def stop_device(self): | |
564 |
|
572 | |||
565 |
raise NotImplementedError |
|
573 | raise NotImplementedError("This method should be implemented in %s Configuration model" %str(self.device.device_type.name).upper()) | |
566 |
|
574 | |||
567 | return None |
|
|||
568 |
|
575 | |||
569 | def start_device(self): |
|
576 | def start_device(self): | |
570 |
|
577 | |||
571 |
raise NotImplementedError |
|
578 | raise NotImplementedError("This method should be implemented in %s Configuration model" %str(self.device.device_type.name).upper()) | |
572 |
|
579 | |||
573 | return None |
|
|||
574 |
|
580 | |||
575 | def write_device(self, parms): |
|
581 | def write_device(self, parms): | |
576 |
|
582 | |||
577 |
raise NotImplementedError |
|
583 | raise NotImplementedError("This method should be implemented in %s Configuration model" %str(self.device.device_type.name).upper()) | |
578 |
|
584 | |||
579 | return None |
|
|||
580 |
|
585 | |||
581 | def read_device(self): |
|
586 | def read_device(self): | |
582 |
|
587 | |||
583 |
raise NotImplementedError |
|
588 | raise NotImplementedError("This method should be implemented in %s Configuration model" %str(self.device.device_type.name).upper()) | |
584 |
|
589 | |||
585 | return None |
|
|||
586 |
|
590 | |||
587 | def get_absolute_url(self): |
|
591 | def get_absolute_url(self): | |
588 | return reverse('url_%s_conf' % self.device.device_type.name, args=[str(self.id)]) |
|
592 | return reverse('url_%s_conf' % self.device.device_type.name, args=[str(self.id)]) |
@@ -73,11 +73,11 | |||||
73 | <a href="#" class="dropdown-toggle" data-toggle="dropdown">Hi {{ user.username }}<span class="caret"></span></a> |
|
73 | <a href="#" class="dropdown-toggle" data-toggle="dropdown">Hi {{ user.username }}<span class="caret"></span></a> | |
74 | <ul class="dropdown-menu" role="menu"> |
|
74 | <ul class="dropdown-menu" role="menu"> | |
75 | <li><a href="#">Control Panel</a></li> |
|
75 | <li><a href="#">Control Panel</a></li> | |
76 |
<li><a href="{% url ' |
|
76 | <li><a href="{% url 'url_logout' %}">Logout</a></li> | |
77 | </ul> |
|
77 | </ul> | |
78 | </li> |
|
78 | </li> | |
79 | {% else %} |
|
79 | {% else %} | |
80 |
<li><a href="{% url ' |
|
80 | <li><a href="{% url 'url_login' %}?next={{request.get_full_path}}">Login</a></li> | |
81 | {% endif %} |
|
81 | {% endif %} | |
82 | </ul> |
|
82 | </ul> | |
83 | </div> |
|
83 | </div> |
@@ -6,33 +6,16 | |||||
6 | <link href="{% static 'css/bootstrap-datetimepicker.min.css' %}" media="screen" rel="stylesheet"> |
|
6 | <link href="{% static 'css/bootstrap-datetimepicker.min.css' %}" media="screen" rel="stylesheet"> | |
7 | {% endblock %} |
|
7 | {% endblock %} | |
8 |
|
8 | |||
9 |
{% block |
|
9 | {% block operation-active %}active{% endblock %} | |
10 |
|
10 | |||
11 | {% block content-title %}{{title}}{% endblock %} |
|
|||
12 | {% block content-suptitle %}{{suptitle}}{% endblock %} |
|
|||
13 |
|
11 | |||
14 | {% block content %} |
|
12 | {% block content %} | |
15 |
|
13 | |||
16 | <!-- Not Empty--> |
|
|||
17 | {% if details %} |
|
|||
18 |
|
||||
19 | <form class="form" method="post" action=""> |
|
|||
20 | {% csrf_token %} |
|
|||
21 |
|
||||
22 |
|
|
14 | {% bootstrap_form form layout='horizontal' size='medium' %} | |
23 |
|
|
15 | <div style="clear: both;"></div> | |
24 | <br> |
|
|||
25 | <!-- For deep search --> |
|
|||
26 | {% if search_button == True %} |
|
|||
27 | <button id="button-1" type="button" class="btn btn-primary pull-right">{{button}}</button> |
|
|||
28 | {% endif %} |
|
|||
29 | <br> |
|
|||
30 | <br> |
|
|||
31 | </form> |
|
|||
32 | <br> |
|
|||
33 | <br> |
|
|||
34 |
|
16 | |||
35 | {% endif %} |
|
17 | {% if campaign %} | |
|
18 | ||||
36 | <div class="clearfix"></div> |
|
19 | <div class="clearfix"></div> | |
37 | <h2>Radar Systems</h2> |
|
20 | <h2>Radar Systems</h2> | |
38 | <br> |
|
21 | <br> | |
@@ -45,7 +28,7 | |||||
45 | <h4 class="panel-title"> |
|
28 | <h4 class="panel-title"> | |
46 |
|
29 | |||
47 | <a class="collapsed" role="button" data-toggle="collapse" href="#collapseTwo-{{ location.id }}" aria-expanded="false" aria-controls="collapseTwo"> |
|
30 | <a class="collapsed" role="button" data-toggle="collapse" href="#collapseTwo-{{ location.id }}" aria-expanded="false" aria-controls="collapseTwo"> | |
48 |
{{location.name}} |
|
31 | {{location.name}} | |
49 | <span> |
|
32 | <span> | |
50 | </span> |
|
33 | </span> | |
51 | </a> |
|
34 | </a> | |
@@ -72,7 +55,7 | |||||
72 | {% endfor%} |
|
55 | {% endfor%} | |
73 | </tr> |
|
56 | </tr> | |
74 |
|
57 | |||
75 | {% for item in experiments %} |
|
58 | {% for item in location.experiments %} | |
76 | {% if location.name in item.location.name %} |
|
59 | {% if location.name in item.location.name %} | |
77 |
|
60 | |||
78 | <tr class="clickable-row" data-href="{% url 'url_experiment' item.id %}" > |
|
61 | <tr class="clickable-row" data-href="{% url 'url_experiment' item.id %}" > | |
@@ -94,7 +77,7 | |||||
94 | {% endfor %} |
|
77 | {% endfor %} | |
95 | </div> |
|
78 | </div> | |
96 |
|
79 | |||
97 |
|
80 | {% endif %} | ||
98 |
|
81 | |||
99 | {% endblock %} |
|
82 | {% endblock %} | |
100 |
|
83 | |||
@@ -135,17 +118,11 | |||||
135 | {% else %} |
|
118 | {% else %} | |
136 | $(document).ready(function() { |
|
119 | $(document).ready(function() { | |
137 | $("#id_campaign").change(function() { |
|
120 | $("#id_campaign").change(function() { | |
138 | var id_camp = document.getElementById("id_campaign").value; |
|
121 | document.location = "{% url 'url_operation'%}"+$(this).val(); | |
139 | //alert(id_camp); |
|
|||
140 | document.location = "{% url 'url_operation_search'%}"+String(id_camp); |
|
|||
141 | }); |
|
122 | }); | |
142 | }); |
|
123 | }); | |
143 | {% endif %} |
|
124 | {% endif %} | |
144 |
|
125 | |||
145 | $("#button-1").click(function() { |
|
|||
146 | document.location = "{% url 'url_operation_search' %}"; |
|
|||
147 | }); |
|
|||
148 |
|
||||
149 |
|
126 | |||
150 | </script> |
|
127 | </script> | |
151 | {% endblock %} |
|
128 | {% endblock %} |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file |
@@ -1,59 +1,61 | |||||
1 | from django.conf.urls import url |
|
1 | from django.conf.urls import url | |
2 |
|
2 | |||
3 | urlpatterns = ( |
|
3 | from apps.main import views | |
4 | url(r'^location/new/$', 'apps.main.views.location_new', name='url_add_location'), |
|
|||
5 | url(r'^location/$', 'apps.main.views.locations', name='url_locations'), |
|
|||
6 | url(r'^location/(?P<id_loc>-?\d+)/$', 'apps.main.views.location', name='url_location'), |
|
|||
7 | url(r'^location/(?P<id_loc>-?\d+)/edit/$', 'apps.main.views.location_edit', name='url_edit_location'), |
|
|||
8 | url(r'^location/(?P<id_loc>-?\d+)/delete/$', 'apps.main.views.location_delete', name='url_delete_location'), |
|
|||
9 |
|
||||
10 | url(r'^device/new/$', 'apps.main.views.device_new', name='url_add_device'), |
|
|||
11 | url(r'^device/$', 'apps.main.views.devices', name='url_devices'), |
|
|||
12 | url(r'^device/(?P<id_dev>-?\d+)/$', 'apps.main.views.device', name='url_device'), |
|
|||
13 | url(r'^device/(?P<id_dev>-?\d+)/edit/$', 'apps.main.views.device_edit', name='url_edit_device'), |
|
|||
14 | url(r'^device/(?P<id_dev>-?\d+)/delete/$', 'apps.main.views.device_delete', name='url_delete_device'), |
|
|||
15 |
|
||||
16 | url(r'^campaign/new/$', 'apps.main.views.campaign_new', name='url_add_campaign'), |
|
|||
17 | url(r'^campaign/$', 'apps.main.views.campaigns', name='url_campaigns'), |
|
|||
18 | url(r'^campaign/(?P<id_camp>-?\d+)/$', 'apps.main.views.campaign', name='url_campaign'), |
|
|||
19 | url(r'^campaign/(?P<id_camp>-?\d+)/edit/$', 'apps.main.views.campaign_edit', name='url_edit_campaign'), |
|
|||
20 | url(r'^campaign/(?P<id_camp>-?\d+)/delete/$', 'apps.main.views.campaign_delete', name='url_delete_campaign'), |
|
|||
21 | url(r'^campaign/(?P<id_camp>-?\d+)/export/$', 'apps.main.views.campaign_export', name='url_export_campaign'), |
|
|||
22 | url(r'^campaign/(?P<id_camp>-?\d+)/import/$', 'apps.main.views.campaign_import', name='url_import_campaign'), |
|
|||
23 |
|
||||
24 | url(r'^experiment/new/$', 'apps.main.views.experiment_new', name='url_add_experiment'), |
|
|||
25 | url(r'^experiment/$', 'apps.main.views.experiments', name='url_experiments'), |
|
|||
26 | url(r'^experiment/(?P<id_exp>-?\d+)/$', 'apps.main.views.experiment', name='url_experiment'), |
|
|||
27 | url(r'^experiment/(?P<id_exp>-?\d+)/edit/$', 'apps.main.views.experiment_edit', name='url_edit_experiment'), |
|
|||
28 | url(r'^experiment/(?P<id_exp>-?\d+)/delete/$', 'apps.main.views.experiment_delete', name='url_delete_experiment'), |
|
|||
29 | url(r'^experiment/(?P<id_exp>-?\d+)/export/$', 'apps.main.views.experiment_export', name='url_export_experiment'), |
|
|||
30 | url(r'^experiment/(?P<id_exp>-?\d+)/import/$', 'apps.main.views.experiment_import', name='url_import_experiment'), |
|
|||
31 | url(r'^experiment/(?P<id_exp>-?\d+)/mix/$', 'apps.main.views.experiment_mix', name='url_mix_experiment'), |
|
|||
32 | url(r'^experiment/(?P<id_exp>-?\d+)/mix/delete/$', 'apps.main.views.experiment_mix_delete', name='url_delete_mix_experiment'), |
|
|||
33 | url(r'^experiment/(?P<id_exp>-?\d+)/summary/$', 'apps.main.views.experiment_summary', name='url_sum_experiment'), |
|
|||
34 | url(r'^experiment/(?P<id_exp>-?\d+)/verify/$', 'apps.main.views.experiment_verify', name='url_verify_experiment'), |
|
|||
35 |
|
||||
36 | url(r'^experiment/(?P<id_exp>-?\d+)/new_dev_conf/$', 'apps.main.views.dev_conf_new', name='url_add_dev_conf'), |
|
|||
37 | url(r'^experiment/(?P<id_exp>-?\d+)/new_dev_conf/(?P<id_dev>-?\d+)/$', 'apps.main.views.dev_conf_new', name='url_add_dev_conf'), |
|
|||
38 | url(r'^dev_conf/$', 'apps.main.views.dev_confs', name='url_dev_confs'), |
|
|||
39 | url(r'^dev_conf/(?P<id_conf>-?\d+)/$', 'apps.main.views.dev_conf', name='url_dev_conf'), |
|
|||
40 | url(r'^dev_conf/(?P<id_conf>-?\d+)/edit/$', 'apps.main.views.dev_conf_edit', name='url_edit_dev_conf'), |
|
|||
41 | url(r'^dev_conf/(?P<id_conf>-?\d+)/delete/$', 'apps.main.views.dev_conf_delete', name='url_delete_dev_conf'), |
|
|||
42 |
|
||||
43 | url(r'^dev_conf/(?P<id_conf>-?\d+)/write/$', 'apps.main.views.dev_conf_write', name='url_write_dev_conf'), |
|
|||
44 | url(r'^dev_conf/(?P<id_conf>-?\d+)/read/$', 'apps.main.views.dev_conf_read', name='url_read_dev_conf'), |
|
|||
45 | url(r'^dev_conf/(?P<id_conf>-?\d+)/import/$', 'apps.main.views.dev_conf_import', name='url_import_dev_conf'), |
|
|||
46 | url(r'^dev_conf/(?P<id_conf>-?\d+)/export/$', 'apps.main.views.dev_conf_export', name='url_export_dev_conf'), |
|
|||
47 | url(r'^dev_conf/(?P<id_conf>-?\d+)/start/$', 'apps.main.views.dev_conf_start', name='url_start_dev_conf'), |
|
|||
48 | url(r'^dev_conf/(?P<id_conf>-?\d+)/stop/$', 'apps.main.views.dev_conf_stop', name='url_stop_dev_conf'), |
|
|||
49 | url(r'^dev_conf/(?P<id_conf>-?\d+)/status/$', 'apps.main.views.dev_conf_status', name='url_status_dev_conf'), |
|
|||
50 |
|
||||
51 | url(r'^operation/$', 'apps.main.views.operation', name='url_operation'), |
|
|||
52 | url(r'^operation/(?P<id_camp>-?\d+)/$', 'apps.main.views.operation', name='url_operation'), |
|
|||
53 | url(r'^operation/search/$', 'apps.main.views.operation_search', name='url_operation_search'), |
|
|||
54 | url(r'^operation/search/(?P<id_camp>-?\d+)/$', 'apps.main.views.operation_search', name='url_operation_search'), |
|
|||
55 | url(r'^operation/(?P<id_camp>-?\d+)/radar/(?P<id_radar>-?\d+)/play/$', 'apps.main.views.radar_play', name='url_radar_play'), |
|
|||
56 | url(r'^operation/(?P<id_camp>-?\d+)/radar/(?P<id_radar>-?\d+)/stop/$', 'apps.main.views.radar_stop', name='url_radar_stop'), |
|
|||
57 | url(r'^operation/(?P<id_camp>-?\d+)/radar/(?P<id_radar>-?\d+)/refresh/$', 'apps.main.views.radar_refresh', name='url_radar_refresh'), |
|
|||
58 |
|
4 | |||
|
5 | urlpatterns = ( | |||
|
6 | url(r'^$', views.index, name='index'), | |||
|
7 | url(r'^location/new/$', views.location_new, name='url_add_location'), | |||
|
8 | url(r'^location/$', views.locations, name='url_locations'), | |||
|
9 | url(r'^location/(?P<id_loc>-?\d+)/$', views.location, name='url_location'), | |||
|
10 | url(r'^location/(?P<id_loc>-?\d+)/edit/$', views.location_edit, name='url_edit_location'), | |||
|
11 | url(r'^location/(?P<id_loc>-?\d+)/delete/$', views.location_delete, name='url_delete_location'), | |||
|
12 | ||||
|
13 | url(r'^device/new/$', views.device_new, name='url_add_device'), | |||
|
14 | url(r'^device/$', views.devices, name='url_devices'), | |||
|
15 | url(r'^device/(?P<id_dev>-?\d+)/$', views.device, name='url_device'), | |||
|
16 | url(r'^device/(?P<id_dev>-?\d+)/edit/$', views.device_edit, name='url_edit_device'), | |||
|
17 | url(r'^device/(?P<id_dev>-?\d+)/delete/$', views.device_delete, name='url_delete_device'), | |||
|
18 | ||||
|
19 | url(r'^campaign/new/$', views.campaign_new, name='url_add_campaign'), | |||
|
20 | url(r'^campaign/$', views.campaigns, name='url_campaigns'), | |||
|
21 | url(r'^campaign/(?P<id_camp>-?\d+)/$', views.campaign, name='url_campaign'), | |||
|
22 | url(r'^campaign/(?P<id_camp>-?\d+)/edit/$', views.campaign_edit, name='url_edit_campaign'), | |||
|
23 | url(r'^campaign/(?P<id_camp>-?\d+)/delete/$', views.campaign_delete, name='url_delete_campaign'), | |||
|
24 | url(r'^campaign/(?P<id_camp>-?\d+)/export/$', views.campaign_export, name='url_export_campaign'), | |||
|
25 | url(r'^campaign/(?P<id_camp>-?\d+)/import/$', views.campaign_import, name='url_import_campaign'), | |||
|
26 | ||||
|
27 | url(r'^experiment/new/$', views.experiment_new, name='url_add_experiment'), | |||
|
28 | url(r'^experiment/$', views.experiments, name='url_experiments'), | |||
|
29 | url(r'^experiment/(?P<id_exp>-?\d+)/$', views.experiment, name='url_experiment'), | |||
|
30 | url(r'^experiment/(?P<id_exp>-?\d+)/edit/$', views.experiment_edit, name='url_edit_experiment'), | |||
|
31 | url(r'^experiment/(?P<id_exp>-?\d+)/delete/$', views.experiment_delete, name='url_delete_experiment'), | |||
|
32 | url(r'^experiment/(?P<id_exp>-?\d+)/export/$', views.experiment_export, name='url_export_experiment'), | |||
|
33 | url(r'^experiment/(?P<id_exp>-?\d+)/import/$', views.experiment_import, name='url_import_experiment'), | |||
|
34 | url(r'^experiment/(?P<id_exp>-?\d+)/mix/$', views.experiment_mix, name='url_mix_experiment'), | |||
|
35 | url(r'^experiment/(?P<id_exp>-?\d+)/mix/delete/$', views.experiment_mix_delete, name='url_delete_mix_experiment'), | |||
|
36 | url(r'^experiment/(?P<id_exp>-?\d+)/summary/$', views.experiment_summary, name='url_sum_experiment'), | |||
|
37 | url(r'^experiment/(?P<id_exp>-?\d+)/verify/$', views.experiment_verify, name='url_verify_experiment'), | |||
|
38 | ||||
|
39 | url(r'^experiment/(?P<id_exp>-?\d+)/new_dev_conf/$', views.dev_conf_new, name='url_add_dev_conf'), | |||
|
40 | url(r'^experiment/(?P<id_exp>-?\d+)/new_dev_conf/(?P<id_dev>-?\d+)/$', views.dev_conf_new, name='url_add_dev_conf'), | |||
|
41 | url(r'^dev_conf/$', views.dev_confs, name='url_dev_confs'), | |||
|
42 | url(r'^dev_conf/(?P<id_conf>-?\d+)/$', views.dev_conf, name='url_dev_conf'), | |||
|
43 | url(r'^dev_conf/(?P<id_conf>-?\d+)/edit/$', views.dev_conf_edit, name='url_edit_dev_conf'), | |||
|
44 | url(r'^dev_conf/(?P<id_conf>-?\d+)/delete/$', views.dev_conf_delete, name='url_delete_dev_conf'), | |||
|
45 | ||||
|
46 | url(r'^dev_conf/(?P<id_conf>-?\d+)/write/$', views.dev_conf_write, name='url_write_dev_conf'), | |||
|
47 | url(r'^dev_conf/(?P<id_conf>-?\d+)/read/$', views.dev_conf_read, name='url_read_dev_conf'), | |||
|
48 | url(r'^dev_conf/(?P<id_conf>-?\d+)/import/$', views.dev_conf_import, name='url_import_dev_conf'), | |||
|
49 | url(r'^dev_conf/(?P<id_conf>-?\d+)/export/$', views.dev_conf_export, name='url_export_dev_conf'), | |||
|
50 | url(r'^dev_conf/(?P<id_conf>-?\d+)/start/$', views.dev_conf_start, name='url_start_dev_conf'), | |||
|
51 | url(r'^dev_conf/(?P<id_conf>-?\d+)/stop/$', views.dev_conf_stop, name='url_stop_dev_conf'), | |||
|
52 | url(r'^dev_conf/(?P<id_conf>-?\d+)/status/$', views.dev_conf_status, name='url_status_dev_conf'), | |||
|
53 | ||||
|
54 | url(r'^operation/$', views.operation, name='url_operation'), | |||
|
55 | url(r'^operation/(?P<id_camp>-?\d+)/$', views.operation, name='url_operation'), | |||
|
56 | url(r'^operation/search/$', views.operation_search, name='url_operation_search'), | |||
|
57 | url(r'^operation/search/(?P<id_camp>-?\d+)/$', views.operation_search, name='url_operation_search'), | |||
|
58 | url(r'^operation/(?P<id_camp>-?\d+)/radar/(?P<id_radar>-?\d+)/play/$', views.radar_play, name='url_radar_play'), | |||
|
59 | url(r'^operation/(?P<id_camp>-?\d+)/radar/(?P<id_radar>-?\d+)/stop/$', views.radar_stop, name='url_radar_stop'), | |||
|
60 | url(r'^operation/(?P<id_camp>-?\d+)/radar/(?P<id_radar>-?\d+)/refresh/$', views.radar_refresh, name='url_radar_refresh'), | |||
59 | ) |
|
61 | ) |
@@ -5,17 +5,23 from django.core.urlresolvers import reverse | |||||
5 | from django.db.models import Q |
|
5 | from django.db.models import Q | |
6 | from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger |
|
6 | from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger | |
7 | from django.contrib import messages |
|
7 | from django.contrib import messages | |
|
8 | from django.http.request import QueryDict | |||
8 | from datetime import datetime |
|
9 | from datetime import datetime | |
9 | import urllib |
|
10 | ||
|
11 | try: | |||
|
12 | from urllib.parse import urlencode | |||
|
13 | except ImportError: | |||
|
14 | from urllib import urlencode | |||
10 |
|
15 | |||
11 | from .forms import CampaignForm, ExperimentForm, DeviceForm, ConfigurationForm, LocationForm, UploadFileForm, DownloadFileForm, OperationForm, NewForm |
|
16 | from .forms import CampaignForm, ExperimentForm, DeviceForm, ConfigurationForm, LocationForm, UploadFileForm, DownloadFileForm, OperationForm, NewForm | |
12 | from .forms import OperationSearchForm, FilterForm |
|
17 | from .forms import OperationSearchForm, FilterForm | |
13 | from apps.cgs.forms import CGSConfigurationForm |
|
18 | ||
|
19 | from apps.rc.forms import RCConfigurationForm | |||
|
20 | from apps.dds.forms import DDSConfigurationForm | |||
14 | from apps.jars.forms import JARSConfigurationForm |
|
21 | from apps.jars.forms import JARSConfigurationForm | |
15 |
from apps. |
|
22 | from apps.cgs.forms import CGSConfigurationForm | |
16 | from apps.abs.forms import ABSConfigurationForm |
|
23 | from apps.abs.forms import ABSConfigurationForm | |
17 |
from apps. |
|
24 | from apps.usrp.forms import USRPConfigurationForm | |
18 | from apps.dds.forms import DDSConfigurationForm |
|
|||
19 |
|
25 | |||
20 | from .models import Campaign, Experiment, Device, Configuration, Location, RunningExperiment |
|
26 | from .models import Campaign, Experiment, Device, Configuration, Location, RunningExperiment | |
21 | from apps.cgs.models import CGSConfiguration |
|
27 | from apps.cgs.models import CGSConfiguration | |
@@ -271,7 +277,7 def campaigns(request): | |||||
271 | kwargs['suptitle'] = 'List' |
|
277 | kwargs['suptitle'] = 'List' | |
272 |
kwargs['form'] = form |
|
278 | kwargs['form'] = form | |
273 | filters.pop('page', None) |
|
279 | filters.pop('page', None) | |
274 |
kwargs['q'] = |
|
280 | kwargs['q'] = urlencode(filters) | |
275 |
|
281 | |||
276 | return render(request, 'base_list.html', kwargs) |
|
282 | return render(request, 'base_list.html', kwargs) | |
277 |
|
283 | |||
@@ -482,7 +488,7 def experiments(request): | |||||
482 | kwargs['suptitle'] = 'List' |
|
488 | kwargs['suptitle'] = 'List' | |
483 | kwargs['form'] = form |
|
489 | kwargs['form'] = form | |
484 | filters.pop('page', None) |
|
490 | filters.pop('page', None) | |
485 |
kwargs['q'] = |
|
491 | kwargs['q'] = urlencode(filters) | |
486 |
|
492 | |||
487 | return render(request, 'base_list.html', kwargs) |
|
493 | return render(request, 'base_list.html', kwargs) | |
488 |
|
494 | |||
@@ -537,7 +543,6 def experiment_new(request, id_camp=None): | |||||
537 |
|
543 | |||
538 | if request.method == 'POST': |
|
544 | if request.method == 'POST': | |
539 | form = ExperimentForm(request.POST) |
|
545 | form = ExperimentForm(request.POST) | |
540 | print form.data |
|
|||
541 | if form.is_valid(): |
|
546 | if form.is_valid(): | |
542 | experiment = form.save() |
|
547 | experiment = form.save() | |
543 |
|
548 | |||
@@ -1014,7 +1019,7 def dev_confs(request): | |||||
1014 | kwargs['suptitle'] = 'List' |
|
1019 | kwargs['suptitle'] = 'List' | |
1015 |
kwargs['form'] = form |
|
1020 | kwargs['form'] = form | |
1016 | filters.pop('page', None) |
|
1021 | filters.pop('page', None) | |
1017 |
kwargs['q'] = |
|
1022 | kwargs['q'] = urlencode(filters) | |
1018 |
|
1023 | |||
1019 | return render(request, 'base_list.html', kwargs) |
|
1024 | return render(request, 'base_list.html', kwargs) | |
1020 |
|
1025 | |||
@@ -1031,10 +1036,10 def dev_conf_new(request, id_exp=0, id_dev=0): | |||||
1031 | initial = {} |
|
1036 | initial = {} | |
1032 | kwargs = {} |
|
1037 | kwargs = {} | |
1033 |
|
1038 | |||
1034 |
if id_exp |
|
1039 | if id_exp!=0: | |
1035 | initial['experiment'] = id_exp |
|
1040 | initial['experiment'] = id_exp | |
1036 |
|
1041 | |||
1037 |
if id_dev |
|
1042 | if id_dev!=0: | |
1038 | initial['device'] = id_dev |
|
1043 | initial['device'] = id_dev | |
1039 |
|
1044 | |||
1040 | if request.method == 'GET': |
|
1045 | if request.method == 'GET': | |
@@ -1103,16 +1108,13 def dev_conf_edit(request, id_conf): | |||||
1103 |
|
1108 | |||
1104 | conf = get_object_or_404(Configuration, pk=id_conf) |
|
1109 | conf = get_object_or_404(Configuration, pk=id_conf) | |
1105 |
|
1110 | |||
1106 | DevConfModel = CONF_MODELS[conf.device.device_type.name] |
|
|||
1107 | DevConfForm = CONF_FORMS[conf.device.device_type.name] |
|
1111 | DevConfForm = CONF_FORMS[conf.device.device_type.name] | |
1108 |
|
1112 | |||
1109 | dev_conf = DevConfModel.objects.get(pk=id_conf) |
|
|||
1110 |
|
||||
1111 | if request.method=='GET': |
|
1113 | if request.method=='GET': | |
1112 |
form = DevConfForm(instance= |
|
1114 | form = DevConfForm(instance=conf) | |
1113 |
|
1115 | |||
1114 | if request.method=='POST': |
|
1116 | if request.method=='POST': | |
1115 |
form = DevConfForm(request.POST, instance= |
|
1117 | form = DevConfForm(request.POST, instance=conf) | |
1116 |
|
1118 | |||
1117 | if form.is_valid(): |
|
1119 | if form.is_valid(): | |
1118 | form.save() |
|
1120 | form.save() | |
@@ -1134,10 +1136,6 def dev_conf_start(request, id_conf): | |||||
1134 |
|
1136 | |||
1135 | conf = get_object_or_404(Configuration, pk=id_conf) |
|
1137 | conf = get_object_or_404(Configuration, pk=id_conf) | |
1136 |
|
1138 | |||
1137 | DevConfModel = CONF_MODELS[conf.device.device_type.name] |
|
|||
1138 |
|
||||
1139 | conf = DevConfModel.objects.get(pk=id_conf) |
|
|||
1140 |
|
||||
1141 | if conf.start_device(): |
|
1139 | if conf.start_device(): | |
1142 | messages.success(request, conf.message) |
|
1140 | messages.success(request, conf.message) | |
1143 | else: |
|
1141 | else: | |
@@ -1152,10 +1150,6 def dev_conf_stop(request, id_conf): | |||||
1152 |
|
1150 | |||
1153 | conf = get_object_or_404(Configuration, pk=id_conf) |
|
1151 | conf = get_object_or_404(Configuration, pk=id_conf) | |
1154 |
|
1152 | |||
1155 | DevConfModel = CONF_MODELS[conf.device.device_type.name] |
|
|||
1156 |
|
||||
1157 | conf = DevConfModel.objects.get(pk=id_conf) |
|
|||
1158 |
|
||||
1159 | if conf.stop_device(): |
|
1153 | if conf.stop_device(): | |
1160 | messages.success(request, conf.message) |
|
1154 | messages.success(request, conf.message) | |
1161 | else: |
|
1155 | else: | |
@@ -1170,10 +1164,6 def dev_conf_status(request, id_conf): | |||||
1170 |
|
1164 | |||
1171 | conf = get_object_or_404(Configuration, pk=id_conf) |
|
1165 | conf = get_object_or_404(Configuration, pk=id_conf) | |
1172 |
|
1166 | |||
1173 | DevConfModel = CONF_MODELS[conf.device.device_type.name] |
|
|||
1174 |
|
||||
1175 | conf = DevConfModel.objects.get(pk=id_conf) |
|
|||
1176 |
|
||||
1177 | if conf.status_device(): |
|
1167 | if conf.status_device(): | |
1178 | messages.success(request, conf.message) |
|
1168 | messages.success(request, conf.message) | |
1179 | else: |
|
1169 | else: | |
@@ -1186,10 +1176,6 def dev_conf_write(request, id_conf): | |||||
1186 |
|
1176 | |||
1187 | conf = get_object_or_404(Configuration, pk=id_conf) |
|
1177 | conf = get_object_or_404(Configuration, pk=id_conf) | |
1188 |
|
1178 | |||
1189 | DevConfModel = CONF_MODELS[conf.device.device_type.name] |
|
|||
1190 |
|
||||
1191 | conf = DevConfModel.objects.get(pk=id_conf) |
|
|||
1192 |
|
||||
1193 | answer = conf.write_device() |
|
1179 | answer = conf.write_device() | |
1194 | conf.status_device() |
|
1180 | conf.status_device() | |
1195 |
|
1181 | |||
@@ -1211,11 +1197,8 def dev_conf_read(request, id_conf): | |||||
1211 |
|
1197 | |||
1212 | conf = get_object_or_404(Configuration, pk=id_conf) |
|
1198 | conf = get_object_or_404(Configuration, pk=id_conf) | |
1213 |
|
1199 | |||
1214 | DevConfModel = CONF_MODELS[conf.device.device_type.name] |
|
|||
1215 | DevConfForm = CONF_FORMS[conf.device.device_type.name] |
|
1200 | DevConfForm = CONF_FORMS[conf.device.device_type.name] | |
1216 |
|
1201 | |||
1217 | conf = DevConfModel.objects.get(pk=id_conf) |
|
|||
1218 |
|
||||
1219 | if request.method=='GET': |
|
1202 | if request.method=='GET': | |
1220 |
|
1203 | |||
1221 | parms = conf.read_device() |
|
1204 | parms = conf.read_device() | |
@@ -1252,10 +1235,7 def dev_conf_read(request, id_conf): | |||||
1252 | def dev_conf_import(request, id_conf): |
|
1235 | def dev_conf_import(request, id_conf): | |
1253 |
|
1236 | |||
1254 | conf = get_object_or_404(Configuration, pk=id_conf) |
|
1237 | conf = get_object_or_404(Configuration, pk=id_conf) | |
1255 |
|
||||
1256 | DevConfModel = CONF_MODELS[conf.device.device_type.name] |
|
|||
1257 |
DevConfForm = CONF_FORMS[conf.device.device_type.name] |
|
1238 | DevConfForm = CONF_FORMS[conf.device.device_type.name] | |
1258 | conf = DevConfModel.objects.get(pk=id_conf) |
|
|||
1259 |
|
1239 | |||
1260 | if request.method == 'GET': |
|
1240 | if request.method == 'GET': | |
1261 | file_form = UploadFileForm() |
|
1241 | file_form = UploadFileForm() | |
@@ -1303,10 +1283,6 def dev_conf_export(request, id_conf): | |||||
1303 |
|
1283 | |||
1304 | conf = get_object_or_404(Configuration, pk=id_conf) |
|
1284 | conf = get_object_or_404(Configuration, pk=id_conf) | |
1305 |
|
1285 | |||
1306 | DevConfModel = CONF_MODELS[conf.device.device_type.name] |
|
|||
1307 |
|
||||
1308 | conf = DevConfModel.objects.get(pk=id_conf) |
|
|||
1309 |
|
||||
1310 | if request.method == 'GET': |
|
1286 | if request.method == 'GET': | |
1311 | file_form = DownloadFileForm(conf.device.device_type.name) |
|
1287 | file_form = DownloadFileForm(conf.device.device_type.name) | |
1312 |
|
1288 | |||
@@ -1422,50 +1398,33 def get_paginator(model, page, order, filters={}, n=10): | |||||
1422 |
|
1398 | |||
1423 | def operation(request, id_camp=None): |
|
1399 | def operation(request, id_camp=None): | |
1424 |
|
1400 | |||
1425 | if not id_camp: |
|
|||
1426 | campaigns = Campaign.objects.all().order_by('-start_date') |
|
|||
1427 |
|
||||
1428 | if not campaigns: |
|
|||
1429 |
|
|
1401 | kwargs = {} | |
1430 | kwargs['title'] = 'No Campaigns' |
|
1402 | campaigns = Campaign.objects.filter(start_date__lte=datetime.now(), | |
1431 | kwargs['suptitle'] = 'Empty' |
|
1403 | end_date__gte=datetime.now()).order_by('-start_date') | |
1432 | return render(request, 'operation.html', kwargs) |
|
|||
1433 |
|
|
1404 | ||
1434 | id_camp = campaigns[0].id |
|
|||
1435 |
|
1405 | |||
|
1406 | if id_camp: | |||
1436 | campaign = get_object_or_404(Campaign, pk = id_camp) |
|
1407 | campaign = get_object_or_404(Campaign, pk = id_camp) | |
|
1408 | form = OperationForm(initial={'campaign': campaign.id}, campaigns=campaigns) | |||
|
1409 | kwargs['campaign'] = campaign | |||
|
1410 | else: | |||
|
1411 | form = OperationForm(campaigns=campaigns) | |||
|
1412 | kwargs['form'] = form | |||
|
1413 | return render(request, 'operation.html', kwargs) | |||
1437 |
|
1414 | |||
1438 | if request.method=='GET': |
|
|||
1439 | form = OperationForm(initial={'campaign': campaign.id}, length = 5) |
|
|||
1440 |
|
1415 | |||
1441 | if request.method=='POST': |
|
|||
1442 | form = OperationForm(request.POST, initial={'campaign':campaign.id}, length = 5) |
|
|||
1443 |
|
1416 | |||
1444 | if form.is_valid(): |
|
|||
1445 | return redirect('url_operation', id_camp=campaign.id) |
|
|||
1446 | #locations = Location.objects.filter(experiment__campaign__pk = campaign.id).distinct() |
|
|||
1447 | experiments = Experiment.objects.filter(campaign__pk=campaign.id) |
|
|||
1448 | #for exs in experiments: |
|
|||
1449 | # exs.get_status() |
|
|||
1450 | locations= Location.objects.filter(experiment=experiments).distinct() |
|
|||
1451 | #experiments = [Experiment.objects.filter(location__pk=location.id).filter(campaign__pk=campaign.id) for location in locations] |
|
|||
1452 | kwargs = {} |
|
|||
1453 | #---Campaign |
|
|||
1454 | kwargs['campaign'] = campaign |
|
|||
1455 | kwargs['campaign_keys'] = ['name', 'start_date', 'end_date', 'tags', 'description'] |
|
|||
1456 | #---Experiment |
|
1417 | #---Experiment | |
1457 | keys = ['id', 'name', 'start_time', 'end_time', 'status'] |
|
1418 | keys = ['id', 'name', 'start_time', 'end_time', 'status'] | |
1458 | kwargs['experiment_keys'] = keys[1:] |
|
1419 | kwargs['experiment_keys'] = keys[1:] | |
1459 | kwargs['experiments'] = experiments |
|
1420 | kwargs['experiments'] = experiments | |
1460 | #---Radar |
|
1421 | #---Radar | |
1461 |
kwargs['locations'] = location |
|
1422 | kwargs['locations'] = campaign.get_experiments_by_location() | |
|
1423 | print kwargs['locations'] | |||
1462 | #---Else |
|
1424 | #---Else | |
1463 | kwargs['title'] = 'Campaign' |
|
1425 | kwargs['title'] = 'Campaign' | |
1464 | kwargs['suptitle'] = campaign.name |
|
1426 | kwargs['suptitle'] = campaign.name | |
1465 | kwargs['form'] = form |
|
1427 | kwargs['form'] = form | |
1466 | kwargs['button'] = 'Search' |
|
|||
1467 | kwargs['details'] = True |
|
|||
1468 | kwargs['search_button'] = True |
|
|||
1469 |
|
1428 | |||
1470 | return render(request, 'operation.html', kwargs) |
|
1429 | return render(request, 'operation.html', kwargs) | |
1471 |
|
1430 | |||
@@ -1627,3 +1586,4 def radar_refresh(request, id_camp, id_radar): | |||||
1627 | return HttpResponseRedirect(reverse('url_operation_search', args=[id_camp])) |
|
1586 | return HttpResponseRedirect(reverse('url_operation_search', args=[id_camp])) | |
1628 | else: |
|
1587 | else: | |
1629 | return HttpResponseRedirect(reverse('url_operation', args=[id_camp])) |
|
1588 | return HttpResponseRedirect(reverse('url_operation', args=[id_camp])) | |
|
1589 |
@@ -1,5 +1,5 | |||||
1 |
from django.conf.urls import |
|
1 | from django.conf.urls import url | |
2 |
|
2 | |||
3 | urlpatterns = patterns('apps.misc.views', |
|
3 | urlpatterns = ( | |
4 |
|
4 | |||
5 | ) |
|
5 | ) |
@@ -87,7 +87,7 class RCConfigurationForm(forms.ModelForm): | |||||
87 | if form_data['clock_divider']<1: |
|
87 | if form_data['clock_divider']<1: | |
88 | self.add_error('clock_divider', 'Invalid Value') |
|
88 | self.add_error('clock_divider', 'Invalid Value') | |
89 | else: |
|
89 | else: | |
90 |
if form_data['ipp']*(20./3*(form_data['clock_in']/form_data['clock_divider']))%10 |
|
90 | if form_data['ipp']*(20./3*(form_data['clock_in']/form_data['clock_divider']))%10!=0: | |
91 | self.add_error('ipp', 'Invalid IPP units={}'.format(form_data['ipp']*(20./3*(form_data['clock_in']/form_data['clock_divider'])))) |
|
91 | self.add_error('ipp', 'Invalid IPP units={}'.format(form_data['ipp']*(20./3*(form_data['clock_in']/form_data['clock_divider'])))) | |
92 |
|
92 | |||
93 | return form_data |
|
93 | return form_data | |
@@ -380,5 +380,3 class RCLineCodesForm(forms.ModelForm): | |||||
380 | class Meta: |
|
380 | class Meta: | |
381 | model = RCLineCode |
|
381 | model = RCLineCode | |
382 | exclude = ('name',) |
|
382 | exclude = ('name',) | |
383 |
|
||||
384 | No newline at end of file |
|
@@ -3,8 +3,6 import ast | |||||
3 | import json |
|
3 | import json | |
4 | import numpy as np |
|
4 | import numpy as np | |
5 |
|
5 | |||
6 | from polymorphic import PolymorphicModel |
|
|||
7 |
|
||||
8 | from django.db import models |
|
6 | from django.db import models | |
9 | from django.core.urlresolvers import reverse |
|
7 | from django.core.urlresolvers import reverse | |
10 | from django.core.validators import MinValueValidator, MaxValueValidator |
|
8 | from django.core.validators import MinValueValidator, MaxValueValidator | |
@@ -148,7 +146,7 class RCConfiguration(Configuration): | |||||
148 | for line in self.get_lines(): |
|
146 | for line in self.get_lines(): | |
149 |
line_data = json.loads(line.params) |
|
147 | line_data = json.loads(line.params) | |
150 | if 'TX_ref' in line_data and line_data['TX_ref'] not in (0, '0'): |
|
148 | if 'TX_ref' in line_data and line_data['TX_ref'] not in (0, '0'): | |
151 | line_data['TX_ref'] = line.get_name() |
|
149 | line_data['TX_ref'] = RCLine.objects.get(pk=line_data['TX_ref']).get_name() | |
152 | if 'code' in line_data: |
|
150 | if 'code' in line_data: | |
153 | line_data['code'] = RCLineCode.objects.get(pk=line_data['code']).name |
|
151 | line_data['code'] = RCLineCode.objects.get(pk=line_data['code']).name | |
154 | line_data['type'] = line.line_type.name |
|
152 | line_data['type'] = line.line_type.name | |
@@ -182,6 +180,7 class RCConfiguration(Configuration): | |||||
182 |
positions = {'tx':0, 'tr':0} |
|
180 | positions = {'tx':0, 'tr':0} | |
183 |
|
181 | |||
184 |
for i, line_data in enumerate(data['lines']): |
|
182 | for i, line_data in enumerate(data['lines']): | |
|
183 | name = line_data.pop('name', '') | |||
185 | line_type = RCLineType.objects.get(name=line_data.pop('type')) |
|
184 | line_type = RCLineType.objects.get(name=line_data.pop('type')) | |
186 | if line_type.name=='codes': |
|
185 | if line_type.name=='codes': | |
187 | code = RCLineCode.objects.get(name=line_data['code']) |
|
186 | code = RCLineCode.objects.get(name=line_data['code']) | |
@@ -226,7 +225,7 class RCConfiguration(Configuration): | |||||
226 | points = list(points) |
|
225 | points = list(points) | |
227 |
points.sort() |
|
226 | points.sort() | |
228 |
|
227 | |||
229 |
if points[0] |
|
228 | if points[0]!=0: | |
230 | points.insert(0, 0) |
|
229 | points.insert(0, 0) | |
231 |
|
230 | |||
232 | return [points[i+1]-points[i] for i in range(len(points)-1)] |
|
231 | return [points[i+1]-points[i] for i in range(len(points)-1)] | |
@@ -349,7 +348,7 class RCConfiguration(Configuration): | |||||
349 | from bokeh.resources import CDN |
|
348 | from bokeh.resources import CDN | |
350 | from bokeh.embed import components |
|
349 | from bokeh.embed import components | |
351 |
from bokeh.mpl import to_bokeh |
|
350 | from bokeh.mpl import to_bokeh | |
352 |
from bokeh.models.tools import WheelZoomTool, ResetTool, PanTool, |
|
351 | from bokeh.models.tools import WheelZoomTool, ResetTool, PanTool, HoverTool, SaveTool | |
353 |
|
352 | |||
354 |
lines = self.get_lines() |
|
353 | lines = self.get_lines() | |
355 |
|
354 | |||
@@ -362,7 +361,7 class RCConfiguration(Configuration): | |||||
362 | for i, line in enumerate(lines): |
|
361 | for i, line in enumerate(lines): | |
363 |
labels.append(line.get_name(channel=True)) |
|
362 | labels.append(line.get_name(channel=True)) | |
364 | l = ax.plot((0, npoints),(N-i-1, N-i-1)) |
|
363 | l = ax.plot((0, npoints),(N-i-1, N-i-1)) | |
365 |
points = [(tup[0], tup[1]-tup[0]) for tup in line.pulses_as_points(km=km) if tup |
|
364 | points = [(tup[0], tup[1]-tup[0]) for tup in line.pulses_as_points(km=km) if tup!=(0,0)] | |
366 |
ax.broken_barh(points, (N-i-1, 0.5), |
|
365 | ax.broken_barh(points, (N-i-1, 0.5), | |
367 | edgecolor=l[0].get_color(), facecolor='none') |
|
366 | edgecolor=l[0].get_color(), facecolor='none') | |
368 |
|
367 | |||
@@ -375,11 +374,12 class RCConfiguration(Configuration): | |||||
375 |
|
374 | |||
376 |
|
375 | |||
377 | labels.reverse() |
|
376 | labels.reverse() | |
|
377 | ax.set_yticks(range(len(labels))) | |||
378 | ax.set_yticklabels(labels) |
|
378 | ax.set_yticklabels(labels) | |
379 |
|
||||
380 | ax.set_xlabel = 'Units' |
|
379 | ax.set_xlabel = 'Units' | |
381 |
plot = to_bokeh(fig, use_pandas=False) |
|
380 | plot = to_bokeh(fig, use_pandas=False) | |
382 |
plot.tools = [PanTool(dimensions=['width']), WheelZoomTool(dimensions=['width']), ResetTool(), |
|
381 | plot.tools = [PanTool(dimensions=['width']), WheelZoomTool(dimensions=['width']), ResetTool(), SaveTool()] | |
|
382 | plot.toolbar_location="above" | |||
383 |
|
383 | |||
384 | return components(plot, CDN) |
|
384 | return components(plot, CDN) | |
385 |
|
385 | |||
@@ -435,7 +435,7 class RCLineCode(models.Model): | |||||
435 | db_table = 'rc_line_codes' |
|
435 | db_table = 'rc_line_codes' | |
436 | ordering = ('name',) |
|
436 | ordering = ('name',) | |
437 |
|
437 | |||
438 |
def __ |
|
438 | def __str__(self): | |
439 |
return u'%s' % self.name |
|
439 | return u'%s' % self.name | |
440 |
|
440 | |||
441 |
|
441 | |||
@@ -448,7 +448,7 class RCLineType(models.Model): | |||||
448 | class Meta: |
|
448 | class Meta: | |
449 | db_table = 'rc_line_types' |
|
449 | db_table = 'rc_line_types' | |
450 |
|
450 | |||
451 |
def __ |
|
451 | def __str__(self): | |
452 | return u'%s - %s' % (self.name.upper(), self.get_name_display()) |
|
452 | return u'%s - %s' % (self.name.upper(), self.get_name_display()) | |
453 |
|
453 | |||
454 |
|
454 | |||
@@ -465,7 +465,7 class RCLine(models.Model): | |||||
465 | db_table = 'rc_lines' |
|
465 | db_table = 'rc_lines' | |
466 | ordering = ['channel'] |
|
466 | ordering = ['channel'] | |
467 |
|
467 | |||
468 |
def __ |
|
468 | def __str__(self): | |
469 | if self.rc_configuration: |
|
469 | if self.rc_configuration: | |
470 | return u'%s - %s' % (self.rc_configuration, self.get_name()) |
|
470 | return u'%s - %s' % (self.rc_configuration, self.get_name()) | |
471 |
|
471 | |||
@@ -581,17 +581,17 class RCLine(models.Model): | |||||
581 |
|
581 | |||
582 | ranges = params['range'].split(',') |
|
582 | ranges = params['range'].split(',') | |
583 |
|
583 | |||
584 |
if len(ranges)>0 and ranges[0] |
|
584 | if len(ranges)>0 and ranges[0]!='0': | |
585 | y_tx = self.mask_ranges(y_tx, ranges) |
|
585 | y_tx = self.mask_ranges(y_tx, ranges) | |
586 |
|
586 | |||
587 | tr_ranges = tr_params['range'].split(',') |
|
587 | tr_ranges = tr_params['range'].split(',') | |
588 |
|
588 | |||
589 |
if len(tr_ranges)>0 and tr_ranges[0] |
|
589 | if len(tr_ranges)>0 and tr_ranges[0]!='0': | |
590 | y_tx = self.mask_ranges(y_tx, tr_ranges) |
|
590 | y_tx = self.mask_ranges(y_tx, tr_ranges) | |
591 |
|
591 | |||
592 | y.extend(y_tx) |
|
592 | y.extend(y_tx) | |
593 |
|
593 | |||
594 |
self.pulses = |
|
594 | self.pulses = str(y) | |
595 | y = self.array_to_points(self.pulses_as_array()) |
|
595 | y = self.array_to_points(self.pulses_as_array()) | |
596 |
|
596 | |||
597 | elif self.line_type.name=='tx': |
|
597 | elif self.line_type.name=='tx': | |
@@ -611,7 +611,7 class RCLine(models.Model): | |||||
611 |
|
611 | |||
612 | ranges = params['range'].split(',') |
|
612 | ranges = params['range'].split(',') | |
613 |
|
613 | |||
614 |
if len(ranges)>0 and ranges[0] |
|
614 | if len(ranges)>0 and ranges[0]!='0': | |
615 | y = self.mask_ranges(y, ranges) |
|
615 | y = self.mask_ranges(y, ranges) | |
616 |
|
616 | |||
617 | elif self.line_type.name=='flip': |
|
617 | elif self.line_type.name=='flip': | |
@@ -624,7 +624,7 class RCLine(models.Model): | |||||
624 | tx = RCLine.objects.get(pk=params['TX_ref']) |
|
624 | tx = RCLine.objects.get(pk=params['TX_ref']) | |
625 | tx_params = json.loads(tx.params) |
|
625 | tx_params = json.loads(tx.params) | |
626 |
delays = [float(d)*km2unit for d in tx_params['delays'].split(',') if d] |
|
626 | delays = [float(d)*km2unit for d in tx_params['delays'].split(',') if d] | |
627 |
f = int(float(tx_params['pulse_width'])*km2unit |
|
627 | f = int(float(tx_params['pulse_width'])*km2unit/len(params['codes'][0])) | |
628 |
codes = [(np.fromstring(''.join([s*f for s in code]), dtype=np.uint8)-48).astype(np.int8) for code in params['codes']] |
|
628 | codes = [(np.fromstring(''.join([s*f for s in code]), dtype=np.uint8)-48).astype(np.int8) for code in params['codes']] | |
629 | codes = [self.array_to_points(code) for code in codes] |
|
629 | codes = [self.array_to_points(code) for code in codes] | |
630 | n = len(codes) |
|
630 | n = len(codes) | |
@@ -634,7 +634,7 class RCLine(models.Model): | |||||
634 | y.extend([(c[0]+tup[0], c[1]+tup[0]) for c in code]) |
|
634 | y.extend([(c[0]+tup[0], c[1]+tup[0]) for c in code]) | |
635 |
|
635 | |||
636 | ranges = tx_params['range'].split(',') |
|
636 | ranges = tx_params['range'].split(',') | |
637 |
if len(ranges)>0 and ranges[0] |
|
637 | if len(ranges)>0 and ranges[0]!='0': | |
638 | y = self.mask_ranges(y, ranges) |
|
638 | y = self.mask_ranges(y, ranges) | |
639 |
|
639 | |||
640 | elif self.line_type.name=='sync': |
|
640 | elif self.line_type.name=='sync': | |
@@ -674,7 +674,7 class RCLine(models.Model): | |||||
674 | before=int(self.rc_configuration.time_before*us2unit)+self.get_win_ref(p, params['TX_ref'], km2unit), |
|
674 | before=int(self.rc_configuration.time_before*us2unit)+self.get_win_ref(p, params['TX_ref'], km2unit), | |
675 | sync=self.rc_configuration.sync) |
|
675 | sync=self.rc_configuration.sync) | |
676 |
|
676 | |||
677 |
if len(tr_ranges)>0 and tr_ranges[0] |
|
677 | if len(tr_ranges)>0 and tr_ranges[0]!='0': | |
678 | y_win = self.mask_ranges(y_win, tr_ranges) |
|
678 | y_win = self.mask_ranges(y_win, tr_ranges) | |
679 |
|
679 | |||
680 |
y.extend(y_win) |
|
680 | y.extend(y_win) | |
@@ -738,11 +738,11 class RCLine(models.Model): | |||||
738 | else: |
|
738 | else: | |
739 | y = [] |
|
739 | y = [] | |
740 |
|
740 | |||
741 |
if self.rc_configuration.total_units |
|
741 | if self.rc_configuration.total_units != total: | |
742 | self.rc_configuration.total_units = total |
|
742 | self.rc_configuration.total_units = total | |
743 | self.rc_configuration.save() |
|
743 | self.rc_configuration.save() | |
744 |
|
744 | |||
745 |
self.pulses = |
|
745 | self.pulses = str(y) | |
746 | self.save() |
|
746 | self.save() | |
747 |
|
747 | |||
748 | @staticmethod |
|
748 | @staticmethod |
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: 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 |
General Comments 0
You need to be logged in to leave comments.
Login now