session.py 文件源码

python
阅读 35 收藏 0 点赞 0 评论 0

项目:nimi-python 作者: ni 项目源码 文件源码
def fetch_waveform_into(self, waveform_array, maximum_time=-1):
        '''fetch_waveform

        For the NI 4080/4081/4082 and the NI 4070/4071/4072, returns an array of
        values from a previously initiated waveform acquisition. You must call
        _initiate before calling this function.

        Args:
            waveform_array (numpy array of float64): **Waveform Array** is an array of measurement values stored in waveform
                data type.
            maximum_time (int): Specifies the **maximum_time** allowed for this function to complete in
                milliseconds. If the function does not complete within this time
                interval, the function returns the NIDMM_ERROR_MAX_TIME_EXCEEDED
                error code. This may happen if an external trigger has not been
                received, or if the specified timeout is not long enough for the
                acquisition to complete.

                The valid range is 0–86400000. The default value is
                NIDMM_VAL_TIME_LIMIT_AUTO (-1). The DMM calculates the timeout
                automatically.

        Returns:
            waveform_array (numpy array of float64): **Waveform Array** is an array of measurement values stored in waveform
                data type.
            actual_number_of_points (int): Indicates the number of measured values actually retrieved from the DMM.
        '''
        import numpy

        if type(waveform_array) is not numpy.ndarray:
            raise TypeError('waveform_array must be {0}, is {1}'.format(numpy.ndarray, type(waveform_array)))
        if numpy.isfortran(waveform_array) is True:
            raise TypeError('waveform_array must be in C-order')
        if waveform_array.dtype is not numpy.dtype('float64'):
            raise TypeError('waveform_array must be numpy.ndarray of dtype=float64, is ' + str(waveform_array.dtype))
        array_size = len(waveform_array)

        vi_ctype = visatype.ViSession(self._vi)  # case 1
        maximum_time_ctype = visatype.ViInt32(maximum_time)  # case 9
        array_size_ctype = visatype.ViInt32(array_size)  # case 8
        waveform_array_ctype = numpy.ctypeslib.as_ctypes(waveform_array)  # case 13.5
        actual_number_of_points_ctype = visatype.ViInt32()  # case 14
        error_code = self._library.niDMM_FetchWaveform(vi_ctype, maximum_time_ctype, array_size_ctype, waveform_array_ctype, ctypes.pointer(actual_number_of_points_ctype))
        errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
        return
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号