ci: update emulated test workflow #77
78 fail, 1 049 skipped, 426 pass in 16m 16s
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 max at 0x7f04c8a5ceb0>(array([0., 0., 0., ..., 0., 0., 0.]))
+ where <function max at 0x7f04c8a5ceb0> = 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.1.19', 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 max at 0x7f04c8a5ceb0>(array([0., 0., 0., ..., 0., 0., 0.]))
E + where <function max at 0x7f04c8a5ceb0> = 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 0x7f04c8b43eb0>, iio_uri = 'ip:10.1.1.19'
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.1.19', 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 max at 0x7f04c8a5ceb0>(array([0., 0., 0., ..., 0., 0., 0.]))
E + where <function max at 0x7f04c8a5ceb0> = 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 max at 0x7f04c8a5ceb0>(array([0., 0., 0., ..., 0., 0., 0.]))
+ where <function max at 0x7f04c8a5ceb0> = 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.1.19', 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 max at 0x7f04c8a5ceb0>(array([0., 0., 0., ..., 0., 0., 0.]))
E + where <function max at 0x7f04c8a5ceb0> = 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 0x7f04c8b43eb0>, iio_uri = 'ip:10.1.1.19'
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.1.19', 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 max at 0x7f04c8a5ceb0>(array([0., 0., 0., ..., 0., 0., 0.]))
E + where <function max at 0x7f04c8a5ceb0> = 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 max at 0x7f04c8a5ceb0>(array([0., 0., 0., ..., 0., 0., 0.]))
+ where <function max at 0x7f04c8a5ceb0> = 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.1.19', 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 max at 0x7f04c8a5ceb0>(array([0., 0., 0., ..., 0., 0., 0.]))
E + where <function max at 0x7f04c8a5ceb0> = 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 0x7f04c8b43eb0>, iio_uri = 'ip:10.1.1.19'
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.1.19', 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 max at 0x7f04c8a5ceb0>(array([0., 0., 0., ..., 0., 0., 0.]))
E + where <function max at 0x7f04c8a5ceb0> = 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 max at 0x7f04c8a5ceb0>(array([0., 0., 0., ..., 0., 0., 0.]))
+ where <function max at 0x7f04c8a5ceb0> = 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.1.19', 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 max at 0x7f04c8a5ceb0>(array([0., 0., 0., ..., 0., 0., 0.]))
E + where <function max at 0x7f04c8a5ceb0> = 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 0x7f04c8b43eb0>, iio_uri = 'ip:10.1.1.19'
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.1.19', 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 max at 0x7f04c8a5ceb0>(array([0., 0., 0., ..., 0., 0., 0.]))
E + where <function max at 0x7f04c8a5ceb0> = 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_dds_loopback[param_set0-2000000-0.5--13-0-adi.ad9375] (test.test_ad9375) failed
results.xml [took 0s]
Raw output
assert (2000000 * 0.01) > 2000000.0
test_dds_loopback = <function dds_loopback at 0x7f04abaf85e0>
iio_uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'manual', 'rx_hardwaregain_chan0': 10, 'rx_hardwaregain_chan1': 10, ...}
channel = 0, frequency = 2000000, scale = 0.5, peak_min = -13
@pytest.mark.iio_hardware(hardware)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize("channel", [0, 1])
@pytest.mark.parametrize(
"param_set, frequency, scale, peak_min",
[
(params["one_cw_tone_manual"], 2000000, 0.5, -13),
(params["one_cw_tone_manual"], 2000000, 0.12, -25),
(params["one_cw_tone_manual"], 2000000, 0.25, -19),
(params["one_cw_tone_auto"], 1000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 2000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 500000, 0.12, -14.7),
(params["change_attenuation_5dB_manual"], 2000000, 0.25, -23.8),
(params["change_attenuation_10dB_manual"], 2000000, 0.25, -28.75),
(params["change_attenuation_0dB_auto"], 1000000, 0.12, -9),
(params["change_attenuation_20dB_auto"], 1000000, 0.12, -24.7),
(params["change_rf_gain_0dB_manual"], 2000000, 0.25, -29),
(params["change_rf_gain_20dB_manual"], 2000000, 0.25, -9),
(params["change_temp_gain_up"], 2000000, 0.25, -16),
(params["change_temp_gain_down"], 2000000, 0.25, -22),
],
)
def test_ad9375_dds_loopback(
test_dds_loopback,
iio_uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
):
> test_dds_loopback(
iio_uri, classname, param_set, channel, frequency, scale, peak_min
)
test/test_ad9375.py:266:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'manual', 'rx_hardwaregain_chan0': 10, 'rx_hardwaregain_chan1': 10, ...}
channel = 0, frequency = 2000000, scale = 0.5, peak_min = -13, use_obs = False
use_rx2 = False
def dds_loopback(
uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
use_obs=False,
use_rx2=False,
):
"""dds_loopback: Test DDS loopback with connected loopback cables.
This test requires a devices with TX and RX onboard where the transmit
signal can be recovered. TX FPGA DDSs are used to generate a sinusoid
which is then estimated on the RX side. The receive tone must be within
1% of its expected frequency with a specified peak
parameters:
uri: type=string
URI of IIO context of target board/system
classname: type=string
Name of pyadi interface class which contain attribute
param_set: type=dict
Dictionary of attribute and values to be set before tone is
generated and received
channel: type=list
List of integers or list of list of integers of channels to
enable through tx_enabled_channels
frequency: type=integer
Frequency in Hz of transmitted tone
scale: type=float
Scale of DDS tone. Range [0,1]
peak_min: type=float
Minimum acceptable value of maximum peak in dBFS of received tone
"""
# See if we can tone using DMAs
sdr = eval(classname + "(uri='" + uri + "')")
# Set custom device parameters
for p in param_set.keys():
setattr(sdr, p, param_set[p])
# Set common buffer settings
sdr.tx_cyclic_buffer = True
N = 2 ** 14
if use_obs and use_rx2:
raise Exception("Both RX2 and OBS are selected. Select one at a time.")
if use_rx2:
sdr.rx2_enabled_channels = [channel]
sdr.rx2_buffer_size = N * 2 * len(sdr.rx2_enabled_channels)
elif use_obs:
sdr.obs.rx_enabled_channels = [0]
sdr.obs.rx_buffer_size = N * 2 * len(sdr.obs.rx_enabled_channels)
else:
sdr.rx_enabled_channels = [channel]
sdr.rx_buffer_size = N * 2 * len(sdr.rx_enabled_channels)
# Create a sinewave waveform
if hasattr(sdr, "sample_rate"):
RXFS = int(sdr.sample_rate)
else:
RXFS = int(sdr.orx_sample_rate) if use_obs else int(sdr.rx_sample_rate)
sdr.dds_single_tone(frequency, scale, channel)
# Pass through SDR
try:
for _ in range(10): # Wait
data = sdr.rx2() if use_rx2 else sdr.obs.rx() if use_obs else sdr.rx()
except Exception as e:
del sdr
raise Exception(e)
del sdr
tone_peaks, tone_freqs = spec.spec_est(data, fs=RXFS, ref=2 ** 15, plot=False)
indx = np.argmax(tone_peaks)
diff = np.abs(tone_freqs[indx] - frequency)
s = "Peak: " + str(tone_peaks[indx]) + "@" + str(tone_freqs[indx])
print(s)
if do_html_log:
pytest.data_log = {
"html": gen_line_plot_html(
tone_freqs,
tone_peaks,
"Frequency (Hz)",
"Amplitude (dBFS)",
"{} ({})".format(s, classname),
)
}
> assert (frequency * 0.01) > diff
E assert (2000000 * 0.01) > 2000000.0
test/dma_tests.py:340: AssertionError
Check warning on line 0 in test.test_ad9375
github-actions / Test Results
test_ad9375_dds_loopback[param_set0-2000000-0.5--13-1-adi.ad9375] (test.test_ad9375) failed
results.xml [took 0s]
Raw output
assert (2000000 * 0.01) > 2000000.0
test_dds_loopback = <function dds_loopback at 0x7f04abaf85e0>
iio_uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'manual', 'rx_hardwaregain_chan0': 10, 'rx_hardwaregain_chan1': 10, ...}
channel = 1, frequency = 2000000, scale = 0.5, peak_min = -13
@pytest.mark.iio_hardware(hardware)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize("channel", [0, 1])
@pytest.mark.parametrize(
"param_set, frequency, scale, peak_min",
[
(params["one_cw_tone_manual"], 2000000, 0.5, -13),
(params["one_cw_tone_manual"], 2000000, 0.12, -25),
(params["one_cw_tone_manual"], 2000000, 0.25, -19),
(params["one_cw_tone_auto"], 1000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 2000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 500000, 0.12, -14.7),
(params["change_attenuation_5dB_manual"], 2000000, 0.25, -23.8),
(params["change_attenuation_10dB_manual"], 2000000, 0.25, -28.75),
(params["change_attenuation_0dB_auto"], 1000000, 0.12, -9),
(params["change_attenuation_20dB_auto"], 1000000, 0.12, -24.7),
(params["change_rf_gain_0dB_manual"], 2000000, 0.25, -29),
(params["change_rf_gain_20dB_manual"], 2000000, 0.25, -9),
(params["change_temp_gain_up"], 2000000, 0.25, -16),
(params["change_temp_gain_down"], 2000000, 0.25, -22),
],
)
def test_ad9375_dds_loopback(
test_dds_loopback,
iio_uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
):
> test_dds_loopback(
iio_uri, classname, param_set, channel, frequency, scale, peak_min
)
test/test_ad9375.py:266:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'manual', 'rx_hardwaregain_chan0': 10, 'rx_hardwaregain_chan1': 10, ...}
channel = 1, frequency = 2000000, scale = 0.5, peak_min = -13, use_obs = False
use_rx2 = False
def dds_loopback(
uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
use_obs=False,
use_rx2=False,
):
"""dds_loopback: Test DDS loopback with connected loopback cables.
This test requires a devices with TX and RX onboard where the transmit
signal can be recovered. TX FPGA DDSs are used to generate a sinusoid
which is then estimated on the RX side. The receive tone must be within
1% of its expected frequency with a specified peak
parameters:
uri: type=string
URI of IIO context of target board/system
classname: type=string
Name of pyadi interface class which contain attribute
param_set: type=dict
Dictionary of attribute and values to be set before tone is
generated and received
channel: type=list
List of integers or list of list of integers of channels to
enable through tx_enabled_channels
frequency: type=integer
Frequency in Hz of transmitted tone
scale: type=float
Scale of DDS tone. Range [0,1]
peak_min: type=float
Minimum acceptable value of maximum peak in dBFS of received tone
"""
# See if we can tone using DMAs
sdr = eval(classname + "(uri='" + uri + "')")
# Set custom device parameters
for p in param_set.keys():
setattr(sdr, p, param_set[p])
# Set common buffer settings
sdr.tx_cyclic_buffer = True
N = 2 ** 14
if use_obs and use_rx2:
raise Exception("Both RX2 and OBS are selected. Select one at a time.")
if use_rx2:
sdr.rx2_enabled_channels = [channel]
sdr.rx2_buffer_size = N * 2 * len(sdr.rx2_enabled_channels)
elif use_obs:
sdr.obs.rx_enabled_channels = [0]
sdr.obs.rx_buffer_size = N * 2 * len(sdr.obs.rx_enabled_channels)
else:
sdr.rx_enabled_channels = [channel]
sdr.rx_buffer_size = N * 2 * len(sdr.rx_enabled_channels)
# Create a sinewave waveform
if hasattr(sdr, "sample_rate"):
RXFS = int(sdr.sample_rate)
else:
RXFS = int(sdr.orx_sample_rate) if use_obs else int(sdr.rx_sample_rate)
sdr.dds_single_tone(frequency, scale, channel)
# Pass through SDR
try:
for _ in range(10): # Wait
data = sdr.rx2() if use_rx2 else sdr.obs.rx() if use_obs else sdr.rx()
except Exception as e:
del sdr
raise Exception(e)
del sdr
tone_peaks, tone_freqs = spec.spec_est(data, fs=RXFS, ref=2 ** 15, plot=False)
indx = np.argmax(tone_peaks)
diff = np.abs(tone_freqs[indx] - frequency)
s = "Peak: " + str(tone_peaks[indx]) + "@" + str(tone_freqs[indx])
print(s)
if do_html_log:
pytest.data_log = {
"html": gen_line_plot_html(
tone_freqs,
tone_peaks,
"Frequency (Hz)",
"Amplitude (dBFS)",
"{} ({})".format(s, classname),
)
}
> assert (frequency * 0.01) > diff
E assert (2000000 * 0.01) > 2000000.0
test/dma_tests.py:340: AssertionError
Check warning on line 0 in test.test_ad9375
github-actions / Test Results
test_ad9375_dds_loopback[param_set1-2000000-0.12--25-0-adi.ad9375] (test.test_ad9375) failed
results.xml [took 0s]
Raw output
assert (2000000 * 0.01) > 2000000.0
test_dds_loopback = <function dds_loopback at 0x7f04abaf85e0>
iio_uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'manual', 'rx_hardwaregain_chan0': 10, 'rx_hardwaregain_chan1': 10, ...}
channel = 0, frequency = 2000000, scale = 0.12, peak_min = -25
@pytest.mark.iio_hardware(hardware)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize("channel", [0, 1])
@pytest.mark.parametrize(
"param_set, frequency, scale, peak_min",
[
(params["one_cw_tone_manual"], 2000000, 0.5, -13),
(params["one_cw_tone_manual"], 2000000, 0.12, -25),
(params["one_cw_tone_manual"], 2000000, 0.25, -19),
(params["one_cw_tone_auto"], 1000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 2000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 500000, 0.12, -14.7),
(params["change_attenuation_5dB_manual"], 2000000, 0.25, -23.8),
(params["change_attenuation_10dB_manual"], 2000000, 0.25, -28.75),
(params["change_attenuation_0dB_auto"], 1000000, 0.12, -9),
(params["change_attenuation_20dB_auto"], 1000000, 0.12, -24.7),
(params["change_rf_gain_0dB_manual"], 2000000, 0.25, -29),
(params["change_rf_gain_20dB_manual"], 2000000, 0.25, -9),
(params["change_temp_gain_up"], 2000000, 0.25, -16),
(params["change_temp_gain_down"], 2000000, 0.25, -22),
],
)
def test_ad9375_dds_loopback(
test_dds_loopback,
iio_uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
):
> test_dds_loopback(
iio_uri, classname, param_set, channel, frequency, scale, peak_min
)
test/test_ad9375.py:266:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'manual', 'rx_hardwaregain_chan0': 10, 'rx_hardwaregain_chan1': 10, ...}
channel = 0, frequency = 2000000, scale = 0.12, peak_min = -25, use_obs = False
use_rx2 = False
def dds_loopback(
uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
use_obs=False,
use_rx2=False,
):
"""dds_loopback: Test DDS loopback with connected loopback cables.
This test requires a devices with TX and RX onboard where the transmit
signal can be recovered. TX FPGA DDSs are used to generate a sinusoid
which is then estimated on the RX side. The receive tone must be within
1% of its expected frequency with a specified peak
parameters:
uri: type=string
URI of IIO context of target board/system
classname: type=string
Name of pyadi interface class which contain attribute
param_set: type=dict
Dictionary of attribute and values to be set before tone is
generated and received
channel: type=list
List of integers or list of list of integers of channels to
enable through tx_enabled_channels
frequency: type=integer
Frequency in Hz of transmitted tone
scale: type=float
Scale of DDS tone. Range [0,1]
peak_min: type=float
Minimum acceptable value of maximum peak in dBFS of received tone
"""
# See if we can tone using DMAs
sdr = eval(classname + "(uri='" + uri + "')")
# Set custom device parameters
for p in param_set.keys():
setattr(sdr, p, param_set[p])
# Set common buffer settings
sdr.tx_cyclic_buffer = True
N = 2 ** 14
if use_obs and use_rx2:
raise Exception("Both RX2 and OBS are selected. Select one at a time.")
if use_rx2:
sdr.rx2_enabled_channels = [channel]
sdr.rx2_buffer_size = N * 2 * len(sdr.rx2_enabled_channels)
elif use_obs:
sdr.obs.rx_enabled_channels = [0]
sdr.obs.rx_buffer_size = N * 2 * len(sdr.obs.rx_enabled_channels)
else:
sdr.rx_enabled_channels = [channel]
sdr.rx_buffer_size = N * 2 * len(sdr.rx_enabled_channels)
# Create a sinewave waveform
if hasattr(sdr, "sample_rate"):
RXFS = int(sdr.sample_rate)
else:
RXFS = int(sdr.orx_sample_rate) if use_obs else int(sdr.rx_sample_rate)
sdr.dds_single_tone(frequency, scale, channel)
# Pass through SDR
try:
for _ in range(10): # Wait
data = sdr.rx2() if use_rx2 else sdr.obs.rx() if use_obs else sdr.rx()
except Exception as e:
del sdr
raise Exception(e)
del sdr
tone_peaks, tone_freqs = spec.spec_est(data, fs=RXFS, ref=2 ** 15, plot=False)
indx = np.argmax(tone_peaks)
diff = np.abs(tone_freqs[indx] - frequency)
s = "Peak: " + str(tone_peaks[indx]) + "@" + str(tone_freqs[indx])
print(s)
if do_html_log:
pytest.data_log = {
"html": gen_line_plot_html(
tone_freqs,
tone_peaks,
"Frequency (Hz)",
"Amplitude (dBFS)",
"{} ({})".format(s, classname),
)
}
> assert (frequency * 0.01) > diff
E assert (2000000 * 0.01) > 2000000.0
test/dma_tests.py:340: AssertionError
Check warning on line 0 in test.test_ad9375
github-actions / Test Results
test_ad9375_dds_loopback[param_set1-2000000-0.12--25-1-adi.ad9375] (test.test_ad9375) failed
results.xml [took 0s]
Raw output
assert (2000000 * 0.01) > 2000000.0
test_dds_loopback = <function dds_loopback at 0x7f04abaf85e0>
iio_uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'manual', 'rx_hardwaregain_chan0': 10, 'rx_hardwaregain_chan1': 10, ...}
channel = 1, frequency = 2000000, scale = 0.12, peak_min = -25
@pytest.mark.iio_hardware(hardware)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize("channel", [0, 1])
@pytest.mark.parametrize(
"param_set, frequency, scale, peak_min",
[
(params["one_cw_tone_manual"], 2000000, 0.5, -13),
(params["one_cw_tone_manual"], 2000000, 0.12, -25),
(params["one_cw_tone_manual"], 2000000, 0.25, -19),
(params["one_cw_tone_auto"], 1000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 2000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 500000, 0.12, -14.7),
(params["change_attenuation_5dB_manual"], 2000000, 0.25, -23.8),
(params["change_attenuation_10dB_manual"], 2000000, 0.25, -28.75),
(params["change_attenuation_0dB_auto"], 1000000, 0.12, -9),
(params["change_attenuation_20dB_auto"], 1000000, 0.12, -24.7),
(params["change_rf_gain_0dB_manual"], 2000000, 0.25, -29),
(params["change_rf_gain_20dB_manual"], 2000000, 0.25, -9),
(params["change_temp_gain_up"], 2000000, 0.25, -16),
(params["change_temp_gain_down"], 2000000, 0.25, -22),
],
)
def test_ad9375_dds_loopback(
test_dds_loopback,
iio_uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
):
> test_dds_loopback(
iio_uri, classname, param_set, channel, frequency, scale, peak_min
)
test/test_ad9375.py:266:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'manual', 'rx_hardwaregain_chan0': 10, 'rx_hardwaregain_chan1': 10, ...}
channel = 1, frequency = 2000000, scale = 0.12, peak_min = -25, use_obs = False
use_rx2 = False
def dds_loopback(
uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
use_obs=False,
use_rx2=False,
):
"""dds_loopback: Test DDS loopback with connected loopback cables.
This test requires a devices with TX and RX onboard where the transmit
signal can be recovered. TX FPGA DDSs are used to generate a sinusoid
which is then estimated on the RX side. The receive tone must be within
1% of its expected frequency with a specified peak
parameters:
uri: type=string
URI of IIO context of target board/system
classname: type=string
Name of pyadi interface class which contain attribute
param_set: type=dict
Dictionary of attribute and values to be set before tone is
generated and received
channel: type=list
List of integers or list of list of integers of channels to
enable through tx_enabled_channels
frequency: type=integer
Frequency in Hz of transmitted tone
scale: type=float
Scale of DDS tone. Range [0,1]
peak_min: type=float
Minimum acceptable value of maximum peak in dBFS of received tone
"""
# See if we can tone using DMAs
sdr = eval(classname + "(uri='" + uri + "')")
# Set custom device parameters
for p in param_set.keys():
setattr(sdr, p, param_set[p])
# Set common buffer settings
sdr.tx_cyclic_buffer = True
N = 2 ** 14
if use_obs and use_rx2:
raise Exception("Both RX2 and OBS are selected. Select one at a time.")
if use_rx2:
sdr.rx2_enabled_channels = [channel]
sdr.rx2_buffer_size = N * 2 * len(sdr.rx2_enabled_channels)
elif use_obs:
sdr.obs.rx_enabled_channels = [0]
sdr.obs.rx_buffer_size = N * 2 * len(sdr.obs.rx_enabled_channels)
else:
sdr.rx_enabled_channels = [channel]
sdr.rx_buffer_size = N * 2 * len(sdr.rx_enabled_channels)
# Create a sinewave waveform
if hasattr(sdr, "sample_rate"):
RXFS = int(sdr.sample_rate)
else:
RXFS = int(sdr.orx_sample_rate) if use_obs else int(sdr.rx_sample_rate)
sdr.dds_single_tone(frequency, scale, channel)
# Pass through SDR
try:
for _ in range(10): # Wait
data = sdr.rx2() if use_rx2 else sdr.obs.rx() if use_obs else sdr.rx()
except Exception as e:
del sdr
raise Exception(e)
del sdr
tone_peaks, tone_freqs = spec.spec_est(data, fs=RXFS, ref=2 ** 15, plot=False)
indx = np.argmax(tone_peaks)
diff = np.abs(tone_freqs[indx] - frequency)
s = "Peak: " + str(tone_peaks[indx]) + "@" + str(tone_freqs[indx])
print(s)
if do_html_log:
pytest.data_log = {
"html": gen_line_plot_html(
tone_freqs,
tone_peaks,
"Frequency (Hz)",
"Amplitude (dBFS)",
"{} ({})".format(s, classname),
)
}
> assert (frequency * 0.01) > diff
E assert (2000000 * 0.01) > 2000000.0
test/dma_tests.py:340: AssertionError
Check warning on line 0 in test.test_ad9375
github-actions / Test Results
test_ad9375_dds_loopback[param_set2-2000000-0.25--19-0-adi.ad9375] (test.test_ad9375) failed
results.xml [took 0s]
Raw output
assert (2000000 * 0.01) > 2000000.0
test_dds_loopback = <function dds_loopback at 0x7f04abaf85e0>
iio_uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'manual', 'rx_hardwaregain_chan0': 10, 'rx_hardwaregain_chan1': 10, ...}
channel = 0, frequency = 2000000, scale = 0.25, peak_min = -19
@pytest.mark.iio_hardware(hardware)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize("channel", [0, 1])
@pytest.mark.parametrize(
"param_set, frequency, scale, peak_min",
[
(params["one_cw_tone_manual"], 2000000, 0.5, -13),
(params["one_cw_tone_manual"], 2000000, 0.12, -25),
(params["one_cw_tone_manual"], 2000000, 0.25, -19),
(params["one_cw_tone_auto"], 1000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 2000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 500000, 0.12, -14.7),
(params["change_attenuation_5dB_manual"], 2000000, 0.25, -23.8),
(params["change_attenuation_10dB_manual"], 2000000, 0.25, -28.75),
(params["change_attenuation_0dB_auto"], 1000000, 0.12, -9),
(params["change_attenuation_20dB_auto"], 1000000, 0.12, -24.7),
(params["change_rf_gain_0dB_manual"], 2000000, 0.25, -29),
(params["change_rf_gain_20dB_manual"], 2000000, 0.25, -9),
(params["change_temp_gain_up"], 2000000, 0.25, -16),
(params["change_temp_gain_down"], 2000000, 0.25, -22),
],
)
def test_ad9375_dds_loopback(
test_dds_loopback,
iio_uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
):
> test_dds_loopback(
iio_uri, classname, param_set, channel, frequency, scale, peak_min
)
test/test_ad9375.py:266:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'manual', 'rx_hardwaregain_chan0': 10, 'rx_hardwaregain_chan1': 10, ...}
channel = 0, frequency = 2000000, scale = 0.25, peak_min = -19, use_obs = False
use_rx2 = False
def dds_loopback(
uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
use_obs=False,
use_rx2=False,
):
"""dds_loopback: Test DDS loopback with connected loopback cables.
This test requires a devices with TX and RX onboard where the transmit
signal can be recovered. TX FPGA DDSs are used to generate a sinusoid
which is then estimated on the RX side. The receive tone must be within
1% of its expected frequency with a specified peak
parameters:
uri: type=string
URI of IIO context of target board/system
classname: type=string
Name of pyadi interface class which contain attribute
param_set: type=dict
Dictionary of attribute and values to be set before tone is
generated and received
channel: type=list
List of integers or list of list of integers of channels to
enable through tx_enabled_channels
frequency: type=integer
Frequency in Hz of transmitted tone
scale: type=float
Scale of DDS tone. Range [0,1]
peak_min: type=float
Minimum acceptable value of maximum peak in dBFS of received tone
"""
# See if we can tone using DMAs
sdr = eval(classname + "(uri='" + uri + "')")
# Set custom device parameters
for p in param_set.keys():
setattr(sdr, p, param_set[p])
# Set common buffer settings
sdr.tx_cyclic_buffer = True
N = 2 ** 14
if use_obs and use_rx2:
raise Exception("Both RX2 and OBS are selected. Select one at a time.")
if use_rx2:
sdr.rx2_enabled_channels = [channel]
sdr.rx2_buffer_size = N * 2 * len(sdr.rx2_enabled_channels)
elif use_obs:
sdr.obs.rx_enabled_channels = [0]
sdr.obs.rx_buffer_size = N * 2 * len(sdr.obs.rx_enabled_channels)
else:
sdr.rx_enabled_channels = [channel]
sdr.rx_buffer_size = N * 2 * len(sdr.rx_enabled_channels)
# Create a sinewave waveform
if hasattr(sdr, "sample_rate"):
RXFS = int(sdr.sample_rate)
else:
RXFS = int(sdr.orx_sample_rate) if use_obs else int(sdr.rx_sample_rate)
sdr.dds_single_tone(frequency, scale, channel)
# Pass through SDR
try:
for _ in range(10): # Wait
data = sdr.rx2() if use_rx2 else sdr.obs.rx() if use_obs else sdr.rx()
except Exception as e:
del sdr
raise Exception(e)
del sdr
tone_peaks, tone_freqs = spec.spec_est(data, fs=RXFS, ref=2 ** 15, plot=False)
indx = np.argmax(tone_peaks)
diff = np.abs(tone_freqs[indx] - frequency)
s = "Peak: " + str(tone_peaks[indx]) + "@" + str(tone_freqs[indx])
print(s)
if do_html_log:
pytest.data_log = {
"html": gen_line_plot_html(
tone_freqs,
tone_peaks,
"Frequency (Hz)",
"Amplitude (dBFS)",
"{} ({})".format(s, classname),
)
}
> assert (frequency * 0.01) > diff
E assert (2000000 * 0.01) > 2000000.0
test/dma_tests.py:340: AssertionError
Check warning on line 0 in test.test_ad9375
github-actions / Test Results
test_ad9375_dds_loopback[param_set2-2000000-0.25--19-1-adi.ad9375] (test.test_ad9375) failed
results.xml [took 0s]
Raw output
assert (2000000 * 0.01) > 2000000.0
test_dds_loopback = <function dds_loopback at 0x7f04abaf85e0>
iio_uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'manual', 'rx_hardwaregain_chan0': 10, 'rx_hardwaregain_chan1': 10, ...}
channel = 1, frequency = 2000000, scale = 0.25, peak_min = -19
@pytest.mark.iio_hardware(hardware)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize("channel", [0, 1])
@pytest.mark.parametrize(
"param_set, frequency, scale, peak_min",
[
(params["one_cw_tone_manual"], 2000000, 0.5, -13),
(params["one_cw_tone_manual"], 2000000, 0.12, -25),
(params["one_cw_tone_manual"], 2000000, 0.25, -19),
(params["one_cw_tone_auto"], 1000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 2000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 500000, 0.12, -14.7),
(params["change_attenuation_5dB_manual"], 2000000, 0.25, -23.8),
(params["change_attenuation_10dB_manual"], 2000000, 0.25, -28.75),
(params["change_attenuation_0dB_auto"], 1000000, 0.12, -9),
(params["change_attenuation_20dB_auto"], 1000000, 0.12, -24.7),
(params["change_rf_gain_0dB_manual"], 2000000, 0.25, -29),
(params["change_rf_gain_20dB_manual"], 2000000, 0.25, -9),
(params["change_temp_gain_up"], 2000000, 0.25, -16),
(params["change_temp_gain_down"], 2000000, 0.25, -22),
],
)
def test_ad9375_dds_loopback(
test_dds_loopback,
iio_uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
):
> test_dds_loopback(
iio_uri, classname, param_set, channel, frequency, scale, peak_min
)
test/test_ad9375.py:266:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'manual', 'rx_hardwaregain_chan0': 10, 'rx_hardwaregain_chan1': 10, ...}
channel = 1, frequency = 2000000, scale = 0.25, peak_min = -19, use_obs = False
use_rx2 = False
def dds_loopback(
uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
use_obs=False,
use_rx2=False,
):
"""dds_loopback: Test DDS loopback with connected loopback cables.
This test requires a devices with TX and RX onboard where the transmit
signal can be recovered. TX FPGA DDSs are used to generate a sinusoid
which is then estimated on the RX side. The receive tone must be within
1% of its expected frequency with a specified peak
parameters:
uri: type=string
URI of IIO context of target board/system
classname: type=string
Name of pyadi interface class which contain attribute
param_set: type=dict
Dictionary of attribute and values to be set before tone is
generated and received
channel: type=list
List of integers or list of list of integers of channels to
enable through tx_enabled_channels
frequency: type=integer
Frequency in Hz of transmitted tone
scale: type=float
Scale of DDS tone. Range [0,1]
peak_min: type=float
Minimum acceptable value of maximum peak in dBFS of received tone
"""
# See if we can tone using DMAs
sdr = eval(classname + "(uri='" + uri + "')")
# Set custom device parameters
for p in param_set.keys():
setattr(sdr, p, param_set[p])
# Set common buffer settings
sdr.tx_cyclic_buffer = True
N = 2 ** 14
if use_obs and use_rx2:
raise Exception("Both RX2 and OBS are selected. Select one at a time.")
if use_rx2:
sdr.rx2_enabled_channels = [channel]
sdr.rx2_buffer_size = N * 2 * len(sdr.rx2_enabled_channels)
elif use_obs:
sdr.obs.rx_enabled_channels = [0]
sdr.obs.rx_buffer_size = N * 2 * len(sdr.obs.rx_enabled_channels)
else:
sdr.rx_enabled_channels = [channel]
sdr.rx_buffer_size = N * 2 * len(sdr.rx_enabled_channels)
# Create a sinewave waveform
if hasattr(sdr, "sample_rate"):
RXFS = int(sdr.sample_rate)
else:
RXFS = int(sdr.orx_sample_rate) if use_obs else int(sdr.rx_sample_rate)
sdr.dds_single_tone(frequency, scale, channel)
# Pass through SDR
try:
for _ in range(10): # Wait
data = sdr.rx2() if use_rx2 else sdr.obs.rx() if use_obs else sdr.rx()
except Exception as e:
del sdr
raise Exception(e)
del sdr
tone_peaks, tone_freqs = spec.spec_est(data, fs=RXFS, ref=2 ** 15, plot=False)
indx = np.argmax(tone_peaks)
diff = np.abs(tone_freqs[indx] - frequency)
s = "Peak: " + str(tone_peaks[indx]) + "@" + str(tone_freqs[indx])
print(s)
if do_html_log:
pytest.data_log = {
"html": gen_line_plot_html(
tone_freqs,
tone_peaks,
"Frequency (Hz)",
"Amplitude (dBFS)",
"{} ({})".format(s, classname),
)
}
> assert (frequency * 0.01) > diff
E assert (2000000 * 0.01) > 2000000.0
test/dma_tests.py:340: AssertionError
Check warning on line 0 in test.test_ad9375
github-actions / Test Results
test_ad9375_dds_loopback[param_set3-1000000-0.12--14.7-0-adi.ad9375] (test.test_ad9375) failed
results.xml [took 0s]
Raw output
assert (1000000 * 0.01) > 1000000.0
test_dds_loopback = <function dds_loopback at 0x7f04abaf85e0>
iio_uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'automatic', 'rx_lo': 2500000000, 'rx_quadrature_tracking_en_chan0': 1, ...}
channel = 0, frequency = 1000000, scale = 0.12, peak_min = -14.7
@pytest.mark.iio_hardware(hardware)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize("channel", [0, 1])
@pytest.mark.parametrize(
"param_set, frequency, scale, peak_min",
[
(params["one_cw_tone_manual"], 2000000, 0.5, -13),
(params["one_cw_tone_manual"], 2000000, 0.12, -25),
(params["one_cw_tone_manual"], 2000000, 0.25, -19),
(params["one_cw_tone_auto"], 1000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 2000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 500000, 0.12, -14.7),
(params["change_attenuation_5dB_manual"], 2000000, 0.25, -23.8),
(params["change_attenuation_10dB_manual"], 2000000, 0.25, -28.75),
(params["change_attenuation_0dB_auto"], 1000000, 0.12, -9),
(params["change_attenuation_20dB_auto"], 1000000, 0.12, -24.7),
(params["change_rf_gain_0dB_manual"], 2000000, 0.25, -29),
(params["change_rf_gain_20dB_manual"], 2000000, 0.25, -9),
(params["change_temp_gain_up"], 2000000, 0.25, -16),
(params["change_temp_gain_down"], 2000000, 0.25, -22),
],
)
def test_ad9375_dds_loopback(
test_dds_loopback,
iio_uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
):
> test_dds_loopback(
iio_uri, classname, param_set, channel, frequency, scale, peak_min
)
test/test_ad9375.py:266:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'automatic', 'rx_lo': 2500000000, 'rx_quadrature_tracking_en_chan0': 1, ...}
channel = 0, frequency = 1000000, scale = 0.12, peak_min = -14.7
use_obs = False, use_rx2 = False
def dds_loopback(
uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
use_obs=False,
use_rx2=False,
):
"""dds_loopback: Test DDS loopback with connected loopback cables.
This test requires a devices with TX and RX onboard where the transmit
signal can be recovered. TX FPGA DDSs are used to generate a sinusoid
which is then estimated on the RX side. The receive tone must be within
1% of its expected frequency with a specified peak
parameters:
uri: type=string
URI of IIO context of target board/system
classname: type=string
Name of pyadi interface class which contain attribute
param_set: type=dict
Dictionary of attribute and values to be set before tone is
generated and received
channel: type=list
List of integers or list of list of integers of channels to
enable through tx_enabled_channels
frequency: type=integer
Frequency in Hz of transmitted tone
scale: type=float
Scale of DDS tone. Range [0,1]
peak_min: type=float
Minimum acceptable value of maximum peak in dBFS of received tone
"""
# See if we can tone using DMAs
sdr = eval(classname + "(uri='" + uri + "')")
# Set custom device parameters
for p in param_set.keys():
setattr(sdr, p, param_set[p])
# Set common buffer settings
sdr.tx_cyclic_buffer = True
N = 2 ** 14
if use_obs and use_rx2:
raise Exception("Both RX2 and OBS are selected. Select one at a time.")
if use_rx2:
sdr.rx2_enabled_channels = [channel]
sdr.rx2_buffer_size = N * 2 * len(sdr.rx2_enabled_channels)
elif use_obs:
sdr.obs.rx_enabled_channels = [0]
sdr.obs.rx_buffer_size = N * 2 * len(sdr.obs.rx_enabled_channels)
else:
sdr.rx_enabled_channels = [channel]
sdr.rx_buffer_size = N * 2 * len(sdr.rx_enabled_channels)
# Create a sinewave waveform
if hasattr(sdr, "sample_rate"):
RXFS = int(sdr.sample_rate)
else:
RXFS = int(sdr.orx_sample_rate) if use_obs else int(sdr.rx_sample_rate)
sdr.dds_single_tone(frequency, scale, channel)
# Pass through SDR
try:
for _ in range(10): # Wait
data = sdr.rx2() if use_rx2 else sdr.obs.rx() if use_obs else sdr.rx()
except Exception as e:
del sdr
raise Exception(e)
del sdr
tone_peaks, tone_freqs = spec.spec_est(data, fs=RXFS, ref=2 ** 15, plot=False)
indx = np.argmax(tone_peaks)
diff = np.abs(tone_freqs[indx] - frequency)
s = "Peak: " + str(tone_peaks[indx]) + "@" + str(tone_freqs[indx])
print(s)
if do_html_log:
pytest.data_log = {
"html": gen_line_plot_html(
tone_freqs,
tone_peaks,
"Frequency (Hz)",
"Amplitude (dBFS)",
"{} ({})".format(s, classname),
)
}
> assert (frequency * 0.01) > diff
E assert (1000000 * 0.01) > 1000000.0
test/dma_tests.py:340: AssertionError
Check warning on line 0 in test.test_ad9375
github-actions / Test Results
test_ad9375_dds_loopback[param_set3-1000000-0.12--14.7-1-adi.ad9375] (test.test_ad9375) failed
results.xml [took 0s]
Raw output
assert (1000000 * 0.01) > 1000000.0
test_dds_loopback = <function dds_loopback at 0x7f04abaf85e0>
iio_uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'automatic', 'rx_lo': 2500000000, 'rx_quadrature_tracking_en_chan0': 1, ...}
channel = 1, frequency = 1000000, scale = 0.12, peak_min = -14.7
@pytest.mark.iio_hardware(hardware)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize("channel", [0, 1])
@pytest.mark.parametrize(
"param_set, frequency, scale, peak_min",
[
(params["one_cw_tone_manual"], 2000000, 0.5, -13),
(params["one_cw_tone_manual"], 2000000, 0.12, -25),
(params["one_cw_tone_manual"], 2000000, 0.25, -19),
(params["one_cw_tone_auto"], 1000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 2000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 500000, 0.12, -14.7),
(params["change_attenuation_5dB_manual"], 2000000, 0.25, -23.8),
(params["change_attenuation_10dB_manual"], 2000000, 0.25, -28.75),
(params["change_attenuation_0dB_auto"], 1000000, 0.12, -9),
(params["change_attenuation_20dB_auto"], 1000000, 0.12, -24.7),
(params["change_rf_gain_0dB_manual"], 2000000, 0.25, -29),
(params["change_rf_gain_20dB_manual"], 2000000, 0.25, -9),
(params["change_temp_gain_up"], 2000000, 0.25, -16),
(params["change_temp_gain_down"], 2000000, 0.25, -22),
],
)
def test_ad9375_dds_loopback(
test_dds_loopback,
iio_uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
):
> test_dds_loopback(
iio_uri, classname, param_set, channel, frequency, scale, peak_min
)
test/test_ad9375.py:266:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'automatic', 'rx_lo': 2500000000, 'rx_quadrature_tracking_en_chan0': 1, ...}
channel = 1, frequency = 1000000, scale = 0.12, peak_min = -14.7
use_obs = False, use_rx2 = False
def dds_loopback(
uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
use_obs=False,
use_rx2=False,
):
"""dds_loopback: Test DDS loopback with connected loopback cables.
This test requires a devices with TX and RX onboard where the transmit
signal can be recovered. TX FPGA DDSs are used to generate a sinusoid
which is then estimated on the RX side. The receive tone must be within
1% of its expected frequency with a specified peak
parameters:
uri: type=string
URI of IIO context of target board/system
classname: type=string
Name of pyadi interface class which contain attribute
param_set: type=dict
Dictionary of attribute and values to be set before tone is
generated and received
channel: type=list
List of integers or list of list of integers of channels to
enable through tx_enabled_channels
frequency: type=integer
Frequency in Hz of transmitted tone
scale: type=float
Scale of DDS tone. Range [0,1]
peak_min: type=float
Minimum acceptable value of maximum peak in dBFS of received tone
"""
# See if we can tone using DMAs
sdr = eval(classname + "(uri='" + uri + "')")
# Set custom device parameters
for p in param_set.keys():
setattr(sdr, p, param_set[p])
# Set common buffer settings
sdr.tx_cyclic_buffer = True
N = 2 ** 14
if use_obs and use_rx2:
raise Exception("Both RX2 and OBS are selected. Select one at a time.")
if use_rx2:
sdr.rx2_enabled_channels = [channel]
sdr.rx2_buffer_size = N * 2 * len(sdr.rx2_enabled_channels)
elif use_obs:
sdr.obs.rx_enabled_channels = [0]
sdr.obs.rx_buffer_size = N * 2 * len(sdr.obs.rx_enabled_channels)
else:
sdr.rx_enabled_channels = [channel]
sdr.rx_buffer_size = N * 2 * len(sdr.rx_enabled_channels)
# Create a sinewave waveform
if hasattr(sdr, "sample_rate"):
RXFS = int(sdr.sample_rate)
else:
RXFS = int(sdr.orx_sample_rate) if use_obs else int(sdr.rx_sample_rate)
sdr.dds_single_tone(frequency, scale, channel)
# Pass through SDR
try:
for _ in range(10): # Wait
data = sdr.rx2() if use_rx2 else sdr.obs.rx() if use_obs else sdr.rx()
except Exception as e:
del sdr
raise Exception(e)
del sdr
tone_peaks, tone_freqs = spec.spec_est(data, fs=RXFS, ref=2 ** 15, plot=False)
indx = np.argmax(tone_peaks)
diff = np.abs(tone_freqs[indx] - frequency)
s = "Peak: " + str(tone_peaks[indx]) + "@" + str(tone_freqs[indx])
print(s)
if do_html_log:
pytest.data_log = {
"html": gen_line_plot_html(
tone_freqs,
tone_peaks,
"Frequency (Hz)",
"Amplitude (dBFS)",
"{} ({})".format(s, classname),
)
}
> assert (frequency * 0.01) > diff
E assert (1000000 * 0.01) > 1000000.0
test/dma_tests.py:340: AssertionError
Check warning on line 0 in test.test_ad9375
github-actions / Test Results
test_ad9375_dds_loopback[param_set4-2000000-0.12--14.7-0-adi.ad9375] (test.test_ad9375) failed
results.xml [took 0s]
Raw output
assert (2000000 * 0.01) > 2000000.0
test_dds_loopback = <function dds_loopback at 0x7f04abaf85e0>
iio_uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'automatic', 'rx_lo': 2500000000, 'rx_quadrature_tracking_en_chan0': 1, ...}
channel = 0, frequency = 2000000, scale = 0.12, peak_min = -14.7
@pytest.mark.iio_hardware(hardware)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize("channel", [0, 1])
@pytest.mark.parametrize(
"param_set, frequency, scale, peak_min",
[
(params["one_cw_tone_manual"], 2000000, 0.5, -13),
(params["one_cw_tone_manual"], 2000000, 0.12, -25),
(params["one_cw_tone_manual"], 2000000, 0.25, -19),
(params["one_cw_tone_auto"], 1000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 2000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 500000, 0.12, -14.7),
(params["change_attenuation_5dB_manual"], 2000000, 0.25, -23.8),
(params["change_attenuation_10dB_manual"], 2000000, 0.25, -28.75),
(params["change_attenuation_0dB_auto"], 1000000, 0.12, -9),
(params["change_attenuation_20dB_auto"], 1000000, 0.12, -24.7),
(params["change_rf_gain_0dB_manual"], 2000000, 0.25, -29),
(params["change_rf_gain_20dB_manual"], 2000000, 0.25, -9),
(params["change_temp_gain_up"], 2000000, 0.25, -16),
(params["change_temp_gain_down"], 2000000, 0.25, -22),
],
)
def test_ad9375_dds_loopback(
test_dds_loopback,
iio_uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
):
> test_dds_loopback(
iio_uri, classname, param_set, channel, frequency, scale, peak_min
)
test/test_ad9375.py:266:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'automatic', 'rx_lo': 2500000000, 'rx_quadrature_tracking_en_chan0': 1, ...}
channel = 0, frequency = 2000000, scale = 0.12, peak_min = -14.7
use_obs = False, use_rx2 = False
def dds_loopback(
uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
use_obs=False,
use_rx2=False,
):
"""dds_loopback: Test DDS loopback with connected loopback cables.
This test requires a devices with TX and RX onboard where the transmit
signal can be recovered. TX FPGA DDSs are used to generate a sinusoid
which is then estimated on the RX side. The receive tone must be within
1% of its expected frequency with a specified peak
parameters:
uri: type=string
URI of IIO context of target board/system
classname: type=string
Name of pyadi interface class which contain attribute
param_set: type=dict
Dictionary of attribute and values to be set before tone is
generated and received
channel: type=list
List of integers or list of list of integers of channels to
enable through tx_enabled_channels
frequency: type=integer
Frequency in Hz of transmitted tone
scale: type=float
Scale of DDS tone. Range [0,1]
peak_min: type=float
Minimum acceptable value of maximum peak in dBFS of received tone
"""
# See if we can tone using DMAs
sdr = eval(classname + "(uri='" + uri + "')")
# Set custom device parameters
for p in param_set.keys():
setattr(sdr, p, param_set[p])
# Set common buffer settings
sdr.tx_cyclic_buffer = True
N = 2 ** 14
if use_obs and use_rx2:
raise Exception("Both RX2 and OBS are selected. Select one at a time.")
if use_rx2:
sdr.rx2_enabled_channels = [channel]
sdr.rx2_buffer_size = N * 2 * len(sdr.rx2_enabled_channels)
elif use_obs:
sdr.obs.rx_enabled_channels = [0]
sdr.obs.rx_buffer_size = N * 2 * len(sdr.obs.rx_enabled_channels)
else:
sdr.rx_enabled_channels = [channel]
sdr.rx_buffer_size = N * 2 * len(sdr.rx_enabled_channels)
# Create a sinewave waveform
if hasattr(sdr, "sample_rate"):
RXFS = int(sdr.sample_rate)
else:
RXFS = int(sdr.orx_sample_rate) if use_obs else int(sdr.rx_sample_rate)
sdr.dds_single_tone(frequency, scale, channel)
# Pass through SDR
try:
for _ in range(10): # Wait
data = sdr.rx2() if use_rx2 else sdr.obs.rx() if use_obs else sdr.rx()
except Exception as e:
del sdr
raise Exception(e)
del sdr
tone_peaks, tone_freqs = spec.spec_est(data, fs=RXFS, ref=2 ** 15, plot=False)
indx = np.argmax(tone_peaks)
diff = np.abs(tone_freqs[indx] - frequency)
s = "Peak: " + str(tone_peaks[indx]) + "@" + str(tone_freqs[indx])
print(s)
if do_html_log:
pytest.data_log = {
"html": gen_line_plot_html(
tone_freqs,
tone_peaks,
"Frequency (Hz)",
"Amplitude (dBFS)",
"{} ({})".format(s, classname),
)
}
> assert (frequency * 0.01) > diff
E assert (2000000 * 0.01) > 2000000.0
test/dma_tests.py:340: AssertionError
Check warning on line 0 in test.test_ad9375
github-actions / Test Results
test_ad9375_dds_loopback[param_set4-2000000-0.12--14.7-1-adi.ad9375] (test.test_ad9375) failed
results.xml [took 0s]
Raw output
assert (2000000 * 0.01) > 2000000.0
test_dds_loopback = <function dds_loopback at 0x7f04abaf85e0>
iio_uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'automatic', 'rx_lo': 2500000000, 'rx_quadrature_tracking_en_chan0': 1, ...}
channel = 1, frequency = 2000000, scale = 0.12, peak_min = -14.7
@pytest.mark.iio_hardware(hardware)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize("channel", [0, 1])
@pytest.mark.parametrize(
"param_set, frequency, scale, peak_min",
[
(params["one_cw_tone_manual"], 2000000, 0.5, -13),
(params["one_cw_tone_manual"], 2000000, 0.12, -25),
(params["one_cw_tone_manual"], 2000000, 0.25, -19),
(params["one_cw_tone_auto"], 1000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 2000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 500000, 0.12, -14.7),
(params["change_attenuation_5dB_manual"], 2000000, 0.25, -23.8),
(params["change_attenuation_10dB_manual"], 2000000, 0.25, -28.75),
(params["change_attenuation_0dB_auto"], 1000000, 0.12, -9),
(params["change_attenuation_20dB_auto"], 1000000, 0.12, -24.7),
(params["change_rf_gain_0dB_manual"], 2000000, 0.25, -29),
(params["change_rf_gain_20dB_manual"], 2000000, 0.25, -9),
(params["change_temp_gain_up"], 2000000, 0.25, -16),
(params["change_temp_gain_down"], 2000000, 0.25, -22),
],
)
def test_ad9375_dds_loopback(
test_dds_loopback,
iio_uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
):
> test_dds_loopback(
iio_uri, classname, param_set, channel, frequency, scale, peak_min
)
test/test_ad9375.py:266:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'automatic', 'rx_lo': 2500000000, 'rx_quadrature_tracking_en_chan0': 1, ...}
channel = 1, frequency = 2000000, scale = 0.12, peak_min = -14.7
use_obs = False, use_rx2 = False
def dds_loopback(
uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
use_obs=False,
use_rx2=False,
):
"""dds_loopback: Test DDS loopback with connected loopback cables.
This test requires a devices with TX and RX onboard where the transmit
signal can be recovered. TX FPGA DDSs are used to generate a sinusoid
which is then estimated on the RX side. The receive tone must be within
1% of its expected frequency with a specified peak
parameters:
uri: type=string
URI of IIO context of target board/system
classname: type=string
Name of pyadi interface class which contain attribute
param_set: type=dict
Dictionary of attribute and values to be set before tone is
generated and received
channel: type=list
List of integers or list of list of integers of channels to
enable through tx_enabled_channels
frequency: type=integer
Frequency in Hz of transmitted tone
scale: type=float
Scale of DDS tone. Range [0,1]
peak_min: type=float
Minimum acceptable value of maximum peak in dBFS of received tone
"""
# See if we can tone using DMAs
sdr = eval(classname + "(uri='" + uri + "')")
# Set custom device parameters
for p in param_set.keys():
setattr(sdr, p, param_set[p])
# Set common buffer settings
sdr.tx_cyclic_buffer = True
N = 2 ** 14
if use_obs and use_rx2:
raise Exception("Both RX2 and OBS are selected. Select one at a time.")
if use_rx2:
sdr.rx2_enabled_channels = [channel]
sdr.rx2_buffer_size = N * 2 * len(sdr.rx2_enabled_channels)
elif use_obs:
sdr.obs.rx_enabled_channels = [0]
sdr.obs.rx_buffer_size = N * 2 * len(sdr.obs.rx_enabled_channels)
else:
sdr.rx_enabled_channels = [channel]
sdr.rx_buffer_size = N * 2 * len(sdr.rx_enabled_channels)
# Create a sinewave waveform
if hasattr(sdr, "sample_rate"):
RXFS = int(sdr.sample_rate)
else:
RXFS = int(sdr.orx_sample_rate) if use_obs else int(sdr.rx_sample_rate)
sdr.dds_single_tone(frequency, scale, channel)
# Pass through SDR
try:
for _ in range(10): # Wait
data = sdr.rx2() if use_rx2 else sdr.obs.rx() if use_obs else sdr.rx()
except Exception as e:
del sdr
raise Exception(e)
del sdr
tone_peaks, tone_freqs = spec.spec_est(data, fs=RXFS, ref=2 ** 15, plot=False)
indx = np.argmax(tone_peaks)
diff = np.abs(tone_freqs[indx] - frequency)
s = "Peak: " + str(tone_peaks[indx]) + "@" + str(tone_freqs[indx])
print(s)
if do_html_log:
pytest.data_log = {
"html": gen_line_plot_html(
tone_freqs,
tone_peaks,
"Frequency (Hz)",
"Amplitude (dBFS)",
"{} ({})".format(s, classname),
)
}
> assert (frequency * 0.01) > diff
E assert (2000000 * 0.01) > 2000000.0
test/dma_tests.py:340: AssertionError
Check warning on line 0 in test.test_ad9375
github-actions / Test Results
test_ad9375_dds_loopback[param_set5-500000-0.12--14.7-0-adi.ad9375] (test.test_ad9375) failed
results.xml [took 0s]
Raw output
assert (500000 * 0.01) > 500000.0
test_dds_loopback = <function dds_loopback at 0x7f04abaf85e0>
iio_uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'automatic', 'rx_lo': 2500000000, 'rx_quadrature_tracking_en_chan0': 1, ...}
channel = 0, frequency = 500000, scale = 0.12, peak_min = -14.7
@pytest.mark.iio_hardware(hardware)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize("channel", [0, 1])
@pytest.mark.parametrize(
"param_set, frequency, scale, peak_min",
[
(params["one_cw_tone_manual"], 2000000, 0.5, -13),
(params["one_cw_tone_manual"], 2000000, 0.12, -25),
(params["one_cw_tone_manual"], 2000000, 0.25, -19),
(params["one_cw_tone_auto"], 1000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 2000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 500000, 0.12, -14.7),
(params["change_attenuation_5dB_manual"], 2000000, 0.25, -23.8),
(params["change_attenuation_10dB_manual"], 2000000, 0.25, -28.75),
(params["change_attenuation_0dB_auto"], 1000000, 0.12, -9),
(params["change_attenuation_20dB_auto"], 1000000, 0.12, -24.7),
(params["change_rf_gain_0dB_manual"], 2000000, 0.25, -29),
(params["change_rf_gain_20dB_manual"], 2000000, 0.25, -9),
(params["change_temp_gain_up"], 2000000, 0.25, -16),
(params["change_temp_gain_down"], 2000000, 0.25, -22),
],
)
def test_ad9375_dds_loopback(
test_dds_loopback,
iio_uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
):
> test_dds_loopback(
iio_uri, classname, param_set, channel, frequency, scale, peak_min
)
test/test_ad9375.py:266:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'automatic', 'rx_lo': 2500000000, 'rx_quadrature_tracking_en_chan0': 1, ...}
channel = 0, frequency = 500000, scale = 0.12, peak_min = -14.7, use_obs = False
use_rx2 = False
def dds_loopback(
uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
use_obs=False,
use_rx2=False,
):
"""dds_loopback: Test DDS loopback with connected loopback cables.
This test requires a devices with TX and RX onboard where the transmit
signal can be recovered. TX FPGA DDSs are used to generate a sinusoid
which is then estimated on the RX side. The receive tone must be within
1% of its expected frequency with a specified peak
parameters:
uri: type=string
URI of IIO context of target board/system
classname: type=string
Name of pyadi interface class which contain attribute
param_set: type=dict
Dictionary of attribute and values to be set before tone is
generated and received
channel: type=list
List of integers or list of list of integers of channels to
enable through tx_enabled_channels
frequency: type=integer
Frequency in Hz of transmitted tone
scale: type=float
Scale of DDS tone. Range [0,1]
peak_min: type=float
Minimum acceptable value of maximum peak in dBFS of received tone
"""
# See if we can tone using DMAs
sdr = eval(classname + "(uri='" + uri + "')")
# Set custom device parameters
for p in param_set.keys():
setattr(sdr, p, param_set[p])
# Set common buffer settings
sdr.tx_cyclic_buffer = True
N = 2 ** 14
if use_obs and use_rx2:
raise Exception("Both RX2 and OBS are selected. Select one at a time.")
if use_rx2:
sdr.rx2_enabled_channels = [channel]
sdr.rx2_buffer_size = N * 2 * len(sdr.rx2_enabled_channels)
elif use_obs:
sdr.obs.rx_enabled_channels = [0]
sdr.obs.rx_buffer_size = N * 2 * len(sdr.obs.rx_enabled_channels)
else:
sdr.rx_enabled_channels = [channel]
sdr.rx_buffer_size = N * 2 * len(sdr.rx_enabled_channels)
# Create a sinewave waveform
if hasattr(sdr, "sample_rate"):
RXFS = int(sdr.sample_rate)
else:
RXFS = int(sdr.orx_sample_rate) if use_obs else int(sdr.rx_sample_rate)
sdr.dds_single_tone(frequency, scale, channel)
# Pass through SDR
try:
for _ in range(10): # Wait
data = sdr.rx2() if use_rx2 else sdr.obs.rx() if use_obs else sdr.rx()
except Exception as e:
del sdr
raise Exception(e)
del sdr
tone_peaks, tone_freqs = spec.spec_est(data, fs=RXFS, ref=2 ** 15, plot=False)
indx = np.argmax(tone_peaks)
diff = np.abs(tone_freqs[indx] - frequency)
s = "Peak: " + str(tone_peaks[indx]) + "@" + str(tone_freqs[indx])
print(s)
if do_html_log:
pytest.data_log = {
"html": gen_line_plot_html(
tone_freqs,
tone_peaks,
"Frequency (Hz)",
"Amplitude (dBFS)",
"{} ({})".format(s, classname),
)
}
> assert (frequency * 0.01) > diff
E assert (500000 * 0.01) > 500000.0
test/dma_tests.py:340: AssertionError
Check warning on line 0 in test.test_ad9375
github-actions / Test Results
test_ad9375_dds_loopback[param_set5-500000-0.12--14.7-1-adi.ad9375] (test.test_ad9375) failed
results.xml [took 0s]
Raw output
assert (500000 * 0.01) > 500000.0
test_dds_loopback = <function dds_loopback at 0x7f04abaf85e0>
iio_uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'automatic', 'rx_lo': 2500000000, 'rx_quadrature_tracking_en_chan0': 1, ...}
channel = 1, frequency = 500000, scale = 0.12, peak_min = -14.7
@pytest.mark.iio_hardware(hardware)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize("channel", [0, 1])
@pytest.mark.parametrize(
"param_set, frequency, scale, peak_min",
[
(params["one_cw_tone_manual"], 2000000, 0.5, -13),
(params["one_cw_tone_manual"], 2000000, 0.12, -25),
(params["one_cw_tone_manual"], 2000000, 0.25, -19),
(params["one_cw_tone_auto"], 1000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 2000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 500000, 0.12, -14.7),
(params["change_attenuation_5dB_manual"], 2000000, 0.25, -23.8),
(params["change_attenuation_10dB_manual"], 2000000, 0.25, -28.75),
(params["change_attenuation_0dB_auto"], 1000000, 0.12, -9),
(params["change_attenuation_20dB_auto"], 1000000, 0.12, -24.7),
(params["change_rf_gain_0dB_manual"], 2000000, 0.25, -29),
(params["change_rf_gain_20dB_manual"], 2000000, 0.25, -9),
(params["change_temp_gain_up"], 2000000, 0.25, -16),
(params["change_temp_gain_down"], 2000000, 0.25, -22),
],
)
def test_ad9375_dds_loopback(
test_dds_loopback,
iio_uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
):
> test_dds_loopback(
iio_uri, classname, param_set, channel, frequency, scale, peak_min
)
test/test_ad9375.py:266:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'automatic', 'rx_lo': 2500000000, 'rx_quadrature_tracking_en_chan0': 1, ...}
channel = 1, frequency = 500000, scale = 0.12, peak_min = -14.7, use_obs = False
use_rx2 = False
def dds_loopback(
uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
use_obs=False,
use_rx2=False,
):
"""dds_loopback: Test DDS loopback with connected loopback cables.
This test requires a devices with TX and RX onboard where the transmit
signal can be recovered. TX FPGA DDSs are used to generate a sinusoid
which is then estimated on the RX side. The receive tone must be within
1% of its expected frequency with a specified peak
parameters:
uri: type=string
URI of IIO context of target board/system
classname: type=string
Name of pyadi interface class which contain attribute
param_set: type=dict
Dictionary of attribute and values to be set before tone is
generated and received
channel: type=list
List of integers or list of list of integers of channels to
enable through tx_enabled_channels
frequency: type=integer
Frequency in Hz of transmitted tone
scale: type=float
Scale of DDS tone. Range [0,1]
peak_min: type=float
Minimum acceptable value of maximum peak in dBFS of received tone
"""
# See if we can tone using DMAs
sdr = eval(classname + "(uri='" + uri + "')")
# Set custom device parameters
for p in param_set.keys():
setattr(sdr, p, param_set[p])
# Set common buffer settings
sdr.tx_cyclic_buffer = True
N = 2 ** 14
if use_obs and use_rx2:
raise Exception("Both RX2 and OBS are selected. Select one at a time.")
if use_rx2:
sdr.rx2_enabled_channels = [channel]
sdr.rx2_buffer_size = N * 2 * len(sdr.rx2_enabled_channels)
elif use_obs:
sdr.obs.rx_enabled_channels = [0]
sdr.obs.rx_buffer_size = N * 2 * len(sdr.obs.rx_enabled_channels)
else:
sdr.rx_enabled_channels = [channel]
sdr.rx_buffer_size = N * 2 * len(sdr.rx_enabled_channels)
# Create a sinewave waveform
if hasattr(sdr, "sample_rate"):
RXFS = int(sdr.sample_rate)
else:
RXFS = int(sdr.orx_sample_rate) if use_obs else int(sdr.rx_sample_rate)
sdr.dds_single_tone(frequency, scale, channel)
# Pass through SDR
try:
for _ in range(10): # Wait
data = sdr.rx2() if use_rx2 else sdr.obs.rx() if use_obs else sdr.rx()
except Exception as e:
del sdr
raise Exception(e)
del sdr
tone_peaks, tone_freqs = spec.spec_est(data, fs=RXFS, ref=2 ** 15, plot=False)
indx = np.argmax(tone_peaks)
diff = np.abs(tone_freqs[indx] - frequency)
s = "Peak: " + str(tone_peaks[indx]) + "@" + str(tone_freqs[indx])
print(s)
if do_html_log:
pytest.data_log = {
"html": gen_line_plot_html(
tone_freqs,
tone_peaks,
"Frequency (Hz)",
"Amplitude (dBFS)",
"{} ({})".format(s, classname),
)
}
> assert (frequency * 0.01) > diff
E assert (500000 * 0.01) > 500000.0
test/dma_tests.py:340: AssertionError
Check warning on line 0 in test.test_ad9375
github-actions / Test Results
test_ad9375_dds_loopback[param_set6-2000000-0.25--23.8-0-adi.ad9375] (test.test_ad9375) failed
results.xml [took 0s]
Raw output
assert (2000000 * 0.01) > 2000000.0
test_dds_loopback = <function dds_loopback at 0x7f04abaf85e0>
iio_uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'manual', 'rx_hardwaregain_chan0': 10, 'rx_hardwaregain_chan1': 10, ...}
channel = 0, frequency = 2000000, scale = 0.25, peak_min = -23.8
@pytest.mark.iio_hardware(hardware)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize("channel", [0, 1])
@pytest.mark.parametrize(
"param_set, frequency, scale, peak_min",
[
(params["one_cw_tone_manual"], 2000000, 0.5, -13),
(params["one_cw_tone_manual"], 2000000, 0.12, -25),
(params["one_cw_tone_manual"], 2000000, 0.25, -19),
(params["one_cw_tone_auto"], 1000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 2000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 500000, 0.12, -14.7),
(params["change_attenuation_5dB_manual"], 2000000, 0.25, -23.8),
(params["change_attenuation_10dB_manual"], 2000000, 0.25, -28.75),
(params["change_attenuation_0dB_auto"], 1000000, 0.12, -9),
(params["change_attenuation_20dB_auto"], 1000000, 0.12, -24.7),
(params["change_rf_gain_0dB_manual"], 2000000, 0.25, -29),
(params["change_rf_gain_20dB_manual"], 2000000, 0.25, -9),
(params["change_temp_gain_up"], 2000000, 0.25, -16),
(params["change_temp_gain_down"], 2000000, 0.25, -22),
],
)
def test_ad9375_dds_loopback(
test_dds_loopback,
iio_uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
):
> test_dds_loopback(
iio_uri, classname, param_set, channel, frequency, scale, peak_min
)
test/test_ad9375.py:266:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'manual', 'rx_hardwaregain_chan0': 10, 'rx_hardwaregain_chan1': 10, ...}
channel = 0, frequency = 2000000, scale = 0.25, peak_min = -23.8
use_obs = False, use_rx2 = False
def dds_loopback(
uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
use_obs=False,
use_rx2=False,
):
"""dds_loopback: Test DDS loopback with connected loopback cables.
This test requires a devices with TX and RX onboard where the transmit
signal can be recovered. TX FPGA DDSs are used to generate a sinusoid
which is then estimated on the RX side. The receive tone must be within
1% of its expected frequency with a specified peak
parameters:
uri: type=string
URI of IIO context of target board/system
classname: type=string
Name of pyadi interface class which contain attribute
param_set: type=dict
Dictionary of attribute and values to be set before tone is
generated and received
channel: type=list
List of integers or list of list of integers of channels to
enable through tx_enabled_channels
frequency: type=integer
Frequency in Hz of transmitted tone
scale: type=float
Scale of DDS tone. Range [0,1]
peak_min: type=float
Minimum acceptable value of maximum peak in dBFS of received tone
"""
# See if we can tone using DMAs
sdr = eval(classname + "(uri='" + uri + "')")
# Set custom device parameters
for p in param_set.keys():
setattr(sdr, p, param_set[p])
# Set common buffer settings
sdr.tx_cyclic_buffer = True
N = 2 ** 14
if use_obs and use_rx2:
raise Exception("Both RX2 and OBS are selected. Select one at a time.")
if use_rx2:
sdr.rx2_enabled_channels = [channel]
sdr.rx2_buffer_size = N * 2 * len(sdr.rx2_enabled_channels)
elif use_obs:
sdr.obs.rx_enabled_channels = [0]
sdr.obs.rx_buffer_size = N * 2 * len(sdr.obs.rx_enabled_channels)
else:
sdr.rx_enabled_channels = [channel]
sdr.rx_buffer_size = N * 2 * len(sdr.rx_enabled_channels)
# Create a sinewave waveform
if hasattr(sdr, "sample_rate"):
RXFS = int(sdr.sample_rate)
else:
RXFS = int(sdr.orx_sample_rate) if use_obs else int(sdr.rx_sample_rate)
sdr.dds_single_tone(frequency, scale, channel)
# Pass through SDR
try:
for _ in range(10): # Wait
data = sdr.rx2() if use_rx2 else sdr.obs.rx() if use_obs else sdr.rx()
except Exception as e:
del sdr
raise Exception(e)
del sdr
tone_peaks, tone_freqs = spec.spec_est(data, fs=RXFS, ref=2 ** 15, plot=False)
indx = np.argmax(tone_peaks)
diff = np.abs(tone_freqs[indx] - frequency)
s = "Peak: " + str(tone_peaks[indx]) + "@" + str(tone_freqs[indx])
print(s)
if do_html_log:
pytest.data_log = {
"html": gen_line_plot_html(
tone_freqs,
tone_peaks,
"Frequency (Hz)",
"Amplitude (dBFS)",
"{} ({})".format(s, classname),
)
}
> assert (frequency * 0.01) > diff
E assert (2000000 * 0.01) > 2000000.0
test/dma_tests.py:340: AssertionError
Check warning on line 0 in test.test_ad9375
github-actions / Test Results
test_ad9375_dds_loopback[param_set6-2000000-0.25--23.8-1-adi.ad9375] (test.test_ad9375) failed
results.xml [took 0s]
Raw output
assert (2000000 * 0.01) > 2000000.0
test_dds_loopback = <function dds_loopback at 0x7f04abaf85e0>
iio_uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'manual', 'rx_hardwaregain_chan0': 10, 'rx_hardwaregain_chan1': 10, ...}
channel = 1, frequency = 2000000, scale = 0.25, peak_min = -23.8
@pytest.mark.iio_hardware(hardware)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize("channel", [0, 1])
@pytest.mark.parametrize(
"param_set, frequency, scale, peak_min",
[
(params["one_cw_tone_manual"], 2000000, 0.5, -13),
(params["one_cw_tone_manual"], 2000000, 0.12, -25),
(params["one_cw_tone_manual"], 2000000, 0.25, -19),
(params["one_cw_tone_auto"], 1000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 2000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 500000, 0.12, -14.7),
(params["change_attenuation_5dB_manual"], 2000000, 0.25, -23.8),
(params["change_attenuation_10dB_manual"], 2000000, 0.25, -28.75),
(params["change_attenuation_0dB_auto"], 1000000, 0.12, -9),
(params["change_attenuation_20dB_auto"], 1000000, 0.12, -24.7),
(params["change_rf_gain_0dB_manual"], 2000000, 0.25, -29),
(params["change_rf_gain_20dB_manual"], 2000000, 0.25, -9),
(params["change_temp_gain_up"], 2000000, 0.25, -16),
(params["change_temp_gain_down"], 2000000, 0.25, -22),
],
)
def test_ad9375_dds_loopback(
test_dds_loopback,
iio_uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
):
> test_dds_loopback(
iio_uri, classname, param_set, channel, frequency, scale, peak_min
)
test/test_ad9375.py:266:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'manual', 'rx_hardwaregain_chan0': 10, 'rx_hardwaregain_chan1': 10, ...}
channel = 1, frequency = 2000000, scale = 0.25, peak_min = -23.8
use_obs = False, use_rx2 = False
def dds_loopback(
uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
use_obs=False,
use_rx2=False,
):
"""dds_loopback: Test DDS loopback with connected loopback cables.
This test requires a devices with TX and RX onboard where the transmit
signal can be recovered. TX FPGA DDSs are used to generate a sinusoid
which is then estimated on the RX side. The receive tone must be within
1% of its expected frequency with a specified peak
parameters:
uri: type=string
URI of IIO context of target board/system
classname: type=string
Name of pyadi interface class which contain attribute
param_set: type=dict
Dictionary of attribute and values to be set before tone is
generated and received
channel: type=list
List of integers or list of list of integers of channels to
enable through tx_enabled_channels
frequency: type=integer
Frequency in Hz of transmitted tone
scale: type=float
Scale of DDS tone. Range [0,1]
peak_min: type=float
Minimum acceptable value of maximum peak in dBFS of received tone
"""
# See if we can tone using DMAs
sdr = eval(classname + "(uri='" + uri + "')")
# Set custom device parameters
for p in param_set.keys():
setattr(sdr, p, param_set[p])
# Set common buffer settings
sdr.tx_cyclic_buffer = True
N = 2 ** 14
if use_obs and use_rx2:
raise Exception("Both RX2 and OBS are selected. Select one at a time.")
if use_rx2:
sdr.rx2_enabled_channels = [channel]
sdr.rx2_buffer_size = N * 2 * len(sdr.rx2_enabled_channels)
elif use_obs:
sdr.obs.rx_enabled_channels = [0]
sdr.obs.rx_buffer_size = N * 2 * len(sdr.obs.rx_enabled_channels)
else:
sdr.rx_enabled_channels = [channel]
sdr.rx_buffer_size = N * 2 * len(sdr.rx_enabled_channels)
# Create a sinewave waveform
if hasattr(sdr, "sample_rate"):
RXFS = int(sdr.sample_rate)
else:
RXFS = int(sdr.orx_sample_rate) if use_obs else int(sdr.rx_sample_rate)
sdr.dds_single_tone(frequency, scale, channel)
# Pass through SDR
try:
for _ in range(10): # Wait
data = sdr.rx2() if use_rx2 else sdr.obs.rx() if use_obs else sdr.rx()
except Exception as e:
del sdr
raise Exception(e)
del sdr
tone_peaks, tone_freqs = spec.spec_est(data, fs=RXFS, ref=2 ** 15, plot=False)
indx = np.argmax(tone_peaks)
diff = np.abs(tone_freqs[indx] - frequency)
s = "Peak: " + str(tone_peaks[indx]) + "@" + str(tone_freqs[indx])
print(s)
if do_html_log:
pytest.data_log = {
"html": gen_line_plot_html(
tone_freqs,
tone_peaks,
"Frequency (Hz)",
"Amplitude (dBFS)",
"{} ({})".format(s, classname),
)
}
> assert (frequency * 0.01) > diff
E assert (2000000 * 0.01) > 2000000.0
test/dma_tests.py:340: AssertionError
Check warning on line 0 in test.test_ad9375
github-actions / Test Results
test_ad9375_dds_loopback[param_set7-2000000-0.25--28.75-0-adi.ad9375] (test.test_ad9375) failed
results.xml [took 0s]
Raw output
assert (2000000 * 0.01) > 2000000.0
test_dds_loopback = <function dds_loopback at 0x7f04abaf85e0>
iio_uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'manual', 'rx_hardwaregain_chan0': 10, 'rx_hardwaregain_chan1': 10, ...}
channel = 0, frequency = 2000000, scale = 0.25, peak_min = -28.75
@pytest.mark.iio_hardware(hardware)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize("channel", [0, 1])
@pytest.mark.parametrize(
"param_set, frequency, scale, peak_min",
[
(params["one_cw_tone_manual"], 2000000, 0.5, -13),
(params["one_cw_tone_manual"], 2000000, 0.12, -25),
(params["one_cw_tone_manual"], 2000000, 0.25, -19),
(params["one_cw_tone_auto"], 1000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 2000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 500000, 0.12, -14.7),
(params["change_attenuation_5dB_manual"], 2000000, 0.25, -23.8),
(params["change_attenuation_10dB_manual"], 2000000, 0.25, -28.75),
(params["change_attenuation_0dB_auto"], 1000000, 0.12, -9),
(params["change_attenuation_20dB_auto"], 1000000, 0.12, -24.7),
(params["change_rf_gain_0dB_manual"], 2000000, 0.25, -29),
(params["change_rf_gain_20dB_manual"], 2000000, 0.25, -9),
(params["change_temp_gain_up"], 2000000, 0.25, -16),
(params["change_temp_gain_down"], 2000000, 0.25, -22),
],
)
def test_ad9375_dds_loopback(
test_dds_loopback,
iio_uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
):
> test_dds_loopback(
iio_uri, classname, param_set, channel, frequency, scale, peak_min
)
test/test_ad9375.py:266:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'manual', 'rx_hardwaregain_chan0': 10, 'rx_hardwaregain_chan1': 10, ...}
channel = 0, frequency = 2000000, scale = 0.25, peak_min = -28.75
use_obs = False, use_rx2 = False
def dds_loopback(
uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
use_obs=False,
use_rx2=False,
):
"""dds_loopback: Test DDS loopback with connected loopback cables.
This test requires a devices with TX and RX onboard where the transmit
signal can be recovered. TX FPGA DDSs are used to generate a sinusoid
which is then estimated on the RX side. The receive tone must be within
1% of its expected frequency with a specified peak
parameters:
uri: type=string
URI of IIO context of target board/system
classname: type=string
Name of pyadi interface class which contain attribute
param_set: type=dict
Dictionary of attribute and values to be set before tone is
generated and received
channel: type=list
List of integers or list of list of integers of channels to
enable through tx_enabled_channels
frequency: type=integer
Frequency in Hz of transmitted tone
scale: type=float
Scale of DDS tone. Range [0,1]
peak_min: type=float
Minimum acceptable value of maximum peak in dBFS of received tone
"""
# See if we can tone using DMAs
sdr = eval(classname + "(uri='" + uri + "')")
# Set custom device parameters
for p in param_set.keys():
setattr(sdr, p, param_set[p])
# Set common buffer settings
sdr.tx_cyclic_buffer = True
N = 2 ** 14
if use_obs and use_rx2:
raise Exception("Both RX2 and OBS are selected. Select one at a time.")
if use_rx2:
sdr.rx2_enabled_channels = [channel]
sdr.rx2_buffer_size = N * 2 * len(sdr.rx2_enabled_channels)
elif use_obs:
sdr.obs.rx_enabled_channels = [0]
sdr.obs.rx_buffer_size = N * 2 * len(sdr.obs.rx_enabled_channels)
else:
sdr.rx_enabled_channels = [channel]
sdr.rx_buffer_size = N * 2 * len(sdr.rx_enabled_channels)
# Create a sinewave waveform
if hasattr(sdr, "sample_rate"):
RXFS = int(sdr.sample_rate)
else:
RXFS = int(sdr.orx_sample_rate) if use_obs else int(sdr.rx_sample_rate)
sdr.dds_single_tone(frequency, scale, channel)
# Pass through SDR
try:
for _ in range(10): # Wait
data = sdr.rx2() if use_rx2 else sdr.obs.rx() if use_obs else sdr.rx()
except Exception as e:
del sdr
raise Exception(e)
del sdr
tone_peaks, tone_freqs = spec.spec_est(data, fs=RXFS, ref=2 ** 15, plot=False)
indx = np.argmax(tone_peaks)
diff = np.abs(tone_freqs[indx] - frequency)
s = "Peak: " + str(tone_peaks[indx]) + "@" + str(tone_freqs[indx])
print(s)
if do_html_log:
pytest.data_log = {
"html": gen_line_plot_html(
tone_freqs,
tone_peaks,
"Frequency (Hz)",
"Amplitude (dBFS)",
"{} ({})".format(s, classname),
)
}
> assert (frequency * 0.01) > diff
E assert (2000000 * 0.01) > 2000000.0
test/dma_tests.py:340: AssertionError
Check warning on line 0 in test.test_ad9375
github-actions / Test Results
test_ad9375_dds_loopback[param_set7-2000000-0.25--28.75-1-adi.ad9375] (test.test_ad9375) failed
results.xml [took 0s]
Raw output
assert (2000000 * 0.01) > 2000000.0
test_dds_loopback = <function dds_loopback at 0x7f04abaf85e0>
iio_uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'manual', 'rx_hardwaregain_chan0': 10, 'rx_hardwaregain_chan1': 10, ...}
channel = 1, frequency = 2000000, scale = 0.25, peak_min = -28.75
@pytest.mark.iio_hardware(hardware)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize("channel", [0, 1])
@pytest.mark.parametrize(
"param_set, frequency, scale, peak_min",
[
(params["one_cw_tone_manual"], 2000000, 0.5, -13),
(params["one_cw_tone_manual"], 2000000, 0.12, -25),
(params["one_cw_tone_manual"], 2000000, 0.25, -19),
(params["one_cw_tone_auto"], 1000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 2000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 500000, 0.12, -14.7),
(params["change_attenuation_5dB_manual"], 2000000, 0.25, -23.8),
(params["change_attenuation_10dB_manual"], 2000000, 0.25, -28.75),
(params["change_attenuation_0dB_auto"], 1000000, 0.12, -9),
(params["change_attenuation_20dB_auto"], 1000000, 0.12, -24.7),
(params["change_rf_gain_0dB_manual"], 2000000, 0.25, -29),
(params["change_rf_gain_20dB_manual"], 2000000, 0.25, -9),
(params["change_temp_gain_up"], 2000000, 0.25, -16),
(params["change_temp_gain_down"], 2000000, 0.25, -22),
],
)
def test_ad9375_dds_loopback(
test_dds_loopback,
iio_uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
):
> test_dds_loopback(
iio_uri, classname, param_set, channel, frequency, scale, peak_min
)
test/test_ad9375.py:266:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'manual', 'rx_hardwaregain_chan0': 10, 'rx_hardwaregain_chan1': 10, ...}
channel = 1, frequency = 2000000, scale = 0.25, peak_min = -28.75
use_obs = False, use_rx2 = False
def dds_loopback(
uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
use_obs=False,
use_rx2=False,
):
"""dds_loopback: Test DDS loopback with connected loopback cables.
This test requires a devices with TX and RX onboard where the transmit
signal can be recovered. TX FPGA DDSs are used to generate a sinusoid
which is then estimated on the RX side. The receive tone must be within
1% of its expected frequency with a specified peak
parameters:
uri: type=string
URI of IIO context of target board/system
classname: type=string
Name of pyadi interface class which contain attribute
param_set: type=dict
Dictionary of attribute and values to be set before tone is
generated and received
channel: type=list
List of integers or list of list of integers of channels to
enable through tx_enabled_channels
frequency: type=integer
Frequency in Hz of transmitted tone
scale: type=float
Scale of DDS tone. Range [0,1]
peak_min: type=float
Minimum acceptable value of maximum peak in dBFS of received tone
"""
# See if we can tone using DMAs
sdr = eval(classname + "(uri='" + uri + "')")
# Set custom device parameters
for p in param_set.keys():
setattr(sdr, p, param_set[p])
# Set common buffer settings
sdr.tx_cyclic_buffer = True
N = 2 ** 14
if use_obs and use_rx2:
raise Exception("Both RX2 and OBS are selected. Select one at a time.")
if use_rx2:
sdr.rx2_enabled_channels = [channel]
sdr.rx2_buffer_size = N * 2 * len(sdr.rx2_enabled_channels)
elif use_obs:
sdr.obs.rx_enabled_channels = [0]
sdr.obs.rx_buffer_size = N * 2 * len(sdr.obs.rx_enabled_channels)
else:
sdr.rx_enabled_channels = [channel]
sdr.rx_buffer_size = N * 2 * len(sdr.rx_enabled_channels)
# Create a sinewave waveform
if hasattr(sdr, "sample_rate"):
RXFS = int(sdr.sample_rate)
else:
RXFS = int(sdr.orx_sample_rate) if use_obs else int(sdr.rx_sample_rate)
sdr.dds_single_tone(frequency, scale, channel)
# Pass through SDR
try:
for _ in range(10): # Wait
data = sdr.rx2() if use_rx2 else sdr.obs.rx() if use_obs else sdr.rx()
except Exception as e:
del sdr
raise Exception(e)
del sdr
tone_peaks, tone_freqs = spec.spec_est(data, fs=RXFS, ref=2 ** 15, plot=False)
indx = np.argmax(tone_peaks)
diff = np.abs(tone_freqs[indx] - frequency)
s = "Peak: " + str(tone_peaks[indx]) + "@" + str(tone_freqs[indx])
print(s)
if do_html_log:
pytest.data_log = {
"html": gen_line_plot_html(
tone_freqs,
tone_peaks,
"Frequency (Hz)",
"Amplitude (dBFS)",
"{} ({})".format(s, classname),
)
}
> assert (frequency * 0.01) > diff
E assert (2000000 * 0.01) > 2000000.0
test/dma_tests.py:340: AssertionError
Check warning on line 0 in test.test_ad9375
github-actions / Test Results
test_ad9375_dds_loopback[param_set8-1000000-0.12--9-0-adi.ad9375] (test.test_ad9375) failed
results.xml [took 0s]
Raw output
assert (1000000 * 0.01) > 1000000.0
test_dds_loopback = <function dds_loopback at 0x7f04abaf85e0>
iio_uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'automatic', 'rx_lo': 2500000000, 'rx_quadrature_tracking_en_chan0': 1, ...}
channel = 0, frequency = 1000000, scale = 0.12, peak_min = -9
@pytest.mark.iio_hardware(hardware)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize("channel", [0, 1])
@pytest.mark.parametrize(
"param_set, frequency, scale, peak_min",
[
(params["one_cw_tone_manual"], 2000000, 0.5, -13),
(params["one_cw_tone_manual"], 2000000, 0.12, -25),
(params["one_cw_tone_manual"], 2000000, 0.25, -19),
(params["one_cw_tone_auto"], 1000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 2000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 500000, 0.12, -14.7),
(params["change_attenuation_5dB_manual"], 2000000, 0.25, -23.8),
(params["change_attenuation_10dB_manual"], 2000000, 0.25, -28.75),
(params["change_attenuation_0dB_auto"], 1000000, 0.12, -9),
(params["change_attenuation_20dB_auto"], 1000000, 0.12, -24.7),
(params["change_rf_gain_0dB_manual"], 2000000, 0.25, -29),
(params["change_rf_gain_20dB_manual"], 2000000, 0.25, -9),
(params["change_temp_gain_up"], 2000000, 0.25, -16),
(params["change_temp_gain_down"], 2000000, 0.25, -22),
],
)
def test_ad9375_dds_loopback(
test_dds_loopback,
iio_uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
):
> test_dds_loopback(
iio_uri, classname, param_set, channel, frequency, scale, peak_min
)
test/test_ad9375.py:266:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'automatic', 'rx_lo': 2500000000, 'rx_quadrature_tracking_en_chan0': 1, ...}
channel = 0, frequency = 1000000, scale = 0.12, peak_min = -9, use_obs = False
use_rx2 = False
def dds_loopback(
uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
use_obs=False,
use_rx2=False,
):
"""dds_loopback: Test DDS loopback with connected loopback cables.
This test requires a devices with TX and RX onboard where the transmit
signal can be recovered. TX FPGA DDSs are used to generate a sinusoid
which is then estimated on the RX side. The receive tone must be within
1% of its expected frequency with a specified peak
parameters:
uri: type=string
URI of IIO context of target board/system
classname: type=string
Name of pyadi interface class which contain attribute
param_set: type=dict
Dictionary of attribute and values to be set before tone is
generated and received
channel: type=list
List of integers or list of list of integers of channels to
enable through tx_enabled_channels
frequency: type=integer
Frequency in Hz of transmitted tone
scale: type=float
Scale of DDS tone. Range [0,1]
peak_min: type=float
Minimum acceptable value of maximum peak in dBFS of received tone
"""
# See if we can tone using DMAs
sdr = eval(classname + "(uri='" + uri + "')")
# Set custom device parameters
for p in param_set.keys():
setattr(sdr, p, param_set[p])
# Set common buffer settings
sdr.tx_cyclic_buffer = True
N = 2 ** 14
if use_obs and use_rx2:
raise Exception("Both RX2 and OBS are selected. Select one at a time.")
if use_rx2:
sdr.rx2_enabled_channels = [channel]
sdr.rx2_buffer_size = N * 2 * len(sdr.rx2_enabled_channels)
elif use_obs:
sdr.obs.rx_enabled_channels = [0]
sdr.obs.rx_buffer_size = N * 2 * len(sdr.obs.rx_enabled_channels)
else:
sdr.rx_enabled_channels = [channel]
sdr.rx_buffer_size = N * 2 * len(sdr.rx_enabled_channels)
# Create a sinewave waveform
if hasattr(sdr, "sample_rate"):
RXFS = int(sdr.sample_rate)
else:
RXFS = int(sdr.orx_sample_rate) if use_obs else int(sdr.rx_sample_rate)
sdr.dds_single_tone(frequency, scale, channel)
# Pass through SDR
try:
for _ in range(10): # Wait
data = sdr.rx2() if use_rx2 else sdr.obs.rx() if use_obs else sdr.rx()
except Exception as e:
del sdr
raise Exception(e)
del sdr
tone_peaks, tone_freqs = spec.spec_est(data, fs=RXFS, ref=2 ** 15, plot=False)
indx = np.argmax(tone_peaks)
diff = np.abs(tone_freqs[indx] - frequency)
s = "Peak: " + str(tone_peaks[indx]) + "@" + str(tone_freqs[indx])
print(s)
if do_html_log:
pytest.data_log = {
"html": gen_line_plot_html(
tone_freqs,
tone_peaks,
"Frequency (Hz)",
"Amplitude (dBFS)",
"{} ({})".format(s, classname),
)
}
> assert (frequency * 0.01) > diff
E assert (1000000 * 0.01) > 1000000.0
test/dma_tests.py:340: AssertionError
Check warning on line 0 in test.test_ad9375
github-actions / Test Results
test_ad9375_dds_loopback[param_set8-1000000-0.12--9-1-adi.ad9375] (test.test_ad9375) failed
results.xml [took 0s]
Raw output
assert (1000000 * 0.01) > 1000000.0
test_dds_loopback = <function dds_loopback at 0x7f04abaf85e0>
iio_uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'automatic', 'rx_lo': 2500000000, 'rx_quadrature_tracking_en_chan0': 1, ...}
channel = 1, frequency = 1000000, scale = 0.12, peak_min = -9
@pytest.mark.iio_hardware(hardware)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize("channel", [0, 1])
@pytest.mark.parametrize(
"param_set, frequency, scale, peak_min",
[
(params["one_cw_tone_manual"], 2000000, 0.5, -13),
(params["one_cw_tone_manual"], 2000000, 0.12, -25),
(params["one_cw_tone_manual"], 2000000, 0.25, -19),
(params["one_cw_tone_auto"], 1000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 2000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 500000, 0.12, -14.7),
(params["change_attenuation_5dB_manual"], 2000000, 0.25, -23.8),
(params["change_attenuation_10dB_manual"], 2000000, 0.25, -28.75),
(params["change_attenuation_0dB_auto"], 1000000, 0.12, -9),
(params["change_attenuation_20dB_auto"], 1000000, 0.12, -24.7),
(params["change_rf_gain_0dB_manual"], 2000000, 0.25, -29),
(params["change_rf_gain_20dB_manual"], 2000000, 0.25, -9),
(params["change_temp_gain_up"], 2000000, 0.25, -16),
(params["change_temp_gain_down"], 2000000, 0.25, -22),
],
)
def test_ad9375_dds_loopback(
test_dds_loopback,
iio_uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
):
> test_dds_loopback(
iio_uri, classname, param_set, channel, frequency, scale, peak_min
)
test/test_ad9375.py:266:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'automatic', 'rx_lo': 2500000000, 'rx_quadrature_tracking_en_chan0': 1, ...}
channel = 1, frequency = 1000000, scale = 0.12, peak_min = -9, use_obs = False
use_rx2 = False
def dds_loopback(
uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
use_obs=False,
use_rx2=False,
):
"""dds_loopback: Test DDS loopback with connected loopback cables.
This test requires a devices with TX and RX onboard where the transmit
signal can be recovered. TX FPGA DDSs are used to generate a sinusoid
which is then estimated on the RX side. The receive tone must be within
1% of its expected frequency with a specified peak
parameters:
uri: type=string
URI of IIO context of target board/system
classname: type=string
Name of pyadi interface class which contain attribute
param_set: type=dict
Dictionary of attribute and values to be set before tone is
generated and received
channel: type=list
List of integers or list of list of integers of channels to
enable through tx_enabled_channels
frequency: type=integer
Frequency in Hz of transmitted tone
scale: type=float
Scale of DDS tone. Range [0,1]
peak_min: type=float
Minimum acceptable value of maximum peak in dBFS of received tone
"""
# See if we can tone using DMAs
sdr = eval(classname + "(uri='" + uri + "')")
# Set custom device parameters
for p in param_set.keys():
setattr(sdr, p, param_set[p])
# Set common buffer settings
sdr.tx_cyclic_buffer = True
N = 2 ** 14
if use_obs and use_rx2:
raise Exception("Both RX2 and OBS are selected. Select one at a time.")
if use_rx2:
sdr.rx2_enabled_channels = [channel]
sdr.rx2_buffer_size = N * 2 * len(sdr.rx2_enabled_channels)
elif use_obs:
sdr.obs.rx_enabled_channels = [0]
sdr.obs.rx_buffer_size = N * 2 * len(sdr.obs.rx_enabled_channels)
else:
sdr.rx_enabled_channels = [channel]
sdr.rx_buffer_size = N * 2 * len(sdr.rx_enabled_channels)
# Create a sinewave waveform
if hasattr(sdr, "sample_rate"):
RXFS = int(sdr.sample_rate)
else:
RXFS = int(sdr.orx_sample_rate) if use_obs else int(sdr.rx_sample_rate)
sdr.dds_single_tone(frequency, scale, channel)
# Pass through SDR
try:
for _ in range(10): # Wait
data = sdr.rx2() if use_rx2 else sdr.obs.rx() if use_obs else sdr.rx()
except Exception as e:
del sdr
raise Exception(e)
del sdr
tone_peaks, tone_freqs = spec.spec_est(data, fs=RXFS, ref=2 ** 15, plot=False)
indx = np.argmax(tone_peaks)
diff = np.abs(tone_freqs[indx] - frequency)
s = "Peak: " + str(tone_peaks[indx]) + "@" + str(tone_freqs[indx])
print(s)
if do_html_log:
pytest.data_log = {
"html": gen_line_plot_html(
tone_freqs,
tone_peaks,
"Frequency (Hz)",
"Amplitude (dBFS)",
"{} ({})".format(s, classname),
)
}
> assert (frequency * 0.01) > diff
E assert (1000000 * 0.01) > 1000000.0
test/dma_tests.py:340: AssertionError
Check warning on line 0 in test.test_ad9375
github-actions / Test Results
test_ad9375_dds_loopback[param_set9-1000000-0.12--24.7-0-adi.ad9375] (test.test_ad9375) failed
results.xml [took 0s]
Raw output
assert (1000000 * 0.01) > 1000000.0
test_dds_loopback = <function dds_loopback at 0x7f04abaf85e0>
iio_uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'automatic', 'rx_lo': 2500000000, 'rx_quadrature_tracking_en_chan0': 1, ...}
channel = 0, frequency = 1000000, scale = 0.12, peak_min = -24.7
@pytest.mark.iio_hardware(hardware)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize("channel", [0, 1])
@pytest.mark.parametrize(
"param_set, frequency, scale, peak_min",
[
(params["one_cw_tone_manual"], 2000000, 0.5, -13),
(params["one_cw_tone_manual"], 2000000, 0.12, -25),
(params["one_cw_tone_manual"], 2000000, 0.25, -19),
(params["one_cw_tone_auto"], 1000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 2000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 500000, 0.12, -14.7),
(params["change_attenuation_5dB_manual"], 2000000, 0.25, -23.8),
(params["change_attenuation_10dB_manual"], 2000000, 0.25, -28.75),
(params["change_attenuation_0dB_auto"], 1000000, 0.12, -9),
(params["change_attenuation_20dB_auto"], 1000000, 0.12, -24.7),
(params["change_rf_gain_0dB_manual"], 2000000, 0.25, -29),
(params["change_rf_gain_20dB_manual"], 2000000, 0.25, -9),
(params["change_temp_gain_up"], 2000000, 0.25, -16),
(params["change_temp_gain_down"], 2000000, 0.25, -22),
],
)
def test_ad9375_dds_loopback(
test_dds_loopback,
iio_uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
):
> test_dds_loopback(
iio_uri, classname, param_set, channel, frequency, scale, peak_min
)
test/test_ad9375.py:266:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'automatic', 'rx_lo': 2500000000, 'rx_quadrature_tracking_en_chan0': 1, ...}
channel = 0, frequency = 1000000, scale = 0.12, peak_min = -24.7
use_obs = False, use_rx2 = False
def dds_loopback(
uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
use_obs=False,
use_rx2=False,
):
"""dds_loopback: Test DDS loopback with connected loopback cables.
This test requires a devices with TX and RX onboard where the transmit
signal can be recovered. TX FPGA DDSs are used to generate a sinusoid
which is then estimated on the RX side. The receive tone must be within
1% of its expected frequency with a specified peak
parameters:
uri: type=string
URI of IIO context of target board/system
classname: type=string
Name of pyadi interface class which contain attribute
param_set: type=dict
Dictionary of attribute and values to be set before tone is
generated and received
channel: type=list
List of integers or list of list of integers of channels to
enable through tx_enabled_channels
frequency: type=integer
Frequency in Hz of transmitted tone
scale: type=float
Scale of DDS tone. Range [0,1]
peak_min: type=float
Minimum acceptable value of maximum peak in dBFS of received tone
"""
# See if we can tone using DMAs
sdr = eval(classname + "(uri='" + uri + "')")
# Set custom device parameters
for p in param_set.keys():
setattr(sdr, p, param_set[p])
# Set common buffer settings
sdr.tx_cyclic_buffer = True
N = 2 ** 14
if use_obs and use_rx2:
raise Exception("Both RX2 and OBS are selected. Select one at a time.")
if use_rx2:
sdr.rx2_enabled_channels = [channel]
sdr.rx2_buffer_size = N * 2 * len(sdr.rx2_enabled_channels)
elif use_obs:
sdr.obs.rx_enabled_channels = [0]
sdr.obs.rx_buffer_size = N * 2 * len(sdr.obs.rx_enabled_channels)
else:
sdr.rx_enabled_channels = [channel]
sdr.rx_buffer_size = N * 2 * len(sdr.rx_enabled_channels)
# Create a sinewave waveform
if hasattr(sdr, "sample_rate"):
RXFS = int(sdr.sample_rate)
else:
RXFS = int(sdr.orx_sample_rate) if use_obs else int(sdr.rx_sample_rate)
sdr.dds_single_tone(frequency, scale, channel)
# Pass through SDR
try:
for _ in range(10): # Wait
data = sdr.rx2() if use_rx2 else sdr.obs.rx() if use_obs else sdr.rx()
except Exception as e:
del sdr
raise Exception(e)
del sdr
tone_peaks, tone_freqs = spec.spec_est(data, fs=RXFS, ref=2 ** 15, plot=False)
indx = np.argmax(tone_peaks)
diff = np.abs(tone_freqs[indx] - frequency)
s = "Peak: " + str(tone_peaks[indx]) + "@" + str(tone_freqs[indx])
print(s)
if do_html_log:
pytest.data_log = {
"html": gen_line_plot_html(
tone_freqs,
tone_peaks,
"Frequency (Hz)",
"Amplitude (dBFS)",
"{} ({})".format(s, classname),
)
}
> assert (frequency * 0.01) > diff
E assert (1000000 * 0.01) > 1000000.0
test/dma_tests.py:340: AssertionError
Check warning on line 0 in test.test_ad9375
github-actions / Test Results
test_ad9375_dds_loopback[param_set9-1000000-0.12--24.7-1-adi.ad9375] (test.test_ad9375) failed
results.xml [took 0s]
Raw output
assert (1000000 * 0.01) > 1000000.0
test_dds_loopback = <function dds_loopback at 0x7f04abaf85e0>
iio_uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'automatic', 'rx_lo': 2500000000, 'rx_quadrature_tracking_en_chan0': 1, ...}
channel = 1, frequency = 1000000, scale = 0.12, peak_min = -24.7
@pytest.mark.iio_hardware(hardware)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize("channel", [0, 1])
@pytest.mark.parametrize(
"param_set, frequency, scale, peak_min",
[
(params["one_cw_tone_manual"], 2000000, 0.5, -13),
(params["one_cw_tone_manual"], 2000000, 0.12, -25),
(params["one_cw_tone_manual"], 2000000, 0.25, -19),
(params["one_cw_tone_auto"], 1000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 2000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 500000, 0.12, -14.7),
(params["change_attenuation_5dB_manual"], 2000000, 0.25, -23.8),
(params["change_attenuation_10dB_manual"], 2000000, 0.25, -28.75),
(params["change_attenuation_0dB_auto"], 1000000, 0.12, -9),
(params["change_attenuation_20dB_auto"], 1000000, 0.12, -24.7),
(params["change_rf_gain_0dB_manual"], 2000000, 0.25, -29),
(params["change_rf_gain_20dB_manual"], 2000000, 0.25, -9),
(params["change_temp_gain_up"], 2000000, 0.25, -16),
(params["change_temp_gain_down"], 2000000, 0.25, -22),
],
)
def test_ad9375_dds_loopback(
test_dds_loopback,
iio_uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
):
> test_dds_loopback(
iio_uri, classname, param_set, channel, frequency, scale, peak_min
)
test/test_ad9375.py:266:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'automatic', 'rx_lo': 2500000000, 'rx_quadrature_tracking_en_chan0': 1, ...}
channel = 1, frequency = 1000000, scale = 0.12, peak_min = -24.7
use_obs = False, use_rx2 = False
def dds_loopback(
uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
use_obs=False,
use_rx2=False,
):
"""dds_loopback: Test DDS loopback with connected loopback cables.
This test requires a devices with TX and RX onboard where the transmit
signal can be recovered. TX FPGA DDSs are used to generate a sinusoid
which is then estimated on the RX side. The receive tone must be within
1% of its expected frequency with a specified peak
parameters:
uri: type=string
URI of IIO context of target board/system
classname: type=string
Name of pyadi interface class which contain attribute
param_set: type=dict
Dictionary of attribute and values to be set before tone is
generated and received
channel: type=list
List of integers or list of list of integers of channels to
enable through tx_enabled_channels
frequency: type=integer
Frequency in Hz of transmitted tone
scale: type=float
Scale of DDS tone. Range [0,1]
peak_min: type=float
Minimum acceptable value of maximum peak in dBFS of received tone
"""
# See if we can tone using DMAs
sdr = eval(classname + "(uri='" + uri + "')")
# Set custom device parameters
for p in param_set.keys():
setattr(sdr, p, param_set[p])
# Set common buffer settings
sdr.tx_cyclic_buffer = True
N = 2 ** 14
if use_obs and use_rx2:
raise Exception("Both RX2 and OBS are selected. Select one at a time.")
if use_rx2:
sdr.rx2_enabled_channels = [channel]
sdr.rx2_buffer_size = N * 2 * len(sdr.rx2_enabled_channels)
elif use_obs:
sdr.obs.rx_enabled_channels = [0]
sdr.obs.rx_buffer_size = N * 2 * len(sdr.obs.rx_enabled_channels)
else:
sdr.rx_enabled_channels = [channel]
sdr.rx_buffer_size = N * 2 * len(sdr.rx_enabled_channels)
# Create a sinewave waveform
if hasattr(sdr, "sample_rate"):
RXFS = int(sdr.sample_rate)
else:
RXFS = int(sdr.orx_sample_rate) if use_obs else int(sdr.rx_sample_rate)
sdr.dds_single_tone(frequency, scale, channel)
# Pass through SDR
try:
for _ in range(10): # Wait
data = sdr.rx2() if use_rx2 else sdr.obs.rx() if use_obs else sdr.rx()
except Exception as e:
del sdr
raise Exception(e)
del sdr
tone_peaks, tone_freqs = spec.spec_est(data, fs=RXFS, ref=2 ** 15, plot=False)
indx = np.argmax(tone_peaks)
diff = np.abs(tone_freqs[indx] - frequency)
s = "Peak: " + str(tone_peaks[indx]) + "@" + str(tone_freqs[indx])
print(s)
if do_html_log:
pytest.data_log = {
"html": gen_line_plot_html(
tone_freqs,
tone_peaks,
"Frequency (Hz)",
"Amplitude (dBFS)",
"{} ({})".format(s, classname),
)
}
> assert (frequency * 0.01) > diff
E assert (1000000 * 0.01) > 1000000.0
test/dma_tests.py:340: AssertionError
Check warning on line 0 in test.test_ad9375
github-actions / Test Results
test_ad9375_dds_loopback[param_set10-2000000-0.25--29-0-adi.ad9375] (test.test_ad9375) failed
results.xml [took 0s]
Raw output
assert (2000000 * 0.01) > 2000000.0
test_dds_loopback = <function dds_loopback at 0x7f04abaf85e0>
iio_uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'manual', 'rx_hardwaregain_chan0': 0, 'rx_hardwaregain_chan1': 0, ...}
channel = 0, frequency = 2000000, scale = 0.25, peak_min = -29
@pytest.mark.iio_hardware(hardware)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize("channel", [0, 1])
@pytest.mark.parametrize(
"param_set, frequency, scale, peak_min",
[
(params["one_cw_tone_manual"], 2000000, 0.5, -13),
(params["one_cw_tone_manual"], 2000000, 0.12, -25),
(params["one_cw_tone_manual"], 2000000, 0.25, -19),
(params["one_cw_tone_auto"], 1000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 2000000, 0.12, -14.7),
(params["one_cw_tone_auto"], 500000, 0.12, -14.7),
(params["change_attenuation_5dB_manual"], 2000000, 0.25, -23.8),
(params["change_attenuation_10dB_manual"], 2000000, 0.25, -28.75),
(params["change_attenuation_0dB_auto"], 1000000, 0.12, -9),
(params["change_attenuation_20dB_auto"], 1000000, 0.12, -24.7),
(params["change_rf_gain_0dB_manual"], 2000000, 0.25, -29),
(params["change_rf_gain_20dB_manual"], 2000000, 0.25, -9),
(params["change_temp_gain_up"], 2000000, 0.25, -16),
(params["change_temp_gain_down"], 2000000, 0.25, -22),
],
)
def test_ad9375_dds_loopback(
test_dds_loopback,
iio_uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
):
> test_dds_loopback(
iio_uri, classname, param_set, channel, frequency, scale, peak_min
)
test/test_ad9375.py:266:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
uri = 'ip:10.1.1.19', classname = 'adi.ad9375'
param_set = {'ensm_mode': 'radio_on', 'gain_control_mode': 'manual', 'rx_hardwaregain_chan0': 0, 'rx_hardwaregain_chan1': 0, ...}
channel = 0, frequency = 2000000, scale = 0.25, peak_min = -29, use_obs = False
use_rx2 = False
def dds_loopback(
uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
use_obs=False,
use_rx2=False,
):
"""dds_loopback: Test DDS loopback with connected loopback cables.
This test requires a devices with TX and RX onboard where the transmit
signal can be recovered. TX FPGA DDSs are used to generate a sinusoid
which is then estimated on the RX side. The receive tone must be within
1% of its expected frequency with a specified peak
parameters:
uri: type=string
URI of IIO context of target board/system
classname: type=string
Name of pyadi interface class which contain attribute
param_set: type=dict
Dictionary of attribute and values to be set before tone is
generated and received
channel: type=list
List of integers or list of list of integers of channels to
enable through tx_enabled_channels
frequency: type=integer
Frequency in Hz of transmitted tone
scale: type=float
Scale of DDS tone. Range [0,1]
peak_min: type=float
Minimum acceptable value of maximum peak in dBFS of received tone
"""
# See if we can tone using DMAs
sdr = eval(classname + "(uri='" + uri + "')")
# Set custom device parameters
for p in param_set.keys():
setattr(sdr, p, param_set[p])
# Set common buffer settings
sdr.tx_cyclic_buffer = True
N = 2 ** 14
if use_obs and use_rx2:
raise Exception("Both RX2 and OBS are selected. Select one at a time.")
if use_rx2:
sdr.rx2_enabled_channels = [channel]
sdr.rx2_buffer_size = N * 2 * len(sdr.rx2_enabled_channels)
elif use_obs:
sdr.obs.rx_enabled_channels = [0]
sdr.obs.rx_buffer_size = N * 2 * len(sdr.obs.rx_enabled_channels)
else:
sdr.rx_enabled_channels = [channel]
sdr.rx_buffer_size = N * 2 * len(sdr.rx_enabled_channels)
# Create a sinewave waveform
if hasattr(sdr, "sample_rate"):
RXFS = int(sdr.sample_rate)
else:
RXFS = int(sdr.orx_sample_rate) if use_obs else int(sdr.rx_sample_rate)
sdr.dds_single_tone(frequency, scale, channel)
# Pass through SDR
try:
for _ in range(10): # Wait
data = sdr.rx2() if use_rx2 else sdr.obs.rx() if use_obs else sdr.rx()
except Exception as e:
del sdr
raise Exception(e)
del sdr
tone_peaks, tone_freqs = spec.spec_est(data, fs=RXFS, ref=2 ** 15, plot=False)
indx = np.argmax(tone_peaks)
diff = np.abs(tone_freqs[indx] - frequency)
s = "Peak: " + str(tone_peaks[indx]) + "@" + str(tone_freqs[indx])
print(s)
if do_html_log:
pytest.data_log = {
"html": gen_line_plot_html(
tone_freqs,
tone_peaks,
"Frequency (Hz)",
"Amplitude (dBFS)",
"{} ({})".format(s, classname),
)
}
> assert (frequency * 0.01) > diff
E assert (2000000 * 0.01) > 2000000.0
test/dma_tests.py:340: AssertionError