def supports_period_measurement(device_name):
    import warnings

    with warnings.catch_warnings():
        # PyDAQmx warns about a positive return value, but actually this is how you are
        # supposed to figure out the size of the array required.
        warnings.simplefilter("ignore")
        # Pass in null pointer and 0 len to ask for what array size is needed:
        npts = daqmx.DAQmxGetDevCISupportedMeasTypes(device_name,
                                                     types.int32(), 0)
    # Create that array
    result = (types.int32 * npts)()
    daqmx.DAQmxGetDevCISupportedMeasTypes(device_name, result, npts)
    return c.DAQmx_Val_Period in [result[i] for i in range(npts)]
Пример #2
0
 def __init__(self):
     # How many samples for each Task()?
     self.reads_per_run = 1000
     # samples/second
     self.sample_rate = 1000
     # (min, max) I *think* the NI 6009 only handles 0 to 5.
     self.voltages = (0.0, 5.0)
     # Holds the sample data
     self.raw_data = np.zeros(self.reads_per_run, dtype = np.float64)
     # Main task instance. Currently we're creating a new one for each
     # read, check if can reuse.
     self.task = None
     self.dev = 'Dev1/ai0'
     self.timeout = 10.0
     self.have_read = daqt.int32()