diff --git a/apps/main/templates/dev_conf_edit.html b/apps/main/templates/dev_conf_edit.html
index 492a521..327d7b5 100644
--- a/apps/main/templates/dev_conf_edit.html
+++ b/apps/main/templates/dev_conf_edit.html
@@ -35,7 +35,7 @@
{% endif %}
-{% if dds_device %}
+{% if device == 'dds' %}
{% endif %}
+{% if device == 'rc' %}
+
+{% endif %}
+
{% endblock %}
\ No newline at end of file
diff --git a/apps/main/views.py b/apps/main/views.py
index a27ffd9..31f2d94 100644
--- a/apps/main/views.py
+++ b/apps/main/views.py
@@ -844,6 +844,7 @@ def dev_conf_new(request, id_exp=0, id_dev=0):
else:
kwargs['button'] = 'Create'
conf = Configuration.objects.get(pk=request.GET['template'])
+ id_dev = conf.device.pk
DevConfForm = CONF_FORMS[conf.device.device_type.name]
form = DevConfForm(instance=conf,
initial={'name': '{} [{:%Y/%m/%d}]'.format(conf.name, datetime.now()),
@@ -881,8 +882,7 @@ def dev_conf_new(request, id_exp=0, id_dev=0):
if id_dev != 0:
device = Device.objects.get(pk=id_dev)
- if 'dds' in device.device_type.name:
- kwargs['dds_device'] = True
+ kwargs['device'] = device.device_type.name
return render(request, 'dev_conf_edit.html', kwargs)
diff --git a/apps/rc/models.py b/apps/rc/models.py
index ed766c1..a250c1b 100644
--- a/apps/rc/models.py
+++ b/apps/rc/models.py
@@ -179,13 +179,14 @@ class RCConfiguration(Configuration):
self.time_after = data['time_after']
self.sync = data['sync']
self.sampling_reference = data['sampling_reference']
+ self.total_units = self.ipp*self.ntx*self.km2unit
self.save()
self.clean_lines()
lines = []
positions = {'tx':0, 'tr':0}
- for i, line_data in enumerate(data['lines']):
+ for i, line_data in enumerate(data['lines']):
line_type = RCLineType.objects.get(name=line_data.pop('type'))
if line_type.name=='codes':
code = RCLineCode.objects.get(name=line_data['code'])
@@ -345,7 +346,7 @@ class RCConfiguration(Configuration):
def update_pulses(self):
for line in self.get_lines():
- line.update_pulses()
+ line.update_pulses()
def plot_pulses(self):
@@ -552,9 +553,10 @@ class RCLine(models.Model):
for tx in txs:
params = json.loads(tx.params)
+
if float(params['pulse_width'])==0:
continue
- delays = [float(d)*km2unit for d in params['delays'].split(',') if d]
+ delays = [float(d)*km2unit for d in params['delays'].split(',') if d]
width = float(params['pulse_width'])*km2unit+int(self.rc_configuration.time_before*us2unit)
before = 0
after = int(self.rc_configuration.time_after*us2unit)
@@ -576,12 +578,12 @@ class RCLine(models.Model):
y_tx = self.mask_ranges(y_tx, tr_ranges)
y.extend(y_tx)
-
- self.pulses = unicode(y)
+
+ self.pulses = unicode(y)
y = self.array_to_points(self.pulses_as_array())
elif self.line_type.name=='tx':
- params = json.loads(self.params)
+ params = json.loads(self.params)
delays = [float(d)*km2unit for d in params['delays'].split(',') if d]
width = float(params['pulse_width'])*km2unit
@@ -715,8 +717,7 @@ class RCLine(models.Model):
y = y & y_temp
elif ops[i]=='NAND':
y = y & ~y_temp
- else:
- print len(y), len(Y)
+ else:
y = np.concatenate([y, Y])
total = len(y)
@@ -727,7 +728,7 @@ class RCLine(models.Model):
if self.rc_configuration.total_units <> total:
self.rc_configuration.total_units = total
- self.rc_configuration.save()
+ self.rc_configuration.save()
self.pulses = unicode(y)
self.save()
diff --git a/apps/rc/static/js/cr.js b/apps/rc/static/js/cr.js
index 15ae2bc..4624c11 100644
--- a/apps/rc/static/js/cr.js
+++ b/apps/rc/static/js/cr.js
@@ -14,7 +14,7 @@ function str2unit(s){
var ret = "";
values = s.split(",");
for (i=0; i
-
+
Km
-
- Units
'''.format(disabled, label, name, value, disabled, label, unit)
+
+ Units
'''.format(input_type, disabled, label, name, value, unit)
script = '''