Hi there,
I've created a patch to implement the following ni-DAQmx read property calls:
DAQmxGetReadRelativeTo() --> task.get_read_relative_to()
DAQmxSetReadRelativeTo() --> task.set_read_relative_to()
DAQmxResetReadRelativeTo() --> task.reset_read_relative_to()
DAQmxGetReadOverwrite() --> task.get_read_overwrite()
DAQmxSetReadOverwrite() --> task.set_read_overwrite()
DAQmxResetReadOverwrite() --> task.reset_read_overwrite()
DAQmxGetReadOffset() --> task.get_read_offset()
DAQmxSetReadOffset() --> task.set_read_offset()
DAQmxResetReadOffset() --> task.reset_read_offset()
These are useful when making measurements where only the last last x samples in
the buffer are required. Setting these properties and the clock to continuous
acquisition can also decrease the time required to start and stop the task if
you make frequent, repeated measurements. An example of usage is below:
>>> from nidaqmx import AnalogInputTask
>>> task = AnalogInputTask()
>>> task.create_voltage_channel('Dev1/ai0', terminal='diff', min_val=0.,
max_val=5.)
>>> task.configure_timing_sample_clock(rate=2e6, sample_mode='continuous',
samples_per_channel=32000)
>>> task.set_read_relative_to('most_recent')
>>> task.set_read_overwrite('overwrite')
>>> task.set_read_offset(32000)
>>> task.start()
>>> task.read(32000)
array([[ 2.99478992],
[ 2.9951122 ],
[ 2.99478992],
...,
[ 2.99462878],
[ 2.9951122 ],
[ 2.99462878]])
>>> task.read(32000)
array([[ 2.99462878],
[ 2.99446764],
[ 2.99462878],
...,
[ 2.99478992],
[ 2.99495106],
[ 2.9951122 ]])
etc.
Tested with nidaqmx v. 9.5 and a USB-6363 DAQ box. The docstrings might be a
little verbose, so feel free to cut them down if you think it's appropriate (I
based them off of the C API documentation).
Thanks,
toki
Original issue reported on code.google.com by reddoghud on 12 Sep 2012 at 12:13
Original issue reported on code.google.com by
reddoghud
on 12 Sep 2012 at 12:13Attachments: