From 706bf2b4b474671f148665cc225cb998ce343636 Mon Sep 17 00:00:00 2001 From: Yann Sionneau Date: Tue, 7 Jul 2015 15:39:51 +0200 Subject: [PATCH] pxi6733: allow usage of 2-dimensional arrays. close #66 --- artiq/devices/pxi6733/driver.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/artiq/devices/pxi6733/driver.py b/artiq/devices/pxi6733/driver.py index d4a53423b..22839ee04 100644 --- a/artiq/devices/pxi6733/driver.py +++ b/artiq/devices/pxi6733/driver.py @@ -63,9 +63,9 @@ class DAQmx: The device will output samples at each clock rising edge. The device waits for a clock rising edge to output the first sample. - When using several channels simultaneously, you must concatenate the - values for the different channels in the ``values`` array. - The sample values for the same channel must be grouped together. + When using several channels simultaneously, you can either concatenate + the values for the different channels in a 1-dimensional ``values`` + numpy ndarray. Example: @@ -76,16 +76,21 @@ class DAQmx: channel and the two following samples will be output via the second channel. + Or you can use a 2-dimensional numpy ndarray like this: + + >>> values = np.array([[ch0_samp0, ch0_samp1],[ch1_samp0, ch1_samp1]], + dtype=float) + Any call to this method will cancel any previous task even if it has not yet completed. :param sampling_freq: The sampling frequency in samples per second. - :param values: A numpy array of sample values (in volts) to load in + :param values: A numpy ndarray of sample values (in volts) to load in the device. """ self.clear_pending_task() - + values = values.flatten() t = self.daq.Task() t.CreateAOVoltageChan(self.channels, b"", min(values), max(values),