This repository is a scos-sensor plugin to add support for the Ettus B2xx line of signal analyzers. See the scos-sensor README for more information about scos-sensor, especially the Architecture and the Actions and Hardware Support sections which explain the scos-sensor plugin architecture.
This repository includes many 700MHz band actions in scos_usrp/configs/actions. Action classes, SignalAnalyzerInterface, GPSInterface, and signals are used from scos_actions.
For information on adding actions, see the scos_actions documentation.
- scos_usrp/configs: This folder contains the yaml files with the parameters used to initialize the USRP supported actions and sample calibration files.
- scos_usrp/discover: This includes the code to read yaml files and make actions available to scos-sensor.
- scos_usrp/hardware: This includes the USRP implementation of the signal analyzer interface and GPS interface. It also includes supporting calibration and test code.
Requires pip>=18.1 (upgrade using python3 -m pip install --upgrade pip
).
Below are steps to run scos-sensor with the scos-usrp plugin:
-
Clone scos-sensor:
git clone https://github.com/NTIA/scos-sensor.git
-
Navigate to scos-sensor:
cd scos-sensor
-
If it does not exist, create env file while in the root scos-sensor directory:
cp env.template ./env
-
Add the
scos_usrp
dependency inrequirements.in
inscos-sensor/src
folder and removescos_tekrsa
. If you are using a different branch than master, change master in the following line to the branch or version you are using:scos_usrp @ git+https://github.com/NTIA/scos-usrp@master
. Then run the commands to generate requirements.txt and requirements-dev.txt:pip-compile requirements.in pip-compile requirements-dev.in
Sync the dependencies to your virtual environment:
pip-sync requirements.txt requirements-dev.txt
-
Make sure
BASE_IMAGE
is set toBASE_IMAGE=ghcr.io/ntia/scos-usrp/scos_usrp_uhd:0.0.2
in env file. -
Get environment variables:
source ./env
-
Build and start containers:
docker-compose up -d --build --force-recreate
Set up a development environment using a tool like Conda
or venv,
with python>=3.8
. This repository dependends on the Python UHD library. In
Ubuntu, you can get this by installing the python3-uhd
package. Then, you can
get access to this package in your 'venv' virtual environment using the
--system-site-packages
option. Then, from the cloned directory, install the
development dependencies by running:
pip install .[dev]
This will install the project itself, along with development dependencies for pre-commit hooks, building distributions, and running tests. Set up pre-commit, which runs auto-formatting and code-checking automatically when you make a commit, by running:
pre-commit install
The pre-commit tool will auto-format Python code using Black
and isort. Other pre-commit hooks are also
enabled, and can be found in .pre-commit-config.yaml
.
This project uses Hatchling as a backend. Hatchling makes versioning and building new releases easy. The package version can be updated easily by using any of the following commands.
hatchling version major # 1.0.0 -> 2.0.0
hatchling version minor # 1.0.0 -> 1.1.0
hatchling version micro # 1.0.0 -> 1.0.1
hatchling version "X.X.X" # 1.0.0 -> X.X.X
To build a new release (both wheel and sdist/tarball), run:
hatchling build
The tests can be run using pytest or Docker.
Run the pytest
command to test without Docker.
Run the following commands to run in Docker.
docker build -f docker/Dockerfile-test -t usrp_test .
docker run usrp_test
Besides running the test suite and ensuring that all tests are passing, we also expect all Python code that's checked in to have been run through an auto-formatter.
This project uses a Python auto-formatter called Black. Additionally, import statement sorting is handled by isort.
There are several ways to autoformat your code before committing. First, IDE integration with on-save hooks is very useful. Second, if you've already pip-installed the dev requirements from the section above, you already have a utility called pre-commit installed that will automate setting up this project's git pre-commit hooks. Simply type the following once, and each time you make a commit, it will be appropriately autoformatted.
pre-commit install
You can manually run the pre-commit hooks using the following command.
pre-commit run --all-files
In addition to Black and isort, various other pre-commit tools are enabled including markdownlint. Markdownlint will show an error message if it detects any style issues in markdown files. See .pre-commit-config.yaml for the list of pre-commit tools enabled for this repository.
Run the following commands to build, tag, and push the docker image to the Github Container Registry. Replace X.X.X with the desired version number.
docker build -f docker/Dockerfile-uhd -t scos_usrp_uhd .
docker tag scos_usrp_uhd ghcr.io/ntia/scos-usrp/scos_usrp_uhd:X.X.X
docker push ghcr.io/ntia/scos-usrp/scos_usrp_uhd:X.X.X.
See LICENSE.
For technical questions about scos-usrp, contact Justin Haze, [email protected]