nifgen module¶
Installation¶
As a prerequisite to using the nifgen module, you must install the NI-FGEN runtime on your system. Visit ni.com/downloads to download the driver runtime for your devices.
The nimi-python modules (i.e. for NI-FGEN) can be installed with pip:
$ python -m pip install nifgen~=0.8.0
Or easy_install from setuptools:
$ python -m easy_install nifgen
Usage¶
The following is a basic example of using the nifgen module to open a session to a Function Generator and generate a sine wave for 5 seconds.
import nifgen
import time
with nifgen.Session("Dev1") as session:
session.output_mode = nifgen.OutputMode.FUNC
session.configure_standard_waveform(waveform=nifgen.Waveform.SINE, amplitude=1.0, frequency=10000000, dc_offset=0.0, start_phase=0.0)
with session.initiate():
time.sleep(5)
Additional examples for NI-FGEN are located in src/nifgen/examples/ directory.