Issue 31 in pylibnidaqmx: Aded support for read properties: read_relative_to, read_overwrite, offset,

6 views
Skip to first unread message

pylibn...@googlecode.com

unread,
Sep 11, 2012, 8:14:03 PM9/11/12
to pylibnida...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 31 by reddoghud: Aded support for read properties:
read_relative_to, read_overwrite, offset,
http://code.google.com/p/pylibnidaqmx/issues/detail?id=31

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

Attachments:
libnidaqmx.py.patch 8.0 KB

pylibn...@googlecode.com

unread,
May 9, 2014, 12:23:25 PM5/9/14
to pylibnida...@googlegroups.com
Updates:
Status: Done

Comment #1 on issue 31 by pearu.peterson: Aded support for read properties:
read_relative_to, read_overwrite, offset,
http://code.google.com/p/pylibnidaqmx/issues/detail?id=31

Applied to svn repo.

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
Reply all
Reply to author
Forward
0 new messages