niscope module

Installation

As a prerequisite to using the niscope module, you must install the NI-SCOPE runtime on your system. Visit ni.com/downloads to download the driver runtime for your devices.

The nimi-python modules (i.e. for NI-SCOPE) can be installed with pip:

$ python -m pip install niscope

Usage

The following is a basic example of using the niscope module to open a session to a High Speed Digitizer and capture a single record of 1000 points.

import niscope
with niscope.Session("Dev1") as session:
    session.channels[0].configure_vertical(range=1.0, coupling=niscope.VerticalCoupling.AC)
    session.channels[1].configure_vertical(range=10.0, coupling=niscope.VerticalCoupling.DC)
    session.configure_horizontal_timing(min_sample_rate=50000000, min_num_pts=1000, ref_position=50.0, num_records=5, enforce_realtime=True)
    with session.initiate():
        waveforms = session.channels[0,1].fetch(num_records=5)
    for wfm in waveforms:
        print('Channel {}, record {} samples acquired: {:,}\n'.format(wfm.channel, wfm.record, len(wfm.samples)))

    # Find all channel 1 records (Note channel name is always a string even if integers used in channel[])
    chan1 = [wfm for wfm in waveforms if wfm.channel == '0']

    # Find all record number 3
    rec3 = [wfm for wfm in waveforms if wfm.record == 3]

If you need faster fetch performance, or to directly interface with SciPy, you can use the fetch_into() method instead of fetch(). See the fetch_into example.

Other usage examples can be found on GitHub.

API Reference