Code Monkey home page Code Monkey logo

pylibnidaqmx's People

pylibnidaqmx's Issues

AnalogOutputTask link on front page is dead

The AnalogOutputTask link in the documentation on the front page 
(https://code.google.com/p/pylibnidaqmx/) is dead.

Original issue reported on code.google.com by richard.hoechenberger on 23 Jan 2014 at 2:21

Problems Performing Digital Input and Output Tasks

What steps will reproduce the problem?

from nidaqmx import DigitalInputTask
import numpy as np
task = DigitalInputTask
task.create_channel('Dev1/port0/line0:7', name='', grouping = 'per_line')
task.configure_timing_sample_clock(rate = 1000.0)
data = task.read(2000, fill_mode='group_by_channel')
del task
from pylab import plot, show
plot (data)
show ()

What is the expected output? What do you see instead?

I want to read/write Digital Signal and I receive this error for the reading:
"""
TypeError: unbound method create_channel() must be called with DigitalInputTask 
instance as first argument (got str instance instead) 
What version of the product are you using? On what operating system?
I am using the latest version
"""

Please provide any additional information below.

Original issue reported on code.google.com by [email protected] on 9 Jul 2014 at 3:23

nidaqmx.h not available when using the core runtime

What steps will reproduce the problem?
1. install the nidaqmx core runtime 
(http://joule.ni.com/nidu/cds/view/p/id/2891/lang/en) rather than the full 
installation (166MB rather than the 1.5GB or so for the full driver -- a huge 
time saver!).
2. the nidaqmx.h file is not installed
3. attempts to use pylibnidaqmx fail

What is the expected output? What do you see instead?

    import nidaqmx
  File "C:\Python27\lib\site-packages\nidaqmx\__init__.py", line 83, in <module>

    from .libnidaqmx import AnalogInputTask, AnalogOutputTask,\
  File "C:\Python27\lib\site-packages\nidaqmx\libnidaqmx.py", line 122, in <modu
le>
    assert os.path.isfile (include_nidaqmx_h), `include_nidaqmx_h`
AssertionError: u'C:\\Program Files (x86)\\National Instruments\\NI-DAQ\\DAQmx A
NSI C Dev\\include\\NIDAQmx.h'


What version of the product are you using? On what operating system?

windows 7 64-bit
the latest pylibnidaqmx from source
nidaqmx 9.5.1 core runtime

Please provide any additional information below.

it would appear that pylibnidaqmx parses this header file to obtain what 
is/isn't supported by the driver version - would it be possible for you to 
include a default header file to use if one is not found in the NI folders?  
(if their licensing permits).  How likely is it to become out-of-date?

Original issue reported on code.google.com by [email protected] on 28 Jun 2012 at 1:42

enhancement: better error reporting

(patch attached)

In my nidaqmx wrapper (which is much less capable that this one), I use 
DAQmxGetExtendedErrorInfo if possible, because it provides better info for 
debugging.  So I added that to pylibnidaqmx.  Also, if such an error occurs, it 
raises a custom exception NIDAQmxRuntimeError, which is a subclass of 
RuntimeError.  This shouldn't break existing code that assumes it raises 
RuntimeError (because NIDAQmxRuntimeError is a RuntimeError), but lets callers 
differentiate between a generic RuntimeError and NIDAQmxRuntimeError if they 
desire.


Original issue reported on code.google.com by [email protected] on 4 Jan 2012 at 12:05

Attachments:

Missing nicaiu.dll from regular location - suggest adding Windows/System32 location

What steps will reproduce the problem?

Unsure. At some point in development, nicaiu.dll went missing. This could have 
been an update, or maybe windows trickery.

What is the expected output? What do you see instead?

Instead of properly registering libnidaqmx, libnidaqmx is set to None. 

What version of the product are you using? On what operating system?

Running Windows 7 Enterprise, 64-bit, with libnidaqmx version 8.9.

Please provide any additional information below.

I did a full system search and found a copy of nicaiu.dll at 
C:/Windows/System32/nicaiu.dll... perhaps this could be added to the initial 
DLL loading process?

Original issue reported on code.google.com by [email protected] on 25 May 2012 at 5:40

Add AnalogOutput status calls

I'm attaching a patch that adds the GetWriteCurrWritePos() and 
GetWriteTotalSampPerChanGenerated() calls.

These are useful for getting the status of an AnalogOutput task while it's 
running.

I put them in the Task base object.  Perhaps these should be split into 
AnalogOutput and the corresponding GetRead calls should be in AnalogInput.

Thanks,
Mark 


diff --git a/nidaqmx/libnidaqmx.py b/nidaqmx/libnidaqmx.py
index a349b72..d7e86d4 100644
--- a/nidaqmx/libnidaqmx.py
+++ b/nidaqmx/libnidaqmx.py
@@ -2556,6 +2556,26 @@ class Task(uInt32):
         CALL('GetReadTotalSampPerChanAcquired', self, ctypes.byref(d))
         return d.value

+    def get_write_current_position(self):
+        """
+        Indicates the position in the buffer of the next sample to generate. 
+        This value is the same for all channels in the task.
+        """
+        d = uInt64(0)
+        CALL('GetWriteCurrWritePos', self, ctypes.byref(d))
+        return d.value
+        
+    def get_write_samples_per_channel_generated(self):
+        """
+        Indicates the total number of samples generated by each
+        channel. NI-DAQmx returns a single value because this value is
+        the same for all channels.
+        """
+        d = uInt64(0)
+        CALL('GetWriteTotalSampPerChanGenerated', self, ctypes.byref(d))
+        return d.value
+
+
     def wait_until_done(self, timeout=-1):
         """
         Waits for the measurement or generation to complete. Use this


Original issue reported on code.google.com by [email protected] on 29 Apr 2014 at 9:51

Tried to use this with PCI-6229 and NIDAQmx9.6

What steps will reproduce the problem?
1. Install Enthought Python EPD 2.7.2
2. Install NI DAQmx 9.6 with NI PCI-6229 Multifunction DAQ
3. Install pylibnidaqmx. No message about failure to install
4. Try to run the AnalogOutputTask

What is the expected output? What do you see instead?
AOTask import throws up error and asks to upload nidaqmx_h_9_6.py to this page

What version of the product are you using? On what operating system?
EPD Python 2.7.3 on Windows 7 x86 (32bit). NI-DAQmx 9.6

Original issue reported on code.google.com by [email protected] on 13 Jul 2013 at 6:22

Attachments:

Import nidaqmx fails on Windows XP 32

On Windows XP 32, doing 'import nidaqmx' fails (using trunk as of Feb 24th)

You get the following traceback:
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)

C:\DOCUME~1\tester\MYDOCU~1\SMSC\nidaqmx\<ipython console> in <module>()

C:\DOCUME~1\tester\MYDOCU~1\SMSC\nidaqmx\nidaqmx\__init__.py in <module>()
     52 that should plot two sine waves.
     53 """
     54
     55
---> 56 from .libnidaqmx import AnalogInputTask, AnalogOutputTask,
DigitalInputT
ask, DigitalOutputTask, CounterInputTask, CounterOutputTask

C:\DOCUME~1\tester\MYDOCU~1\SMSC\nidaqmx\nidaqmx\libnidaqmx.py in <module>()
     80 if libnidaqmx is not None:
     81
---> 82     nidaqmx_version = get_nidaqmx_version()
     83     nidaqmx_h_name = 'nidaqmx_h_%s' % (nidaqmx_version.replace
('.', '_'
))
     84

C:\DOCUME~1\tester\MYDOCU~1\SMSC\nidaqmx\nidaqmx\libnidaqmx.py in
get_nidaqmx_ve
rsion()
     72         return None
     73     d = uInt32 (0)
---> 74     libnidaqmx.DAQmxGetSysNIDAQMajorVersion(ctypes.byref(d))
     75     major = d.value
     76     libnidaqmx.DAQmxGetSysNIDAQMinorVersion(ctypes.byref(d))

ValueError: Procedure called with not enough arguments (4 bytes missing) or
wrong calling convention

The problem is that on Windows most DAQmx calls use the windll calling
convention.  Replacing the definition of libnidaqmx with

else:
    if os.name=='nt':
        libnidaqmx = ctypes.windll.LoadLibrary(lib)
    else:
        libnidaqmx = ctypes.cdll.LoadLibrary(lib)

resolves the problem.

Original issue reported on code.google.com by [email protected] on 25 Feb 2010 at 3:42

support for 'nidaqmx base'?

What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?
macbook pro
os x 10.6.4


Please provide any additional information below.

nidaqmx is not available for mac os x.  only a subset, 'nidaqmx base' is 
available.  are there any plans to provide support for 'nidaqmx base'?

Original issue reported on code.google.com by [email protected] on 30 Jun 2010 at 6:52

USB 6509 - Setting a Digital Output Task

QUERY: 

I am interested in setting up a Digital Output Task on NI-USB 6509 using the 
libnidaqmx library. Following are the simple lines of code I have written:

from libnidaqmx import System
from libnidaqmx import Device
import numpy as np

from libnidaqmx import DigitalOutputTask

system = System()

print 'libnidaqmx version:', system.version
print 'NI-DAQ devices:', system.devices
dev1 = system.devices[0]
print 'Product Type:', dev1.get_product_type()
print 'Product Number:',dev1.get_product_number()
print 'Product Serial:', dev1.get_serial_number()
print 'Bus Type:', dev1.get_bus()

task = DigitalOutputTask()
task.create_channel('Dev1/Port2/Line7',grouping='per_line');   
task.configure_timing_sample_clock()

I get an error saying that the property value is invalid because it conflicts 
with another property. The detailed error warning is attached below.

I am guessing it might be because this board does not have an on-board clock 
which is the default parameter in the above function. If that is the case could 
associating this function with the system clock could be a solution ? 

This library has been tested on PCI cards on Linux platform, so can it be used 
on other cards on Windows platform ?

I am setting up this board for using this library for running small 
experiments, so any suggestions regarding the feasibility of doing this would 
be really helpful.

Thanks.

What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?

I see this : 
Traceback (most recent call last):
  File "<pyshell#1>", line 5, in <module>
    samples_per_channel = 1000)
  File "C:\Users\anupam\Documents\Project\nidaqmx\libnidaqmx.py", line 1296, in configure_timing_sample_clock
    uInt64(samples_per_channel))
  File "C:\Users\anupam\Documents\Project\nidaqmx\libnidaqmx.py", line 187, in CALL
    r = CHK(r, funcname, *new_args)
  File "C:\Users\anupam\Documents\Project\nidaqmx\libnidaqmx.py", line 168, in CHK
    raise RuntimeError('%s%s:%s' % (funcname,args, text))
RuntimeError: DAQmxCfgSampClkTiming(DigitalOutputTask('_unnamedTask<0>'), 
'OnboardClock', c_double(1.0), 10280, 10123, c_ulonglong(1000L)):
  Requested value is not a supported value for this property. The property value
  may be invalid because it conflicts with another property.

What version of the product are you using? On what operating system?

NI - USB 6509, Windows 7

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 5 Jul 2011 at 9:29

Add ResetDevice command

Please add the ResetDevice command.  We've found the nidaq devices to be 
unreliable after extended use, and the only thing that seems to fix the problem 
is to reset the device.  I have added the ResetDevice command, but would like 
to see it in the base library:

    def reset_device (self):
        """
        Reset the DAQ to the initial state
        """
        return CALL ('ResetDevice', self)


Original issue reported on code.google.com by [email protected] on 31 May 2013 at 2:22

Could not access device more than one time

What steps will reproduce the problem?
1. Run twice:
>>> from nidaqmx import AnalogInputTask
>>> import numpy as np
>>> task = AnalogInputTask()
>>> task.create_voltage_channel('Dev1/ai16', terminal = 'rse', min_val=-10.0, 
max_val=10.0)
>>> task.configure_timing_sample_clock(rate = 1000.0)
>>> task.start()
>>> data = task.read(2000, fill_mode='group_by_channel')
>>> del task
>>> from pylab import plot, show
>>> plot (data)
>>> show ()

What is the expected output? What do you see instead?
Do 2 measurements. First measurement succeeds, second fails:
RuntimeError: DAQmxReadAnalogF64(AnalogInputTask('_unnamedTask<0>'), 2000, 
c_double(10.0), 0, 41860352, 2000, <cparam 'P' (0224D558)>, None):
  Onboard device memory overflow. Because of system and/or bus-bandwidth
  limitations, the driver could not read data from the device fast enough to keep
  up with the device throughput.  Reduce the sample rate, or reduce the number of
  programs your computer is executing concurrently.
  ----------


What version of the product are you using? On what operating system?
Latest git + windows7 64 bit

Please provide any additional information below.
See attachemnt for full error. 

I can run this twice:
http://www.scipy.org/Cookbook/Data_Acquisition_with_NIDAQmx

Original issue reported on code.google.com by [email protected] on 19 Oct 2012 at 9:39

Attachments:

enhancement: libraries probably shouldn't print to stdout

Sometimes there are messages printed to STDOUT (e.g. when the library generates 
a nidaqmx_h_x_x.py file).  This interfered with an application I made that 
expected specific strings printed to STDOUT.  Obviously it was not expecting 
the messages from pylibnidaqmx, and it was tricky to track down, because 
pylibnidaqmx doesn't print very often.   I think such output belongs on STDERR 
instead, but I suppose it's a matter of opinion.  Patch attached.


Original issue reported on code.google.com by [email protected] on 30 Mar 2012 at 10:12

Attachments:

Device.get_digital_input_lines() fails for NI USB-6509

1. Attach a NI USB-6509 or set up a simulated one in NI MAX
2. Get the correct device from nidaqmx
3. Do device.get_digital_input_lines()

You get the following traceback:

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)

C:\DOCUME~1\tester\MYDOCU~1\SMSC\nidaqmx\<ipython console> in <module>()

C:\DOCUME~1\tester\MYDOCU~1\SMSC\nidaqmx\nidaqmx\libnidaqmx.py in
get_digital_in
put_lines(self)
    316         buf_size = 1000
    317         buf = ctypes.create_string_buffer('\000' * buf_size)
--> 318         CALL ('GetDevDILines', self, ctypes.byref (buf), buf_size)
    319         names = [n.strip() for n in buf.value.split(',') if n.strip()]
    320         return names

C:\DOCUME~1\tester\MYDOCU~1\SMSC\nidaqmx\nidaqmx\libnidaqmx.py in
CALL(name, *ar
gs)
    164             new_args.append (a)
    165     r = func(*new_args)
--> 166     r = CHK(r, funcname, *new_args)
    167     return r
    168

C:\DOCUME~1\tester\MYDOCU~1\SMSC\nidaqmx\nidaqmx\libnidaqmx.py in
CHK(return_cod
e, funcname, *args)
    148             text = '\n  '.join(['']+textwrap.wrap(buf.value,
80)+['-'*10
])
    149             if return_code < 0:
--> 150                 raise RuntimeError('%s%s:%s' % (funcname,args, text))
    151             else:
    152                 sys.stderr.write('%s%s warning:%s\n' % (funcname, args,
text))

RuntimeError: DAQmxGetDevDILines('Dev1', <cparam 'P' (0149C338)>, 1000):
  Buffer is too small to fit the string.
  ----------

In [16]: s.devices[0].get_digital_output_lines()
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)

C:\DOCUME~1\tester\MYDOCU~1\SMSC\nidaqmx\<ipython console> in <module>()

C:\DOCUME~1\tester\MYDOCU~1\SMSC\nidaqmx\nidaqmx\libnidaqmx.py in
get_digital_ou
tput_lines(self)
    338         buf_size = 1000
    339         buf = ctypes.create_string_buffer('\000' * buf_size)
--> 340         CALL ('GetDevDOLines', self, ctypes.byref (buf), buf_size)
    341         names = [n.strip() for n in buf.value.split(',') if n.strip()]
    342         return names

C:\DOCUME~1\tester\MYDOCU~1\SMSC\nidaqmx\nidaqmx\libnidaqmx.py in
CALL(name, *ar
gs)
    164             new_args.append (a)
    165     r = func(*new_args)
--> 166     r = CHK(r, funcname, *new_args)
    167     return r
    168

C:\DOCUME~1\tester\MYDOCU~1\SMSC\nidaqmx\nidaqmx\libnidaqmx.py in
CHK(return_cod
e, funcname, *args)
    148             text = '\n  '.join(['']+textwrap.wrap(buf.value,
80)+['-'*10
])
    149             if return_code < 0:
--> 150                 raise RuntimeError('%s%s:%s' % (funcname,args, text))
    151             else:
    152                 sys.stderr.write('%s%s warning:%s\n' % (funcname, args,
text))

RuntimeError: DAQmxGetDevDOLines('Dev1', <cparam 'P' (010FD6E0)>, 1000):
  Buffer is too small to fit the string.
  ----------

Increasing the buffer size in get_digital_input_lines() and
get_digital_output_lines() to 2500 works fine (actual response size is
probably about half of this).  A more general solution would be better.

Original issue reported on code.google.com by [email protected] on 25 Feb 2010 at 7:44

python 3 support

pylibnidaqmx doesn't support python3.  Are there any plans to do so?  I can 
assist.

Original issue reported on code.google.com by [email protected] on 3 Jan 2014 at 11:40

register_every_n_samples_event function doesn't work

What steps will reproduce the problem?
1.connect NI USB-6008 
2.run AI_callback.py

What is the expected output? What do you see instead?
The callback function, processData, should be called around 10 times. It
was called only one time and then report an error.

>>> etner processData
[1.7970646050673522, 1.7984920817111949, 1.7988999321808641,
1.798899932180865, 1.7986960069460296, 1.7978803060066901,
1.7980842312415248, 1.797472455537021, 1.7968606798325175, 1.7976763807718563]
Traceback (most recent call last):
  File
"C:\Python26\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py",
line 322, in RunScript
    debugger.run(codeObject, __main__.__dict__, start_stepping=0)
  File
"C:\Python26\Lib\site-packages\pythonwin\pywin\debugger\__init__.py", line
60, in run
    _GetCurrentDebugger().run(cmd, globals,locals, start_stepping)
  File
"C:\Python26\Lib\site-packages\pythonwin\pywin\debugger\debugger.py", line
655, in run
    exec cmd in globals, locals
  File "C:\Python26\AI_callback.py", line 21, in <module>
    task.stop()
  File "C:\Python26\lib\site-packages\nidaqmx\libnidaqmx.py", line 787, in stop
    return CALL('StopTask', self) == 0
  File "C:\Python26\lib\site-packages\nidaqmx\libnidaqmx.py", line 187, in CALL
    r = CHK(r, funcname, *new_args)
  File "C:\Python26\lib\site-packages\nidaqmx\libnidaqmx.py", line 168, in CHK
    raise RuntimeError('%s%s:%s' % (funcname,args, text))
RuntimeError: DAQmxStopTask(AnalogInputTask('_unnamedTask<5>'),):
  Measurements: Task specified is invalid or does not exist.
  ----------


What version of the product are you using? On what operating system?
I am using NI USB-6008 on windows PC.

Please provide any additional information below.
I tried register_done_event with finite AI mode, it has the same the problems. 

Original issue reported on code.google.com by [email protected] on 28 Apr 2010 at 8:37

Attachments:

Importing Analog/digital input/output task does not work

What steps will reproduce the problem?
1. Installation pylibnidaqmx from Source
2.
3.

What is the expected output? What do you see instead?
Expected output: the import should be successful. Instead I get the following 
message:

from nidaqmx import AnalogInputTask
------------------------------------------------------------
Traceback (most recent call last):
  File "<ipython console>", line 1, in <module>
ImportError: cannot import name AnalogInputTask

What version of the product are you using? On what operating system?
NI6008; Pythonxy bundle, pylibnidaqmx-0.2.0

Please provide any additional information below.
import nidaqmx works. But fails to import classes in "libnidaqmx.py" file.

Thank you,
Regards,
Kousik


Original issue reported on code.google.com by [email protected] on 27 Jul 2011 at 2:09

nidaqmx_h_9_8.py

Install terminated with this request to upload the attached file:

Generating 'C:\\Python27\\lib\\site-packages\\nidaqmx\\nidaqmx_h_9_8.py'
Please upload generated file 
'C:\\Python27\\lib\\site-packages\\nidaqmx\\nidaqmx_h_9_8.py' to 
http://code.google.com/p/pylibnidaqmx/issues

Original issue reported on code.google.com by [email protected] on 6 Nov 2013 at 6:52

Attachments:

[Enhancement] DigitalInputOutputTask

You provide a read-only DigitalInputTask class and a write-only 
DigitalOutputTask, which makes sense regarding the semantics. However, as far 
as I know DO can always be read on NI hardware. I did not want to patch your 
code so that I have made the following trivial class for DIO


class DIOTask(DigitalOutputTask, DigitalInputTask):

    channel_type = "DO"

    def create_channel(self, *args, **kwargs):
        DigitalOutputTask.create_channel(self, *args, **kwargs)


and it works as expected on my hardware.

However, the solution on your side might be to simply inherit DigitalInputTask 
(instead of DigitalTask) in your declaration of DigitalOutputTask, line 2913 of 
libnidaqmx.py and provide a DigitalIOTask = DigitalOutputTask for the 
semantics. If you do not want to do this, I would still suggest to add my 
DIOTask to your library. I did not try to see what channel_type does, so I left 
it to "DO".


Thank you for your work anyway,
Mathias

Original issue reported on code.google.com by [email protected] on 17 Mar 2012 at 9:14

nidaqmx_h_8_9.py

Windows XP SP3, NI-DAQmx 8.9.5, pythonxy. Here is another addition to your 
collection of nidaqmx_h_x_y.py files.

By the way, I have PCI cards from the 622x series and BNC-2090A connectors. I 
started testing your library on this hardware and digital output works. I chose 
your library among the few others I found because the interface looked the best 
to me. Thank you for your work.

Original issue reported on code.google.com by [email protected] on 1 Aug 2011 at 3:45

Attachments:

nidaqmx_h_14_1.py for NiDAQmx runtime Version 14.1

What steps will reproduce the problem?
1. - 
2. - 
3. - 

What is the expected output? What do you see instead?
-

What version of the product are you using? On what operating system?
latest from trunk, win7 64Bit with 32bit NiDAQmx installed

Please provide any additional information below.
Attached: "nidaqmx_h_14_1.py" for latest NI-DAQmx Runtime 14.1 header

Original issue reported on code.google.com by [email protected] on 9 Sep 2014 at 10:54

Attachments:

NIDAQmx.h missing on windows 7 64 bit

What steps will reproduce the problem?
Install NIDAQ drivers from NI. Run any pylibnydaqmx command.

What is the expected output? What do you see instead?
pylibnidaqmx should include the NIDAQmx.h from the "Program Files (x86)" dir.

What version of the product are you using? On what operating system?
Latest from git, on windows7

Please provide any additional information below.
NI installs only dev files in C:\Program Files (x86)\National 
Instruments\NI-DAQ, not in C:\Program Files)\National Instruments\NI-DAQ

Original issue reported on code.google.com by [email protected] on 19 Oct 2012 at 9:27

AttributeError by readig analog input

What steps will reproduce the problem?
1.I want to read a analg input like the example
2.The failure occure after the line >>> task = AnalogInputTask()
3.

What is the expected output? What do you see instead?
I got the failure:  
File "C:\Python27\lib\site-packages\nidaqmx\libnidaqmx.py", line 178, in CALL 
func = getattr(libnidaqmx, funcname)
AttributeError: 'NoneType' object has no attribute 'DAQmxCreateTask'


What version of the product are you using? On what operating system?
Win7

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 12 Mar 2015 at 11:03

Aded support for read properties: read_relative_to, read_overwrite, offset,

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

Attachments:

Importing Analog/digital input/output task does not work

What steps will reproduce the problem?
1. Installation pylibnidaqmx from Source
2.
3.

What is the expected output? What do you see instead?
Expected output: the import should be successful. Instead I get the following 
message:

from nidaqmx import AnalogInputTask
------------------------------------------------------------
Traceback (most recent call last):
  File "<ipython console>", line 1, in <module>
ImportError: cannot import name AnalogInputTask

What version of the product are you using? On what operating system?
NI6008; Pythonxy bundle, pylibnidaqmx-0.2.0

Please provide any additional information below.
import nidaqmx works. But fails to import classes in "libnidaqmx.py" file.

Thank you,
Regards,
Kousik


Original issue reported on code.google.com by [email protected] on 27 Jul 2011 at 2:09

Status Code: -200479 During First Example

I'm running the first example to troubleshoot why my more complex 
AnalogOutputTask isn't running correctly. Here's the example:

from nidaqmx import AnalogOutputTask
import numpy as np

data = 9.95*np.sin(np.arange(1000, dtype=np.float64)*2*np.pi/1000)
task = AnalogOutputTask()
task.create_voltage_channel('Dev1/ao2', min_val=-10.0, max_val=10.0)
task.configure_timing_sample_clock(rate = 1000.0)
task.write(data)
task.start()
raw_input('Generating voltage continuously. Press Enter to interrupt..')
task.stop()
del task


What steps will reproduce the problem?
1. Running the first example in IPython.

What is the expected output? What do you see instead?
I would expect the AnalogOutputTask to produce a sine wave.


What version of the product are you using? On what operating system?

NidaqMX 9.8 and PyLibNidaqMX 0.2.0 (I think)

Please provide any additional information below.
Any help in understanding this issue would be appreciated! I know the 
AnalogOutputTask works in other context, so there must be something about this 
simple task that breaks a deeper issue I'm having with calling AnalogOutputTask.

Thanks,
Andrew

Original issue reported on code.google.com by [email protected] on 18 Aug 2014 at 3:53

DI-Task, channel with grouping='for_all_lines' fails

What steps will reproduce the problem?
1. run the attached script

(I tried to make it rather general so that I hope it will run correctly on 
other NIDAQmx hardware. If not, look at the script and change it accordingly).

What is the expected output? What do you see instead?

I expect that a digital input channel gets created and 1 sample is read from 
32-bit wide input port.

However, the script fails with an error because the DigitalTask.read() method 
tries to use np.uint256 (which does not exist). It should use np.uint32.

What version of the product are you using? On what operating system?
System information
==============================
OS: Win7, 64bit
NIDAQmx version = 9.1
Connected devices: Dev1
Global tasks:
Global channels:

Device: Dev1
==============================
Type: NI-USB-6259
Bus type: USB

Please provide any additional information below.

I have attached a patch.

Original issue reported on code.google.com by [email protected] on 20 Apr 2012 at 9:23

Attachments:

Bug in create_channel_count_edges

What steps will reproduce the problem?

1. from nidaqmx import *
2. t3 = CounterInputTask()
3. t3.create_channel_count_edges("Dev0/ctr1")

The create_channel_count_edges method of CounterInputTask() will not create a 
channel as is does not pass the init counts value to the underlying NI-DAQmx 
function. In libnidaqmx.py, replace 

        return CALL ('CreateCICountEdgesChan', self, counter, name, edge_val, direction_val)==0

with

        return CALL ('CreateCICountEdgesChan', self, counter, name, edge_val, init, direction_val)==0


Original issue reported on code.google.com by [email protected] on 20 Nov 2013 at 12:12

Problem with DigitalOutputTask.write() when `grouping=for_all_lines`

What steps will reproduce the problem?

>>> from nidaqmx import DigitalOutputTask
>>> do = DigitalOutputTask()
>>> do.create_channel('Dev1/port0/line0:7', grouping='for_all_lines')
CreateDOChan argument  is unicode
True
>>> do.write(1)

What is the expected output? What do you see instead?

The sample(s) should be written and a positive integer returned. Instead, I get:
Traceback (most recent call last):
  File "<ipython-input-5-e7e16794d5a3>", line 1, in <module>
    do.write(1)
  File "d:\development\pylibnidaqmx\nidaqmx\libnidaqmx.py", line 3645, in write
    data.ctypes.data, ctypes.byref(samples_written), None)
  File "d:\development\pylibnidaqmx\nidaqmx\libnidaqmx.py", line 268, in CALL
    r = CHK(r, funcname, *new_args)
  File "d:\development\pylibnidaqmx\nidaqmx\libnidaqmx.py", line 246, in CHK
    raise NIDAQmxRuntimeError('%s%s:%s' % (funcname,args, text))
NIDAQmxRuntimeError: DAQmxWriteDigitalLines(DigitalOutputTask('_unnamedTask<0>')
, 1, c_ulong(1L), c_double(10.0), 0, 116675480, <cparam 'P' (06DD4F08)>, None):
  Attempted writing digital data that is not supported. Data: 250 Supported
  Values: 0, 1  Task Name: _unnamedTask<0>  Status Code: -200562
  ----------

What version of the product are you using? On what operating system?

Latest trunk.

I don't know if I'm doing something wrong or have found a bug. Any help would 
be greatly appreciated.

Richard

Original issue reported on code.google.com by richard.hoechenberger on 2 Dec 2014 at 11:58

a hardcoded path should not be used to find NIDAQmx.h

What steps will reproduce the problem?
1. Install 32-bit NIDAQ on a 64-bit Windows system
2. Verify that nidaqmx does not have the nidaqmx_h_x_x.py file corresponding to 
the version of NIDAQ that is installed.
3. Try to import nidaqmx.

What is the expected output? What do you see instead?

It should generate the nidaqmx_h_x_x.py for the corresponding version of 
NIDAQmx.  Since the NIDAQ header is in ...\Program Files (x86)\... pylibnidaqmx 
will crash because the file it's looking for doesn't exist.

What version of the product are you using? On what operating system?

SVN r38, Win7 64

Attached patch uses programfiles environment variable, which should do the 
Right Thing.

Also attached is the autogenerated file for version 9.3.

Original issue reported on code.google.com by [email protected] on 30 Mar 2012 at 10:06

Attachments:

Cannot find library nidaqmx.dll when using nidaqmx 9.0 driver

What steps will reproduce the problem?
1. Install nidaqmx 9.0 from NI website
2. Run setup script included with pylibnidaqmx
3. Try to run: from libnidaqmx import AnalogInputTask

What is the expected output? What do you see instead?
Expected output: none
What I see:
>>> from libnidaqmx import AnalogInputTask
Error: Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "C:\Python26\Lib\site-packages\nidaqmx\libnidaqmx.py", line 104, in
<module>
    raise ImportError('Failed to find NI-DAQmx library. Make sure that
libnidaqmx is installed and its location is listed in PATH|LD_LIBRARY_PATH|..')
ImportError: Failed to find NI-DAQmx library. Make sure that libnidaqmx is
installed and its location is listed in PATH|LD_LIBRARY_PATH|..


What version of the product are you using? On what operating system?
pylibnidaqmx version: 12
OS: Windows XP
Python 2.6 - Python(x,y) distribution

Please provide any additional information below.

Searching for any file named nidaqmx.dll on the system shows there is none.
 There are nidaqmx.h and nidaqmx.lib, but no .dll file.  

Searching the NI help forums, I found a message from a delphi developer
searching for the same .dll file
(http://forums.ni.com/ni/board/message?board.id=70&thread.id=1746) .  He
was pointed to a different .dll file: nicaiu.dll.  When I change the
ctypes.util.find_library() call in libnidaqmx.py to search for 'nicau'
instead of 'nidaqmx', it loads the library but generates a new error: 

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "C:\Python26\Lib\site-packages\nidaqmx\libnidaqmx.py", line 129, in
<module>
    nidaqmx_version = get_nidaqmx_version()
  File "C:\Python26\Lib\site-packages\nidaqmx\libnidaqmx.py", line 123, in
get_nidaqmx_version
    libnidaqmx.DAQmxGetSysNIDAQMajorVersion(ctypes.byref(d))
ValueError: Procedure called with not enough arguments (4 bytes missing) or
wrong calling convention

Original issue reported on code.google.com by [email protected] on 2 Dec 2009 at 12:11

msvccompiler in numpy.distutils

While installing nidaqmx the following error occurred at the end of the 
installation:

"No module names msvccompiler in numpy.distutils; trying from distutils 
customize MSVCCompiler"

The list of modules in Python shows that "nidaqmx_h_9_6" and "nidaqmx_h_9_7" 
are available. However, trying to execute "from nidaqmx import System" gave the 
following error:

File "<pyshell#11>", line 1, in <module>
    from nidaqmx_h_9_7 import System
ImportError: cannot import name System

I am working on Windows 7 64-bit.

Original issue reported on code.google.com by [email protected] on 25 Nov 2013 at 10:04

NIDAQmx.h path

What steps will reproduce the problem?
1. import nidaqmx


What is the expected output? What do you see instead?
I expect that the module nidaqmx gets loaded.
Instead, I get an error message indicating that NIDAQmx.h was not found

What version of the product are you using? On what operating system?
SVN revision 42
Win7 64bit
NIDAQmx 9.1.1
NI-USB-6259

Please provide any additional information below.

The following change in libnidaqmx.py fixes the problem for me. However, I do 
not know whether this fix also works for other NIDAQmx version or operating 
systems.

# A. Schlatter, 17.4.2012:
include_nidaqmx_h = os.path.join(nidaqmx_install, 
                            r'DAQmx ANSI C Dev\include\NIDAQmx.h')
ansi_c_dev = os.path.join(nidaqmx_install, r'DAQmx ANSI C Dev')
regkey.Close()


Original issue reported on code.google.com by [email protected] on 17 Apr 2012 at 9:46

add call for DAQmxResetDevice

I propose adding the call to DAQmxResetDevice to the Device class in 
libnidaqmx.py

class Device(str):

    """
    Exposes NI-DACmx device to Python.
    """


    def reset(self):
        """
        Stops and deletes all tasks on a device and rests outputs to their defaults
        calls  int32 DAQmxResetDevice (const char deviceName[]);
        """
        return CALL('ResetDevice',self)

Original issue reported on code.google.com by [email protected] on 19 Jun 2012 at 5:20

DigitalInputTask

What steps will reproduce the problem?
from nidaqmx import AnalogInputTask
from nidaqmx import DigitalInputTask
import numpy as np
task = AnalogInputTask()
task.create_voltage_channel('Dev1/ai0', terminal = 'rse', min_val=-10.0, 
max_val=10.0)
task.configure_timing_sample_clock(rate = 1000.0)
task.start()
data = task.read(2000, fill_mode='group_by_channel')
del task
ditask = DigitalInputTask() 
ditask.create_channel('Dev1/port0/line0', name= 'line06' )
ditask.configure_timing_sample_clock(rate = 1000.0)
didata = task.read(2000, fill_mode='group_by_channel')
del ditask
from pylab import plot, show
plot (didata)
show ()

What is the expected output? What do you see instead?
Receive the Data Input data.

What version of the product are you using? On what operating system?
I am using the the lastest verison on the Windows 7 OS.

Please provide any additional information below.
i recieve this error: 
"""
  Requested value is not a supported value for this property. The property value
  may be invalid because it conflicts with another property. Property:
  DAQmx_SampTimingType Requested Value: DAQmx_Val_SampClk You Can Select:
  DAQmx_Val_OnDemand  Task Name: _unnamedTask<2>  Status Code: -200077
"""

Original issue reported on code.google.com by [email protected] on 14 Jul 2014 at 6:47

Basic usage example of analog output does not need task.start()

In the Basic Usage example, on analog output, there is the command task.start() 
after task.write(data), it is unecessary (and harmfull if you are running in 
script) since the default auto_start state for write is True.

Original issue reported on code.google.com by bernardo.kyotoku on 24 Jul 2010 at 3:20

add support for reference triggering

I don't see support for the reference triggered functions:

DAQmxCfgAnlgEdgeRefTrig()
DAQmxCfgAnlgWindowRefTrig()
DAQmxCfgDigEdgeRefTrig()
DAQmxCfgDigPatternRefTrig()

Original issue reported on code.google.com by [email protected] on 15 Jun 2012 at 6:24

enhancement-add examples of using pylibnidaqmx

Hi 
I've been writing small examples of using the library and thought I would
share them to see if they are generally useful. I'll attach a zip file.  
They can BSD licensed or may be used under whatever license pylibnidaqmx
itself uses.

I have a mercurial repository for them.
see http://bitbucket.org/cleemesser/pylibnidaqmx-examples/src/

I'm currently doing most testing on windows xp using DAQmx 8.8 and some
version 9.0.2

Also of note, I have a cython interface file to the raw DAQmx library which
works (at least on windows).  It's possible to use this together with
pylibnidaqmx.

Original issue reported on code.google.com by [email protected] on 17 Feb 2010 at 12:31

Attachments:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.