Skip to content

fetch(), read(), and friends return wrong data when called with channel ranges on multi-instrument niscope session #1770

@sbethur

Description

@sbethur

Description of issue

On a multi-instrument session in niscope, any method that returns MeasurementStats or WaveformInfo object (fetch(), read(), and friends) returns wrong data when the channel repeatability contains ranges.

System report

python -c "import niscope; niscope.print_diagnostic_information()" output:

OS:
   Name:      Windows
   Version:   10.0.16299
   Bits:      64
Driver:
   Name:      NI-SCOPE
   Version:   22.5.0.43
Module:
   Name:      niscope
   Version:   1.4.1
Python:
   Version:   3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
   Bits:      64
   Is_Venv:   True
   Installed Packages:
       zipp==3.8.0
       typing-extensions==4.2.0
       tomli==2.0.1
       setuptools==47.1.0
       pytest==7.1.2
       pyparsing==3.0.9
       py==1.11.0
       pluggy==1.0.0
       pip==20.1.1
       packaging==21.3
       numpy==1.21.6
       nitclk==1.4.1
       niscope==1.4.1
       nidcpower==1.4.1
       iniconfig==1.1.1
       importlib-metadata==4.12.0
       hightime==0.2.1
       fasteners==0.17.3
       colorama==0.4.5
       attrs==21.4.0
       atomicwrites==1.4.0

Steps to reproduce issue

import niscope

with niscope.Session('FakeDevice1, FakeDevice2', False, True, 'Simulate=1, DriverSetup=Model:5164; BoardType:PXIe') as session:
    test_record_length = 2000
    test_starting_record_number = 2
    test_num_records_to_acquire = 5
    test_num_records_to_fetch = test_num_records_to_acquire - test_starting_record_number
    session.configure_vertical(1.0, niscope.VerticalCoupling.AC)
    session.configure_horizontal_timing(50000000, test_record_length, 50.0, test_num_records_to_acquire, True)
    with session.initiate():
        # Passing case
        test_channels = 'FakeDevice2/0,FakeDevice1/1'
        waveforms = session.channels[test_channels].fetch(
            num_samples=test_record_length,
            record_number=test_starting_record_number,
            num_records=test_num_records_to_fetch)
        for w in waveforms:
            print (w.channel, ':', w.record)
        
        # Failing case
        test_channels = 'FakeDevice2/0:1'
        waveforms = session.channels[test_channels].fetch(
            num_samples=test_record_length,
            record_number=test_starting_record_number,
            num_records=test_num_records_to_fetch)
        for w in waveforms:
            print (w.channel, ':', w.record)

Output:

FakeDevice2/0 : 2
FakeDevice1/1 : 2
FakeDevice2/0 : 3
FakeDevice1/1 : 3
FakeDevice2/0 : 4
FakeDevice1/1 : 4
FakeDevice2/0:1 : 2
FakeDevice2/0:1 : 3
FakeDevice2/0:1 : 4
FakeDevice2/0:1 : 5
FakeDevice2/0:1 : 6
FakeDevice2/0:1 : 7

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions