Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
sbethur opened this issue Jun 30, 2022 · 0 comments · Fixed by #1958
Assignees

Comments

@sbethur
Copy link
Contributor

sbethur commented Jun 30, 2022

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
@marcoskirsch marcoskirsch added this to the nimi-python 1.4.3 milestone Jul 21, 2022
@ni-jfitzger ni-jfitzger self-assigned this May 1, 2023
ni-jfitzger added a commit to ni-jfitzger/nimi-python that referenced this issue May 4, 2023
marcoskirsch pushed a commit that referenced this issue May 9, 2023
…l and record info in fetched data (#1958)

* Fix fetch, read?

* Fix fetch_array_measurement?

* Fix fetch_measurement_stats?

* fix fetch_into?

* Update changelog in anticipation of fix

* enable correct test cases for catching #1770

* Use subtemplate for population of channel and record info in fetched data

* remove mention of niscope from changelog fix description

* Remove get_channel_names TODO from tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants