Skip to content

Commit f1a4cd6

Browse files
committed
Squashed commit of the following:
commit e2a992d028dd505b56eb5d84db8cc0c055221743 Author: David Meyer <dihm@users.noreply.github.com> Date: Tue Aug 22 15:30:36 2023 -0400 Merge pull request #101 from dihm/dtype_hotfix Fix bad np.array call in `Output.expand_timeseries` commit 20577d18ab9276dee33e7a2c89787221580f10e0 Author: David Meyer <dihm@users.noreply.github.com> Date: Wed Apr 12 21:35:18 2023 -0400 Merge pull request #89 from dihm/dds_gate_kwargs Allow passthrough of other kwargs in DDS gate DigitalOut specification.
1 parent 72eb32f commit f1a4cd6

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

labscript/labscript.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import threading
2020
from inspect import getcallargs
2121
from functools import wraps, lru_cache
22+
import numpy as np
2223

2324
# Notes for v3
2425
#
@@ -1722,7 +1723,7 @@ def expand_timeseries(self,all_times,flat_all_times_len):
17221723
# If this output is not ramping, then its timeseries should
17231724
# not be expanded. It's already as expanded as it'll get.
17241725
if not self.parent_clock_line.ramping_allowed:
1725-
self.raw_output = np.array(self.timeseries, dtype=np.dtype)
1726+
self.raw_output = np.array(self.timeseries, dtype=np.dtype(self.dtype))
17261727
return
17271728
outputarray = np.empty((flat_all_times_len,), dtype=np.dtype(self.dtype))
17281729
j=0
@@ -2860,7 +2861,7 @@ def __init__(self, name, parent_device, connection, digital_gate={}, freq_limits
28602861
digital_gate (dict, optional): Configures a digital output to use as an enable/disable
28612862
gate for the output. Should contain keys `'device'` and `'connection'`
28622863
with arguments for the `parent_device` and `connection` for instantiating
2863-
the :obj:`DigitalOut`.
2864+
the :obj:`DigitalOut`. All other (optional) keys are passed as kwargs.
28642865
freq_limits (tuple, optional): `(lower, upper)` limits for the
28652866
frequency of the output
28662867
freq_conv_class (:obj:`labscript_utils:labscript_utils.unitconversions`, optional):
@@ -2912,8 +2913,10 @@ def __init__(self, name, parent_device, connection, digital_gate={}, freq_limits
29122913
self.phase = AnalogQuantity(self.name + '_phase', self, 'phase', phase_limits, phase_conv_class, phase_conv_params)
29132914

29142915
self.gate = None
2915-
if 'device' in digital_gate and 'connection' in digital_gate:
2916-
self.gate = DigitalOut(name + '_gate', digital_gate['device'], digital_gate['connection'])
2916+
if 'device' in digital_gate and 'connection' in digital_gate:
2917+
dev = digital_gate.pop('device')
2918+
conn = digital_gate.pop('connection')
2919+
self.gate = DigitalOut(name + '_gate', dev, conn, **digital_gate)
29172920
# Did they only put one key in the dictionary, or use the wrong keywords?
29182921
elif len(digital_gate) > 0:
29192922
raise LabscriptError('You must specify the "device" and "connection" for the digital gate of %s.' % (self.name))
@@ -3041,7 +3044,7 @@ def __init__(self,name,parent_device,connection,digital_gate = {},freq_limits =
30413044
digital_gate (dict, optional): Configures a digital output to use as an enable/disable
30423045
gate for the output. Should contain keys `'device'` and `'connection'`
30433046
with arguments for the `parent_device` and `connection` for instantiating
3044-
the :obj:`DigitalOut`.
3047+
the :obj:`DigitalOut`. All other (optional) keys are passed as kwargs.
30453048
freq_limits (tuple, optional): `(lower, upper)` limits for the
30463049
frequency of the output
30473050
freq_conv_class (:obj:`labscript_utils:labscript_utils.unitconversions`, optional):
@@ -3091,8 +3094,10 @@ def __init__(self,name,parent_device,connection,digital_gate = {},freq_limits =
30913094
self.amplitude = StaticAnalogQuantity(self.name+'_amp',self,'amp',amp_limits,amp_conv_class,amp_conv_params)
30923095
self.phase = StaticAnalogQuantity(self.name+'_phase',self,'phase',phase_limits,phase_conv_class,phase_conv_params)
30933096

3094-
if 'device' in digital_gate and 'connection' in digital_gate:
3095-
self.gate = DigitalOut(self.name+'_gate',digital_gate['device'],digital_gate['connection'])
3097+
if 'device' in digital_gate and 'connection' in digital_gate:
3098+
dev = digital_gate.pop('device')
3099+
conn = digital_gate.pop('connection')
3100+
self.gate = DigitalOut(name + '_gate', dev, conn, **digital_gate)
30963101
# Did they only put one key in the dictionary, or use the wrong keywords?
30973102
elif len(digital_gate) > 0:
30983103
raise LabscriptError('You must specify the "device" and "connection" for the digital gate of %s.'%(self.name))

0 commit comments

Comments
 (0)