ci: run test without optional deps #78
GitHub Actions / Test Results
failed
Sep 16, 2024 in 0s
4 fail, 1 168 skipped, 381 pass in 11m 51s
Annotations
Check warning on line 0 in test.test_ad9371
github-actions / Test Results
test_ad9371_rx_data[0-adi.ad9371] (test.test_ad9371) failed
results.xml [took 0s]
Raw output
Exception: Buffer all zeros
assert 0.0 > 0
+ where 0.0 = <function amax at 0x7ff0b04bbca0>(array([0., 0., 0., ..., 0., 0., 0.]))
+ where <function amax at 0x7ff0b04bbca0> = np.max
+ and array([0., 0., 0., ..., 0., 0., 0.]) = <ufunc 'absolute'>(array([0.+0.j, 0.+0.j, 0.+0.j, ..., 0.+0.j, 0.+0.j, 0.+0.j]))
+ where <ufunc 'absolute'> = np.abs
uri = 'ip:10.1.0.113', classname = 'adi.ad9371', 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 > 0
E + where 0.0 = <function amax at 0x7ff0b04bbca0>(array([0., 0., 0., ..., 0., 0., 0.]))
E + where <function amax at 0x7ff0b04bbca0> = np.max
E + and array([0., 0., 0., ..., 0., 0., 0.]) = <ufunc 'absolute'>(array([0.+0.j, 0.+0.j, 0.+0.j, ..., 0.+0.j, 0.+0.j, 0.+0.j]))
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 0x7ff095fd4dc0>, iio_uri = 'ip:10.1.0.113'
classname = 'adi.ad9371', channel = 0
@pytest.mark.iio_hardware(hardware)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize("channel", range(2))
def test_ad9371_rx_data(test_dma_rx, iio_uri, classname, channel):
> test_dma_rx(iio_uri, classname, channel)
test/test_ad9371.py:273:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
uri = 'ip:10.1.0.113', classname = 'adi.ad9371', 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 > 0
E + where 0.0 = <function amax at 0x7ff0b04bbca0>(array([0., 0., 0., ..., 0., 0., 0.]))
E + where <function amax at 0x7ff0b04bbca0> = np.max
E + and array([0., 0., 0., ..., 0., 0., 0.]) = <ufunc 'absolute'>(array([0.+0.j, 0.+0.j, 0.+0.j, ..., 0.+0.j, 0.+0.j, 0.+0.j]))
E + where <ufunc 'absolute'> = np.abs
test/dma_tests.py:82: Exception
Check warning on line 0 in test.test_ad9371
github-actions / Test Results
test_ad9371_rx_data[1-adi.ad9371] (test.test_ad9371) failed
results.xml [took 0s]
Raw output
Exception: Buffer all zeros
assert 0.0 > 0
+ where 0.0 = <function amax at 0x7ff0b04bbca0>(array([0., 0., 0., ..., 0., 0., 0.]))
+ where <function amax at 0x7ff0b04bbca0> = np.max
+ and array([0., 0., 0., ..., 0., 0., 0.]) = <ufunc 'absolute'>(array([0.+0.j, 0.+0.j, 0.+0.j, ..., 0.+0.j, 0.+0.j, 0.+0.j]))
+ where <ufunc 'absolute'> = np.abs
uri = 'ip:10.1.0.113', classname = 'adi.ad9371', channel = 1, 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 > 0
E + where 0.0 = <function amax at 0x7ff0b04bbca0>(array([0., 0., 0., ..., 0., 0., 0.]))
E + where <function amax at 0x7ff0b04bbca0> = np.max
E + and array([0., 0., 0., ..., 0., 0., 0.]) = <ufunc 'absolute'>(array([0.+0.j, 0.+0.j, 0.+0.j, ..., 0.+0.j, 0.+0.j, 0.+0.j]))
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 0x7ff095fd4dc0>, iio_uri = 'ip:10.1.0.113'
classname = 'adi.ad9371', channel = 1
@pytest.mark.iio_hardware(hardware)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize("channel", range(2))
def test_ad9371_rx_data(test_dma_rx, iio_uri, classname, channel):
> test_dma_rx(iio_uri, classname, channel)
test/test_ad9371.py:273:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
uri = 'ip:10.1.0.113', classname = 'adi.ad9371', channel = 1, 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 > 0
E + where 0.0 = <function amax at 0x7ff0b04bbca0>(array([0., 0., 0., ..., 0., 0., 0.]))
E + where <function amax at 0x7ff0b04bbca0> = np.max
E + and array([0., 0., 0., ..., 0., 0., 0.]) = <ufunc 'absolute'>(array([0.+0.j, 0.+0.j, 0.+0.j, ..., 0.+0.j, 0.+0.j, 0.+0.j]))
E + where <ufunc 'absolute'> = np.abs
test/dma_tests.py:82: Exception
Check warning on line 0 in test.test_ad9375
github-actions / Test Results
test_ad9375_rx_data[0-adi.ad9375] (test.test_ad9375) failed
results.xml [took 0s]
Raw output
Exception: Buffer all zeros
assert 0.0 > 0
+ where 0.0 = <function amax at 0x7ff0b04bbca0>(array([0., 0., 0., ..., 0., 0., 0.]))
+ where <function amax at 0x7ff0b04bbca0> = np.max
+ and array([0., 0., 0., ..., 0., 0., 0.]) = <ufunc 'absolute'>(array([0.+0.j, 0.+0.j, 0.+0.j, ..., 0.+0.j, 0.+0.j, 0.+0.j]))
+ where <ufunc 'absolute'> = np.abs
uri = 'ip:10.1.0.113', classname = 'adi.ad9375', 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 > 0
E + where 0.0 = <function amax at 0x7ff0b04bbca0>(array([0., 0., 0., ..., 0., 0., 0.]))
E + where <function amax at 0x7ff0b04bbca0> = np.max
E + and array([0., 0., 0., ..., 0., 0., 0.]) = <ufunc 'absolute'>(array([0.+0.j, 0.+0.j, 0.+0.j, ..., 0.+0.j, 0.+0.j, 0.+0.j]))
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 0x7ff095fd4dc0>, iio_uri = 'ip:10.1.0.113'
classname = 'adi.ad9375', channel = 0
@pytest.mark.iio_hardware(hardware)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize("channel", range(2))
def test_ad9375_rx_data(test_dma_rx, iio_uri, classname, channel):
> test_dma_rx(iio_uri, classname, channel)
test/test_ad9375.py:230:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
uri = 'ip:10.1.0.113', classname = 'adi.ad9375', 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 > 0
E + where 0.0 = <function amax at 0x7ff0b04bbca0>(array([0., 0., 0., ..., 0., 0., 0.]))
E + where <function amax at 0x7ff0b04bbca0> = np.max
E + and array([0., 0., 0., ..., 0., 0., 0.]) = <ufunc 'absolute'>(array([0.+0.j, 0.+0.j, 0.+0.j, ..., 0.+0.j, 0.+0.j, 0.+0.j]))
E + where <ufunc 'absolute'> = np.abs
test/dma_tests.py:82: Exception
Check warning on line 0 in test.test_ad9375
github-actions / Test Results
test_ad9375_rx_data[1-adi.ad9375] (test.test_ad9375) failed
results.xml [took 0s]
Raw output
Exception: Buffer all zeros
assert 0.0 > 0
+ where 0.0 = <function amax at 0x7ff0b04bbca0>(array([0., 0., 0., ..., 0., 0., 0.]))
+ where <function amax at 0x7ff0b04bbca0> = np.max
+ and array([0., 0., 0., ..., 0., 0., 0.]) = <ufunc 'absolute'>(array([0.+0.j, 0.+0.j, 0.+0.j, ..., 0.+0.j, 0.+0.j, 0.+0.j]))
+ where <ufunc 'absolute'> = np.abs
uri = 'ip:10.1.0.113', classname = 'adi.ad9375', channel = 1, 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 > 0
E + where 0.0 = <function amax at 0x7ff0b04bbca0>(array([0., 0., 0., ..., 0., 0., 0.]))
E + where <function amax at 0x7ff0b04bbca0> = np.max
E + and array([0., 0., 0., ..., 0., 0., 0.]) = <ufunc 'absolute'>(array([0.+0.j, 0.+0.j, 0.+0.j, ..., 0.+0.j, 0.+0.j, 0.+0.j]))
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 0x7ff095fd4dc0>, iio_uri = 'ip:10.1.0.113'
classname = 'adi.ad9375', channel = 1
@pytest.mark.iio_hardware(hardware)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize("channel", range(2))
def test_ad9375_rx_data(test_dma_rx, iio_uri, classname, channel):
> test_dma_rx(iio_uri, classname, channel)
test/test_ad9375.py:230:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
uri = 'ip:10.1.0.113', classname = 'adi.ad9375', channel = 1, 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 > 0
E + where 0.0 = <function amax at 0x7ff0b04bbca0>(array([0., 0., 0., ..., 0., 0., 0.]))
E + where <function amax at 0x7ff0b04bbca0> = np.max
E + and array([0., 0., 0., ..., 0., 0., 0.]) = <ufunc 'absolute'>(array([0.+0.j, 0.+0.j, 0.+0.j, ..., 0.+0.j, 0.+0.j, 0.+0.j]))
E + where <ufunc 'absolute'> = np.abs
test/dma_tests.py:82: Exception
Loading