def fetch_waveform_into(self, waveform_data):
'''fetch_waveform
Returns waveform data.
Args:
waveform_data (numpy array of float64): Samples fetched from the device. Array should be numberOfSamples big.
Returns:
waveform_data (numpy array of float64): Samples fetched from the device. Array should be numberOfSamples big.
actual_number_of_samples (int): Number of samples actually fetched.
'''
import numpy
if type(waveform_data) is not numpy.ndarray:
raise TypeError('waveform_data must be {0}, is {1}'.format(numpy.ndarray, type(waveform_data)))
if numpy.isfortran(waveform_data) is True:
raise TypeError('waveform_data must be in C-order')
if waveform_data.dtype is not numpy.dtype('float64'):
raise TypeError('waveform_data must be numpy.ndarray of dtype=float64, is ' + str(waveform_data.dtype))
number_of_samples = len(waveform_data)
vi_ctype = visatype.ViSession(self._vi) # case 1
number_of_samples_ctype = visatype.ViInt32(number_of_samples) # case 8
waveform_data_ctype = numpy.ctypeslib.as_ctypes(waveform_data) # case 13.5
actual_number_of_samples_ctype = visatype.ViInt32() # case 14
error_code = self._library.niFake_FetchWaveform(vi_ctype, number_of_samples_ctype, waveform_data_ctype, ctypes.pointer(actual_number_of_samples_ctype))
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
return
评论列表
文章目录