forked from M-Labs/artiq
1
0
Fork 0

pxi6733: allow usage of 2-dimensional arrays. close #66

This commit is contained in:
Yann Sionneau 2015-07-07 15:39:51 +02:00
parent 8a33d8c868
commit 706bf2b4b4
1 changed files with 10 additions and 5 deletions

View File

@ -63,9 +63,9 @@ class DAQmx:
The device will output samples at each clock rising edge. The device will output samples at each clock rising edge.
The device waits for a clock rising edge to output the first sample. The device waits for a clock rising edge to output the first sample.
When using several channels simultaneously, you must concatenate the When using several channels simultaneously, you can either concatenate
values for the different channels in the ``values`` array. the values for the different channels in a 1-dimensional ``values``
The sample values for the same channel must be grouped together. numpy ndarray.
Example: Example:
@ -76,16 +76,21 @@ class DAQmx:
channel and the two following samples will be output via the second channel and the two following samples will be output via the second
channel. 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 Any call to this method will cancel any previous task even if it has
not yet completed. not yet completed.
:param sampling_freq: The sampling frequency in samples per second. :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. the device.
""" """
self.clear_pending_task() self.clear_pending_task()
values = values.flatten()
t = self.daq.Task() t = self.daq.Task()
t.CreateAOVoltageChan(self.channels, b"", t.CreateAOVoltageChan(self.channels, b"",
min(values), max(values), min(values), max(values),