Source code for ppf_moke.balanced_diode

# -*- coding: utf-8 -*-


import nidaqmx
import numpy as np


[docs]def read_voltage(N=100): """ returns the measured voltage using a national instruments measurement card on Device 1 channel 0 Parameters ----------- N : integer number of samples acquired, optional value Returns -------- measurement : float averaged measured voltage over N samples in V std : float standard deviation of the averaged N samples in V Example -------- >>> data, std = read_voltage() """ with nidaqmx.Task() as task: task.ai_channels.add_ai_voltage_chan("Dev1/ai0") measurement = np.mean(task.read(N)) std = np.std(task.read(N)) return measurement, std
[docs]def test(): """ prints a confirmation to the console if the module is properly loaded """ print("balanced_diode module is working")