def _write_named_waveform_f64_numpy(self, waveform_name, data):
'''_write_named_waveform_f64
Writes floating-point data to the waveform in onboard memory. The
waveform handle passed in must have been created by a call to the
nifgen_AllocateWaveform function or to one of the following niFgen
Create Waveform functions:
- nifgen_CreateWaveformF64
- nifgen_CreateWaveformI16
- nifgen_CreateWaveformFromFileI16
- nifgen_CreateWaveformFromFileF64
- nifgen_CreateWaveformFromFileHWS
By default, the subsequent call to the _write_named_waveform_f64
function continues writing data from the position of the last sample
written. You can set the write position and offset by calling the
nifgen_SetNamedWaveformNextWritePosition function. If streaming is
enabled, you can write more data than the allocated waveform size in
onboard memory. Refer to the
`Streaming <REPLACE_DRIVER_SPECIFIC_URL_2(streaming)>`__ topic for more
information about streaming data.
Tip:
This method requires repeated capabilities (usually channels). If called directly on the
nifgen.Session object, then the method will use all repeated capabilities in the session.
You can specify a subset of repeated capabilities using the Python index notation on an
nifgen.Session instance, and calling this method on the result.:
session['0,1']._write_named_waveform_f64(waveform_name, data)
Args:
waveform_name (string): Specifies the name to associate with the allocated waveform.
data (numpy array of float64): Specifies the array of data to load into the waveform. The array must
have at least as many elements as the value in **size**.
'''
import numpy
if type(data) is not numpy.ndarray:
raise TypeError('data must be {0}, is {1}'.format(numpy.ndarray, type(data)))
if numpy.isfortran(data) is True:
raise TypeError('data must be in C-order')
if data.dtype is not numpy.dtype('float64'):
raise TypeError('data must be numpy.ndarray of dtype=float64, is ' + str(data.dtype))
vi_ctype = visatype.ViSession(self._vi) # case 1
channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case 2
waveform_name_ctype = ctypes.create_string_buffer(waveform_name.encode(self._encoding)) # case 3
size_ctype = visatype.ViInt32(0 if data is None else len(data)) # case 6
data_ctype = numpy.ctypeslib.as_ctypes(data) # case 13.5
error_code = self._library.niFgen_WriteNamedWaveformF64(vi_ctype, channel_name_ctype, waveform_name_ctype, size_ctype, data_ctype)
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
return
评论列表
文章目录