Skip to content

Add support for AD7091R-2, AD7091R-4 and AD7091R-8 #66

Add support for AD7091R-2, AD7091R-4 and AD7091R-8

Add support for AD7091R-2, AD7091R-4 and AD7091R-8 #66

GitHub Actions / Test Results failed Sep 3, 2024 in 0s

1 fail, 1 244 skipped, 357 pass in 11m 49s

1 602 tests  ±0     357 ✅ ±0   11m 49s ⏱️ -1s
    1 suites ±0   1 244 💤 ±0 
    1 files   ±0       1 ❌ ±0 

Results for commit c22d8ea. ± Comparison against earlier commit 3e595a5.

Annotations

Check warning on line 0 in test.test_ad7091r

See this annotation in the file changed.

@github-actions github-actions / Test Results

test_ad7091rx_rx_data[0-adi.ad7091rx] (test.test_ad7091r) failed

results.xml [took 3s]
Raw output
Exception: Buffer all zeros
assert 0 > 0
 +  where 0 = <function max at 0x7fd1c43d8cf0>(array([0, 0, 0, ..., 0, 0, 0], dtype=uint16))
 +    where <function max at 0x7fd1c43d8cf0> = np.max
 +    and   array([0, 0, 0, ..., 0, 0, 0], dtype=uint16) = <ufunc 'absolute'>(array([0, 0, 0, ..., 0, 0, 0], dtype=uint16))
 +      where <ufunc 'absolute'> = np.abs
uri = 'ip:10.1.0.26', classname = 'adi.ad7091rx', channel = 0, use_rx2 = False
buffer_size = 32768, annotated = False, param_set = None

    def dma_rx(
        uri,
        classname,
        channel,
        use_rx2=False,
        buffer_size=2 ** 15,
        annotated=False,
        param_set=None,
    ):
        """dma_rx: Construct RX buffers and verify data is non-zero when pulled.
        Collected buffer is of size 2**15 and 10 buffers are checked
    
        parameters:
            uri: type=string
                URI of IIO context of target board/system
            classname: type=string
                Name of pyadi interface class which contain attribute
            channel: type=list
                List of integers or list of list of integers of channels to
                enable through rx_enabled_channels
            use_rx2: type=bool
                If True, use rx2() instead of rx()
            buffer_size: type=int
                Size of RX buffer in samples. Defaults to 2**15
            annotated: type=bool
                If True, annotated output is provided (dict)
            param_set: type=dict
                Dictionary of attribute and values to be set before tone is
                received
        """
        sdr = eval(classname + "(uri='" + uri + "')")
        # Set custom device parameters
        if param_set:
            for p in param_set.keys():
                setattr(sdr, p, param_set[p])
        N = buffer_size
    
        if use_rx2:
            sdr.rx2_enabled_channels = channel if isinstance(channel, list) else [channel]
            sdr.rx2_buffer_size = N * len(sdr.rx2_enabled_channels)
        else:
            sdr.rx_enabled_channels = channel if isinstance(channel, list) else [channel]
            sdr.rx_buffer_size = N * len(sdr.rx_enabled_channels)
    
        sdr.rx_annotated = annotated
        try:
            for _ in range(10):
                data = sdr.rx2() if use_rx2 else sdr.rx()
                if annotated:
                    print(data)
                    assert list(data.keys()) == [
                        sdr._rx_channel_names[ec] for ec in sdr.rx_enabled_channels
                    ]
                    for ci in sdr.rx_enabled_channels:
                        assert np.max(np.abs(data[sdr._rx_channel_names[ci]])) > 0
                else:
                    if isinstance(data, list):
                        for chan in data:
                            assert np.max(np.abs(chan)) > 0, "Buffer all zeros"
                    else:
>                       assert np.max(np.abs(data)) > 0, "Buffer all zeros"
E                       AssertionError: Buffer all zeros
E                       assert 0 > 0
E                        +  where 0 = <function max at 0x7fd1c43d8cf0>(array([0, 0, 0, ..., 0, 0, 0], dtype=uint16))
E                        +    where <function max at 0x7fd1c43d8cf0> = np.max
E                        +    and   array([0, 0, 0, ..., 0, 0, 0], dtype=uint16) = <ufunc 'absolute'>(array([0, 0, 0, ..., 0, 0, 0], dtype=uint16))
E                        +      where <ufunc 'absolute'> = np.abs

test/dma_tests.py:79: AssertionError

The above exception was the direct cause of the following exception:

test_dma_rx = <function dma_rx at 0x7fd1aa04bd00>, iio_uri = 'ip:10.1.0.26'
classname = 'adi.ad7091rx', channel = 0

    @pytest.mark.iio_hardware(hardware)
    @pytest.mark.parametrize("classname", [(classname)])
    @pytest.mark.parametrize("channel", [0])
    def test_ad7091rx_rx_data(test_dma_rx, iio_uri, classname, channel):
>       test_dma_rx(iio_uri, classname, channel)

test/test_ad7091r.py:12: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

uri = 'ip:10.1.0.26', classname = 'adi.ad7091rx', channel = 0, use_rx2 = False
buffer_size = 32768, annotated = False, param_set = None

    def dma_rx(
        uri,
        classname,
        channel,
        use_rx2=False,
        buffer_size=2 ** 15,
        annotated=False,
        param_set=None,
    ):
        """dma_rx: Construct RX buffers and verify data is non-zero when pulled.
        Collected buffer is of size 2**15 and 10 buffers are checked
    
        parameters:
            uri: type=string
                URI of IIO context of target board/system
            classname: type=string
                Name of pyadi interface class which contain attribute
            channel: type=list
                List of integers or list of list of integers of channels to
                enable through rx_enabled_channels
            use_rx2: type=bool
                If True, use rx2() instead of rx()
            buffer_size: type=int
                Size of RX buffer in samples. Defaults to 2**15
            annotated: type=bool
                If True, annotated output is provided (dict)
            param_set: type=dict
                Dictionary of attribute and values to be set before tone is
                received
        """
        sdr = eval(classname + "(uri='" + uri + "')")
        # Set custom device parameters
        if param_set:
            for p in param_set.keys():
                setattr(sdr, p, param_set[p])
        N = buffer_size
    
        if use_rx2:
            sdr.rx2_enabled_channels = channel if isinstance(channel, list) else [channel]
            sdr.rx2_buffer_size = N * len(sdr.rx2_enabled_channels)
        else:
            sdr.rx_enabled_channels = channel if isinstance(channel, list) else [channel]
            sdr.rx_buffer_size = N * len(sdr.rx_enabled_channels)
    
        sdr.rx_annotated = annotated
        try:
            for _ in range(10):
                data = sdr.rx2() if use_rx2 else sdr.rx()
                if annotated:
                    print(data)
                    assert list(data.keys()) == [
                        sdr._rx_channel_names[ec] for ec in sdr.rx_enabled_channels
                    ]
                    for ci in sdr.rx_enabled_channels:
                        assert np.max(np.abs(data[sdr._rx_channel_names[ci]])) > 0
                else:
                    if isinstance(data, list):
                        for chan in data:
                            assert np.max(np.abs(chan)) > 0, "Buffer all zeros"
                    else:
                        assert np.max(np.abs(data)) > 0, "Buffer all zeros"
        except Exception as e:
            del sdr
>           raise Exception(e) from e
E           Exception: Buffer all zeros
E           assert 0 > 0
E            +  where 0 = <function max at 0x7fd1c43d8cf0>(array([0, 0, 0, ..., 0, 0, 0], dtype=uint16))
E            +    where <function max at 0x7fd1c43d8cf0> = np.max
E            +    and   array([0, 0, 0, ..., 0, 0, 0], dtype=uint16) = <ufunc 'absolute'>(array([0, 0, 0, ..., 0, 0, 0], dtype=uint16))
E            +      where <ufunc 'absolute'> = np.abs

test/dma_tests.py:82: Exception