Compare commits
110 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
144ee1710d | ||
|
|
09ed997f91 | ||
|
|
e437931254 | ||
|
|
72fcc794e7 | ||
|
|
ff12d819da | ||
|
|
dc9d7ea91a | ||
|
|
5bc11cd78c | ||
|
|
9e6f9c3ffe | ||
|
|
e1017bc2e5 | ||
|
|
ebe1f76cd9 | ||
|
|
8830ef3dfe | ||
|
|
d999851da5 | ||
|
|
6d0406c6b9 | ||
|
|
6140f84058 | ||
|
|
a8f3b9c811 | ||
|
|
8f098671a0 | ||
|
|
4cf99e8927 | ||
|
|
5a703a0d3c | ||
|
|
90f35a8f29 | ||
|
|
87e6f50486 | ||
|
|
0667c1b3c3 | ||
|
|
9d82f9b9c9 | ||
|
|
51222372b1 | ||
|
|
d3607a16c1 | ||
|
|
6a427c08b5 | ||
|
|
afd53af87b | ||
|
|
6b4a5bdaf3 | ||
|
|
3e0d7ceec5 | ||
|
|
130491e641 | ||
|
|
1f620d6534 | ||
|
|
b4d4ef8f1f | ||
|
|
bb8f83e832 | ||
|
|
b90932e51d | ||
|
|
b36540e2a1 | ||
|
|
c02414417d | ||
|
|
13f4fe77bb | ||
|
|
401f3f5e95 | ||
|
|
73c3a75234 | ||
|
|
06941bac2e | ||
|
|
6e33ac0288 | ||
|
|
65ce1a62c4 | ||
|
|
5dc74a5548 | ||
|
|
e7edba9e25 | ||
|
|
ce5adbafe5 | ||
|
|
b52431ca51 | ||
|
|
00f04a8886 | ||
|
|
0eb2d1f6a2 | ||
|
|
26ef5d3ad9 | ||
|
|
b90c2e740d | ||
|
|
e39baf38ed | ||
|
|
b9471d7fcb | ||
|
|
a350050e6e | ||
|
|
01574a9f01 | ||
|
|
cdb7aef82e | ||
|
|
a0a8c9b2f7 | ||
|
|
0b2648bfe0 | ||
|
|
69ce39ab39 | ||
|
|
83e22892ba | ||
|
|
7434fc9ed3 | ||
|
|
7260bff7e9 | ||
|
|
dd1fd596f8 | ||
|
|
b9089d55d2 | ||
|
|
6ab147bffe | ||
|
|
a308b9a7e0 | ||
|
|
96f49a00e4 | ||
|
|
b8f8f4dbc0 | ||
|
|
a4ce3bfaf1 | ||
|
|
3bb8c361e9 | ||
|
|
89e67fae31 | ||
|
|
50cef7d424 | ||
|
|
20801883d5 | ||
|
|
56d70b03d2 | ||
|
|
47de4d1163 | ||
|
|
2978329d03 | ||
|
|
4471c836d9 | ||
|
|
d16484bf72 | ||
|
|
436e9ce2c8 | ||
|
|
4a6341bcc0 | ||
|
|
90e60a74b5 | ||
|
|
f65ffd13f7 | ||
|
|
a3e5e7e141 | ||
|
|
668d6580d0 | ||
|
|
eacc828b75 | ||
|
|
4ba900f500 | ||
|
|
35c0bfa513 | ||
|
|
beb50fc788 | ||
|
|
fc135eacef | ||
|
|
84c6255567 | ||
|
|
224a0b8a67 | ||
|
|
c3976f1ca3 | ||
|
|
dd3a869c08 | ||
|
|
7e966090ab | ||
|
|
7a4c465f7d | ||
|
|
0ced97e3eb | ||
|
|
2bdd638cef | ||
|
|
93fc536926 | ||
|
|
1f15a953e3 | ||
|
|
0d7f628f3c | ||
|
|
7348a10f1b | ||
|
|
c9d2c4c6bc | ||
|
|
0c5539be3a | ||
|
|
1cf4d37e56 | ||
|
|
2fc376abae | ||
|
|
9c660578ad | ||
|
|
ba84cd7c39 | ||
|
|
2085a2c432 | ||
|
|
4126dedd19 | ||
|
|
7892aac4de | ||
|
|
7dcff01910 | ||
|
|
dc8f194e6e |
12
.coveragerc
Normal file
12
.coveragerc
Normal file
@@ -0,0 +1,12 @@
|
||||
[run]
|
||||
branch = True
|
||||
include = */pyModeS/*
|
||||
omit = *tests*
|
||||
|
||||
[report]
|
||||
exclude_lines =
|
||||
coverage: ignore
|
||||
raise NotImplementedError
|
||||
if TYPE_CHECKING:
|
||||
|
||||
ignore_errors = True
|
||||
11
.github/dependabot.yml
vendored
Normal file
11
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "pip"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "monthly"
|
||||
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "monthly"
|
||||
67
.github/workflows/pypi-publish.yml
vendored
Normal file
67
.github/workflows/pypi-publish.yml
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
# This workflows will upload a Python Package using Twine when a release is created
|
||||
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
|
||||
|
||||
name: publish
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
POETRY_VERSION: "1.3.1"
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
python-version: ["3.8", "3.9", "3.10", "3.11"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Add poetry to windows path
|
||||
if: "startsWith(runner.os, 'windows')"
|
||||
run: |
|
||||
echo "C:\Users\runneradmin\.local\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
||||
|
||||
- name: Install and configure Poetry
|
||||
uses: snok/install-poetry@v1.3.3
|
||||
with:
|
||||
version: ${{ env.POETRY_VERSION }}
|
||||
virtualenvs-create: true
|
||||
virtualenvs-in-project: true
|
||||
|
||||
- name: Display Python version
|
||||
run: poetry run python -c "import sys; print(sys.version)"
|
||||
|
||||
- name: Build packages
|
||||
run: poetry build
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
poetry run pip install --upgrade pip
|
||||
poetry run pip install twine
|
||||
|
||||
- name: Build and publish
|
||||
env:
|
||||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
|
||||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
|
||||
run: |
|
||||
poetry run twine upload dist/*.whl
|
||||
|
||||
- name: Build and publish (source)
|
||||
if: ${{ startsWith(runner.os, 'ubuntu') && env.PYTHON_VERSION == '3.11' }}
|
||||
env:
|
||||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
|
||||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
|
||||
run: |
|
||||
poetry run twine upload dist/*.tar.gz
|
||||
71
.github/workflows/run-tests.yml
vendored
Normal file
71
.github/workflows/run-tests.yml
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
name: tests
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request_target:
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
POETRY_VERSION: "1.3.1"
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
python-version: ["3.8", "3.9", "3.10", "3.11"]
|
||||
|
||||
env:
|
||||
PYTHON_VERSION: ${{ matrix.python-version }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
# virtualenv cache should depends on OS, Python version and `poetry.lock` (and optionally workflow files).
|
||||
- name: Cache Packages
|
||||
uses: actions/cache@v3
|
||||
if: ${{ !startsWith(runner.os, 'windows') }}
|
||||
with:
|
||||
path: |
|
||||
~/.local
|
||||
.venv
|
||||
key: poetry-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('**/poetry.lock') }}
|
||||
|
||||
- name: Add poetry to windows path
|
||||
if: "startsWith(runner.os, 'windows')"
|
||||
run: |
|
||||
echo "C:\Users\runneradmin\.local\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
||||
|
||||
- name: Install and configure Poetry
|
||||
uses: snok/install-poetry@v1.3.3
|
||||
with:
|
||||
version: ${{ env.POETRY_VERSION }}
|
||||
virtualenvs-create: true
|
||||
virtualenvs-in-project: true
|
||||
|
||||
- name: Display Python version
|
||||
run: poetry run python -c "import sys; print(sys.version)"
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
poetry install
|
||||
|
||||
- name: Type checking
|
||||
run: |
|
||||
poetry run mypy pyModeS
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
poetry run pytest tests --cov --cov-report term-missing
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
if: ${{ github.event_name != 'pull_request_target' }}
|
||||
uses: codecov/codecov-action@v3
|
||||
with:
|
||||
env_vars: PYTHON_VERSION
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -5,9 +5,6 @@ __pycache__/
|
||||
*.py[cod]
|
||||
.pytest_cache/
|
||||
|
||||
#cython
|
||||
*.c
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
|
||||
6
Makefile
6
Makefile
@@ -8,6 +8,12 @@ ext:
|
||||
python setup.py build_ext --inplace
|
||||
|
||||
test:
|
||||
make clean
|
||||
@echo ""
|
||||
@echo "[Test with py_common]"
|
||||
python -m pytest tests
|
||||
@echo ""
|
||||
@echo "[Test with c_common]"
|
||||
python setup.py build_ext --inplace
|
||||
python -m pytest tests
|
||||
|
||||
|
||||
44
README.rst
44
README.rst
@@ -1,7 +1,7 @@
|
||||
The Python ADS-B/Mode-S Decoder
|
||||
===============================
|
||||
|
||||
PyModeS is a Python library designed to decode Mode-S (including ADS-B) message. It can be imported to your python project or used as a standalone tool to view and save live traffic data.
|
||||
PyModeS is a Python library designed to decode Mode-S (including ADS-B) messages. It can be imported to your python project or used as a standalone tool to view and save live traffic data.
|
||||
|
||||
This is a project created by Junzi Sun, who works at `TU Delft <https://www.tudelft.nl/en/>`_, `Aerospace Engineering Faculty <https://www.tudelft.nl/en/ae/>`_, `CNS/ATM research group <http://cs.lr.tudelft.nl/atm/>`_. It is supported by many `contributors <https://github.com/junzis/pyModeS/graphs/contributors>`_ from different institutions.
|
||||
|
||||
@@ -72,21 +72,35 @@ Installation examples::
|
||||
# stable version
|
||||
pip install pyModeS
|
||||
|
||||
# conda (compiled) version
|
||||
conda install -c conda-forge pymodes
|
||||
|
||||
# development version
|
||||
pip install git+https://github.com/junzis/pyModeS
|
||||
|
||||
|
||||
Dependencies ``numpy``, ``pyzmq`` and ``pyrtlsdr`` are installed automatically during previous installations processes.
|
||||
Dependencies ``numpy``, and ``pyzmq`` are installed automatically during previous installations processes.
|
||||
|
||||
If you need to connect pyModeS to a RTL-SDR receiver, ``pyrtlsdr`` need to be installed manually::
|
||||
|
||||
pip install pyrtlsdr
|
||||
|
||||
|
||||
Advanced installation (using c modules)
|
||||
------------------------------------------
|
||||
|
||||
If you want to make use of the (faster) c module, install ``pyModeS`` as follows::
|
||||
|
||||
# conda (compiled) version
|
||||
conda install -c conda-forge pymodes
|
||||
|
||||
# stable version
|
||||
pip install pyModeS
|
||||
|
||||
# development version
|
||||
git clone https://github.com/junzis/pyModeS
|
||||
cd pyModeS
|
||||
make ext
|
||||
make install
|
||||
poetry install -E rtlsdr
|
||||
|
||||
|
||||
View live traffic (modeslive)
|
||||
@@ -112,7 +126,7 @@ General usage::
|
||||
Live with RTL-SDR
|
||||
*******************
|
||||
|
||||
If you have an RTL-SDR receiver plugged to the computer, you can connect it with ``rtlsdr`` source switch, shown as follows::
|
||||
If you have an RTL-SDR receiver connected to your computer, you can use the ``rtlsdr`` source switch (require ``pyrtlsdr`` package), with command::
|
||||
|
||||
$ modeslive --source rtlsdr
|
||||
|
||||
@@ -261,8 +275,20 @@ Mode-S Enhanced Surveillance (EHS)
|
||||
pms.commb.vr60ins(msg) # Inertial vertical speed (ft/min)
|
||||
|
||||
|
||||
Meteorological routine air report (MRAR) [Experimental]
|
||||
********************************************************
|
||||
Meteorological reports [Experimental]
|
||||
**************************************
|
||||
|
||||
To identify BDS 4,4 and 4,5 codes, you must set ``mrar`` argument to ``True`` in the ``infer()`` function:
|
||||
|
||||
.. code:: python
|
||||
|
||||
pms.bds.infer(msg. mrar=True)
|
||||
|
||||
Once the correct MRAR and MHR messages are identified, decode them as follows:
|
||||
|
||||
|
||||
Meteorological routine air report (MRAR)
|
||||
+++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
.. code:: python
|
||||
|
||||
@@ -273,8 +299,8 @@ Meteorological routine air report (MRAR) [Experimental]
|
||||
pms.commb.hum44(msg) # Humidity (%)
|
||||
|
||||
|
||||
Meteorological hazard air report (MHR) [Experimental]
|
||||
*******************************************************
|
||||
Meteorological hazard air report (MHR)
|
||||
+++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
.. code:: python
|
||||
|
||||
|
||||
77
build.py
Normal file
77
build.py
Normal file
@@ -0,0 +1,77 @@
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
from distutils.core import Distribution, Extension
|
||||
from distutils.command import build_ext
|
||||
|
||||
from Cython.Build import cythonize
|
||||
|
||||
|
||||
def build() -> None:
|
||||
compile_args = []
|
||||
|
||||
if sys.platform == "linux":
|
||||
compile_args += [
|
||||
"-march=native",
|
||||
"-O3",
|
||||
"-msse",
|
||||
"-msse2",
|
||||
"-mfma",
|
||||
"-mfpmath=sse",
|
||||
"-Wno-pointer-sign",
|
||||
"-Wno-unused-variable",
|
||||
]
|
||||
|
||||
extensions = [
|
||||
Extension(
|
||||
"pyModeS.c_common",
|
||||
["pyModeS/c_common.pyx"],
|
||||
extra_compile_args=compile_args,
|
||||
),
|
||||
Extension(
|
||||
"pyModeS.decoder.flarm.decode",
|
||||
[
|
||||
"pyModeS/decoder/flarm/decode.pyx",
|
||||
"pyModeS/decoder/flarm/core.c",
|
||||
],
|
||||
extra_compile_args=compile_args,
|
||||
include_dirs=["pyModeS/decoder/flarm"],
|
||||
),
|
||||
# Extension(
|
||||
# "pyModeS.extra.demod2400.core",
|
||||
# [
|
||||
# "pyModeS/extra/demod2400/core.pyx",
|
||||
# "pyModeS/extra/demod2400/demod2400.c",
|
||||
# ],
|
||||
# extra_compile_args=compile_args,
|
||||
# include_dirs=["pyModeS/extra/demod2400"],
|
||||
# libraries=["m"],
|
||||
# ),
|
||||
]
|
||||
|
||||
ext_modules = cythonize(
|
||||
extensions,
|
||||
compiler_directives={"binding": True, "language_level": 3},
|
||||
)
|
||||
|
||||
distribution = Distribution(
|
||||
{"name": "extended", "ext_modules": ext_modules}
|
||||
)
|
||||
distribution.package_dir = "extended" # type: ignore
|
||||
|
||||
cmd = build_ext.build_ext(distribution)
|
||||
cmd.verbose = True # type: ignore
|
||||
cmd.ensure_finalized() # type: ignore
|
||||
cmd.run()
|
||||
|
||||
# Copy built extensions back to the project
|
||||
for output in cmd.get_outputs():
|
||||
relative_extension = os.path.relpath(output, cmd.build_lib)
|
||||
shutil.copyfile(output, relative_extension)
|
||||
mode = os.stat(relative_extension).st_mode
|
||||
mode |= (mode & 0o444) >> 2
|
||||
os.chmod(relative_extension, mode)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
build()
|
||||
775
poetry.lock
generated
Normal file
775
poetry.lock
generated
Normal file
@@ -0,0 +1,775 @@
|
||||
# This file is automatically @generated by Poetry and should not be changed by hand.
|
||||
|
||||
[[package]]
|
||||
name = "attrs"
|
||||
version = "22.2.0"
|
||||
description = "Classes Without Boilerplate"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.6"
|
||||
files = [
|
||||
{file = "attrs-22.2.0-py3-none-any.whl", hash = "sha256:29e95c7f6778868dbd49170f98f8818f78f3dc5e0e37c0b1f474e3561b240836"},
|
||||
{file = "attrs-22.2.0.tar.gz", hash = "sha256:c9227bfc2f01993c03f68db37d1d15c9690188323c067c641f1a35ca58185f99"},
|
||||
]
|
||||
|
||||
[package.extras]
|
||||
cov = ["attrs[tests]", "coverage-enable-subprocess", "coverage[toml] (>=5.3)"]
|
||||
dev = ["attrs[docs,tests]"]
|
||||
docs = ["furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib-towncrier", "towncrier", "zope.interface"]
|
||||
tests = ["attrs[tests-no-zope]", "zope.interface"]
|
||||
tests-no-zope = ["cloudpickle", "cloudpickle", "hypothesis", "hypothesis", "mypy (>=0.971,<0.990)", "mypy (>=0.971,<0.990)", "pympler", "pympler", "pytest (>=4.3.0)", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-mypy-plugins", "pytest-xdist[psutil]", "pytest-xdist[psutil]"]
|
||||
|
||||
[[package]]
|
||||
name = "black"
|
||||
version = "22.12.0"
|
||||
description = "The uncompromising code formatter."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "black-22.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9eedd20838bd5d75b80c9f5487dbcb06836a43833a37846cf1d8c1cc01cef59d"},
|
||||
{file = "black-22.12.0-cp310-cp310-win_amd64.whl", hash = "sha256:159a46a4947f73387b4d83e87ea006dbb2337eab6c879620a3ba52699b1f4351"},
|
||||
{file = "black-22.12.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d30b212bffeb1e252b31dd269dfae69dd17e06d92b87ad26e23890f3efea366f"},
|
||||
{file = "black-22.12.0-cp311-cp311-win_amd64.whl", hash = "sha256:7412e75863aa5c5411886804678b7d083c7c28421210180d67dfd8cf1221e1f4"},
|
||||
{file = "black-22.12.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c116eed0efb9ff870ded8b62fe9f28dd61ef6e9ddd28d83d7d264a38417dcee2"},
|
||||
{file = "black-22.12.0-cp37-cp37m-win_amd64.whl", hash = "sha256:1f58cbe16dfe8c12b7434e50ff889fa479072096d79f0a7f25e4ab8e94cd8350"},
|
||||
{file = "black-22.12.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:77d86c9f3db9b1bf6761244bc0b3572a546f5fe37917a044e02f3166d5aafa7d"},
|
||||
{file = "black-22.12.0-cp38-cp38-win_amd64.whl", hash = "sha256:82d9fe8fee3401e02e79767016b4907820a7dc28d70d137eb397b92ef3cc5bfc"},
|
||||
{file = "black-22.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:101c69b23df9b44247bd88e1d7e90154336ac4992502d4197bdac35dd7ee3320"},
|
||||
{file = "black-22.12.0-cp39-cp39-win_amd64.whl", hash = "sha256:559c7a1ba9a006226f09e4916060982fd27334ae1998e7a38b3f33a37f7a2148"},
|
||||
{file = "black-22.12.0-py3-none-any.whl", hash = "sha256:436cc9167dd28040ad90d3b404aec22cedf24a6e4d7de221bec2730ec0c97bcf"},
|
||||
{file = "black-22.12.0.tar.gz", hash = "sha256:229351e5a18ca30f447bf724d007f890f97e13af070bb6ad4c0a441cd7596a2f"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
click = ">=8.0.0"
|
||||
mypy-extensions = ">=0.4.3"
|
||||
pathspec = ">=0.9.0"
|
||||
platformdirs = ">=2"
|
||||
tomli = {version = ">=1.1.0", markers = "python_full_version < \"3.11.0a7\""}
|
||||
typing-extensions = {version = ">=3.10.0.0", markers = "python_version < \"3.10\""}
|
||||
|
||||
[package.extras]
|
||||
colorama = ["colorama (>=0.4.3)"]
|
||||
d = ["aiohttp (>=3.7.4)"]
|
||||
jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"]
|
||||
uvloop = ["uvloop (>=0.15.2)"]
|
||||
|
||||
[[package]]
|
||||
name = "certifi"
|
||||
version = "2022.12.7"
|
||||
description = "Python package for providing Mozilla's CA Bundle."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.6"
|
||||
files = [
|
||||
{file = "certifi-2022.12.7-py3-none-any.whl", hash = "sha256:4ad3232f5e926d6718ec31cfc1fcadfde020920e278684144551c91769c7bc18"},
|
||||
{file = "certifi-2022.12.7.tar.gz", hash = "sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cffi"
|
||||
version = "1.15.1"
|
||||
description = "Foreign Function Interface for Python calling C code."
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
files = [
|
||||
{file = "cffi-1.15.1-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:a66d3508133af6e8548451b25058d5812812ec3798c886bf38ed24a98216fab2"},
|
||||
{file = "cffi-1.15.1-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:470c103ae716238bbe698d67ad020e1db9d9dba34fa5a899b5e21577e6d52ed2"},
|
||||
{file = "cffi-1.15.1-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:9ad5db27f9cabae298d151c85cf2bad1d359a1b9c686a275df03385758e2f914"},
|
||||
{file = "cffi-1.15.1-cp27-cp27m-win32.whl", hash = "sha256:b3bbeb01c2b273cca1e1e0c5df57f12dce9a4dd331b4fa1635b8bec26350bde3"},
|
||||
{file = "cffi-1.15.1-cp27-cp27m-win_amd64.whl", hash = "sha256:e00b098126fd45523dd056d2efba6c5a63b71ffe9f2bbe1a4fe1716e1d0c331e"},
|
||||
{file = "cffi-1.15.1-cp27-cp27mu-manylinux1_i686.whl", hash = "sha256:d61f4695e6c866a23a21acab0509af1cdfd2c013cf256bbf5b6b5e2695827162"},
|
||||
{file = "cffi-1.15.1-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:ed9cb427ba5504c1dc15ede7d516b84757c3e3d7868ccc85121d9310d27eed0b"},
|
||||
{file = "cffi-1.15.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:39d39875251ca8f612b6f33e6b1195af86d1b3e60086068be9cc053aa4376e21"},
|
||||
{file = "cffi-1.15.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:285d29981935eb726a4399badae8f0ffdff4f5050eaa6d0cfc3f64b857b77185"},
|
||||
{file = "cffi-1.15.1-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3eb6971dcff08619f8d91607cfc726518b6fa2a9eba42856be181c6d0d9515fd"},
|
||||
{file = "cffi-1.15.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:21157295583fe8943475029ed5abdcf71eb3911894724e360acff1d61c1d54bc"},
|
||||
{file = "cffi-1.15.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:5635bd9cb9731e6d4a1132a498dd34f764034a8ce60cef4f5319c0541159392f"},
|
||||
{file = "cffi-1.15.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2012c72d854c2d03e45d06ae57f40d78e5770d252f195b93f581acf3ba44496e"},
|
||||
{file = "cffi-1.15.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dd86c085fae2efd48ac91dd7ccffcfc0571387fe1193d33b6394db7ef31fe2a4"},
|
||||
{file = "cffi-1.15.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:fa6693661a4c91757f4412306191b6dc88c1703f780c8234035eac011922bc01"},
|
||||
{file = "cffi-1.15.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:59c0b02d0a6c384d453fece7566d1c7e6b7bae4fc5874ef2ef46d56776d61c9e"},
|
||||
{file = "cffi-1.15.1-cp310-cp310-win32.whl", hash = "sha256:cba9d6b9a7d64d4bd46167096fc9d2f835e25d7e4c121fb2ddfc6528fb0413b2"},
|
||||
{file = "cffi-1.15.1-cp310-cp310-win_amd64.whl", hash = "sha256:ce4bcc037df4fc5e3d184794f27bdaab018943698f4ca31630bc7f84a7b69c6d"},
|
||||
{file = "cffi-1.15.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:3d08afd128ddaa624a48cf2b859afef385b720bb4b43df214f85616922e6a5ac"},
|
||||
{file = "cffi-1.15.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:3799aecf2e17cf585d977b780ce79ff0dc9b78d799fc694221ce814c2c19db83"},
|
||||
{file = "cffi-1.15.1-cp311-cp311-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a591fe9e525846e4d154205572a029f653ada1a78b93697f3b5a8f1f2bc055b9"},
|
||||
{file = "cffi-1.15.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3548db281cd7d2561c9ad9984681c95f7b0e38881201e157833a2342c30d5e8c"},
|
||||
{file = "cffi-1.15.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:91fc98adde3d7881af9b59ed0294046f3806221863722ba7d8d120c575314325"},
|
||||
{file = "cffi-1.15.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:94411f22c3985acaec6f83c6df553f2dbe17b698cc7f8ae751ff2237d96b9e3c"},
|
||||
{file = "cffi-1.15.1-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:03425bdae262c76aad70202debd780501fabeaca237cdfddc008987c0e0f59ef"},
|
||||
{file = "cffi-1.15.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:cc4d65aeeaa04136a12677d3dd0b1c0c94dc43abac5860ab33cceb42b801c1e8"},
|
||||
{file = "cffi-1.15.1-cp311-cp311-win32.whl", hash = "sha256:a0f100c8912c114ff53e1202d0078b425bee3649ae34d7b070e9697f93c5d52d"},
|
||||
{file = "cffi-1.15.1-cp311-cp311-win_amd64.whl", hash = "sha256:04ed324bda3cda42b9b695d51bb7d54b680b9719cfab04227cdd1e04e5de3104"},
|
||||
{file = "cffi-1.15.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:50a74364d85fd319352182ef59c5c790484a336f6db772c1a9231f1c3ed0cbd7"},
|
||||
{file = "cffi-1.15.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e263d77ee3dd201c3a142934a086a4450861778baaeeb45db4591ef65550b0a6"},
|
||||
{file = "cffi-1.15.1-cp36-cp36m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:cec7d9412a9102bdc577382c3929b337320c4c4c4849f2c5cdd14d7368c5562d"},
|
||||
{file = "cffi-1.15.1-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4289fc34b2f5316fbb762d75362931e351941fa95fa18789191b33fc4cf9504a"},
|
||||
{file = "cffi-1.15.1-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:173379135477dc8cac4bc58f45db08ab45d228b3363adb7af79436135d028405"},
|
||||
{file = "cffi-1.15.1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:6975a3fac6bc83c4a65c9f9fcab9e47019a11d3d2cf7f3c0d03431bf145a941e"},
|
||||
{file = "cffi-1.15.1-cp36-cp36m-win32.whl", hash = "sha256:2470043b93ff09bf8fb1d46d1cb756ce6132c54826661a32d4e4d132e1977adf"},
|
||||
{file = "cffi-1.15.1-cp36-cp36m-win_amd64.whl", hash = "sha256:30d78fbc8ebf9c92c9b7823ee18eb92f2e6ef79b45ac84db507f52fbe3ec4497"},
|
||||
{file = "cffi-1.15.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:198caafb44239b60e252492445da556afafc7d1e3ab7a1fb3f0584ef6d742375"},
|
||||
{file = "cffi-1.15.1-cp37-cp37m-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:5ef34d190326c3b1f822a5b7a45f6c4535e2f47ed06fec77d3d799c450b2651e"},
|
||||
{file = "cffi-1.15.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8102eaf27e1e448db915d08afa8b41d6c7ca7a04b7d73af6514df10a3e74bd82"},
|
||||
{file = "cffi-1.15.1-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:5df2768244d19ab7f60546d0c7c63ce1581f7af8b5de3eb3004b9b6fc8a9f84b"},
|
||||
{file = "cffi-1.15.1-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a8c4917bd7ad33e8eb21e9a5bbba979b49d9a97acb3a803092cbc1133e20343c"},
|
||||
{file = "cffi-1.15.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0e2642fe3142e4cc4af0799748233ad6da94c62a8bec3a6648bf8ee68b1c7426"},
|
||||
{file = "cffi-1.15.1-cp37-cp37m-win32.whl", hash = "sha256:e229a521186c75c8ad9490854fd8bbdd9a0c9aa3a524326b55be83b54d4e0ad9"},
|
||||
{file = "cffi-1.15.1-cp37-cp37m-win_amd64.whl", hash = "sha256:a0b71b1b8fbf2b96e41c4d990244165e2c9be83d54962a9a1d118fd8657d2045"},
|
||||
{file = "cffi-1.15.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:320dab6e7cb2eacdf0e658569d2575c4dad258c0fcc794f46215e1e39f90f2c3"},
|
||||
{file = "cffi-1.15.1-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1e74c6b51a9ed6589199c787bf5f9875612ca4a8a0785fb2d4a84429badaf22a"},
|
||||
{file = "cffi-1.15.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a5c84c68147988265e60416b57fc83425a78058853509c1b0629c180094904a5"},
|
||||
{file = "cffi-1.15.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3b926aa83d1edb5aa5b427b4053dc420ec295a08e40911296b9eb1b6170f6cca"},
|
||||
{file = "cffi-1.15.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:87c450779d0914f2861b8526e035c5e6da0a3199d8f1add1a665e1cbc6fc6d02"},
|
||||
{file = "cffi-1.15.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4f2c9f67e9821cad2e5f480bc8d83b8742896f1242dba247911072d4fa94c192"},
|
||||
{file = "cffi-1.15.1-cp38-cp38-win32.whl", hash = "sha256:8b7ee99e510d7b66cdb6c593f21c043c248537a32e0bedf02e01e9553a172314"},
|
||||
{file = "cffi-1.15.1-cp38-cp38-win_amd64.whl", hash = "sha256:00a9ed42e88df81ffae7a8ab6d9356b371399b91dbdf0c3cb1e84c03a13aceb5"},
|
||||
{file = "cffi-1.15.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:54a2db7b78338edd780e7ef7f9f6c442500fb0d41a5a4ea24fff1c929d5af585"},
|
||||
{file = "cffi-1.15.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:fcd131dd944808b5bdb38e6f5b53013c5aa4f334c5cad0c72742f6eba4b73db0"},
|
||||
{file = "cffi-1.15.1-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7473e861101c9e72452f9bf8acb984947aa1661a7704553a9f6e4baa5ba64415"},
|
||||
{file = "cffi-1.15.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6c9a799e985904922a4d207a94eae35c78ebae90e128f0c4e521ce339396be9d"},
|
||||
{file = "cffi-1.15.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3bcde07039e586f91b45c88f8583ea7cf7a0770df3a1649627bf598332cb6984"},
|
||||
{file = "cffi-1.15.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:33ab79603146aace82c2427da5ca6e58f2b3f2fb5da893ceac0c42218a40be35"},
|
||||
{file = "cffi-1.15.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5d598b938678ebf3c67377cdd45e09d431369c3b1a5b331058c338e201f12b27"},
|
||||
{file = "cffi-1.15.1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:db0fbb9c62743ce59a9ff687eb5f4afbe77e5e8403d6697f7446e5f609976f76"},
|
||||
{file = "cffi-1.15.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:98d85c6a2bef81588d9227dde12db8a7f47f639f4a17c9ae08e773aa9c697bf3"},
|
||||
{file = "cffi-1.15.1-cp39-cp39-win32.whl", hash = "sha256:40f4774f5a9d4f5e344f31a32b5096977b5d48560c5592e2f3d2c4374bd543ee"},
|
||||
{file = "cffi-1.15.1-cp39-cp39-win_amd64.whl", hash = "sha256:70df4e3b545a17496c9b3f41f5115e69a4f2e77e94e1d2a8e1070bc0c38c8a3c"},
|
||||
{file = "cffi-1.15.1.tar.gz", hash = "sha256:d400bfb9a37b1351253cb402671cea7e89bdecc294e8016a707f6d1d8ac934f9"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
pycparser = "*"
|
||||
|
||||
[[package]]
|
||||
name = "charset-normalizer"
|
||||
version = "2.1.1"
|
||||
description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.6.0"
|
||||
files = [
|
||||
{file = "charset-normalizer-2.1.1.tar.gz", hash = "sha256:5a3d016c7c547f69d6f81fb0db9449ce888b418b5b9952cc5e6e66843e9dd845"},
|
||||
{file = "charset_normalizer-2.1.1-py3-none-any.whl", hash = "sha256:83e9a75d1911279afd89352c68b45348559d1fc0506b054b346651b5e7fee29f"},
|
||||
]
|
||||
|
||||
[package.extras]
|
||||
unicode-backport = ["unicodedata2"]
|
||||
|
||||
[[package]]
|
||||
name = "click"
|
||||
version = "8.1.3"
|
||||
description = "Composable command line interface toolkit"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "click-8.1.3-py3-none-any.whl", hash = "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"},
|
||||
{file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
colorama = {version = "*", markers = "platform_system == \"Windows\""}
|
||||
|
||||
[[package]]
|
||||
name = "codecov"
|
||||
version = "2.1.12"
|
||||
description = "Hosted coverage reports for GitHub, Bitbucket and Gitlab"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
files = [
|
||||
{file = "codecov-2.1.12-py2.py3-none-any.whl", hash = "sha256:585dc217dc3d8185198ceb402f85d5cb5dbfa0c5f350a5abcdf9e347776a5b47"},
|
||||
{file = "codecov-2.1.12.tar.gz", hash = "sha256:a0da46bb5025426da895af90938def8ee12d37fcbcbbbc15b6dc64cf7ebc51c1"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
coverage = "*"
|
||||
requests = ">=2.7.9"
|
||||
|
||||
[[package]]
|
||||
name = "colorama"
|
||||
version = "0.4.6"
|
||||
description = "Cross-platform colored terminal text."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
|
||||
files = [
|
||||
{file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"},
|
||||
{file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "coverage"
|
||||
version = "7.0.1"
|
||||
description = "Code coverage measurement for Python"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "coverage-7.0.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:b3695c4f4750bca943b3e1f74ad4be8d29e4aeab927d50772c41359107bd5d5c"},
|
||||
{file = "coverage-7.0.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:fa6a5a224b7f4cfb226f4fc55a57e8537fcc096f42219128c2c74c0e7d0953e1"},
|
||||
{file = "coverage-7.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:74f70cd92669394eaf8d7756d1b195c8032cf7bbbdfce3bc489d4e15b3b8cf73"},
|
||||
{file = "coverage-7.0.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b66bb21a23680dee0be66557dc6b02a3152ddb55edf9f6723fa4a93368f7158d"},
|
||||
{file = "coverage-7.0.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d87717959d4d0ee9db08a0f1d80d21eb585aafe30f9b0a54ecf779a69cb015f6"},
|
||||
{file = "coverage-7.0.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:854f22fa361d1ff914c7efa347398374cc7d567bdafa48ac3aa22334650dfba2"},
|
||||
{file = "coverage-7.0.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:1e414dc32ee5c3f36544ea466b6f52f28a7af788653744b8570d0bf12ff34bc0"},
|
||||
{file = "coverage-7.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:6c5ad996c6fa4d8ed669cfa1e8551348729d008a2caf81489ab9ea67cfbc7498"},
|
||||
{file = "coverage-7.0.1-cp310-cp310-win32.whl", hash = "sha256:691571f31ace1837838b7e421d3a09a8c00b4aac32efacb4fc9bd0a5c647d25a"},
|
||||
{file = "coverage-7.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:89caf4425fe88889e2973a8e9a3f6f5f9bbe5dd411d7d521e86428c08a873a4a"},
|
||||
{file = "coverage-7.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:63d56165a7c76265468d7e0c5548215a5ba515fc2cba5232d17df97bffa10f6c"},
|
||||
{file = "coverage-7.0.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:4f943a3b2bc520102dd3e0bb465e1286e12c9a54f58accd71b9e65324d9c7c01"},
|
||||
{file = "coverage-7.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:830525361249dc4cd013652b0efad645a385707a5ae49350c894b67d23fbb07c"},
|
||||
{file = "coverage-7.0.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:fd1b9c5adc066db699ccf7fa839189a649afcdd9e02cb5dc9d24e67e7922737d"},
|
||||
{file = "coverage-7.0.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e00c14720b8b3b6c23b487e70bd406abafc976ddc50490f645166f111c419c39"},
|
||||
{file = "coverage-7.0.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:6d55d840e1b8c0002fce66443e124e8581f30f9ead2e54fbf6709fb593181f2c"},
|
||||
{file = "coverage-7.0.1-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:66b18c3cf8bbab0cce0d7b9e4262dc830e93588986865a8c78ab2ae324b3ed56"},
|
||||
{file = "coverage-7.0.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:12a5aa77783d49e05439fbe6e6b427484f8a0f9f456b46a51d8aac022cfd024d"},
|
||||
{file = "coverage-7.0.1-cp311-cp311-win32.whl", hash = "sha256:b77015d1cb8fe941be1222a5a8b4e3fbca88180cfa7e2d4a4e58aeabadef0ab7"},
|
||||
{file = "coverage-7.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:fb992c47cb1e5bd6a01e97182400bcc2ba2077080a17fcd7be23aaa6e572e390"},
|
||||
{file = "coverage-7.0.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:e78e9dcbf4f3853d3ae18a8f9272111242531535ec9e1009fa8ec4a2b74557dc"},
|
||||
{file = "coverage-7.0.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e60bef2e2416f15fdc05772bf87db06c6a6f9870d1db08fdd019fbec98ae24a9"},
|
||||
{file = "coverage-7.0.1-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9823e4789ab70f3ec88724bba1a203f2856331986cd893dedbe3e23a6cfc1e4e"},
|
||||
{file = "coverage-7.0.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9158f8fb06747ac17bd237930c4372336edc85b6e13bdc778e60f9d685c3ca37"},
|
||||
{file = "coverage-7.0.1-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:486ee81fa694b4b796fc5617e376326a088f7b9729c74d9defa211813f3861e4"},
|
||||
{file = "coverage-7.0.1-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:1285648428a6101b5f41a18991c84f1c3959cee359e51b8375c5882fc364a13f"},
|
||||
{file = "coverage-7.0.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:2c44fcfb3781b41409d0f060a4ed748537557de9362a8a9282182fafb7a76ab4"},
|
||||
{file = "coverage-7.0.1-cp37-cp37m-win32.whl", hash = "sha256:d6814854c02cbcd9c873c0f3286a02e3ac1250625cca822ca6bc1018c5b19f1c"},
|
||||
{file = "coverage-7.0.1-cp37-cp37m-win_amd64.whl", hash = "sha256:f66460f17c9319ea4f91c165d46840314f0a7c004720b20be58594d162a441d8"},
|
||||
{file = "coverage-7.0.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:9b373c9345c584bb4b5f5b8840df7f4ab48c4cbb7934b58d52c57020d911b856"},
|
||||
{file = "coverage-7.0.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:d3022c3007d3267a880b5adcf18c2a9bf1fc64469b394a804886b401959b8742"},
|
||||
{file = "coverage-7.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:92651580bd46519067e36493acb394ea0607b55b45bd81dd4e26379ed1871f55"},
|
||||
{file = "coverage-7.0.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3cfc595d2af13856505631be072835c59f1acf30028d1c860b435c5fc9c15b69"},
|
||||
{file = "coverage-7.0.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0b4b3a4d9915b2be879aff6299c0a6129f3d08a775d5a061f503cf79571f73e4"},
|
||||
{file = "coverage-7.0.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:b6f22bb64cc39bcb883e5910f99a27b200fdc14cdd79df8696fa96b0005c9444"},
|
||||
{file = "coverage-7.0.1-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:72d1507f152abacea81f65fee38e4ef3ac3c02ff8bc16f21d935fd3a8a4ad910"},
|
||||
{file = "coverage-7.0.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:0a79137fc99815fff6a852c233628e735ec15903cfd16da0f229d9c4d45926ab"},
|
||||
{file = "coverage-7.0.1-cp38-cp38-win32.whl", hash = "sha256:b3763e7fcade2ff6c8e62340af9277f54336920489ceb6a8cd6cc96da52fcc62"},
|
||||
{file = "coverage-7.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:09f6b5a8415b6b3e136d5fec62b552972187265cb705097bf030eb9d4ffb9b60"},
|
||||
{file = "coverage-7.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:978258fec36c154b5e250d356c59af7d4c3ba02bef4b99cda90b6029441d797d"},
|
||||
{file = "coverage-7.0.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:19ec666533f0f70a0993f88b8273057b96c07b9d26457b41863ccd021a043b9a"},
|
||||
{file = "coverage-7.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cfded268092a84605f1cc19e5c737f9ce630a8900a3589e9289622db161967e9"},
|
||||
{file = "coverage-7.0.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:07bcfb1d8ac94af886b54e18a88b393f6a73d5959bb31e46644a02453c36e475"},
|
||||
{file = "coverage-7.0.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:397b4a923cc7566bbc7ae2dfd0ba5a039b61d19c740f1373791f2ebd11caea59"},
|
||||
{file = "coverage-7.0.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:aec2d1515d9d39ff270059fd3afbb3b44e6ec5758af73caf18991807138c7118"},
|
||||
{file = "coverage-7.0.1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:c20cfebcc149a4c212f6491a5f9ff56f41829cd4f607b5be71bb2d530ef243b1"},
|
||||
{file = "coverage-7.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:fd556ff16a57a070ce4f31c635953cc44e25244f91a0378c6e9bdfd40fdb249f"},
|
||||
{file = "coverage-7.0.1-cp39-cp39-win32.whl", hash = "sha256:b9ea158775c7c2d3e54530a92da79496fb3fb577c876eec761c23e028f1e216c"},
|
||||
{file = "coverage-7.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:d1991f1dd95eba69d2cd7708ff6c2bbd2426160ffc73c2b81f617a053ebcb1a8"},
|
||||
{file = "coverage-7.0.1-pp37.pp38.pp39-none-any.whl", hash = "sha256:3dd4ee135e08037f458425b8842d24a95a0961831a33f89685ff86b77d378f89"},
|
||||
{file = "coverage-7.0.1.tar.gz", hash = "sha256:a4a574a19eeb67575a5328a5760bbbb737faa685616586a9f9da4281f940109c"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
tomli = {version = "*", optional = true, markers = "python_full_version <= \"3.11.0a6\" and extra == \"toml\""}
|
||||
|
||||
[package.extras]
|
||||
toml = ["tomli"]
|
||||
|
||||
[[package]]
|
||||
name = "exceptiongroup"
|
||||
version = "1.1.0"
|
||||
description = "Backport of PEP 654 (exception groups)"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "exceptiongroup-1.1.0-py3-none-any.whl", hash = "sha256:327cbda3da756e2de031a3107b81ab7b3770a602c4d16ca618298c526f4bec1e"},
|
||||
{file = "exceptiongroup-1.1.0.tar.gz", hash = "sha256:bcb67d800a4497e1b404c2dd44fca47d3b7a5e5433dbab67f96c1a685cdfdf23"},
|
||||
]
|
||||
|
||||
[package.extras]
|
||||
test = ["pytest (>=6)"]
|
||||
|
||||
[[package]]
|
||||
name = "flake8"
|
||||
version = "5.0.4"
|
||||
description = "the modular source code checker: pep8 pyflakes and co"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.6.1"
|
||||
files = [
|
||||
{file = "flake8-5.0.4-py2.py3-none-any.whl", hash = "sha256:7a1cf6b73744f5806ab95e526f6f0d8c01c66d7bbe349562d22dfca20610b248"},
|
||||
{file = "flake8-5.0.4.tar.gz", hash = "sha256:6fbe320aad8d6b95cec8b8e47bc933004678dc63095be98528b7bdd2a9f510db"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
mccabe = ">=0.7.0,<0.8.0"
|
||||
pycodestyle = ">=2.9.0,<2.10.0"
|
||||
pyflakes = ">=2.5.0,<2.6.0"
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "3.4"
|
||||
description = "Internationalized Domain Names in Applications (IDNA)"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.5"
|
||||
files = [
|
||||
{file = "idna-3.4-py3-none-any.whl", hash = "sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2"},
|
||||
{file = "idna-3.4.tar.gz", hash = "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iniconfig"
|
||||
version = "1.1.1"
|
||||
description = "iniconfig: brain-dead simple config-ini parsing"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
files = [
|
||||
{file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"},
|
||||
{file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "isort"
|
||||
version = "5.11.4"
|
||||
description = "A Python utility / library to sort Python imports."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.7.0"
|
||||
files = [
|
||||
{file = "isort-5.11.4-py3-none-any.whl", hash = "sha256:c033fd0edb91000a7f09527fe5c75321878f98322a77ddcc81adbd83724afb7b"},
|
||||
{file = "isort-5.11.4.tar.gz", hash = "sha256:6db30c5ded9815d813932c04c2f85a360bcdd35fed496f4d8f35495ef0a261b6"},
|
||||
]
|
||||
|
||||
[package.extras]
|
||||
colors = ["colorama (>=0.4.3,<0.5.0)"]
|
||||
pipfile-deprecated-finder = ["pipreqs", "requirementslib"]
|
||||
plugins = ["setuptools"]
|
||||
requirements-deprecated-finder = ["pip-api", "pipreqs"]
|
||||
|
||||
[[package]]
|
||||
name = "mccabe"
|
||||
version = "0.7.0"
|
||||
description = "McCabe checker, plugin for flake8"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.6"
|
||||
files = [
|
||||
{file = "mccabe-0.7.0-py2.py3-none-any.whl", hash = "sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e"},
|
||||
{file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mypy"
|
||||
version = "0.991"
|
||||
description = "Optional static typing for Python"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "mypy-0.991-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:7d17e0a9707d0772f4a7b878f04b4fd11f6f5bcb9b3813975a9b13c9332153ab"},
|
||||
{file = "mypy-0.991-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:0714258640194d75677e86c786e80ccf294972cc76885d3ebbb560f11db0003d"},
|
||||
{file = "mypy-0.991-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:0c8f3be99e8a8bd403caa8c03be619544bc2c77a7093685dcf308c6b109426c6"},
|
||||
{file = "mypy-0.991-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bc9ec663ed6c8f15f4ae9d3c04c989b744436c16d26580eaa760ae9dd5d662eb"},
|
||||
{file = "mypy-0.991-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:4307270436fd7694b41f913eb09210faff27ea4979ecbcd849e57d2da2f65305"},
|
||||
{file = "mypy-0.991-cp310-cp310-win_amd64.whl", hash = "sha256:901c2c269c616e6cb0998b33d4adbb4a6af0ac4ce5cd078afd7bc95830e62c1c"},
|
||||
{file = "mypy-0.991-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:d13674f3fb73805ba0c45eb6c0c3053d218aa1f7abead6e446d474529aafc372"},
|
||||
{file = "mypy-0.991-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:1c8cd4fb70e8584ca1ed5805cbc7c017a3d1a29fb450621089ffed3e99d1857f"},
|
||||
{file = "mypy-0.991-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:209ee89fbb0deed518605edddd234af80506aec932ad28d73c08f1400ef80a33"},
|
||||
{file = "mypy-0.991-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:37bd02ebf9d10e05b00d71302d2c2e6ca333e6c2a8584a98c00e038db8121f05"},
|
||||
{file = "mypy-0.991-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:26efb2fcc6b67e4d5a55561f39176821d2adf88f2745ddc72751b7890f3194ad"},
|
||||
{file = "mypy-0.991-cp311-cp311-win_amd64.whl", hash = "sha256:3a700330b567114b673cf8ee7388e949f843b356a73b5ab22dd7cff4742a5297"},
|
||||
{file = "mypy-0.991-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:1f7d1a520373e2272b10796c3ff721ea1a0712288cafaa95931e66aa15798813"},
|
||||
{file = "mypy-0.991-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:641411733b127c3e0dab94c45af15fea99e4468f99ac88b39efb1ad677da5711"},
|
||||
{file = "mypy-0.991-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:3d80e36b7d7a9259b740be6d8d906221789b0d836201af4234093cae89ced0cd"},
|
||||
{file = "mypy-0.991-cp37-cp37m-win_amd64.whl", hash = "sha256:e62ebaad93be3ad1a828a11e90f0e76f15449371ffeecca4a0a0b9adc99abcef"},
|
||||
{file = "mypy-0.991-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:b86ce2c1866a748c0f6faca5232059f881cda6dda2a893b9a8373353cfe3715a"},
|
||||
{file = "mypy-0.991-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:ac6e503823143464538efda0e8e356d871557ef60ccd38f8824a4257acc18d93"},
|
||||
{file = "mypy-0.991-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:0cca5adf694af539aeaa6ac633a7afe9bbd760df9d31be55ab780b77ab5ae8bf"},
|
||||
{file = "mypy-0.991-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a12c56bf73cdab116df96e4ff39610b92a348cc99a1307e1da3c3768bbb5b135"},
|
||||
{file = "mypy-0.991-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:652b651d42f155033a1967739788c436491b577b6a44e4c39fb340d0ee7f0d70"},
|
||||
{file = "mypy-0.991-cp38-cp38-win_amd64.whl", hash = "sha256:4175593dc25d9da12f7de8de873a33f9b2b8bdb4e827a7cae952e5b1a342e243"},
|
||||
{file = "mypy-0.991-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:98e781cd35c0acf33eb0295e8b9c55cdbef64fcb35f6d3aa2186f289bed6e80d"},
|
||||
{file = "mypy-0.991-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:6d7464bac72a85cb3491c7e92b5b62f3dcccb8af26826257760a552a5e244aa5"},
|
||||
{file = "mypy-0.991-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:c9166b3f81a10cdf9b49f2d594b21b31adadb3d5e9db9b834866c3258b695be3"},
|
||||
{file = "mypy-0.991-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b8472f736a5bfb159a5e36740847808f6f5b659960115ff29c7cecec1741c648"},
|
||||
{file = "mypy-0.991-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:5e80e758243b97b618cdf22004beb09e8a2de1af481382e4d84bc52152d1c476"},
|
||||
{file = "mypy-0.991-cp39-cp39-win_amd64.whl", hash = "sha256:74e259b5c19f70d35fcc1ad3d56499065c601dfe94ff67ae48b85596b9ec1461"},
|
||||
{file = "mypy-0.991-py3-none-any.whl", hash = "sha256:de32edc9b0a7e67c2775e574cb061a537660e51210fbf6006b0b36ea695ae9bb"},
|
||||
{file = "mypy-0.991.tar.gz", hash = "sha256:3c0165ba8f354a6d9881809ef29f1a9318a236a6d81c690094c5df32107bde06"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
mypy-extensions = ">=0.4.3"
|
||||
tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""}
|
||||
typing-extensions = ">=3.10"
|
||||
|
||||
[package.extras]
|
||||
dmypy = ["psutil (>=4.0)"]
|
||||
install-types = ["pip"]
|
||||
python2 = ["typed-ast (>=1.4.0,<2)"]
|
||||
reports = ["lxml"]
|
||||
|
||||
[[package]]
|
||||
name = "mypy-extensions"
|
||||
version = "0.4.3"
|
||||
description = "Experimental type system extensions for programs checked with the mypy typechecker."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
files = [
|
||||
{file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"},
|
||||
{file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "numpy"
|
||||
version = "1.24.1"
|
||||
description = "Fundamental package for array computing in Python"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=3.8"
|
||||
files = [
|
||||
{file = "numpy-1.24.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:179a7ef0889ab769cc03573b6217f54c8bd8e16cef80aad369e1e8185f994cd7"},
|
||||
{file = "numpy-1.24.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:b09804ff570b907da323b3d762e74432fb07955701b17b08ff1b5ebaa8cfe6a9"},
|
||||
{file = "numpy-1.24.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f1b739841821968798947d3afcefd386fa56da0caf97722a5de53e07c4ccedc7"},
|
||||
{file = "numpy-1.24.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0e3463e6ac25313462e04aea3fb8a0a30fb906d5d300f58b3bc2c23da6a15398"},
|
||||
{file = "numpy-1.24.1-cp310-cp310-win32.whl", hash = "sha256:b31da69ed0c18be8b77bfce48d234e55d040793cebb25398e2a7d84199fbc7e2"},
|
||||
{file = "numpy-1.24.1-cp310-cp310-win_amd64.whl", hash = "sha256:b07b40f5fb4fa034120a5796288f24c1fe0e0580bbfff99897ba6267af42def2"},
|
||||
{file = "numpy-1.24.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:7094891dcf79ccc6bc2a1f30428fa5edb1e6fb955411ffff3401fb4ea93780a8"},
|
||||
{file = "numpy-1.24.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:28e418681372520c992805bb723e29d69d6b7aa411065f48216d8329d02ba032"},
|
||||
{file = "numpy-1.24.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e274f0f6c7efd0d577744f52032fdd24344f11c5ae668fe8d01aac0422611df1"},
|
||||
{file = "numpy-1.24.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0044f7d944ee882400890f9ae955220d29b33d809a038923d88e4e01d652acd9"},
|
||||
{file = "numpy-1.24.1-cp311-cp311-win32.whl", hash = "sha256:442feb5e5bada8408e8fcd43f3360b78683ff12a4444670a7d9e9824c1817d36"},
|
||||
{file = "numpy-1.24.1-cp311-cp311-win_amd64.whl", hash = "sha256:de92efa737875329b052982e37bd4371d52cabf469f83e7b8be9bb7752d67e51"},
|
||||
{file = "numpy-1.24.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:b162ac10ca38850510caf8ea33f89edcb7b0bb0dfa5592d59909419986b72407"},
|
||||
{file = "numpy-1.24.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:26089487086f2648944f17adaa1a97ca6aee57f513ba5f1c0b7ebdabbe2b9954"},
|
||||
{file = "numpy-1.24.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:caf65a396c0d1f9809596be2e444e3bd4190d86d5c1ce21f5fc4be60a3bc5b36"},
|
||||
{file = "numpy-1.24.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b0677a52f5d896e84414761531947c7a330d1adc07c3a4372262f25d84af7bf7"},
|
||||
{file = "numpy-1.24.1-cp38-cp38-win32.whl", hash = "sha256:dae46bed2cb79a58d6496ff6d8da1e3b95ba09afeca2e277628171ca99b99db1"},
|
||||
{file = "numpy-1.24.1-cp38-cp38-win_amd64.whl", hash = "sha256:6ec0c021cd9fe732e5bab6401adea5a409214ca5592cd92a114f7067febcba0c"},
|
||||
{file = "numpy-1.24.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:28bc9750ae1f75264ee0f10561709b1462d450a4808cd97c013046073ae64ab6"},
|
||||
{file = "numpy-1.24.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:84e789a085aabef2f36c0515f45e459f02f570c4b4c4c108ac1179c34d475ed7"},
|
||||
{file = "numpy-1.24.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8e669fbdcdd1e945691079c2cae335f3e3a56554e06bbd45d7609a6cf568c700"},
|
||||
{file = "numpy-1.24.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ef85cf1f693c88c1fd229ccd1055570cb41cdf4875873b7728b6301f12cd05bf"},
|
||||
{file = "numpy-1.24.1-cp39-cp39-win32.whl", hash = "sha256:87a118968fba001b248aac90e502c0b13606721b1343cdaddbc6e552e8dfb56f"},
|
||||
{file = "numpy-1.24.1-cp39-cp39-win_amd64.whl", hash = "sha256:ddc7ab52b322eb1e40521eb422c4e0a20716c271a306860979d450decbb51b8e"},
|
||||
{file = "numpy-1.24.1-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:ed5fb71d79e771ec930566fae9c02626b939e37271ec285e9efaf1b5d4370e7d"},
|
||||
{file = "numpy-1.24.1-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ad2925567f43643f51255220424c23d204024ed428afc5aad0f86f3ffc080086"},
|
||||
{file = "numpy-1.24.1-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:cfa1161c6ac8f92dea03d625c2d0c05e084668f4a06568b77a25a89111621566"},
|
||||
{file = "numpy-1.24.1.tar.gz", hash = "sha256:2386da9a471cc00a1f47845e27d916d5ec5346ae9696e01a8a34760858fe9dd2"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "packaging"
|
||||
version = "22.0"
|
||||
description = "Core utilities for Python packages"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "packaging-22.0-py3-none-any.whl", hash = "sha256:957e2148ba0e1a3b282772e791ef1d8083648bc131c8ab0c1feba110ce1146c3"},
|
||||
{file = "packaging-22.0.tar.gz", hash = "sha256:2198ec20bd4c017b8f9717e00f0c8714076fc2fd93816750ab48e2c41de2cfd3"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pathspec"
|
||||
version = "0.10.3"
|
||||
description = "Utility library for gitignore style pattern matching of file paths."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "pathspec-0.10.3-py3-none-any.whl", hash = "sha256:3c95343af8b756205e2aba76e843ba9520a24dd84f68c22b9f93251507509dd6"},
|
||||
{file = "pathspec-0.10.3.tar.gz", hash = "sha256:56200de4077d9d0791465aa9095a01d421861e405b5096955051deefd697d6f6"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "platformdirs"
|
||||
version = "2.6.2"
|
||||
description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "platformdirs-2.6.2-py3-none-any.whl", hash = "sha256:83c8f6d04389165de7c9b6f0c682439697887bca0aa2f1c87ef1826be3584490"},
|
||||
{file = "platformdirs-2.6.2.tar.gz", hash = "sha256:e1fea1fe471b9ff8332e229df3cb7de4f53eeea4998d3b6bfff542115e998bd2"},
|
||||
]
|
||||
|
||||
[package.extras]
|
||||
docs = ["furo (>=2022.12.7)", "proselint (>=0.13)", "sphinx (>=5.3)", "sphinx-autodoc-typehints (>=1.19.5)"]
|
||||
test = ["appdirs (==1.4.4)", "covdefaults (>=2.2.2)", "pytest (>=7.2)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"]
|
||||
|
||||
[[package]]
|
||||
name = "pluggy"
|
||||
version = "1.0.0"
|
||||
description = "plugin and hook calling mechanisms for python"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.6"
|
||||
files = [
|
||||
{file = "pluggy-1.0.0-py2.py3-none-any.whl", hash = "sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"},
|
||||
{file = "pluggy-1.0.0.tar.gz", hash = "sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159"},
|
||||
]
|
||||
|
||||
[package.extras]
|
||||
dev = ["pre-commit", "tox"]
|
||||
testing = ["pytest", "pytest-benchmark"]
|
||||
|
||||
[[package]]
|
||||
name = "py"
|
||||
version = "1.11.0"
|
||||
description = "library with cross-python path, ini-parsing, io, code, log facilities"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||
files = [
|
||||
{file = "py-1.11.0-py2.py3-none-any.whl", hash = "sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378"},
|
||||
{file = "py-1.11.0.tar.gz", hash = "sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pycodestyle"
|
||||
version = "2.9.1"
|
||||
description = "Python style guide checker"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.6"
|
||||
files = [
|
||||
{file = "pycodestyle-2.9.1-py2.py3-none-any.whl", hash = "sha256:d1735fc58b418fd7c5f658d28d943854f8a849b01a5d0a1e6f3f3fdd0166804b"},
|
||||
{file = "pycodestyle-2.9.1.tar.gz", hash = "sha256:2c9607871d58c76354b697b42f5d57e1ada7d261c261efac224b664affdc5785"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pycparser"
|
||||
version = "2.21"
|
||||
description = "C parser in Python"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
files = [
|
||||
{file = "pycparser-2.21-py2.py3-none-any.whl", hash = "sha256:8ee45429555515e1f6b185e78100aea234072576aa43ab53aefcae078162fca9"},
|
||||
{file = "pycparser-2.21.tar.gz", hash = "sha256:e644fdec12f7872f86c58ff790da456218b10f863970249516d60a5eaca77206"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pyflakes"
|
||||
version = "2.5.0"
|
||||
description = "passive checker of Python programs"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.6"
|
||||
files = [
|
||||
{file = "pyflakes-2.5.0-py2.py3-none-any.whl", hash = "sha256:4579f67d887f804e67edb544428f264b7b24f435b263c4614f384135cea553d2"},
|
||||
{file = "pyflakes-2.5.0.tar.gz", hash = "sha256:491feb020dca48ccc562a8c0cbe8df07ee13078df59813b83959cbdada312ea3"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pyrtlsdr"
|
||||
version = "0.2.93"
|
||||
description = "A Python wrapper for librtlsdr (a driver for Realtek RTL2832U based SDR's)"
|
||||
category = "main"
|
||||
optional = true
|
||||
python-versions = "*"
|
||||
files = [
|
||||
{file = "pyrtlsdr-0.2.93-py2.py3-none-any.whl", hash = "sha256:9a35999876092af963869b499e6094555626c0c3bab45308643f9411495e8cc7"},
|
||||
{file = "pyrtlsdr-0.2.93.tar.gz", hash = "sha256:2de29bb4e4037088a78e89012bc2cc84b73dc45c60608b28b7d903f62923ba26"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pytest"
|
||||
version = "7.2.0"
|
||||
description = "pytest: simple powerful testing with Python"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "pytest-7.2.0-py3-none-any.whl", hash = "sha256:892f933d339f068883b6fd5a459f03d85bfcb355e4981e146d2c7616c21fef71"},
|
||||
{file = "pytest-7.2.0.tar.gz", hash = "sha256:c4014eb40e10f11f355ad4e3c2fb2c6c6d1919c73f3b5a433de4708202cade59"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
attrs = ">=19.2.0"
|
||||
colorama = {version = "*", markers = "sys_platform == \"win32\""}
|
||||
exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""}
|
||||
iniconfig = "*"
|
||||
packaging = "*"
|
||||
pluggy = ">=0.12,<2.0"
|
||||
tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""}
|
||||
|
||||
[package.extras]
|
||||
testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "xmlschema"]
|
||||
|
||||
[[package]]
|
||||
name = "pytest-cov"
|
||||
version = "4.0.0"
|
||||
description = "Pytest plugin for measuring coverage."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.6"
|
||||
files = [
|
||||
{file = "pytest-cov-4.0.0.tar.gz", hash = "sha256:996b79efde6433cdbd0088872dbc5fb3ed7fe1578b68cdbba634f14bb8dd0470"},
|
||||
{file = "pytest_cov-4.0.0-py3-none-any.whl", hash = "sha256:2feb1b751d66a8bd934e5edfa2e961d11309dc37b73b0eabe73b5945fee20f6b"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
coverage = {version = ">=5.2.1", extras = ["toml"]}
|
||||
pytest = ">=4.6"
|
||||
|
||||
[package.extras]
|
||||
testing = ["fields", "hunter", "process-tests", "pytest-xdist", "six", "virtualenv"]
|
||||
|
||||
[[package]]
|
||||
name = "pyzmq"
|
||||
version = "24.0.1"
|
||||
description = "Python bindings for 0MQ"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=3.6"
|
||||
files = [
|
||||
{file = "pyzmq-24.0.1-cp310-cp310-macosx_10_15_universal2.whl", hash = "sha256:28b119ba97129d3001673a697b7cce47fe6de1f7255d104c2f01108a5179a066"},
|
||||
{file = "pyzmq-24.0.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:bcbebd369493d68162cddb74a9c1fcebd139dfbb7ddb23d8f8e43e6c87bac3a6"},
|
||||
{file = "pyzmq-24.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ae61446166983c663cee42c852ed63899e43e484abf080089f771df4b9d272ef"},
|
||||
{file = "pyzmq-24.0.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:87f7ac99b15270db8d53f28c3c7b968612993a90a5cf359da354efe96f5372b4"},
|
||||
{file = "pyzmq-24.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9dca7c3956b03b7663fac4d150f5e6d4f6f38b2462c1e9afd83bcf7019f17913"},
|
||||
{file = "pyzmq-24.0.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:8c78bfe20d4c890cb5580a3b9290f700c570e167d4cdcc55feec07030297a5e3"},
|
||||
{file = "pyzmq-24.0.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:48f721f070726cd2a6e44f3c33f8ee4b24188e4b816e6dd8ba542c8c3bb5b246"},
|
||||
{file = "pyzmq-24.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:afe1f3bc486d0ce40abb0a0c9adb39aed3bbac36ebdc596487b0cceba55c21c1"},
|
||||
{file = "pyzmq-24.0.1-cp310-cp310-win32.whl", hash = "sha256:3e6192dbcefaaa52ed81be88525a54a445f4b4fe2fffcae7fe40ebb58bd06bfd"},
|
||||
{file = "pyzmq-24.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:86de64468cad9c6d269f32a6390e210ca5ada568c7a55de8e681ca3b897bb340"},
|
||||
{file = "pyzmq-24.0.1-cp311-cp311-macosx_10_15_universal2.whl", hash = "sha256:838812c65ed5f7c2bd11f7b098d2e5d01685a3f6d1f82849423b570bae698c00"},
|
||||
{file = "pyzmq-24.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:dfb992dbcd88d8254471760879d48fb20836d91baa90f181c957122f9592b3dc"},
|
||||
{file = "pyzmq-24.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7abddb2bd5489d30ffeb4b93a428130886c171b4d355ccd226e83254fcb6b9ef"},
|
||||
{file = "pyzmq-24.0.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:94010bd61bc168c103a5b3b0f56ed3b616688192db7cd5b1d626e49f28ff51b3"},
|
||||
{file = "pyzmq-24.0.1-cp311-cp311-manylinux_2_28_x86_64.whl", hash = "sha256:8242543c522d84d033fe79be04cb559b80d7eb98ad81b137ff7e0a9020f00ace"},
|
||||
{file = "pyzmq-24.0.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:ccb94342d13e3bf3ffa6e62f95b5e3f0bc6bfa94558cb37f4b3d09d6feb536ff"},
|
||||
{file = "pyzmq-24.0.1-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:6640f83df0ae4ae1104d4c62b77e9ef39be85ebe53f636388707d532bee2b7b8"},
|
||||
{file = "pyzmq-24.0.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:a180dbd5ea5d47c2d3b716d5c19cc3fb162d1c8db93b21a1295d69585bfddac1"},
|
||||
{file = "pyzmq-24.0.1-cp311-cp311-win32.whl", hash = "sha256:624321120f7e60336be8ec74a172ae7fba5c3ed5bf787cc85f7e9986c9e0ebc2"},
|
||||
{file = "pyzmq-24.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:1724117bae69e091309ffb8255412c4651d3f6355560d9af312d547f6c5bc8b8"},
|
||||
{file = "pyzmq-24.0.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:15975747462ec49fdc863af906bab87c43b2491403ab37a6d88410635786b0f4"},
|
||||
{file = "pyzmq-24.0.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b947e264f0e77d30dcbccbb00f49f900b204b922eb0c3a9f0afd61aaa1cedc3d"},
|
||||
{file = "pyzmq-24.0.1-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:0ec91f1bad66f3ee8c6deb65fa1fe418e8ad803efedd69c35f3b5502f43bd1dc"},
|
||||
{file = "pyzmq-24.0.1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:db03704b3506455d86ec72c3358a779e9b1d07b61220dfb43702b7b668edcd0d"},
|
||||
{file = "pyzmq-24.0.1-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:e7e66b4e403c2836ac74f26c4b65d8ac0ca1eef41dfcac2d013b7482befaad83"},
|
||||
{file = "pyzmq-24.0.1-cp36-cp36m-musllinux_1_1_i686.whl", hash = "sha256:7a23ccc1083c260fa9685c93e3b170baba45aeed4b524deb3f426b0c40c11639"},
|
||||
{file = "pyzmq-24.0.1-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:fa0ae3275ef706c0309556061185dd0e4c4cd3b7d6f67ae617e4e677c7a41e2e"},
|
||||
{file = "pyzmq-24.0.1-cp36-cp36m-win32.whl", hash = "sha256:f01de4ec083daebf210531e2cca3bdb1608dbbbe00a9723e261d92087a1f6ebc"},
|
||||
{file = "pyzmq-24.0.1-cp36-cp36m-win_amd64.whl", hash = "sha256:de4217b9eb8b541cf2b7fde4401ce9d9a411cc0af85d410f9d6f4333f43640be"},
|
||||
{file = "pyzmq-24.0.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:78068e8678ca023594e4a0ab558905c1033b2d3e806a0ad9e3094e231e115a33"},
|
||||
{file = "pyzmq-24.0.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:77c2713faf25a953c69cf0f723d1b7dd83827b0834e6c41e3fb3bbc6765914a1"},
|
||||
{file = "pyzmq-24.0.1-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:8bb4af15f305056e95ca1bd086239b9ebc6ad55e9f49076d27d80027f72752f6"},
|
||||
{file = "pyzmq-24.0.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:0f14cffd32e9c4c73da66db97853a6aeceaac34acdc0fae9e5bbc9370281864c"},
|
||||
{file = "pyzmq-24.0.1-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:0108358dab8c6b27ff6b985c2af4b12665c1bc659648284153ee501000f5c107"},
|
||||
{file = "pyzmq-24.0.1-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:d66689e840e75221b0b290b0befa86f059fb35e1ee6443bce51516d4d61b6b99"},
|
||||
{file = "pyzmq-24.0.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:ae08ac90aa8fa14caafc7a6251bd218bf6dac518b7bff09caaa5e781119ba3f2"},
|
||||
{file = "pyzmq-24.0.1-cp37-cp37m-win32.whl", hash = "sha256:8421aa8c9b45ea608c205db9e1c0c855c7e54d0e9c2c2f337ce024f6843cab3b"},
|
||||
{file = "pyzmq-24.0.1-cp37-cp37m-win_amd64.whl", hash = "sha256:54d8b9c5e288362ec8595c1d98666d36f2070fd0c2f76e2b3c60fbad9bd76227"},
|
||||
{file = "pyzmq-24.0.1-cp38-cp38-macosx_10_15_universal2.whl", hash = "sha256:acbd0a6d61cc954b9f535daaa9ec26b0a60a0d4353c5f7c1438ebc88a359a47e"},
|
||||
{file = "pyzmq-24.0.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:47b11a729d61a47df56346283a4a800fa379ae6a85870d5a2e1e4956c828eedc"},
|
||||
{file = "pyzmq-24.0.1-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:abe6eb10122f0d746a0d510c2039ae8edb27bc9af29f6d1b05a66cc2401353ff"},
|
||||
{file = "pyzmq-24.0.1-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:07bec1a1b22dacf718f2c0e71b49600bb6a31a88f06527dfd0b5aababe3fa3f7"},
|
||||
{file = "pyzmq-24.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f0d945a85b70da97ae86113faf9f1b9294efe66bd4a5d6f82f2676d567338b66"},
|
||||
{file = "pyzmq-24.0.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:1b7928bb7580736ffac5baf814097be342ba08d3cfdfb48e52773ec959572287"},
|
||||
{file = "pyzmq-24.0.1-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:b946da90dc2799bcafa682692c1d2139b2a96ec3c24fa9fc6f5b0da782675330"},
|
||||
{file = "pyzmq-24.0.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:c8840f064b1fb377cffd3efeaad2b190c14d4c8da02316dae07571252d20b31f"},
|
||||
{file = "pyzmq-24.0.1-cp38-cp38-win32.whl", hash = "sha256:4854f9edc5208f63f0841c0c667260ae8d6846cfa233c479e29fdc85d42ebd58"},
|
||||
{file = "pyzmq-24.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:42d4f97b9795a7aafa152a36fe2ad44549b83a743fd3e77011136def512e6c2a"},
|
||||
{file = "pyzmq-24.0.1-cp39-cp39-macosx_10_15_universal2.whl", hash = "sha256:52afb0ac962963fff30cf1be775bc51ae083ef4c1e354266ab20e5382057dd62"},
|
||||
{file = "pyzmq-24.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:8bad8210ad4df68c44ff3685cca3cda448ee46e20d13edcff8909eba6ec01ca4"},
|
||||
{file = "pyzmq-24.0.1-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:dabf1a05318d95b1537fd61d9330ef4313ea1216eea128a17615038859da3b3b"},
|
||||
{file = "pyzmq-24.0.1-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:5bd3d7dfd9cd058eb68d9a905dec854f86649f64d4ddf21f3ec289341386c44b"},
|
||||
{file = "pyzmq-24.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e8012bce6836d3f20a6c9599f81dfa945f433dab4dbd0c4917a6fb1f998ab33d"},
|
||||
{file = "pyzmq-24.0.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:c31805d2c8ade9b11feca4674eee2b9cce1fec3e8ddb7bbdd961a09dc76a80ea"},
|
||||
{file = "pyzmq-24.0.1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:3104f4b084ad5d9c0cb87445cc8cfd96bba710bef4a66c2674910127044df209"},
|
||||
{file = "pyzmq-24.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:df0841f94928f8af9c7a1f0aaaffba1fb74607af023a152f59379c01c53aee58"},
|
||||
{file = "pyzmq-24.0.1-cp39-cp39-win32.whl", hash = "sha256:a435ef8a3bd95c8a2d316d6e0ff70d0db524f6037411652803e118871d703333"},
|
||||
{file = "pyzmq-24.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:2032d9cb994ce3b4cba2b8dfae08c7e25bc14ba484c770d4d3be33c27de8c45b"},
|
||||
{file = "pyzmq-24.0.1-pp37-pypy37_pp73-macosx_10_9_x86_64.whl", hash = "sha256:bb5635c851eef3a7a54becde6da99485eecf7d068bd885ac8e6d173c4ecd68b0"},
|
||||
{file = "pyzmq-24.0.1-pp37-pypy37_pp73-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:83ea1a398f192957cb986d9206ce229efe0ee75e3c6635baff53ddf39bd718d5"},
|
||||
{file = "pyzmq-24.0.1-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:941fab0073f0a54dc33d1a0460cb04e0d85893cb0c5e1476c785000f8b359409"},
|
||||
{file = "pyzmq-24.0.1-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0e8f482c44ccb5884bf3f638f29bea0f8dc68c97e38b2061769c4cb697f6140d"},
|
||||
{file = "pyzmq-24.0.1-pp37-pypy37_pp73-win_amd64.whl", hash = "sha256:613010b5d17906c4367609e6f52e9a2595e35d5cc27d36ff3f1b6fa6e954d944"},
|
||||
{file = "pyzmq-24.0.1-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:65c94410b5a8355cfcf12fd600a313efee46ce96a09e911ea92cf2acf6708804"},
|
||||
{file = "pyzmq-24.0.1-pp38-pypy38_pp73-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:20e7eeb1166087db636c06cae04a1ef59298627f56fb17da10528ab52a14c87f"},
|
||||
{file = "pyzmq-24.0.1-pp38-pypy38_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:a2712aee7b3834ace51738c15d9ee152cc5a98dc7d57dd93300461b792ab7b43"},
|
||||
{file = "pyzmq-24.0.1-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1a7c280185c4da99e0cc06c63bdf91f5b0b71deb70d8717f0ab870a43e376db8"},
|
||||
{file = "pyzmq-24.0.1-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:858375573c9225cc8e5b49bfac846a77b696b8d5e815711b8d4ba3141e6e8879"},
|
||||
{file = "pyzmq-24.0.1-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:80093b595921eed1a2cead546a683b9e2ae7f4a4592bb2ab22f70d30174f003a"},
|
||||
{file = "pyzmq-24.0.1-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8f3f3154fde2b1ff3aa7b4f9326347ebc89c8ef425ca1db8f665175e6d3bd42f"},
|
||||
{file = "pyzmq-24.0.1-pp39-pypy39_pp73-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:abb756147314430bee5d10919b8493c0ccb109ddb7f5dfd2fcd7441266a25b75"},
|
||||
{file = "pyzmq-24.0.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:44e706bac34e9f50779cb8c39f10b53a4d15aebb97235643d3112ac20bd577b4"},
|
||||
{file = "pyzmq-24.0.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:687700f8371643916a1d2c61f3fdaa630407dd205c38afff936545d7b7466066"},
|
||||
{file = "pyzmq-24.0.1.tar.gz", hash = "sha256:216f5d7dbb67166759e59b0479bca82b8acf9bed6015b526b8eb10143fb08e77"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
cffi = {version = "*", markers = "implementation_name == \"pypy\""}
|
||||
py = {version = "*", markers = "implementation_name == \"pypy\""}
|
||||
|
||||
[[package]]
|
||||
name = "requests"
|
||||
version = "2.28.1"
|
||||
description = "Python HTTP for Humans."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.7, <4"
|
||||
files = [
|
||||
{file = "requests-2.28.1-py3-none-any.whl", hash = "sha256:8fefa2a1a1365bf5520aac41836fbee479da67864514bdb821f31ce07ce65349"},
|
||||
{file = "requests-2.28.1.tar.gz", hash = "sha256:7c5599b102feddaa661c826c56ab4fee28bfd17f5abca1ebbe3e7f19d7c97983"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
certifi = ">=2017.4.17"
|
||||
charset-normalizer = ">=2,<3"
|
||||
idna = ">=2.5,<4"
|
||||
urllib3 = ">=1.21.1,<1.27"
|
||||
|
||||
[package.extras]
|
||||
socks = ["PySocks (>=1.5.6,!=1.5.7)"]
|
||||
use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"]
|
||||
|
||||
[[package]]
|
||||
name = "tomli"
|
||||
version = "2.0.1"
|
||||
description = "A lil' TOML parser"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"},
|
||||
{file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typing-extensions"
|
||||
version = "4.4.0"
|
||||
description = "Backported and Experimental Type Hints for Python 3.7+"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "typing_extensions-4.4.0-py3-none-any.whl", hash = "sha256:16fa4864408f655d35ec496218b85f79b3437c829e93320c7c9215ccfd92489e"},
|
||||
{file = "typing_extensions-4.4.0.tar.gz", hash = "sha256:1511434bb92bf8dd198c12b1cc812e800d4181cfcb867674e0f8279cc93087aa"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "urllib3"
|
||||
version = "1.26.13"
|
||||
description = "HTTP library with thread-safe connection pooling, file post, and more."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*"
|
||||
files = [
|
||||
{file = "urllib3-1.26.13-py2.py3-none-any.whl", hash = "sha256:47cc05d99aaa09c9e72ed5809b60e7ba354e64b59c9c173ac3018642d8bb41fc"},
|
||||
{file = "urllib3-1.26.13.tar.gz", hash = "sha256:c083dd0dce68dbfbe1129d5271cb90f9447dea7d52097c6e0126120c521ddea8"},
|
||||
]
|
||||
|
||||
[package.extras]
|
||||
brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)", "brotlipy (>=0.6.0)"]
|
||||
secure = ["certifi", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "ipaddress", "pyOpenSSL (>=0.14)", "urllib3-secure-extra"]
|
||||
socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"]
|
||||
|
||||
[extras]
|
||||
rtlsdr = ["pyrtlsdr"]
|
||||
|
||||
[metadata]
|
||||
lock-version = "2.0"
|
||||
python-versions = "^3.8"
|
||||
content-hash = "53dde5ef0e7bc3d687076c6b3e535101dce9db8877e196bf8fe81bb2773c0f17"
|
||||
@@ -4,17 +4,31 @@ import warnings
|
||||
try:
|
||||
from . import c_common as common
|
||||
from .c_common import *
|
||||
except:
|
||||
from . import py_common as common
|
||||
from .py_common import *
|
||||
except Exception:
|
||||
from . import py_common as common # type: ignore
|
||||
from .py_common import * # type: ignore
|
||||
|
||||
from .decoder import tell
|
||||
from .decoder import adsb
|
||||
from .decoder import commb
|
||||
from .decoder import allcall
|
||||
from .decoder import surv
|
||||
from .decoder import bds
|
||||
from .extra import aero
|
||||
from .extra import tcpclient
|
||||
|
||||
__all__ = [
|
||||
"common",
|
||||
"tell",
|
||||
"adsb",
|
||||
"commb",
|
||||
"allcall",
|
||||
"surv",
|
||||
"bds",
|
||||
"aero",
|
||||
"tcpclient",
|
||||
]
|
||||
|
||||
|
||||
warnings.simplefilter("once", DeprecationWarning)
|
||||
|
||||
|
||||
@@ -17,8 +17,12 @@ cpdef bint is_icao_assigned(str icao)
|
||||
|
||||
cpdef int typecode(str msg)
|
||||
cpdef int cprNL(double lat)
|
||||
|
||||
cpdef str idcode(str msg)
|
||||
cpdef str squawk(str binstr)
|
||||
|
||||
cpdef int altcode(str msg)
|
||||
cpdef int altitude(str binstr)
|
||||
|
||||
cpdef str data(str msg)
|
||||
cpdef bint allzeros(str msg)
|
||||
|
||||
18
pyModeS/c_common.pyi
Normal file
18
pyModeS/c_common.pyi
Normal file
@@ -0,0 +1,18 @@
|
||||
def hex2bin(hexstr: str) -> str: ...
|
||||
def bin2int(binstr: str) -> int: ...
|
||||
def hex2int(hexstr: str) -> int: ...
|
||||
def bin2hex(binstr: str) -> str: ...
|
||||
def df(msg: str) -> int: ...
|
||||
def crc(msg: str, encode: bool = False) -> int: ...
|
||||
def floor(x: float) -> float: ...
|
||||
def icao(msg: str) -> str: ...
|
||||
def is_icao_assigned(icao: str) -> bool: ...
|
||||
def typecode(msg: str) -> int: ...
|
||||
def cprNL(lat: float) -> int: ...
|
||||
def idcode(msg: str) -> str: ...
|
||||
def squawk(binstr: str) -> str: ...
|
||||
def altcode(msg: str) -> int: ...
|
||||
def altitude(binstr: str) -> int: ...
|
||||
def data(msg: str) -> str: ...
|
||||
def allzeros(msg: str) -> bool: ...
|
||||
def wrongstatus(data: str, sb: int, msb: int, lsb: int) -> bool: ...
|
||||
@@ -25,7 +25,7 @@ cdef unsigned char int_to_char(unsigned char i):
|
||||
@cython.boundscheck(False)
|
||||
@cython.overflowcheck(False)
|
||||
cpdef str hex2bin(str hexstr):
|
||||
"""Convert a hexdecimal string to binary string, with zero fillings."""
|
||||
"""Convert a hexadecimal string to binary string, with zero fillings."""
|
||||
# num_of_bits = len(hexstr) * 4
|
||||
cdef hexbytes = bytes(hexstr.encode())
|
||||
cdef Py_ssize_t len_hexstr = PyBytes_GET_SIZE(hexbytes)
|
||||
@@ -73,7 +73,7 @@ cpdef str bin2hex(str binstr):
|
||||
|
||||
@cython.boundscheck(False)
|
||||
cpdef unsigned char df(str msg):
|
||||
"""Decode Downlink Format vaule, bits 1 to 5."""
|
||||
"""Decode Downlink Format value, bits 1 to 5."""
|
||||
cdef str dfbin = hex2bin(msg[:2])
|
||||
# return min(bin2int(dfbin[0:5]), 24)
|
||||
cdef long df = bin2int(dfbin[0:5])
|
||||
@@ -160,17 +160,7 @@ cpdef long floor(double x):
|
||||
return <long> c_floor(x)
|
||||
|
||||
cpdef str icao(str msg):
|
||||
"""Calculate the ICAO address from an Mode-S message.
|
||||
|
||||
Applicable only with DF4, DF5, DF20, DF21 messages.
|
||||
|
||||
Args:
|
||||
msg (String): 28 bytes hexadecimal message string
|
||||
|
||||
Returns:
|
||||
String: ICAO address in 6 bytes hexadecimal string
|
||||
|
||||
"""
|
||||
"""Calculate the ICAO address from an Mode-S message."""
|
||||
cdef unsigned char DF = df(msg)
|
||||
cdef long c0, c1
|
||||
|
||||
@@ -217,14 +207,7 @@ cpdef bint is_icao_assigned(str icao):
|
||||
@cython.boundscheck(False)
|
||||
@cython.wraparound(False)
|
||||
cpdef int typecode(str msg):
|
||||
"""Type code of ADS-B message
|
||||
|
||||
Args:
|
||||
msg (string): 28 bytes hexadecimal message string
|
||||
|
||||
Returns:
|
||||
int: type code number
|
||||
"""
|
||||
"""Type code of ADS-B message"""
|
||||
if df(msg) not in (17, 18):
|
||||
return -1
|
||||
# return None
|
||||
@@ -245,7 +228,7 @@ cpdef int cprNL(double lat):
|
||||
|
||||
cdef int nz = 15
|
||||
cdef double a = 1 - cos(pi / (2 * nz))
|
||||
cdef double b = cos(pi / 180.0 * fabs(lat)) ** 2
|
||||
cdef double b = cos(pi / 180 * fabs(lat)) ** 2
|
||||
cdef double nl = 2 * pi / (acos(1 - a / b))
|
||||
NL = floor(nl)
|
||||
return NL
|
||||
@@ -253,45 +236,41 @@ cpdef int cprNL(double lat):
|
||||
@cython.boundscheck(False)
|
||||
@cython.wraparound(False)
|
||||
cpdef str idcode(str msg):
|
||||
"""Compute identity (squawk code).
|
||||
|
||||
Applicable only for DF5 or DF21 messages, bit 20-32.
|
||||
credit: @fbyrkjeland
|
||||
|
||||
Args:
|
||||
msg (String): 28 bytes hexadecimal message string
|
||||
|
||||
Returns:
|
||||
string: squawk code
|
||||
|
||||
"""
|
||||
"""Compute identity (squawk code)."""
|
||||
if df(msg) not in [5, 21]:
|
||||
raise RuntimeError("Message must be Downlink Format 5 or 21.")
|
||||
|
||||
cdef bytearray _mbin = bytearray(hex2bin(msg).encode())
|
||||
squawk_code = squawk(hex2bin(msg)[19:32])
|
||||
return squawk_code
|
||||
|
||||
|
||||
@cython.boundscheck(False)
|
||||
@cython.wraparound(False)
|
||||
cpdef str squawk(str binstr):
|
||||
"""Compute identity (squawk code)."""
|
||||
|
||||
if len(binstr) != 13 or set(binstr) != set('01'):
|
||||
raise RuntimeError("Input must be 13 bits binary string")
|
||||
|
||||
cdef bytearray _mbin = bytearray(binstr.encode())
|
||||
cdef unsigned char[:] mbin = _mbin
|
||||
|
||||
cdef bytearray _idcode = bytearray(4)
|
||||
cdef unsigned char[:] idcode = _idcode
|
||||
|
||||
cdef unsigned char C1 = mbin[19]
|
||||
cdef unsigned char A1 = mbin[20]
|
||||
cdef unsigned char C2 = mbin[21]
|
||||
cdef unsigned char A2 = mbin[22]
|
||||
cdef unsigned char C4 = mbin[23]
|
||||
cdef unsigned char A4 = mbin[24]
|
||||
# _ = mbin[25]
|
||||
cdef unsigned char B1 = mbin[26]
|
||||
cdef unsigned char D1 = mbin[27]
|
||||
cdef unsigned char B2 = mbin[28]
|
||||
cdef unsigned char D2 = mbin[29]
|
||||
cdef unsigned char B4 = mbin[30]
|
||||
cdef unsigned char D4 = mbin[31]
|
||||
|
||||
# byte1 = int(A4 + A2 + A1, 2)
|
||||
# byte2 = int(B4 + B2 + B1, 2)
|
||||
# byte3 = int(C4 + C2 + C1, 2)
|
||||
# byte4 = int(D4 + D2 + D1, 2)
|
||||
cdef unsigned char C1 = mbin[0]
|
||||
cdef unsigned char A1 = mbin[1]
|
||||
cdef unsigned char C2 = mbin[2]
|
||||
cdef unsigned char A2 = mbin[3]
|
||||
cdef unsigned char C4 = mbin[4]
|
||||
cdef unsigned char A4 = mbin[5]
|
||||
# X = mbin[6]
|
||||
cdef unsigned char B1 = mbin[7]
|
||||
cdef unsigned char D1 = mbin[8]
|
||||
cdef unsigned char B2 = mbin[9]
|
||||
cdef unsigned char D2 = mbin[10]
|
||||
cdef unsigned char B4 = mbin[11]
|
||||
cdef unsigned char D4 = mbin[12]
|
||||
|
||||
idcode[0] = int_to_char((char_to_int(A4)*2 + char_to_int(A2))*2 + char_to_int(A1))
|
||||
idcode[1] = int_to_char((char_to_int(B4)*2 + char_to_int(B2))*2 + char_to_int(B1))
|
||||
@@ -300,68 +279,68 @@ cpdef str idcode(str msg):
|
||||
|
||||
return _idcode.decode()
|
||||
|
||||
#return str(byte1) + str(byte2) + str(byte3) + str(byte4)
|
||||
|
||||
|
||||
@cython.boundscheck(False)
|
||||
@cython.wraparound(False)
|
||||
cpdef int altcode(str msg):
|
||||
"""Compute the altitude.
|
||||
|
||||
Applicable only for DF4 or DF20 message, bit 20-32.
|
||||
credit: @fbyrkjeland
|
||||
|
||||
Args:
|
||||
msg (String): 28 bytes hexadecimal message string
|
||||
|
||||
Returns:
|
||||
int: altitude in ft
|
||||
|
||||
"""
|
||||
"""Compute the altitude."""
|
||||
if df(msg) not in [0, 4, 16, 20]:
|
||||
raise RuntimeError("Message must be Downlink Format 0, 4, 16, or 20.")
|
||||
|
||||
# Altitude code, bit 20-32
|
||||
cdef bytearray _mbin = bytearray(hex2bin(msg).encode())
|
||||
alt = altitude(hex2bin(msg)[19:32])
|
||||
return alt
|
||||
|
||||
|
||||
@cython.boundscheck(False)
|
||||
@cython.wraparound(False)
|
||||
cpdef int altitude(str binstr):
|
||||
|
||||
if len(binstr) != 13 or not set(binstr).issubset(set("01")):
|
||||
raise RuntimeError("Input must be 13 bits binary string")
|
||||
|
||||
cdef bytearray _mbin = bytearray(binstr.encode())
|
||||
cdef unsigned char[:] mbin = _mbin
|
||||
|
||||
cdef char mbit = mbin[25] # M bit: 26
|
||||
cdef char qbit = mbin[27] # Q bit: 28
|
||||
cdef char Mbit = binstr[6]
|
||||
cdef char Qbit = binstr[8]
|
||||
|
||||
cdef int alt = 0
|
||||
cdef bytearray vbin
|
||||
cdef bytearray _graybytes = bytearray(11)
|
||||
cdef unsigned char[:] graybytes = _graybytes
|
||||
|
||||
if mbit == 48: # unit in ft, "0" -> 48
|
||||
if qbit == 49: # 25ft interval, "1" -> 49
|
||||
vbin = _mbin[19:25] + _mbin[26:27] + _mbin[28:32]
|
||||
if bin2int(binstr) == 0:
|
||||
# altitude unknown or invalid
|
||||
alt = -9999
|
||||
|
||||
elif Mbit == 48: # unit in ft, "0" -> 48
|
||||
if Qbit == 49: # 25ft interval, "1" -> 49
|
||||
vbin = _mbin[:6] + _mbin[7:8] + _mbin[9:]
|
||||
alt = bin2int(vbin.decode()) * 25 - 1000
|
||||
if qbit == 48: # 100ft interval, above 50175ft, "0" -> 48
|
||||
graybytes[8] = mbin[19]
|
||||
graybytes[2] = mbin[20]
|
||||
graybytes[9] = mbin[21]
|
||||
graybytes[3] = mbin[22]
|
||||
graybytes[10] = mbin[23]
|
||||
graybytes[4] = mbin[24]
|
||||
# _ = mbin[25]
|
||||
graybytes[5] = mbin[26]
|
||||
# cdef char D1 = mbin[27] # always zero
|
||||
graybytes[6] = mbin[28]
|
||||
graybytes[0] = mbin[29]
|
||||
graybytes[7] = mbin[30]
|
||||
graybytes[1] = mbin[31]
|
||||
# graybytes = D2 + D4 + A1 + A2 + A4 + B1 + B2 + B4 + C1 + C2 + C4
|
||||
if Qbit == 48: # 100ft interval, above 50175ft, "0" -> 48
|
||||
graybytes[8] = mbin[0]
|
||||
graybytes[2] = mbin[1]
|
||||
graybytes[9] = mbin[2]
|
||||
graybytes[3] = mbin[3]
|
||||
graybytes[10] = mbin[4]
|
||||
graybytes[4] = mbin[5]
|
||||
# M = mbin[6]
|
||||
graybytes[5] = mbin[7]
|
||||
# Q = mbin[8]
|
||||
graybytes[6] = mbin[9]
|
||||
graybytes[0] = mbin[10]
|
||||
graybytes[7] = mbin[11]
|
||||
graybytes[1] = mbin[12]
|
||||
|
||||
alt = gray2alt(_graybytes.decode())
|
||||
|
||||
if mbit == 49: # unit in meter, "1" -> 49
|
||||
vbin = _mbin[19:25] + _mbin[26:31]
|
||||
elif Mbit == 49: # unit in meter, "1" -> 49
|
||||
vbin = _mbin[:6] + _mbin[7:]
|
||||
alt = int(bin2int(vbin.decode()) * 3.28084) # convert to ft
|
||||
|
||||
return alt
|
||||
|
||||
|
||||
|
||||
cpdef int gray2alt(str codestr):
|
||||
cdef str gc500 = codestr[:8]
|
||||
cdef int n500 = gray2int(gc500)
|
||||
@@ -400,15 +379,7 @@ cpdef str data(str msg):
|
||||
|
||||
|
||||
cpdef bint allzeros(str msg):
|
||||
"""Check if the data bits are all zeros.
|
||||
|
||||
Args:
|
||||
msg (String): 28 bytes hexadecimal message string
|
||||
|
||||
Returns:
|
||||
bool: True or False
|
||||
|
||||
"""
|
||||
"""Check if the data bits are all zeros."""
|
||||
d = hex2bin(data(msg))
|
||||
|
||||
if bin2int(d) > 0:
|
||||
|
||||
22
pyModeS/common.pyi
Normal file
22
pyModeS/common.pyi
Normal file
@@ -0,0 +1,22 @@
|
||||
from typing import Optional
|
||||
|
||||
def hex2bin(hexstr: str) -> str: ...
|
||||
def bin2int(binstr: str) -> int: ...
|
||||
def hex2int(hexstr: str) -> int: ...
|
||||
def bin2hex(binstr: str) -> str: ...
|
||||
def df(msg: str) -> int: ...
|
||||
def crc(msg: str, encode: bool = False) -> int: ...
|
||||
def floor(x: float) -> float: ...
|
||||
def icao(msg: str) -> Optional[str]: ...
|
||||
def is_icao_assigned(icao: str) -> bool: ...
|
||||
def typecode(msg: str) -> Optional[int]: ...
|
||||
def cprNL(lat: float) -> int: ...
|
||||
def idcode(msg: str) -> str: ...
|
||||
def squawk(binstr: str) -> str: ...
|
||||
def altcode(msg: str) -> Optional[int]: ...
|
||||
def altitude(binstr: str) -> Optional[int]: ...
|
||||
def gray2alt(binstr: str) -> Optional[int]: ...
|
||||
def gray2int(binstr: str) -> int: ...
|
||||
def data(msg: str) -> str: ...
|
||||
def allzeros(msg: str) -> bool: ...
|
||||
def wrongstatus(data: str, sb: int, msb: int, lsb: int) -> bool: ...
|
||||
@@ -1,8 +1,8 @@
|
||||
def tell(msg):
|
||||
from pyModeS import common, adsb, commb, bds
|
||||
def tell(msg: str) -> None:
|
||||
from .. import common, adsb, commb, bds
|
||||
|
||||
def _print(label, value, unit=None):
|
||||
print("%20s: " % label, end="")
|
||||
print("%28s: " % label, end="")
|
||||
print("%s " % value, end="")
|
||||
if unit:
|
||||
print(unit)
|
||||
@@ -20,9 +20,14 @@ def tell(msg):
|
||||
_print("Protocol", "Mode-S Extended Squitter (ADS-B)")
|
||||
|
||||
tc = common.typecode(msg)
|
||||
|
||||
if tc is None:
|
||||
_print("ERROR", "Unknown typecode")
|
||||
return
|
||||
|
||||
if 1 <= tc <= 4: # callsign
|
||||
callsign = adsb.callsign(msg)
|
||||
_print("Type", "Identitification and category")
|
||||
_print("Type", "Identification and category")
|
||||
_print("Callsign:", callsign)
|
||||
|
||||
if 5 <= tc <= 8: # surface position
|
||||
@@ -52,12 +57,14 @@ def tell(msg):
|
||||
|
||||
if tc == 19:
|
||||
_print("Type", "Airborne velocity")
|
||||
spd, trk, vr, t = adsb.velocity(msg)
|
||||
types = {"GS": "Ground speed", "TAS": "True airspeed"}
|
||||
_print("Speed", spd, "knots")
|
||||
_print("Track", trk, "degrees")
|
||||
_print("Vertical rate", vr, "feet/minute")
|
||||
_print("Type", types[t])
|
||||
velocity = adsb.velocity(msg)
|
||||
if velocity is not None:
|
||||
spd, trk, vr, t = velocity
|
||||
types = {"GS": "Ground speed", "TAS": "True airspeed"}
|
||||
_print("Speed", spd, "knots")
|
||||
_print("Track", trk, "degrees")
|
||||
_print("Vertical rate", vr, "feet/minute")
|
||||
_print("Type", types[t])
|
||||
|
||||
if 20 <= tc <= 22: # airborne position
|
||||
_print("Type", "Airborne position (with GNSS altitude)")
|
||||
@@ -71,6 +78,94 @@ def tell(msg):
|
||||
_print("CPR Longitude", cprlon)
|
||||
_print("Altitude", alt, "feet")
|
||||
|
||||
if tc == 29: # target state and status
|
||||
_print("Type", "Target State and Status")
|
||||
subtype = common.bin2int((common.hex2bin(msg)[32:])[5:7])
|
||||
_print("Subtype", subtype)
|
||||
tcas_operational = adsb.tcas_operational(msg)
|
||||
types_29 = {0: "Not Engaged", 1: "Engaged"}
|
||||
tcas_operational_types = {0: "Not Operational", 1: "Operational"}
|
||||
if subtype == 0:
|
||||
emergency_types = {
|
||||
0: "No emergency",
|
||||
1: "General emergency",
|
||||
2: "Lifeguard/medical emergency",
|
||||
3: "Minimum fuel",
|
||||
4: "No communications",
|
||||
5: "Unlawful interference",
|
||||
6: "Downed aircraft",
|
||||
7: "Reserved",
|
||||
}
|
||||
vertical_horizontal_types = {
|
||||
1: "Acquiring mode",
|
||||
2: "Capturing/Maintaining mode",
|
||||
}
|
||||
tcas_ra_types = {0: "Not active", 1: "Active"}
|
||||
alt, alt_source, alt_ref = adsb.target_altitude(msg)
|
||||
angle, angle_type, angle_source = adsb.target_angle(msg)
|
||||
vertical_mode = adsb.vertical_mode(msg)
|
||||
horizontal_mode = adsb.horizontal_mode(msg)
|
||||
tcas_ra = adsb.tcas_ra(msg)
|
||||
emergency_status = adsb.emergency_status(msg)
|
||||
_print("Target altitude", alt, "feet")
|
||||
_print("Altitude source", alt_source)
|
||||
_print("Altitude reference", alt_ref)
|
||||
_print("Angle", angle, "°")
|
||||
_print("Angle Type", angle_type)
|
||||
_print("Angle Source", angle_source)
|
||||
if vertical_mode is not None:
|
||||
_print(
|
||||
"Vertical mode",
|
||||
vertical_horizontal_types[vertical_mode],
|
||||
)
|
||||
if horizontal_mode is not None:
|
||||
_print(
|
||||
"Horizontal mode",
|
||||
vertical_horizontal_types[horizontal_mode],
|
||||
)
|
||||
_print(
|
||||
"TCAS/ACAS",
|
||||
tcas_operational_types[tcas_operational]
|
||||
if tcas_operational
|
||||
else None,
|
||||
)
|
||||
_print("TCAS/ACAS RA", tcas_ra_types[tcas_ra])
|
||||
_print("Emergency status", emergency_types[emergency_status])
|
||||
else:
|
||||
alt, alt_source = adsb.selected_altitude(msg) # type: ignore
|
||||
baro = adsb.baro_pressure_setting(msg)
|
||||
hdg = adsb.selected_heading(msg)
|
||||
autopilot = adsb.autopilot(msg)
|
||||
vnav = adsb.vnav_mode(msg)
|
||||
alt_hold = adsb.altitude_hold_mode(msg)
|
||||
app = adsb.approach_mode(msg)
|
||||
lnav = adsb.lnav_mode(msg)
|
||||
_print("Selected altitude", alt, "feet")
|
||||
_print("Altitude source", alt_source)
|
||||
_print(
|
||||
"Barometric pressure setting",
|
||||
baro,
|
||||
"" if baro is None else "millibars",
|
||||
)
|
||||
_print("Selected Heading", hdg, "°")
|
||||
if not (common.bin2int((common.hex2bin(msg)[32:])[46]) == 0):
|
||||
_print(
|
||||
"Autopilot", types_29[autopilot] if autopilot else None
|
||||
)
|
||||
_print("VNAV mode", types_29[vnav] if vnav else None)
|
||||
_print(
|
||||
"Altitude hold mode",
|
||||
types_29[alt_hold] if alt_hold else None,
|
||||
)
|
||||
_print("Approach mode", types_29[app] if app else None)
|
||||
_print(
|
||||
"TCAS/ACAS",
|
||||
tcas_operational_types[tcas_operational]
|
||||
if tcas_operational
|
||||
else None,
|
||||
)
|
||||
_print("LNAV mode", types_29[lnav] if lnav else None)
|
||||
|
||||
if df == 20:
|
||||
_print("Protocol", "Mode-S Comm-B altitude reply")
|
||||
_print("Altitude", common.altcode(msg), "feet")
|
||||
@@ -94,7 +189,7 @@ def tell(msg):
|
||||
}
|
||||
|
||||
BDS = bds.infer(msg, mrar=True)
|
||||
if BDS in labels.keys():
|
||||
if BDS is not None and BDS in labels.keys():
|
||||
_print("BDS", "%s (%s)" % (BDS, labels[BDS]))
|
||||
else:
|
||||
_print("BDS", BDS)
|
||||
|
||||
@@ -2,47 +2,120 @@
|
||||
|
||||
The ADS-B module also imports functions from the following modules:
|
||||
|
||||
- pyModeS.decoder.bds.bds05: ``airborne_position()``, ``airborne_position_with_ref()``, ``altitude()``
|
||||
- pyModeS.decoder.bds.bds06: ``surface_position()``, ``surface_position_with_ref()``, ``surface_velocity()``
|
||||
- pyModeS.decoder.bds.bds08: ``category()``, ``callsign()``
|
||||
- pyModeS.decoder.bds.bds09: ``airborne_velocity()``, ``altitude_diff()``
|
||||
- bds05: ``airborne_position()``, ``airborne_position_with_ref()``,
|
||||
``altitude()``
|
||||
- bds06: ``surface_position()``, ``surface_position_with_ref()``,
|
||||
``surface_velocity()``
|
||||
- bds08: ``category()``, ``callsign()``
|
||||
- bds09: ``airborne_velocity()``, ``altitude_diff()``
|
||||
|
||||
"""
|
||||
|
||||
import pyModeS as pms
|
||||
from __future__ import annotations
|
||||
from datetime import datetime
|
||||
|
||||
from pyModeS import common
|
||||
|
||||
from pyModeS.decoder import uncertainty
|
||||
|
||||
# from pyModeS.decoder.bds import bds05, bds06, bds09
|
||||
from pyModeS.decoder.bds.bds05 import (
|
||||
airborne_position,
|
||||
airborne_position_with_ref,
|
||||
altitude as altitude05,
|
||||
)
|
||||
from pyModeS.decoder.bds.bds06 import (
|
||||
from .. import common
|
||||
from . import uncertainty
|
||||
from .bds.bds05 import airborne_position, airborne_position_with_ref
|
||||
from .bds.bds05 import altitude as altitude05
|
||||
from .bds.bds06 import (
|
||||
surface_position,
|
||||
surface_position_with_ref,
|
||||
surface_velocity,
|
||||
)
|
||||
from pyModeS.decoder.bds.bds08 import category, callsign
|
||||
from pyModeS.decoder.bds.bds09 import airborne_velocity, altitude_diff
|
||||
from .bds.bds08 import callsign, category
|
||||
from .bds.bds09 import airborne_velocity, altitude_diff
|
||||
from .bds.bds61 import emergency_squawk, emergency_state, is_emergency
|
||||
from .bds.bds62 import (
|
||||
altitude_hold_mode,
|
||||
approach_mode,
|
||||
autopilot,
|
||||
baro_pressure_setting,
|
||||
emergency_status,
|
||||
horizontal_mode,
|
||||
lnav_mode,
|
||||
selected_altitude,
|
||||
selected_heading,
|
||||
target_altitude,
|
||||
target_angle,
|
||||
tcas_operational,
|
||||
tcas_ra,
|
||||
vertical_mode,
|
||||
vnav_mode,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"airborne_position",
|
||||
"airborne_position_with_ref",
|
||||
"altitude05",
|
||||
"surface_position",
|
||||
"surface_position_with_ref",
|
||||
"surface_velocity",
|
||||
"callsign",
|
||||
"category",
|
||||
"airborne_velocity",
|
||||
"altitude_diff",
|
||||
"emergency_squawk",
|
||||
"emergency_state",
|
||||
"is_emergency",
|
||||
"df",
|
||||
"icao",
|
||||
"typecode",
|
||||
"position",
|
||||
"position_with_ref",
|
||||
"altitude",
|
||||
"velocity",
|
||||
"speed_heading",
|
||||
"oe_flag",
|
||||
"version",
|
||||
"nuc_p",
|
||||
"nuc_v",
|
||||
"nic_v1",
|
||||
"nic_v2",
|
||||
"nic_s",
|
||||
"nic_a_c",
|
||||
"nic_b",
|
||||
"nac_p",
|
||||
"nac_v",
|
||||
"sil",
|
||||
"selected_altitude",
|
||||
"target_altitude",
|
||||
"vertical_mode",
|
||||
"horizontal_mode",
|
||||
"selected_heading",
|
||||
"target_angle",
|
||||
"baro_pressure_setting",
|
||||
"autopilot",
|
||||
"vnav_mode",
|
||||
"altitude_hold_mode",
|
||||
"approach_mode",
|
||||
"lnav_mode",
|
||||
"tcas_operational",
|
||||
"tcas_ra",
|
||||
"emergency_status",
|
||||
]
|
||||
|
||||
|
||||
def df(msg):
|
||||
def df(msg: str) -> int:
|
||||
return common.df(msg)
|
||||
|
||||
|
||||
def icao(msg):
|
||||
def icao(msg: str) -> None | str:
|
||||
return common.icao(msg)
|
||||
|
||||
|
||||
def typecode(msg):
|
||||
def typecode(msg: str) -> None | int:
|
||||
return common.typecode(msg)
|
||||
|
||||
|
||||
def position(msg0, msg1, t0, t1, lat_ref=None, lon_ref=None):
|
||||
def position(
|
||||
msg0: str,
|
||||
msg1: str,
|
||||
t0: int | datetime,
|
||||
t1: int | datetime,
|
||||
lat_ref: None | float = None,
|
||||
lon_ref: None | float = None,
|
||||
) -> None | tuple[float, float]:
|
||||
"""Decode surface or airborne position from a pair of even and odd
|
||||
position messages.
|
||||
|
||||
@@ -64,6 +137,9 @@ def position(msg0, msg1, t0, t1, lat_ref=None, lon_ref=None):
|
||||
tc0 = typecode(msg0)
|
||||
tc1 = typecode(msg1)
|
||||
|
||||
if tc0 is None or tc1 is None:
|
||||
raise RuntimeError("Incorrect or inconsistent message types")
|
||||
|
||||
if 5 <= tc0 <= 8 and 5 <= tc1 <= 8:
|
||||
if lat_ref is None or lon_ref is None:
|
||||
raise RuntimeError(
|
||||
@@ -85,13 +161,15 @@ def position(msg0, msg1, t0, t1, lat_ref=None, lon_ref=None):
|
||||
raise RuntimeError("Incorrect or inconsistent message types")
|
||||
|
||||
|
||||
def position_with_ref(msg, lat_ref, lon_ref):
|
||||
def position_with_ref(
|
||||
msg: str, lat_ref: float, lon_ref: float
|
||||
) -> tuple[float, float]:
|
||||
"""Decode position with only one message.
|
||||
|
||||
A reference position is required, which can be previously
|
||||
calculated location, ground station, or airport location.
|
||||
The function works with both airborne and surface position messages.
|
||||
The reference position shall be with in 180NM (airborne) or 45NM (surface)
|
||||
The reference position shall be within 180NM (airborne) or 45NM (surface)
|
||||
of the true position.
|
||||
|
||||
Args:
|
||||
@@ -105,6 +183,9 @@ def position_with_ref(msg, lat_ref, lon_ref):
|
||||
|
||||
tc = typecode(msg)
|
||||
|
||||
if tc is None:
|
||||
raise RuntimeError("incorrect or inconsistent message types")
|
||||
|
||||
if 5 <= tc <= 8:
|
||||
return surface_position_with_ref(msg, lat_ref, lon_ref)
|
||||
|
||||
@@ -115,7 +196,7 @@ def position_with_ref(msg, lat_ref, lon_ref):
|
||||
raise RuntimeError("incorrect or inconsistent message types")
|
||||
|
||||
|
||||
def altitude(msg):
|
||||
def altitude(msg: str) -> None | float:
|
||||
"""Decode aircraft altitude.
|
||||
|
||||
Args:
|
||||
@@ -127,7 +208,7 @@ def altitude(msg):
|
||||
"""
|
||||
tc = typecode(msg)
|
||||
|
||||
if tc < 5 or tc == 19 or tc > 22:
|
||||
if tc is None or tc < 5 or tc == 19 or tc > 22:
|
||||
raise RuntimeError("%s: Not a position message" % msg)
|
||||
|
||||
elif tc >= 5 and tc <= 8:
|
||||
@@ -139,39 +220,47 @@ def altitude(msg):
|
||||
return altitude05(msg)
|
||||
|
||||
|
||||
def velocity(msg, source=False):
|
||||
"""Calculate the speed, heading, and vertical rate (handles both airborne or surface message).
|
||||
def velocity(
|
||||
msg: str, source: bool = False
|
||||
) -> None | tuple[None | float, None | float, None | int, str]:
|
||||
"""Calculate the speed, heading, and vertical rate
|
||||
(handles both airborne or surface message).
|
||||
|
||||
Args:
|
||||
msg (str): 28 hexdigits string
|
||||
source (boolean): Include direction and vertical rate sources in return. Default to False.
|
||||
source (boolean): Include direction and vertical rate sources in return.
|
||||
Default to False.
|
||||
If set to True, the function will return six value instead of four.
|
||||
|
||||
Returns:
|
||||
int, float, int, string, [string], [string]: Four or six parameters, including:
|
||||
int, float, int, string, [string], [string]:
|
||||
- Speed (kt)
|
||||
- Angle (degree), either ground track or heading
|
||||
- Vertical rate (ft/min)
|
||||
- Speed type ('GS' for ground speed, 'AS' for airspeed)
|
||||
- [Optional] Direction source ('TRUE_NORTH' or 'MAGENTIC_NORTH')
|
||||
- [Optional] Direction source ('TRUE_NORTH' or 'MAGNETIC_NORTH')
|
||||
- [Optional] Vertical rate source ('BARO' or 'GNSS')
|
||||
|
||||
For surface messages, vertical rate and its respective sources are set to None.
|
||||
For surface messages, vertical rate and its respective sources are set
|
||||
to None.
|
||||
|
||||
"""
|
||||
if 5 <= typecode(msg) <= 8:
|
||||
tc = typecode(msg)
|
||||
error = "incorrect or inconsistent message types, expecting 4<TC<9 or TC=19"
|
||||
if tc is None:
|
||||
raise RuntimeError(error)
|
||||
|
||||
if 5 <= tc <= 8:
|
||||
return surface_velocity(msg, source)
|
||||
|
||||
elif typecode(msg) == 19:
|
||||
elif tc == 19:
|
||||
return airborne_velocity(msg, source)
|
||||
|
||||
else:
|
||||
raise RuntimeError(
|
||||
"incorrect or inconsistent message types, expecting 4<TC<9 or TC=19"
|
||||
)
|
||||
raise RuntimeError(error)
|
||||
|
||||
|
||||
def speed_heading(msg):
|
||||
def speed_heading(msg: str) -> None | tuple[None | float, None | float]:
|
||||
"""Get speed and ground track (or heading) from the velocity message
|
||||
(handles both airborne or surface message)
|
||||
|
||||
@@ -181,11 +270,14 @@ def speed_heading(msg):
|
||||
Returns:
|
||||
(int, float): speed (kt), ground track or heading (degree)
|
||||
"""
|
||||
spd, trk_or_hdg, rocd, tag = velocity(msg)
|
||||
decoded = velocity(msg)
|
||||
if decoded is None:
|
||||
return None
|
||||
spd, trk_or_hdg, rocd, tag = decoded
|
||||
return spd, trk_or_hdg
|
||||
|
||||
|
||||
def oe_flag(msg):
|
||||
def oe_flag(msg: str) -> int:
|
||||
"""Check the odd/even flag. Bit 54, 0 for even, 1 for odd.
|
||||
Args:
|
||||
msg (str): 28 hexdigits string
|
||||
@@ -196,7 +288,7 @@ def oe_flag(msg):
|
||||
return int(msgbin[53])
|
||||
|
||||
|
||||
def version(msg):
|
||||
def version(msg: str) -> int:
|
||||
"""ADS-B Version
|
||||
|
||||
Args:
|
||||
@@ -218,13 +310,15 @@ def version(msg):
|
||||
return version
|
||||
|
||||
|
||||
def nuc_p(msg):
|
||||
"""Calculate NUCp, Navigation Uncertainty Category - Position (ADS-B version 1)
|
||||
def nuc_p(msg: str) -> tuple[int, None | float, None | int, None | int]:
|
||||
"""Calculate NUCp, Navigation Uncertainty Category - Position
|
||||
(ADS-B version 1)
|
||||
|
||||
Args:
|
||||
msg (str): 28 hexdigits string,
|
||||
|
||||
Returns:
|
||||
int: NUCp, Navigation Uncertainty Category (position)
|
||||
int: Horizontal Protection Limit
|
||||
int: 95% Containment Radius - Horizontal (meters)
|
||||
int: 95% Containment Radius - Vertical (meters)
|
||||
@@ -232,7 +326,7 @@ def nuc_p(msg):
|
||||
"""
|
||||
tc = typecode(msg)
|
||||
|
||||
if typecode(msg) < 5 or typecode(msg) > 22:
|
||||
if tc is None or tc < 5 or tc is None or tc > 22:
|
||||
raise RuntimeError(
|
||||
"%s: Not a surface position message (5<TC<8), \
|
||||
airborne position message (8<TC<19), \
|
||||
@@ -240,27 +334,36 @@ def nuc_p(msg):
|
||||
% msg
|
||||
)
|
||||
|
||||
try:
|
||||
NUCp = uncertainty.TC_NUCp_lookup[tc]
|
||||
HPL = uncertainty.NUCp[NUCp]["HPL"]
|
||||
RCu = uncertainty.NUCp[NUCp]["RCu"]
|
||||
RCv = uncertainty.NUCp[NUCp]["RCv"]
|
||||
except KeyError:
|
||||
NUCp = uncertainty.TC_NUCp_lookup[tc]
|
||||
index = uncertainty.NUCp.get(NUCp, None)
|
||||
|
||||
if index is not None:
|
||||
HPL = index["HPL"]
|
||||
RCu = index["RCu"]
|
||||
RCv = index["RCv"]
|
||||
else:
|
||||
HPL, RCu, RCv = uncertainty.NA, uncertainty.NA, uncertainty.NA
|
||||
|
||||
if tc in [20, 21]:
|
||||
RCv = uncertainty.NA
|
||||
RCv = uncertainty.NA
|
||||
|
||||
return HPL, RCu, RCv
|
||||
# RCv only available for GNSS height
|
||||
if tc == 20:
|
||||
RCv = 4
|
||||
elif tc == 21:
|
||||
RCv = 15
|
||||
|
||||
return NUCp, HPL, RCu, RCv
|
||||
|
||||
|
||||
def nuc_v(msg):
|
||||
"""Calculate NUCv, Navigation Uncertainty Category - Velocity (ADS-B version 1)
|
||||
def nuc_v(msg: str) -> tuple[int, None | float, None | float]:
|
||||
"""Calculate NUCv, Navigation Uncertainty Category - Velocity
|
||||
(ADS-B version 1)
|
||||
|
||||
Args:
|
||||
msg (str): 28 hexdigits string,
|
||||
|
||||
Returns:
|
||||
int: NUCv, Navigation Uncertainty Category (velocity)
|
||||
int or string: 95% Horizontal Velocity Error
|
||||
int or string: 95% Vertical Velocity Error
|
||||
"""
|
||||
@@ -273,17 +376,18 @@ def nuc_v(msg):
|
||||
|
||||
msgbin = common.hex2bin(msg)
|
||||
NUCv = common.bin2int(msgbin[42:45])
|
||||
index = uncertainty.NUCv.get(NUCv, None)
|
||||
|
||||
try:
|
||||
HVE = uncertainty.NUCv[NUCv]["HVE"]
|
||||
VVE = uncertainty.NUCv[NUCv]["VVE"]
|
||||
except KeyError:
|
||||
if index is not None:
|
||||
HVE = index["HVE"]
|
||||
VVE = index["VVE"]
|
||||
else:
|
||||
HVE, VVE = uncertainty.NA, uncertainty.NA
|
||||
|
||||
return HVE, VVE
|
||||
return NUCv, HVE, VVE
|
||||
|
||||
|
||||
def nic_v1(msg, NICs):
|
||||
def nic_v1(msg: str, NICs: int) -> tuple[int, None | float, None | float]:
|
||||
"""Calculate NIC, navigation integrity category, for ADS-B version 1
|
||||
|
||||
Args:
|
||||
@@ -291,10 +395,12 @@ def nic_v1(msg, NICs):
|
||||
NICs (int or string): NIC supplement
|
||||
|
||||
Returns:
|
||||
int: NIC, Navigation Integrity Category
|
||||
int or string: Horizontal Radius of Containment
|
||||
int or string: Vertical Protection Limit
|
||||
"""
|
||||
if typecode(msg) < 5 or typecode(msg) > 22:
|
||||
tc = typecode(msg)
|
||||
if tc is None or tc < 5 or tc > 22:
|
||||
raise RuntimeError(
|
||||
"%s: Not a surface position message (5<TC<8), \
|
||||
airborne position message (8<TC<19), \
|
||||
@@ -302,33 +408,37 @@ def nic_v1(msg, NICs):
|
||||
% msg
|
||||
)
|
||||
|
||||
tc = typecode(msg)
|
||||
NIC = uncertainty.TC_NICv1_lookup[tc]
|
||||
|
||||
if isinstance(NIC, dict):
|
||||
NIC = NIC[NICs]
|
||||
|
||||
try:
|
||||
Rc = uncertainty.NICv1[NIC][NICs]["Rc"]
|
||||
VPL = uncertainty.NICv1[NIC][NICs]["VPL"]
|
||||
except KeyError:
|
||||
Rc, VPL = uncertainty.NA, uncertainty.NA
|
||||
d_index = uncertainty.NICv1.get(NIC, None)
|
||||
Rc, VPL = uncertainty.NA, uncertainty.NA
|
||||
|
||||
return Rc, VPL
|
||||
if d_index is not None:
|
||||
index = d_index.get(NICs, None)
|
||||
if index is not None:
|
||||
Rc = index["Rc"]
|
||||
VPL = index["VPL"]
|
||||
|
||||
return NIC, Rc, VPL
|
||||
|
||||
|
||||
def nic_v2(msg, NICa, NICbc):
|
||||
def nic_v2(msg: str, NICa: int, NICbc: int) -> tuple[int, int]:
|
||||
"""Calculate NIC, navigation integrity category, for ADS-B version 2
|
||||
|
||||
Args:
|
||||
msg (str): 28 hexdigits string
|
||||
NICa (int or string): NIC supplement - A
|
||||
NICbc (int or srting): NIC supplement - B or C
|
||||
NICbc (int or string): NIC supplement - B or C
|
||||
|
||||
Returns:
|
||||
int: NIC, Navigation Integrity Category
|
||||
int or string: Horizontal Radius of Containment
|
||||
"""
|
||||
if typecode(msg) < 5 or typecode(msg) > 22:
|
||||
tc = typecode(msg)
|
||||
if tc is None or tc < 5 or tc > 22:
|
||||
raise RuntimeError(
|
||||
"%s: Not a surface position message (5<TC<8), \
|
||||
airborne position message (8<TC<19), \
|
||||
@@ -336,7 +446,6 @@ def nic_v2(msg, NICa, NICbc):
|
||||
% msg
|
||||
)
|
||||
|
||||
tc = typecode(msg)
|
||||
NIC = uncertainty.TC_NICv2_lookup[tc]
|
||||
|
||||
if 20 <= tc <= 22:
|
||||
@@ -352,10 +461,10 @@ def nic_v2(msg, NICa, NICbc):
|
||||
except KeyError:
|
||||
Rc = uncertainty.NA
|
||||
|
||||
return Rc
|
||||
return NIC, Rc # type: ignore
|
||||
|
||||
|
||||
def nic_s(msg):
|
||||
def nic_s(msg: str) -> int:
|
||||
"""Obtain NIC supplement bit, TC=31 message
|
||||
|
||||
Args:
|
||||
@@ -377,7 +486,7 @@ def nic_s(msg):
|
||||
return nic_s
|
||||
|
||||
|
||||
def nic_a_c(msg):
|
||||
def nic_a_c(msg: str) -> tuple[int, int]:
|
||||
"""Obtain NICa/c, navigation integrity category supplements a and c
|
||||
|
||||
Args:
|
||||
@@ -400,7 +509,7 @@ def nic_a_c(msg):
|
||||
return nic_a, nic_c
|
||||
|
||||
|
||||
def nic_b(msg):
|
||||
def nic_b(msg: str) -> int:
|
||||
"""Obtain NICb, navigation integrity category supplement-b
|
||||
|
||||
Args:
|
||||
@@ -411,7 +520,7 @@ def nic_b(msg):
|
||||
"""
|
||||
tc = typecode(msg)
|
||||
|
||||
if tc < 9 or tc > 18:
|
||||
if tc is None or tc < 9 or tc > 18:
|
||||
raise RuntimeError(
|
||||
"%s: Not a airborne position message, expecting 8<TC<19" % msg
|
||||
)
|
||||
@@ -422,15 +531,18 @@ def nic_b(msg):
|
||||
return nic_b
|
||||
|
||||
|
||||
def nac_p(msg):
|
||||
def nac_p(msg: str) -> tuple[int, int | None, int | None]:
|
||||
"""Calculate NACp, Navigation Accuracy Category - Position
|
||||
|
||||
Args:
|
||||
msg (str): 28 hexdigits string, TC = 29 or 31
|
||||
|
||||
Returns:
|
||||
int or string: 95% horizontal accuracy bounds, Estimated Position Uncertainty
|
||||
int or string: 95% vertical accuracy bounds, Vertical Estimated Position Uncertainty
|
||||
int: NACp, Navigation Accuracy Category (position)
|
||||
int or string: 95% horizontal accuracy bounds,
|
||||
Estimated Position Uncertainty
|
||||
int or string: 95% vertical accuracy bounds,
|
||||
Vertical Estimated Position Uncertainty
|
||||
"""
|
||||
tc = typecode(msg)
|
||||
|
||||
@@ -454,18 +566,21 @@ def nac_p(msg):
|
||||
except KeyError:
|
||||
EPU, VEPU = uncertainty.NA, uncertainty.NA
|
||||
|
||||
return EPU, VEPU
|
||||
return NACp, EPU, VEPU
|
||||
|
||||
|
||||
def nac_v(msg):
|
||||
def nac_v(msg: str) -> tuple[int, float | None, float | None]:
|
||||
"""Calculate NACv, Navigation Accuracy Category - Velocity
|
||||
|
||||
Args:
|
||||
msg (str): 28 hexdigits string, TC = 19
|
||||
|
||||
Returns:
|
||||
int or string: 95% horizontal accuracy bounds for velocity, Horizontal Figure of Merit
|
||||
int or string: 95% vertical accuracy bounds for velocity, Vertical Figure of Merit
|
||||
int: NACv, Navigation Accuracy Category (velocity)
|
||||
int or string: 95% horizontal accuracy bounds for velocity,
|
||||
Horizontal Figure of Merit
|
||||
int or string: 95% vertical accuracy bounds for velocity,
|
||||
Vertical Figure of Merit
|
||||
"""
|
||||
tc = typecode(msg)
|
||||
|
||||
@@ -483,18 +598,23 @@ def nac_v(msg):
|
||||
except KeyError:
|
||||
HFOMr, VFOMr = uncertainty.NA, uncertainty.NA
|
||||
|
||||
return HFOMr, VFOMr
|
||||
return NACv, HFOMr, VFOMr
|
||||
|
||||
|
||||
def sil(msg, version):
|
||||
def sil(
|
||||
msg: str,
|
||||
version: None | int,
|
||||
) -> tuple[float | None, float | None, str]:
|
||||
"""Calculate SIL, Surveillance Integrity Level
|
||||
|
||||
Args:
|
||||
msg (str): 28 hexdigits string with TC = 29, 31
|
||||
|
||||
Returns:
|
||||
int or string: Probability of exceeding Horizontal Radius of Containment RCu
|
||||
int or string: Probability of exceeding Vertical Integrity Containment Region VPL
|
||||
int or string:
|
||||
Probability of exceeding Horizontal Radius of Containment RCu
|
||||
int or string:
|
||||
Probability of exceeding Vertical Integrity Containment Region VPL
|
||||
string: SIL supplement based on per "hour" or "sample", or 'unknown'
|
||||
"""
|
||||
tc = typecode(msg)
|
||||
|
||||
@@ -1,5 +1,98 @@
|
||||
"""
|
||||
Decoding all call replies DF=11
|
||||
Decode all-call reply messages, with downlink format 11
|
||||
"""
|
||||
|
||||
[To be implemented]
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
from typing import Callable, TypeVar
|
||||
|
||||
from .. import common
|
||||
|
||||
T = TypeVar("T")
|
||||
F = Callable[[str], T]
|
||||
|
||||
|
||||
def _checkdf(func: F[T]) -> F[T]:
|
||||
|
||||
"""Ensure downlink format is 11."""
|
||||
|
||||
def wrapper(msg: str) -> T:
|
||||
df = common.df(msg)
|
||||
if df != 11:
|
||||
raise RuntimeError(
|
||||
"Incorrect downlink format, expect 11, got {}".format(df)
|
||||
)
|
||||
return func(msg)
|
||||
|
||||
return wrapper
|
||||
|
||||
|
||||
@_checkdf
|
||||
def icao(msg: str) -> None | str:
|
||||
"""Decode transponder code (ICAO address).
|
||||
|
||||
Args:
|
||||
msg (str): 14 hexdigits string
|
||||
Returns:
|
||||
string: ICAO address
|
||||
|
||||
"""
|
||||
return common.icao(msg)
|
||||
|
||||
|
||||
@_checkdf
|
||||
def interrogator(msg: str) -> str:
|
||||
"""Decode interrogator identifier code.
|
||||
|
||||
Args:
|
||||
msg (str): 14 hexdigits string
|
||||
Returns:
|
||||
int: interrogator identifier code
|
||||
|
||||
"""
|
||||
# the CRC remainder contains the CL and IC field.
|
||||
# the top three bits are CL field and last four bits are IC field.
|
||||
remainder = common.crc(msg)
|
||||
if remainder > 79:
|
||||
IC = "corrupt IC"
|
||||
elif remainder < 16:
|
||||
IC = "II" + str(remainder)
|
||||
else:
|
||||
IC = "SI" + str(remainder - 16)
|
||||
return IC
|
||||
|
||||
|
||||
@_checkdf
|
||||
def capability(msg: str) -> tuple[int, None | str]:
|
||||
"""Decode transponder capability.
|
||||
|
||||
Args:
|
||||
msg (str): 14 hexdigits string
|
||||
Returns:
|
||||
int, str: transponder capability, description
|
||||
|
||||
"""
|
||||
msgbin = common.hex2bin(msg)
|
||||
ca = common.bin2int(msgbin[5:8])
|
||||
|
||||
if ca == 0:
|
||||
text = "level 1 transponder"
|
||||
elif ca == 4:
|
||||
text = "level 2 transponder, ability to set CA to 7, on ground"
|
||||
elif ca == 5:
|
||||
text = "level 2 transponder, ability to set CA to 7, airborne"
|
||||
elif ca == 6:
|
||||
text = (
|
||||
"evel 2 transponder, ability to set CA to 7, "
|
||||
"either airborne or ground"
|
||||
)
|
||||
elif ca == 7:
|
||||
text = (
|
||||
"Downlink Request value is 0, "
|
||||
"or the Flight Status is 2, 3, 4 or 5, "
|
||||
"either airborne or on the ground"
|
||||
)
|
||||
else:
|
||||
text = None
|
||||
|
||||
return ca, text
|
||||
|
||||
@@ -18,16 +18,13 @@
|
||||
Common functions for Mode-S decoding
|
||||
"""
|
||||
|
||||
from typing import Optional
|
||||
|
||||
import numpy as np
|
||||
|
||||
from pyModeS.extra import aero
|
||||
from pyModeS import common
|
||||
|
||||
from pyModeS.decoder.bds import (
|
||||
bds05,
|
||||
bds06,
|
||||
bds08,
|
||||
bds09,
|
||||
from ... import common
|
||||
from ...extra import aero
|
||||
from . import ( # noqa: F401
|
||||
bds10,
|
||||
bds17,
|
||||
bds20,
|
||||
@@ -36,12 +33,15 @@ from pyModeS.decoder.bds import (
|
||||
bds44,
|
||||
bds45,
|
||||
bds50,
|
||||
bds53,
|
||||
bds60,
|
||||
bds61,
|
||||
bds62,
|
||||
)
|
||||
|
||||
|
||||
def is50or60(msg, spd_ref, trk_ref, alt_ref):
|
||||
def is50or60(
|
||||
msg: str, spd_ref: float, trk_ref: float, alt_ref: float
|
||||
) -> Optional[str]:
|
||||
"""Use reference ground speed and trk to determine BDS50 and DBS60.
|
||||
|
||||
Args:
|
||||
@@ -51,7 +51,8 @@ def is50or60(msg, spd_ref, trk_ref, alt_ref):
|
||||
alt_ref (float): reference altitude (ADS-B altitude), ft
|
||||
|
||||
Returns:
|
||||
String or None: BDS version, or possible versions, or None if nothing matches.
|
||||
String or None: BDS version, or possible versions,
|
||||
or None if nothing matches.
|
||||
|
||||
"""
|
||||
|
||||
@@ -60,25 +61,34 @@ def is50or60(msg, spd_ref, trk_ref, alt_ref):
|
||||
vy = v * np.cos(np.radians(angle))
|
||||
return vx, vy
|
||||
|
||||
# message must be both BDS 50 and 60 before processing
|
||||
if not (bds50.is50(msg) and bds60.is60(msg)):
|
||||
return None
|
||||
|
||||
h50 = bds50.trk50(msg)
|
||||
v50 = bds50.gs50(msg)
|
||||
|
||||
if h50 is None or v50 is None:
|
||||
return "BDS50,BDS60"
|
||||
|
||||
# --- assuming BDS60 ---
|
||||
h60 = bds60.hdg60(msg)
|
||||
m60 = bds60.mach60(msg)
|
||||
i60 = bds60.ias60(msg)
|
||||
|
||||
# additional check now knowing the altitude
|
||||
if (m60 is not None) and (i60 is not None):
|
||||
ias_ = aero.mach2cas(m60, alt_ref * aero.ft) / aero.kts
|
||||
if abs(i60 - ias_) > 20:
|
||||
return "BDS50"
|
||||
|
||||
if h60 is None or (m60 is None and i60 is None):
|
||||
return "BDS50,BDS60"
|
||||
|
||||
m60 = np.nan if m60 is None else m60
|
||||
i60 = np.nan if i60 is None else i60
|
||||
|
||||
# --- assuming BDS50 ---
|
||||
h50 = bds50.trk50(msg)
|
||||
v50 = bds50.gs50(msg)
|
||||
|
||||
if h50 is None or v50 is None:
|
||||
return "BDS50,BDS60"
|
||||
|
||||
XY5 = vxy(v50 * aero.kts, h50)
|
||||
XY6m = vxy(aero.mach2tas(m60, alt_ref * aero.ft), h60)
|
||||
XY6i = vxy(aero.cas2tas(i60 * aero.kts, alt_ref * aero.ft), h60)
|
||||
@@ -104,15 +114,17 @@ def is50or60(msg, spd_ref, trk_ref, alt_ref):
|
||||
return BDS
|
||||
|
||||
|
||||
def infer(msg, mrar=False):
|
||||
def infer(msg: str, mrar: bool = False) -> Optional[str]:
|
||||
"""Estimate the most likely BDS code of an message.
|
||||
|
||||
Args:
|
||||
msg (str): 28 hexdigits string
|
||||
mrar (bool): Also infer MRAR (BDS 44) and MHR (BDS 45). Defaults to False.
|
||||
mrar (bool): Also infer MRAR (BDS 44) and MHR (BDS 45).
|
||||
Defaults to False.
|
||||
|
||||
Returns:
|
||||
String or None: BDS version, or possible versions, or None if nothing matches.
|
||||
String or None: BDS version, or possible versions,
|
||||
or None if nothing matches.
|
||||
|
||||
"""
|
||||
df = common.df(msg)
|
||||
@@ -123,6 +135,8 @@ def infer(msg, mrar=False):
|
||||
# For ADS-B / Mode-S extended squitter
|
||||
if df == 17:
|
||||
tc = common.typecode(msg)
|
||||
if tc is None:
|
||||
return None
|
||||
|
||||
if 1 <= tc <= 4:
|
||||
return "BDS08" # identification and category
|
||||
|
||||
@@ -1,14 +1,20 @@
|
||||
# ------------------------------------------
|
||||
# BDS 0,5
|
||||
# ADS-B TC=9-18
|
||||
# Airborn position
|
||||
# Airborne position
|
||||
# ------------------------------------------
|
||||
|
||||
from pyModeS import common
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from ... import common
|
||||
|
||||
|
||||
def airborne_position(msg0, msg1, t0, t1):
|
||||
"""Decode airborn position from a pair of even and odd position message
|
||||
def airborne_position(
|
||||
msg0: str, msg1: str, t0: int | datetime, t1: int | datetime
|
||||
) -> None | tuple[float, float]:
|
||||
"""Decode airborne position from a pair of even and odd position message
|
||||
|
||||
Args:
|
||||
msg0 (string): even message (28 hexdigits)
|
||||
@@ -34,13 +40,13 @@ def airborne_position(msg0, msg1, t0, t1):
|
||||
raise RuntimeError("Both even and odd CPR frames are required.")
|
||||
|
||||
# 131072 is 2^17, since CPR lat and lon are 17 bits each.
|
||||
cprlat_even = common.bin2int(mb0[22:39]) / 131072.0
|
||||
cprlon_even = common.bin2int(mb0[39:56]) / 131072.0
|
||||
cprlat_odd = common.bin2int(mb1[22:39]) / 131072.0
|
||||
cprlon_odd = common.bin2int(mb1[39:56]) / 131072.0
|
||||
cprlat_even = common.bin2int(mb0[22:39]) / 131072
|
||||
cprlon_even = common.bin2int(mb0[39:56]) / 131072
|
||||
cprlat_odd = common.bin2int(mb1[22:39]) / 131072
|
||||
cprlon_odd = common.bin2int(mb1[39:56]) / 131072
|
||||
|
||||
air_d_lat_even = 360.0 / 60
|
||||
air_d_lat_odd = 360.0 / 59
|
||||
air_d_lat_even = 360 / 60
|
||||
air_d_lat_odd = 360 / 59
|
||||
|
||||
# compute latitude index 'j'
|
||||
j = common.floor(59 * cprlat_even - 60 * cprlat_odd + 0.5)
|
||||
@@ -59,18 +65,19 @@ def airborne_position(msg0, msg1, t0, t1):
|
||||
return None
|
||||
|
||||
# compute ni, longitude index m, and longitude
|
||||
if t0 > t1:
|
||||
# (people pass int+int or datetime+datetime)
|
||||
if t0 > t1: # type: ignore
|
||||
lat = lat_even
|
||||
nl = common.cprNL(lat)
|
||||
ni = max(common.cprNL(lat) - 0, 1)
|
||||
m = common.floor(cprlon_even * (nl - 1) - cprlon_odd * nl + 0.5)
|
||||
lon = (360.0 / ni) * (m % ni + cprlon_even)
|
||||
lon = (360 / ni) * (m % ni + cprlon_even)
|
||||
else:
|
||||
lat = lat_odd
|
||||
nl = common.cprNL(lat)
|
||||
ni = max(common.cprNL(lat) - 1, 1)
|
||||
m = common.floor(cprlon_even * (nl - 1) - cprlon_odd * nl + 0.5)
|
||||
lon = (360.0 / ni) * (m % ni + cprlon_odd)
|
||||
lon = (360 / ni) * (m % ni + cprlon_odd)
|
||||
|
||||
if lon > 180:
|
||||
lon = lon - 360
|
||||
@@ -78,11 +85,13 @@ def airborne_position(msg0, msg1, t0, t1):
|
||||
return round(lat, 5), round(lon, 5)
|
||||
|
||||
|
||||
def airborne_position_with_ref(msg, lat_ref, lon_ref):
|
||||
def airborne_position_with_ref(
|
||||
msg: str, lat_ref: float, lon_ref: float
|
||||
) -> tuple[float, float]:
|
||||
"""Decode airborne position with only one message,
|
||||
knowing reference nearby location, such as previously calculated location,
|
||||
ground station, or airport location, etc. The reference position shall
|
||||
be with in 180NM of the true position.
|
||||
be within 180NM of the true position.
|
||||
|
||||
Args:
|
||||
msg (str): even message (28 hexdigits)
|
||||
@@ -95,11 +104,11 @@ def airborne_position_with_ref(msg, lat_ref, lon_ref):
|
||||
|
||||
mb = common.hex2bin(msg)[32:]
|
||||
|
||||
cprlat = common.bin2int(mb[22:39]) / 131072.0
|
||||
cprlon = common.bin2int(mb[39:56]) / 131072.0
|
||||
cprlat = common.bin2int(mb[22:39]) / 131072
|
||||
cprlon = common.bin2int(mb[39:56]) / 131072
|
||||
|
||||
i = int(mb[21])
|
||||
d_lat = 360.0 / 59 if i else 360.0 / 60
|
||||
d_lat = 360 / 59 if i else 360 / 60
|
||||
|
||||
j = common.floor(lat_ref / d_lat) + common.floor(
|
||||
0.5 + ((lat_ref % d_lat) / d_lat) - cprlat
|
||||
@@ -110,9 +119,9 @@ def airborne_position_with_ref(msg, lat_ref, lon_ref):
|
||||
ni = common.cprNL(lat) - i
|
||||
|
||||
if ni > 0:
|
||||
d_lon = 360.0 / ni
|
||||
d_lon = 360 / ni
|
||||
else:
|
||||
d_lon = 360.0
|
||||
d_lon = 360
|
||||
|
||||
m = common.floor(lon_ref / d_lon) + common.floor(
|
||||
0.5 + ((lon_ref % d_lon) / d_lon) - cprlon
|
||||
@@ -123,7 +132,7 @@ def airborne_position_with_ref(msg, lat_ref, lon_ref):
|
||||
return round(lat, 5), round(lon, 5)
|
||||
|
||||
|
||||
def altitude(msg):
|
||||
def altitude(msg: str) -> None | int:
|
||||
"""Decode aircraft altitude
|
||||
|
||||
Args:
|
||||
@@ -135,21 +144,14 @@ def altitude(msg):
|
||||
|
||||
tc = common.typecode(msg)
|
||||
|
||||
if tc < 9 or tc == 19 or tc > 22:
|
||||
raise RuntimeError("%s: Not a airborn position message" % msg)
|
||||
if tc is None or tc < 9 or tc == 19 or tc > 22:
|
||||
raise RuntimeError("%s: Not an airborne position message" % msg)
|
||||
|
||||
mb = common.hex2bin(msg)[32:]
|
||||
altbin = mb[8:20]
|
||||
|
||||
if tc < 19:
|
||||
# barometric altitude
|
||||
q = mb[15]
|
||||
if q:
|
||||
n = common.bin2int(mb[8:15] + mb[16:20])
|
||||
alt = n * 25 - 1000
|
||||
else:
|
||||
alt = None
|
||||
altcode = altbin[0:6] + "0" + altbin[6:]
|
||||
return common.altitude(altcode)
|
||||
else:
|
||||
# GNSS altitude, meters -> feet
|
||||
alt = common.bin2int(mb[8:20]) * 3.28084
|
||||
|
||||
return alt
|
||||
return common.bin2int(altbin) * 3.28084 # type: ignore
|
||||
|
||||
@@ -1,13 +1,25 @@
|
||||
# ------------------------------------------
|
||||
# BDS 0,6
|
||||
# ADS-B TC=5-8
|
||||
# Surface movment
|
||||
# Surface movement
|
||||
# ------------------------------------------
|
||||
|
||||
from pyModeS import common
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from ... import common
|
||||
|
||||
|
||||
def surface_position(msg0, msg1, t0, t1, lat_ref, lon_ref):
|
||||
def surface_position(
|
||||
msg0: str,
|
||||
msg1: str,
|
||||
t0: int | datetime,
|
||||
t1: int | datetime,
|
||||
lat_ref: float,
|
||||
lon_ref: float,
|
||||
) -> None | tuple[float, float]:
|
||||
|
||||
"""Decode surface position from a pair of even and odd position message,
|
||||
the lat/lon of receiver must be provided to yield the correct solution.
|
||||
|
||||
@@ -27,13 +39,13 @@ def surface_position(msg0, msg1, t0, t1, lat_ref, lon_ref):
|
||||
msgbin1 = common.hex2bin(msg1)
|
||||
|
||||
# 131072 is 2^17, since CPR lat and lon are 17 bits each.
|
||||
cprlat_even = common.bin2int(msgbin0[54:71]) / 131072.0
|
||||
cprlon_even = common.bin2int(msgbin0[71:88]) / 131072.0
|
||||
cprlat_odd = common.bin2int(msgbin1[54:71]) / 131072.0
|
||||
cprlon_odd = common.bin2int(msgbin1[71:88]) / 131072.0
|
||||
cprlat_even = common.bin2int(msgbin0[54:71]) / 131072
|
||||
cprlon_even = common.bin2int(msgbin0[71:88]) / 131072
|
||||
cprlat_odd = common.bin2int(msgbin1[54:71]) / 131072
|
||||
cprlon_odd = common.bin2int(msgbin1[71:88]) / 131072
|
||||
|
||||
air_d_lat_even = 90.0 / 60
|
||||
air_d_lat_odd = 90.0 / 59
|
||||
air_d_lat_even = 90 / 60
|
||||
air_d_lat_odd = 90 / 59
|
||||
|
||||
# compute latitude index 'j'
|
||||
j = common.floor(59 * cprlat_even - 60 * cprlat_odd + 0.5)
|
||||
@@ -43,8 +55,8 @@ def surface_position(msg0, msg1, t0, t1, lat_ref, lon_ref):
|
||||
lat_odd_n = float(air_d_lat_odd * (j % 59 + cprlat_odd))
|
||||
|
||||
# solution for north hemisphere
|
||||
lat_even_s = lat_even_n - 90.0
|
||||
lat_odd_s = lat_odd_n - 90.0
|
||||
lat_even_s = lat_even_n - 90
|
||||
lat_odd_s = lat_odd_n - 90
|
||||
|
||||
# chose which solution corrispondes to receiver location
|
||||
lat_even = lat_even_n if lat_ref > 0 else lat_even_s
|
||||
@@ -55,38 +67,41 @@ def surface_position(msg0, msg1, t0, t1, lat_ref, lon_ref):
|
||||
return None
|
||||
|
||||
# compute ni, longitude index m, and longitude
|
||||
if t0 > t1:
|
||||
# (people pass int+int or datetime+datetime)
|
||||
if t0 > t1: # type: ignore
|
||||
lat = lat_even
|
||||
nl = common.cprNL(lat_even)
|
||||
ni = max(common.cprNL(lat_even) - 0, 1)
|
||||
m = common.floor(cprlon_even * (nl - 1) - cprlon_odd * nl + 0.5)
|
||||
lon = (90.0 / ni) * (m % ni + cprlon_even)
|
||||
lon = (90 / ni) * (m % ni + cprlon_even)
|
||||
else:
|
||||
lat = lat_odd
|
||||
nl = common.cprNL(lat_odd)
|
||||
ni = max(common.cprNL(lat_odd) - 1, 1)
|
||||
m = common.floor(cprlon_even * (nl - 1) - cprlon_odd * nl + 0.5)
|
||||
lon = (90.0 / ni) * (m % ni + cprlon_odd)
|
||||
lon = (90 / ni) * (m % ni + cprlon_odd)
|
||||
|
||||
# four possible longitude solutions
|
||||
lons = [lon, lon + 90.0, lon + 180.0, lon + 270.0]
|
||||
lons = [lon, lon + 90, lon + 180, lon + 270]
|
||||
|
||||
# make sure lons are between -180 and 180
|
||||
lons = [(l + 180) % 360 - 180 for l in lons]
|
||||
lons = [(lon + 180) % 360 - 180 for lon in lons]
|
||||
|
||||
# the closest solution to receiver is the correct one
|
||||
dls = [abs(lon_ref - l) for l in lons]
|
||||
dls = [abs(lon_ref - lon) for lon in lons]
|
||||
imin = min(range(4), key=dls.__getitem__)
|
||||
lon = lons[imin]
|
||||
|
||||
return round(lat, 5), round(lon, 5)
|
||||
|
||||
|
||||
def surface_position_with_ref(msg, lat_ref, lon_ref):
|
||||
def surface_position_with_ref(
|
||||
msg: str, lat_ref: float, lon_ref: float
|
||||
) -> tuple[float, float]:
|
||||
"""Decode surface position with only one message,
|
||||
knowing reference nearby location, such as previously calculated location,
|
||||
ground station, or airport location, etc. The reference position shall
|
||||
be with in 45NM of the true position.
|
||||
be within 45NM of the true position.
|
||||
|
||||
Args:
|
||||
msg (str): even message (28 hexdigits)
|
||||
@@ -99,11 +114,11 @@ def surface_position_with_ref(msg, lat_ref, lon_ref):
|
||||
|
||||
mb = common.hex2bin(msg)[32:]
|
||||
|
||||
cprlat = common.bin2int(mb[22:39]) / 131072.0
|
||||
cprlon = common.bin2int(mb[39:56]) / 131072.0
|
||||
cprlat = common.bin2int(mb[22:39]) / 131072
|
||||
cprlon = common.bin2int(mb[39:56]) / 131072
|
||||
|
||||
i = int(mb[21])
|
||||
d_lat = 90.0 / 59 if i else 90.0 / 60
|
||||
d_lat = 90 / 59 if i else 90 / 60
|
||||
|
||||
j = common.floor(lat_ref / d_lat) + common.floor(
|
||||
0.5 + ((lat_ref % d_lat) / d_lat) - cprlat
|
||||
@@ -114,9 +129,9 @@ def surface_position_with_ref(msg, lat_ref, lon_ref):
|
||||
ni = common.cprNL(lat) - i
|
||||
|
||||
if ni > 0:
|
||||
d_lon = 90.0 / ni
|
||||
d_lon = 90 / ni
|
||||
else:
|
||||
d_lon = 90.0
|
||||
d_lon = 90
|
||||
|
||||
m = common.floor(lon_ref / d_lon) + common.floor(
|
||||
0.5 + ((lon_ref % d_lon) / d_lon) - cprlon
|
||||
@@ -127,16 +142,19 @@ def surface_position_with_ref(msg, lat_ref, lon_ref):
|
||||
return round(lat, 5), round(lon, 5)
|
||||
|
||||
|
||||
def surface_velocity(msg, source=False):
|
||||
def surface_velocity(
|
||||
msg: str, source: bool = False
|
||||
) -> tuple[None | float, float, int, str]:
|
||||
"""Decode surface velocity from a surface position message
|
||||
|
||||
Args:
|
||||
msg (str): 28 hexdigits string
|
||||
source (boolean): Include direction and vertical rate sources in return. Default to False.
|
||||
source (boolean): Include direction and vertical rate sources in return.
|
||||
Default to False.
|
||||
If set to True, the function will return six value instead of four.
|
||||
|
||||
Returns:
|
||||
int, float, int, string, [string], [string]: Four or six parameters, including:
|
||||
int, float, int, string, [string], [string]:
|
||||
- Speed (kt)
|
||||
- Angle (degree), ground track
|
||||
- Vertical rate, always 0
|
||||
@@ -145,7 +163,8 @@ def surface_velocity(msg, source=False):
|
||||
- [Optional] Vertical rate source (None)
|
||||
|
||||
"""
|
||||
if common.typecode(msg) < 5 or common.typecode(msg) > 8:
|
||||
tc = common.typecode(msg)
|
||||
if tc is None or tc < 5 or tc > 8:
|
||||
raise RuntimeError("%s: Not a surface message, expecting 5<TC<8" % msg)
|
||||
|
||||
mb = common.hex2bin(msg)[32:]
|
||||
@@ -153,7 +172,7 @@ def surface_velocity(msg, source=False):
|
||||
# ground track
|
||||
trk_status = int(mb[12])
|
||||
if trk_status == 1:
|
||||
trk = common.bin2int(mb[13:20]) * 360.0 / 128.0
|
||||
trk = common.bin2int(mb[13:20]) * 360 / 128
|
||||
trk = round(trk, 1)
|
||||
else:
|
||||
trk = None
|
||||
@@ -164,18 +183,17 @@ def surface_velocity(msg, source=False):
|
||||
if mov == 0 or mov > 124:
|
||||
spd = None
|
||||
elif mov == 1:
|
||||
spd = 0
|
||||
spd = 0.0
|
||||
elif mov == 124:
|
||||
spd = 175
|
||||
spd = 175.0
|
||||
else:
|
||||
movs = [2, 9, 13, 39, 94, 109, 124]
|
||||
kts = [0.125, 1, 2, 15, 70, 100, 175]
|
||||
i = next(m[0] for m in enumerate(movs) if m[1] > mov)
|
||||
step = (kts[i] - kts[i - 1]) * 1.0 / (movs[i] - movs[i - 1])
|
||||
spd = kts[i - 1] + (mov - movs[i - 1]) * step
|
||||
spd = round(spd, 2)
|
||||
mov_lb = [2, 9, 13, 39, 94, 109, 124]
|
||||
kts_lb: list[float] = [0.125, 1, 2, 15, 70, 100, 175]
|
||||
step: list[float] = [0.125, 0.25, 0.5, 1, 2, 5]
|
||||
i = next(m[0] for m in enumerate(mov_lb) if m[1] > mov)
|
||||
spd = kts_lb[i - 1] + (mov - mov_lb[i - 1]) * step[i - 1]
|
||||
|
||||
if source:
|
||||
return spd, trk, 0, "GS", "TRUE_NORTH", None
|
||||
return spd, trk, 0, "GS", "TRUE_NORTH", None # type: ignore
|
||||
else:
|
||||
return spd, trk, 0, "GS"
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
# ------------------------------------------
|
||||
# BDS 0,8
|
||||
# ADS-B TC=1-4
|
||||
# Aircraft identitification and category
|
||||
# Aircraft identification and category
|
||||
# ------------------------------------------
|
||||
|
||||
from pyModeS import common
|
||||
from ... import common
|
||||
|
||||
|
||||
def category(msg):
|
||||
def category(msg: str) -> int:
|
||||
"""Aircraft category number
|
||||
|
||||
Args:
|
||||
@@ -17,7 +17,8 @@ def category(msg):
|
||||
int: category number
|
||||
"""
|
||||
|
||||
if common.typecode(msg) < 1 or common.typecode(msg) > 4:
|
||||
tc = common.typecode(msg)
|
||||
if tc is None or tc < 1 or tc > 4:
|
||||
raise RuntimeError("%s: Not a identification message" % msg)
|
||||
|
||||
msgbin = common.hex2bin(msg)
|
||||
@@ -25,7 +26,7 @@ def category(msg):
|
||||
return common.bin2int(mebin[5:8])
|
||||
|
||||
|
||||
def callsign(msg):
|
||||
def callsign(msg: str) -> str:
|
||||
"""Aircraft callsign
|
||||
|
||||
Args:
|
||||
@@ -34,8 +35,9 @@ def callsign(msg):
|
||||
Returns:
|
||||
string: callsign
|
||||
"""
|
||||
tc = common.typecode(msg)
|
||||
|
||||
if common.typecode(msg) < 1 or common.typecode(msg) > 4:
|
||||
if tc is None or tc < 1 or tc > 4:
|
||||
raise RuntimeError("%s: Not a identification message" % msg)
|
||||
|
||||
chars = "#ABCDEFGHIJKLMNOPQRSTUVWXYZ#####_###############0123456789######"
|
||||
|
||||
@@ -1,35 +1,41 @@
|
||||
# ------------------------------------------
|
||||
# BDS 0,9
|
||||
# ADS-B TC=19
|
||||
# Aircraft Airborn velocity
|
||||
# Aircraft Airborne velocity
|
||||
# ------------------------------------------
|
||||
|
||||
from pyModeS import common
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import math
|
||||
|
||||
from ... import common
|
||||
|
||||
def airborne_velocity(msg, source=False):
|
||||
|
||||
def airborne_velocity(
|
||||
msg: str, source: bool = False
|
||||
) -> None | tuple[None | int, None | float, None | int, str]:
|
||||
"""Decode airborne velocity.
|
||||
|
||||
Args:
|
||||
msg (str): 28 hexdigits string
|
||||
source (boolean): Include direction and vertical rate sources in return. Default to False.
|
||||
source (boolean): Include direction and vertical rate sources in return.
|
||||
Default to False.
|
||||
If set to True, the function will return six value instead of four.
|
||||
|
||||
Returns:
|
||||
int, float, int, string, [string], [string]: Four or six parameters, including:
|
||||
int, float, int, string, [string], [string]:
|
||||
- Speed (kt)
|
||||
- Angle (degree), either ground track or heading
|
||||
- Vertical rate (ft/min)
|
||||
- Speed type ('GS' for ground speed, 'AS' for airspeed)
|
||||
- [Optional] Direction source ('TRUE_NORTH' or 'MAGENTIC_NORTH')
|
||||
- [Optional] Direction source ('TRUE_NORTH' or 'MAGNETIC_NORTH')
|
||||
- [Optional] Vertical rate source ('BARO' or 'GNSS')
|
||||
|
||||
"""
|
||||
if common.typecode(msg) != 19:
|
||||
raise RuntimeError("%s: Not a airborne velocity message, expecting TC=19" % msg)
|
||||
raise RuntimeError(
|
||||
"%s: Not a airborne velocity message, expecting TC=19" % msg
|
||||
)
|
||||
|
||||
mb = common.hex2bin(msg)[32:]
|
||||
|
||||
@@ -38,43 +44,56 @@ def airborne_velocity(msg, source=False):
|
||||
if common.bin2int(mb[14:24]) == 0 or common.bin2int(mb[25:35]) == 0:
|
||||
return None
|
||||
|
||||
trk_or_hdg: None | float
|
||||
spd: None | float
|
||||
|
||||
if subtype in (1, 2):
|
||||
v_ew_sign = -1 if mb[13] == "1" else 1
|
||||
v_ew = common.bin2int(mb[14:24]) - 1 # east-west velocity
|
||||
if subtype == 2: # Supersonic
|
||||
v_ew *= 4
|
||||
|
||||
v_ns_sign = -1 if mb[24] == "1" else 1
|
||||
v_ns = common.bin2int(mb[25:35]) - 1 # north-south velocity
|
||||
if subtype == 2: # Supersonic
|
||||
v_ns *= 4
|
||||
v_ew = common.bin2int(mb[14:24])
|
||||
v_ns = common.bin2int(mb[25:35])
|
||||
|
||||
v_we = v_ew_sign * v_ew
|
||||
v_sn = v_ns_sign * v_ns
|
||||
if v_ew == 0 or v_ns == 0:
|
||||
spd = None
|
||||
trk_or_hdg = None
|
||||
vs = None
|
||||
else:
|
||||
v_ew_sign = -1 if mb[13] == "1" else 1
|
||||
v_ew = v_ew - 1 # east-west velocity
|
||||
if subtype == 2: # Supersonic
|
||||
v_ew *= 4
|
||||
|
||||
spd = math.sqrt(v_sn * v_sn + v_we * v_we) # unit in kts
|
||||
spd = int(spd)
|
||||
v_ns_sign = -1 if mb[24] == "1" else 1
|
||||
v_ns = v_ns - 1 # north-south velocity
|
||||
if subtype == 2: # Supersonic
|
||||
v_ns *= 4
|
||||
|
||||
trk = math.atan2(v_we, v_sn)
|
||||
trk = math.degrees(trk) # convert to degrees
|
||||
trk = trk if trk >= 0 else trk + 360 # no negative val
|
||||
v_we = v_ew_sign * v_ew
|
||||
v_sn = v_ns_sign * v_ns
|
||||
|
||||
spd = math.sqrt(v_sn * v_sn + v_we * v_we) # unit in kts
|
||||
spd = int(spd)
|
||||
|
||||
trk = math.atan2(v_we, v_sn)
|
||||
trk = math.degrees(trk) # convert to degrees
|
||||
trk = trk if trk >= 0 else trk + 360 # no negative val
|
||||
|
||||
trk_or_hdg = round(trk, 2)
|
||||
|
||||
spd_type = "GS"
|
||||
trk_or_hdg = round(trk, 2)
|
||||
dir_type = "TRUE_NORTH"
|
||||
|
||||
else:
|
||||
if mb[13] == "0":
|
||||
hdg = None
|
||||
else:
|
||||
hdg = common.bin2int(mb[14:24]) / 1024.0 * 360.0
|
||||
hdg = common.bin2int(mb[14:24]) / 1024 * 360.0
|
||||
hdg = round(hdg, 2)
|
||||
|
||||
trk_or_hdg = hdg
|
||||
|
||||
spd = common.bin2int(mb[25:35])
|
||||
spd = None if spd == 0 else spd - 1
|
||||
if subtype == 4: # Supersonic
|
||||
if subtype == 4 and spd is not None: # Supersonic
|
||||
spd *= 4
|
||||
|
||||
if mb[24] == "0":
|
||||
@@ -82,7 +101,7 @@ def airborne_velocity(msg, source=False):
|
||||
else:
|
||||
spd_type = "TAS"
|
||||
|
||||
dir_type = "MAGENTIC_NORTH"
|
||||
dir_type = "MAGNETIC_NORTH"
|
||||
|
||||
vr_source = "GNSS" if mb[35] == "0" else "BARO"
|
||||
vr_sign = -1 if mb[36] == "1" else 1
|
||||
@@ -90,12 +109,19 @@ def airborne_velocity(msg, source=False):
|
||||
vs = None if vr == 0 else int(vr_sign * (vr - 1) * 64)
|
||||
|
||||
if source:
|
||||
return spd, trk_or_hdg, vs, spd_type, dir_type, vr_source
|
||||
return ( # type: ignore
|
||||
spd,
|
||||
trk_or_hdg,
|
||||
vs,
|
||||
spd_type,
|
||||
dir_type,
|
||||
vr_source,
|
||||
)
|
||||
else:
|
||||
return spd, trk_or_hdg, vs, spd_type
|
||||
|
||||
|
||||
def altitude_diff(msg):
|
||||
def altitude_diff(msg: str) -> None | float:
|
||||
"""Decode the differece between GNSS and barometric altitude.
|
||||
|
||||
Args:
|
||||
@@ -108,8 +134,10 @@ def altitude_diff(msg):
|
||||
"""
|
||||
tc = common.typecode(msg)
|
||||
|
||||
if tc != 19:
|
||||
raise RuntimeError("%s: Not a airborne velocity message, expecting TC=19" % msg)
|
||||
if tc is None or tc != 19:
|
||||
raise RuntimeError(
|
||||
"%s: Not a airborne velocity message, expecting TC=19" % msg
|
||||
)
|
||||
|
||||
msgbin = common.hex2bin(msg)
|
||||
sign = -1 if int(msgbin[80]) else 1
|
||||
|
||||
@@ -3,10 +3,11 @@
|
||||
# Data link capability report
|
||||
# ------------------------------------------
|
||||
|
||||
from pyModeS import common
|
||||
|
||||
from ... import common
|
||||
|
||||
|
||||
def is10(msg):
|
||||
def is10(msg: str) -> bool:
|
||||
"""Check if a message is likely to be BDS code 1,0
|
||||
|
||||
Args:
|
||||
@@ -38,7 +39,7 @@ def is10(msg):
|
||||
return True
|
||||
|
||||
|
||||
def ovc10(msg):
|
||||
def ovc10(msg: str) -> int:
|
||||
"""Return the overlay control capability
|
||||
|
||||
Args:
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
# Common usage GICB capability report
|
||||
# ------------------------------------------
|
||||
|
||||
from pyModeS import common
|
||||
from typing import List
|
||||
|
||||
from ... import common
|
||||
|
||||
|
||||
def is17(msg):
|
||||
def is17(msg: str) -> bool:
|
||||
"""Check if a message is likely to be BDS code 1,7
|
||||
|
||||
Args:
|
||||
@@ -21,7 +23,7 @@ def is17(msg):
|
||||
|
||||
d = common.hex2bin(common.data(msg))
|
||||
|
||||
if common.bin2int(d[28:56]) != 0:
|
||||
if common.bin2int(d[24:56]) != 0:
|
||||
return False
|
||||
|
||||
caps = cap17(msg)
|
||||
@@ -38,14 +40,14 @@ def is17(msg):
|
||||
return True
|
||||
|
||||
|
||||
def cap17(msg):
|
||||
def cap17(msg: str) -> List[str]:
|
||||
"""Extract capacities from BDS 1,7 message
|
||||
|
||||
Args:
|
||||
msg (str): 28 hexdigits string
|
||||
|
||||
Returns:
|
||||
list: list of support BDS codes
|
||||
list: list of supported BDS codes
|
||||
"""
|
||||
allbds = [
|
||||
"05",
|
||||
@@ -72,14 +74,10 @@ def cap17(msg):
|
||||
"56",
|
||||
"5F",
|
||||
"60",
|
||||
"NA",
|
||||
"NA",
|
||||
"E1",
|
||||
"E2",
|
||||
]
|
||||
|
||||
d = common.hex2bin(common.data(msg))
|
||||
idx = [i for i, v in enumerate(d[:28]) if v == "1"]
|
||||
capacity = ["BDS" + allbds[i] for i in idx if allbds[i] is not "NA"]
|
||||
idx = [i for i, v in enumerate(d[:24]) if v == "1"]
|
||||
capacity = ["BDS" + allbds[i] for i in idx]
|
||||
|
||||
return capacity
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
# Aircraft identification
|
||||
# ------------------------------------------
|
||||
|
||||
from pyModeS import common
|
||||
from ... import common
|
||||
|
||||
|
||||
def is20(msg):
|
||||
def is20(msg: str) -> bool:
|
||||
"""Check if a message is likely to be BDS code 2,0
|
||||
|
||||
Args:
|
||||
@@ -24,15 +24,17 @@ def is20(msg):
|
||||
if d[0:8] != "00100000":
|
||||
return False
|
||||
|
||||
cs = cs20(msg)
|
||||
# allow empty callsign
|
||||
if common.bin2int(d[8:56]) == 0:
|
||||
return True
|
||||
|
||||
if "#" in cs:
|
||||
if "#" in cs20(msg):
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def cs20(msg):
|
||||
def cs20(msg: str) -> str:
|
||||
"""Aircraft callsign
|
||||
|
||||
Args:
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
# ACAS active resolution advisory
|
||||
# ------------------------------------------
|
||||
|
||||
from pyModeS import common
|
||||
from ... import common
|
||||
|
||||
|
||||
def is30(msg):
|
||||
"""Check if a message is likely to be BDS code 2,0
|
||||
def is30(msg: str) -> bool:
|
||||
"""Check if a message is likely to be BDS code 3,0
|
||||
|
||||
Args:
|
||||
msg (str): 28 hexdigits string
|
||||
|
||||
@@ -4,10 +4,12 @@
|
||||
# ------------------------------------------
|
||||
|
||||
import warnings
|
||||
from pyModeS import common
|
||||
from typing import Optional
|
||||
|
||||
from ... import common
|
||||
|
||||
|
||||
def is40(msg):
|
||||
def is40(msg: str) -> bool:
|
||||
"""Check if a message is likely to be BDS code 4,0
|
||||
|
||||
Args:
|
||||
@@ -50,7 +52,7 @@ def is40(msg):
|
||||
return True
|
||||
|
||||
|
||||
def selalt40mcp(msg):
|
||||
def selalt40mcp(msg: str) -> Optional[int]:
|
||||
"""Selected altitude, MCP/FCU
|
||||
|
||||
Args:
|
||||
@@ -68,7 +70,7 @@ def selalt40mcp(msg):
|
||||
return alt
|
||||
|
||||
|
||||
def selalt40fms(msg):
|
||||
def selalt40fms(msg: str) -> Optional[int]:
|
||||
"""Selected altitude, FMS
|
||||
|
||||
Args:
|
||||
@@ -86,7 +88,7 @@ def selalt40fms(msg):
|
||||
return alt
|
||||
|
||||
|
||||
def p40baro(msg):
|
||||
def p40baro(msg: str) -> Optional[float]:
|
||||
"""Barometric pressure setting
|
||||
|
||||
Args:
|
||||
@@ -104,17 +106,19 @@ def p40baro(msg):
|
||||
return p
|
||||
|
||||
|
||||
def alt40mcp(msg):
|
||||
def alt40mcp(msg: str) -> Optional[int]:
|
||||
warnings.warn(
|
||||
"alt40mcp() has been renamed to selalt40mcp(). It will be removed in the future.",
|
||||
"""alt40mcp() has been renamed to selalt40mcp().
|
||||
It will be removed in the future.""",
|
||||
DeprecationWarning,
|
||||
)
|
||||
return selalt40mcp(msg)
|
||||
|
||||
|
||||
def alt40fms(msg):
|
||||
def alt40fms(msg: str) -> Optional[int]:
|
||||
warnings.warn(
|
||||
"alt40fms() has been renamed to selalt40fms(). It will be removed in the future.",
|
||||
"""alt40fms() has been renamed to selalt40fms().
|
||||
It will be removed in the future.""",
|
||||
DeprecationWarning,
|
||||
)
|
||||
return selalt40mcp(msg)
|
||||
return selalt40fms(msg)
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
# Meteorological routine air report
|
||||
# ------------------------------------------
|
||||
|
||||
from pyModeS import common
|
||||
from typing import Optional, Tuple
|
||||
|
||||
from ... import common
|
||||
|
||||
|
||||
def is44(msg):
|
||||
def is44(msg: str) -> bool:
|
||||
"""Check if a message is likely to be BDS code 4,4.
|
||||
|
||||
Meteorological routine air report
|
||||
@@ -51,7 +53,7 @@ def is44(msg):
|
||||
return True
|
||||
|
||||
|
||||
def wind44(msg):
|
||||
def wind44(msg: str) -> Tuple[Optional[int], Optional[float]]:
|
||||
"""Wind speed and direction.
|
||||
|
||||
Args:
|
||||
@@ -68,12 +70,12 @@ def wind44(msg):
|
||||
return None, None
|
||||
|
||||
speed = common.bin2int(d[5:14]) # knots
|
||||
direction = common.bin2int(d[14:23]) * 180.0 / 256.0 # degree
|
||||
direction = common.bin2int(d[14:23]) * 180 / 256 # degree
|
||||
|
||||
return round(speed, 0), round(direction, 1)
|
||||
|
||||
|
||||
def temp44(msg):
|
||||
def temp44(msg: str) -> Tuple[float, float]:
|
||||
"""Static air temperature.
|
||||
|
||||
Args:
|
||||
@@ -102,7 +104,7 @@ def temp44(msg):
|
||||
return temp, temp_alternative
|
||||
|
||||
|
||||
def p44(msg):
|
||||
def p44(msg: str) -> Optional[int]:
|
||||
"""Static pressure.
|
||||
|
||||
Args:
|
||||
@@ -122,7 +124,7 @@ def p44(msg):
|
||||
return p
|
||||
|
||||
|
||||
def hum44(msg):
|
||||
def hum44(msg: str) -> Optional[float]:
|
||||
"""humidity
|
||||
|
||||
Args:
|
||||
@@ -136,13 +138,13 @@ def hum44(msg):
|
||||
if d[49] == "0":
|
||||
return None
|
||||
|
||||
hm = common.bin2int(d[50:56]) * 100.0 / 64 # %
|
||||
hm = common.bin2int(d[50:56]) * 100 / 64 # %
|
||||
|
||||
return round(hm, 1)
|
||||
|
||||
|
||||
def turb44(msg):
|
||||
"""Turblence.
|
||||
def turb44(msg: str) -> Optional[int]:
|
||||
"""Turbulence.
|
||||
|
||||
Args:
|
||||
msg (str): 28 hexdigits string
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
# Meteorological hazard report
|
||||
# ------------------------------------------
|
||||
|
||||
from pyModeS import common
|
||||
from typing import Optional
|
||||
|
||||
from ... import common
|
||||
|
||||
|
||||
def is45(msg):
|
||||
def is45(msg: str) -> bool:
|
||||
"""Check if a message is likely to be BDS code 4,5.
|
||||
|
||||
Meteorological hazard report
|
||||
@@ -60,7 +62,7 @@ def is45(msg):
|
||||
return True
|
||||
|
||||
|
||||
def turb45(msg):
|
||||
def turb45(msg: str) -> Optional[int]:
|
||||
"""Turbulence.
|
||||
|
||||
Args:
|
||||
@@ -78,7 +80,7 @@ def turb45(msg):
|
||||
return turb
|
||||
|
||||
|
||||
def ws45(msg):
|
||||
def ws45(msg: str) -> Optional[int]:
|
||||
"""Wind shear.
|
||||
|
||||
Args:
|
||||
@@ -96,7 +98,7 @@ def ws45(msg):
|
||||
return ws
|
||||
|
||||
|
||||
def mb45(msg):
|
||||
def mb45(msg: str) -> Optional[int]:
|
||||
"""Microburst.
|
||||
|
||||
Args:
|
||||
@@ -114,7 +116,7 @@ def mb45(msg):
|
||||
return mb
|
||||
|
||||
|
||||
def ic45(msg):
|
||||
def ic45(msg: str) -> Optional[int]:
|
||||
"""Icing.
|
||||
|
||||
Args:
|
||||
@@ -132,7 +134,7 @@ def ic45(msg):
|
||||
return ic
|
||||
|
||||
|
||||
def wv45(msg):
|
||||
def wv45(msg: str) -> Optional[int]:
|
||||
"""Wake vortex.
|
||||
|
||||
Args:
|
||||
@@ -150,7 +152,7 @@ def wv45(msg):
|
||||
return ws
|
||||
|
||||
|
||||
def temp45(msg):
|
||||
def temp45(msg: str) -> Optional[float]:
|
||||
"""Static air temperature.
|
||||
|
||||
Args:
|
||||
@@ -174,7 +176,7 @@ def temp45(msg):
|
||||
return temp
|
||||
|
||||
|
||||
def p45(msg):
|
||||
def p45(msg: str) -> Optional[int]:
|
||||
"""Average static pressure.
|
||||
|
||||
Args:
|
||||
@@ -191,7 +193,7 @@ def p45(msg):
|
||||
return p
|
||||
|
||||
|
||||
def rh45(msg):
|
||||
def rh45(msg: str) -> Optional[int]:
|
||||
"""Radio height.
|
||||
|
||||
Args:
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
# Track and turn report
|
||||
# ------------------------------------------
|
||||
|
||||
from pyModeS import common
|
||||
from typing import Optional
|
||||
|
||||
from ... import common
|
||||
|
||||
|
||||
def is50(msg):
|
||||
def is50(msg: str) -> bool:
|
||||
"""Check if a message is likely to be BDS code 5,0
|
||||
(Track and turn report)
|
||||
|
||||
@@ -40,7 +42,7 @@ def is50(msg):
|
||||
return False
|
||||
|
||||
roll = roll50(msg)
|
||||
if (roll is not None) and abs(roll) > 60:
|
||||
if (roll is not None) and abs(roll) > 50:
|
||||
return False
|
||||
|
||||
gs = gs50(msg)
|
||||
@@ -57,7 +59,7 @@ def is50(msg):
|
||||
return True
|
||||
|
||||
|
||||
def roll50(msg):
|
||||
def roll50(msg: str) -> Optional[float]:
|
||||
"""Roll angle, BDS 5,0 message
|
||||
|
||||
Args:
|
||||
@@ -78,11 +80,11 @@ def roll50(msg):
|
||||
if sign:
|
||||
value = value - 512
|
||||
|
||||
angle = value * 45.0 / 256.0 # degree
|
||||
angle = value * 45 / 256 # degree
|
||||
return round(angle, 1)
|
||||
|
||||
|
||||
def trk50(msg):
|
||||
def trk50(msg: str) -> Optional[float]:
|
||||
"""True track angle, BDS 5,0 message
|
||||
|
||||
Args:
|
||||
@@ -102,7 +104,7 @@ def trk50(msg):
|
||||
if sign:
|
||||
value = value - 1024
|
||||
|
||||
trk = value * 90.0 / 512.0
|
||||
trk = value * 90 / 512.0
|
||||
|
||||
# convert from [-180, 180] to [0, 360]
|
||||
if trk < 0:
|
||||
@@ -111,7 +113,7 @@ def trk50(msg):
|
||||
return round(trk, 3)
|
||||
|
||||
|
||||
def gs50(msg):
|
||||
def gs50(msg: str) -> Optional[float]:
|
||||
"""Ground speed, BDS 5,0 message
|
||||
|
||||
Args:
|
||||
@@ -129,7 +131,7 @@ def gs50(msg):
|
||||
return spd
|
||||
|
||||
|
||||
def rtrk50(msg):
|
||||
def rtrk50(msg: str) -> Optional[float]:
|
||||
"""Track angle rate, BDS 5,0 message
|
||||
|
||||
Args:
|
||||
@@ -151,11 +153,11 @@ def rtrk50(msg):
|
||||
if sign:
|
||||
value = value - 512
|
||||
|
||||
angle = value * 8.0 / 256.0 # degree / sec
|
||||
angle = value * 8 / 256 # degree / sec
|
||||
return round(angle, 3)
|
||||
|
||||
|
||||
def tas50(msg):
|
||||
def tas50(msg: str) -> Optional[float]:
|
||||
"""Aircraft true airspeed, BDS 5,0 message
|
||||
|
||||
Args:
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
# Air-referenced state vector
|
||||
# ------------------------------------------
|
||||
|
||||
from pyModeS import common
|
||||
from typing import Optional
|
||||
|
||||
from ... import common
|
||||
|
||||
|
||||
def is53(msg):
|
||||
def is53(msg: str) -> bool:
|
||||
"""Check if a message is likely to be BDS code 5,3
|
||||
(Air-referenced state vector)
|
||||
|
||||
@@ -58,7 +60,7 @@ def is53(msg):
|
||||
return True
|
||||
|
||||
|
||||
def hdg53(msg):
|
||||
def hdg53(msg: str) -> Optional[float]:
|
||||
"""Magnetic heading, BDS 5,3 message
|
||||
|
||||
Args:
|
||||
@@ -78,7 +80,7 @@ def hdg53(msg):
|
||||
if sign:
|
||||
value = value - 1024
|
||||
|
||||
hdg = value * 90.0 / 512.0 # degree
|
||||
hdg = value * 90 / 512 # degree
|
||||
|
||||
# convert from [-180, 180] to [0, 360]
|
||||
if hdg < 0:
|
||||
@@ -87,7 +89,7 @@ def hdg53(msg):
|
||||
return round(hdg, 3)
|
||||
|
||||
|
||||
def ias53(msg):
|
||||
def ias53(msg: str) -> Optional[float]:
|
||||
"""Indicated airspeed, DBS 5,3 message
|
||||
|
||||
Args:
|
||||
@@ -105,7 +107,7 @@ def ias53(msg):
|
||||
return ias
|
||||
|
||||
|
||||
def mach53(msg):
|
||||
def mach53(msg: str) -> Optional[float]:
|
||||
"""MACH number, DBS 5,3 message
|
||||
|
||||
Args:
|
||||
@@ -123,7 +125,7 @@ def mach53(msg):
|
||||
return round(mach, 3)
|
||||
|
||||
|
||||
def tas53(msg):
|
||||
def tas53(msg: str) -> Optional[float]:
|
||||
"""Aircraft true airspeed, BDS 5,3 message
|
||||
|
||||
Args:
|
||||
@@ -141,7 +143,7 @@ def tas53(msg):
|
||||
return round(tas, 1)
|
||||
|
||||
|
||||
def vr53(msg):
|
||||
def vr53(msg: str) -> Optional[int]:
|
||||
"""Vertical rate
|
||||
|
||||
Args:
|
||||
|
||||
@@ -3,10 +3,13 @@
|
||||
# Heading and speed report
|
||||
# ------------------------------------------
|
||||
|
||||
from pyModeS import common
|
||||
from typing import Optional
|
||||
|
||||
from ... import common
|
||||
from ...extra import aero
|
||||
|
||||
|
||||
def is60(msg):
|
||||
def is60(msg: str) -> bool:
|
||||
"""Check if a message is likely to be BDS code 6,0
|
||||
|
||||
Args:
|
||||
@@ -54,10 +57,18 @@ def is60(msg):
|
||||
if vr_ins is not None and abs(vr_ins) > 6000:
|
||||
return False
|
||||
|
||||
# additional check knowing altitude
|
||||
if (mach is not None) and (ias is not None) and (common.df(msg) == 20):
|
||||
alt = common.altcode(msg)
|
||||
if alt is not None:
|
||||
ias_ = aero.mach2cas(mach, alt * aero.ft) / aero.kts
|
||||
if abs(ias - ias_) > 20:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def hdg60(msg):
|
||||
def hdg60(msg: str) -> Optional[float]:
|
||||
"""Megnetic heading of aircraft
|
||||
|
||||
Args:
|
||||
@@ -77,16 +88,16 @@ def hdg60(msg):
|
||||
if sign:
|
||||
value = value - 1024
|
||||
|
||||
hdg = value * 90 / 512.0 # degree
|
||||
hdg = value * 90 / 512 # degree
|
||||
|
||||
# convert from [-180, 180] to [0, 360]
|
||||
if hdg < 0:
|
||||
hdg = 360 + hdg
|
||||
|
||||
return round(hdg, 3)
|
||||
return hdg
|
||||
|
||||
|
||||
def ias60(msg):
|
||||
def ias60(msg: str) -> Optional[float]:
|
||||
"""Indicated airspeed
|
||||
|
||||
Args:
|
||||
@@ -104,7 +115,7 @@ def ias60(msg):
|
||||
return ias
|
||||
|
||||
|
||||
def mach60(msg):
|
||||
def mach60(msg: str) -> Optional[float]:
|
||||
"""Aircraft MACH number
|
||||
|
||||
Args:
|
||||
@@ -119,10 +130,10 @@ def mach60(msg):
|
||||
return None
|
||||
|
||||
mach = common.bin2int(d[24:34]) * 2.048 / 512.0
|
||||
return round(mach, 3)
|
||||
return mach
|
||||
|
||||
|
||||
def vr60baro(msg):
|
||||
def vr60baro(msg: str) -> Optional[int]:
|
||||
"""Vertical rate from barometric measurement, this value may be very noisy.
|
||||
|
||||
Args:
|
||||
@@ -148,7 +159,7 @@ def vr60baro(msg):
|
||||
return roc
|
||||
|
||||
|
||||
def vr60ins(msg):
|
||||
def vr60ins(msg: str) -> Optional[int]:
|
||||
"""Vertical rate measurd by onbard equiments (IRS, AHRS)
|
||||
|
||||
Args:
|
||||
|
||||
87
pyModeS/decoder/bds/bds61.py
Normal file
87
pyModeS/decoder/bds/bds61.py
Normal file
@@ -0,0 +1,87 @@
|
||||
# ------------------------------------------
|
||||
# BDS 6,1
|
||||
# ADS-B TC=28
|
||||
# Aircraft Airborne status
|
||||
# ------------------------------------------
|
||||
|
||||
from ... import common
|
||||
|
||||
|
||||
def is_emergency(msg: str) -> bool:
|
||||
"""Check if the aircraft is reporting an emergency.
|
||||
|
||||
Non-emergencies are either a subtype of zero (no information) or
|
||||
subtype of one and a value of zero (no emergency).
|
||||
Subtype = 2 indicates an ACAS RA broadcast, look in BDS 3,0
|
||||
|
||||
:param msg: 28 bytes hexadecimal message string
|
||||
:return: if the aircraft has declared an emergency
|
||||
"""
|
||||
if common.typecode(msg) != 28:
|
||||
raise RuntimeError(
|
||||
"%s: Not an airborne status message, expecting TC=28" % msg
|
||||
)
|
||||
|
||||
mb = common.hex2bin(msg)[32:]
|
||||
subtype = common.bin2int(mb[5:8])
|
||||
|
||||
if subtype == 2:
|
||||
raise RuntimeError("%s: Emergency message is ACAS-RA, not implemented")
|
||||
|
||||
emergency_state = common.bin2int(mb[8:11])
|
||||
|
||||
if subtype == 1 and emergency_state == 1:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
def emergency_state(msg: str) -> int:
|
||||
"""Decode aircraft emergency state.
|
||||
|
||||
Value Meaning
|
||||
----- -----------------------
|
||||
0 No emergency
|
||||
1 General emergency
|
||||
2 Lifeguard/Medical
|
||||
3 Minimum fuel
|
||||
4 No communications
|
||||
5 Unlawful communications
|
||||
6-7 Reserved
|
||||
|
||||
:param msg: 28 bytes hexadecimal message string
|
||||
:return: emergency state
|
||||
"""
|
||||
|
||||
mb = common.hex2bin(msg)[32:]
|
||||
subtype = common.bin2int(mb[5:8])
|
||||
|
||||
if subtype == 2:
|
||||
raise RuntimeError("%s: Emergency message is ACAS-RA, not implemented")
|
||||
|
||||
emergency_state = common.bin2int(mb[8:11])
|
||||
return emergency_state
|
||||
|
||||
|
||||
def emergency_squawk(msg: str) -> str:
|
||||
"""Decode squawk code.
|
||||
|
||||
Emergency value 1: squawk 7700.
|
||||
Emergency value 4: squawk 7600.
|
||||
Emergency value 5: squawk 7500.
|
||||
|
||||
:param msg: 28 bytes hexadecimal message string
|
||||
:return: aircraft squawk code
|
||||
"""
|
||||
if common.typecode(msg) != 28:
|
||||
raise RuntimeError(
|
||||
"%s: Not an airborne status message, expecting TC=28" % msg
|
||||
)
|
||||
|
||||
msgbin = common.hex2bin(msg)
|
||||
|
||||
# construct the 13 bits Mode A ID code
|
||||
idcode = msgbin[43:56]
|
||||
|
||||
squawk = common.squawk(idcode)
|
||||
return squawk
|
||||
553
pyModeS/decoder/bds/bds62.py
Normal file
553
pyModeS/decoder/bds/bds62.py
Normal file
@@ -0,0 +1,553 @@
|
||||
# ------------------------------------------
|
||||
# BDS 6,2
|
||||
# ADS-B TC=29
|
||||
# Target State and Status
|
||||
# ------------------------------------------
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from ... import common
|
||||
|
||||
|
||||
def selected_altitude(msg: str) -> tuple[None | float, str]:
|
||||
"""Decode selected altitude.
|
||||
|
||||
Args:
|
||||
msg (str): 28 hexdigits string
|
||||
|
||||
Returns:
|
||||
int: Selected altitude (ft)
|
||||
string: Source ('MCP/FCU' or 'FMS')
|
||||
|
||||
"""
|
||||
|
||||
if common.typecode(msg) != 29:
|
||||
raise RuntimeError(
|
||||
"%s: Not a target state and status message, expecting TC=29" % msg
|
||||
)
|
||||
|
||||
mb = common.hex2bin(msg)[32:]
|
||||
|
||||
subtype = common.bin2int(mb[5:7])
|
||||
|
||||
if subtype == 0:
|
||||
raise RuntimeError(
|
||||
"%s: ADS-B version 1 target state and status message does not"
|
||||
" contain selected altitude, use target altitude instead" % msg
|
||||
)
|
||||
|
||||
alt = common.bin2int(mb[9:20])
|
||||
if alt == 0:
|
||||
return None, "N/A"
|
||||
alt = (alt - 1) * 32
|
||||
alt_source = "MCP/FCU" if int(mb[8]) == 0 else "FMS"
|
||||
|
||||
return alt, alt_source
|
||||
|
||||
|
||||
def target_altitude(msg: str) -> tuple[None | int, str, str]:
|
||||
"""Decode target altitude.
|
||||
|
||||
Args:
|
||||
msg (str): 28 hexdigits string
|
||||
|
||||
Returns:
|
||||
int: Target altitude (ft)
|
||||
string: Source ('MCP/FCU', 'Holding mode' or 'FMS/RNAV')
|
||||
string: Altitude reference, either pressure altitude or barometric
|
||||
corrected altitude ('FL' or 'MSL')
|
||||
|
||||
"""
|
||||
|
||||
if common.typecode(msg) != 29:
|
||||
raise RuntimeError(
|
||||
"%s: Not a target state and status message, expecting TC=29" % msg
|
||||
)
|
||||
|
||||
mb = common.hex2bin(msg)[32:]
|
||||
|
||||
subtype = common.bin2int(mb[5:7])
|
||||
|
||||
if subtype == 1:
|
||||
raise RuntimeError(
|
||||
"%s: ADS-B version 2 target state and status message does not"
|
||||
" contain target altitude, use selected altitude instead" % msg
|
||||
)
|
||||
|
||||
alt_avail = common.bin2int(mb[7:9])
|
||||
if alt_avail == 0:
|
||||
return None, "N/A", ""
|
||||
elif alt_avail == 1:
|
||||
alt_source = "MCP/FCU"
|
||||
elif alt_avail == 2:
|
||||
alt_source = "Holding mode"
|
||||
else:
|
||||
alt_source = "FMS/RNAV"
|
||||
|
||||
alt_ref = "FL" if int(mb[9]) == 0 else "MSL"
|
||||
|
||||
alt = -1000 + common.bin2int(mb[15:25]) * 100
|
||||
|
||||
return alt, alt_source, alt_ref
|
||||
|
||||
|
||||
def vertical_mode(msg: str) -> None | int:
|
||||
"""Decode vertical mode.
|
||||
|
||||
Value Meaning
|
||||
----- -----------------------
|
||||
1 "Acquiring" mode
|
||||
2 "Capturing" or "Maintaining" mode
|
||||
3 Reserved
|
||||
|
||||
Args:
|
||||
msg (str): 28 hexdigits string
|
||||
|
||||
Returns:
|
||||
int: Vertical mode
|
||||
|
||||
"""
|
||||
|
||||
if common.typecode(msg) != 29:
|
||||
raise RuntimeError(
|
||||
"%s: Not a target state and status message, expecting TC=29" % msg
|
||||
)
|
||||
|
||||
mb = common.hex2bin(msg)[32:]
|
||||
|
||||
subtype = common.bin2int(mb[5:7])
|
||||
|
||||
if subtype == 1:
|
||||
raise RuntimeError(
|
||||
"%s: ADS-B version 2 target state and status message does not"
|
||||
" contain vertical mode, use vnav mode instead" % msg
|
||||
)
|
||||
|
||||
vertical_mode = common.bin2int(mb[13:15])
|
||||
if vertical_mode == 0:
|
||||
return None
|
||||
|
||||
return vertical_mode
|
||||
|
||||
|
||||
def horizontal_mode(msg: str) -> None | int:
|
||||
"""Decode horizontal mode.
|
||||
|
||||
Value Meaning
|
||||
----- -----------------------
|
||||
1 "Acquiring" mode
|
||||
2 "Capturing" or "Maintaining" mode
|
||||
3 Reserved
|
||||
|
||||
Args:
|
||||
msg (str): 28 hexdigits string
|
||||
|
||||
Returns:
|
||||
int: Horizontal mode
|
||||
|
||||
"""
|
||||
|
||||
if common.typecode(msg) != 29:
|
||||
raise RuntimeError(
|
||||
"%s: Not a target state and status message, expecting TC=29" % msg
|
||||
)
|
||||
|
||||
mb = common.hex2bin(msg)[32:]
|
||||
|
||||
subtype = common.bin2int(mb[5:7])
|
||||
|
||||
if subtype == 1:
|
||||
raise RuntimeError(
|
||||
"%s: ADS-B version 2 target state and status message does not "
|
||||
"contain horizontal mode, use lnav mode instead" % msg
|
||||
)
|
||||
|
||||
horizontal_mode = common.bin2int(mb[25:27])
|
||||
if horizontal_mode == 0:
|
||||
return None
|
||||
|
||||
return horizontal_mode
|
||||
|
||||
|
||||
def selected_heading(msg: str) -> None | float:
|
||||
"""Decode selected heading.
|
||||
|
||||
Args:
|
||||
msg (str): 28 bytes hexadecimal message string
|
||||
|
||||
Returns:
|
||||
float: Selected heading (degree)
|
||||
|
||||
"""
|
||||
|
||||
if common.typecode(msg) != 29:
|
||||
raise RuntimeError(
|
||||
"%s: Not a target state and status message, expecting TC=29" % msg
|
||||
)
|
||||
|
||||
mb = common.hex2bin(msg)[32:]
|
||||
|
||||
subtype = common.bin2int(mb[5:7])
|
||||
|
||||
if subtype == 0:
|
||||
raise RuntimeError(
|
||||
"%s: ADS-B version 1 target state and status message does not "
|
||||
"contain selected heading, use target angle instead" % msg
|
||||
)
|
||||
|
||||
if int(mb[29]) == 0:
|
||||
return None
|
||||
else:
|
||||
hdg_sign = int(mb[30])
|
||||
hdg = (hdg_sign + 1) * common.bin2int(mb[31:39]) * (180 / 256)
|
||||
hdg = round(hdg, 2)
|
||||
|
||||
return hdg
|
||||
|
||||
|
||||
def target_angle(msg: str) -> tuple[None | int, str, str]:
|
||||
"""Decode target heading/track angle.
|
||||
|
||||
Args:
|
||||
msg (str): 28 bytes hexadecimal message string
|
||||
|
||||
Returns:
|
||||
int: Target angle (degree)
|
||||
string: Angle type ('Heading' or 'Track')
|
||||
string: Source ('MCP/FCU', 'Autopilot Mode' or 'FMS/RNAV')
|
||||
|
||||
"""
|
||||
|
||||
if common.typecode(msg) != 29:
|
||||
raise RuntimeError(
|
||||
"%s: Not a target state and status message, expecting TC=29" % msg
|
||||
)
|
||||
|
||||
mb = common.hex2bin(msg)[32:]
|
||||
|
||||
subtype = common.bin2int(mb[5:7])
|
||||
|
||||
if subtype == 1:
|
||||
raise RuntimeError(
|
||||
"%s: ADS-B version 2 target state and status message does not "
|
||||
"contain target angle, use selected heading instead" % msg
|
||||
)
|
||||
|
||||
angle_avail = common.bin2int(mb[25:27])
|
||||
if angle_avail == 0:
|
||||
return None, "", "N/A"
|
||||
else:
|
||||
angle = common.bin2int(mb[27:36])
|
||||
|
||||
if angle_avail == 1:
|
||||
angle_source = "MCP/FCU"
|
||||
elif angle_avail == 2:
|
||||
angle_source = "Autopilot mode"
|
||||
else:
|
||||
angle_source = "FMS/RNAV"
|
||||
|
||||
angle_type = "Heading" if int(mb[36]) else "Track"
|
||||
|
||||
return angle, angle_type, angle_source
|
||||
|
||||
|
||||
def baro_pressure_setting(msg: str) -> None | float:
|
||||
"""Decode barometric pressure setting.
|
||||
|
||||
Args:
|
||||
msg (str): 28 hexdigits string
|
||||
|
||||
Returns:
|
||||
float: Barometric pressure setting (millibars)
|
||||
|
||||
"""
|
||||
|
||||
if common.typecode(msg) != 29:
|
||||
raise RuntimeError(
|
||||
"%s: Not a target state and status message, expecting TC=29" % msg
|
||||
)
|
||||
|
||||
mb = common.hex2bin(msg)[32:]
|
||||
|
||||
subtype = common.bin2int(mb[5:7])
|
||||
|
||||
if subtype == 0:
|
||||
raise RuntimeError(
|
||||
"%s: ADS-B version 1 target state and status message does not "
|
||||
"contain barometric pressure setting" % msg
|
||||
)
|
||||
|
||||
baro = common.bin2int(mb[20:29])
|
||||
if baro == 0:
|
||||
return None
|
||||
|
||||
return 800 + (baro - 1) * 0.8
|
||||
|
||||
|
||||
def autopilot(msg) -> None | bool:
|
||||
"""Decode autopilot engagement.
|
||||
|
||||
Args:
|
||||
msg (str): 28 hexdigits string
|
||||
|
||||
Returns:
|
||||
bool: Autopilot engaged
|
||||
|
||||
"""
|
||||
|
||||
if common.typecode(msg) != 29:
|
||||
raise RuntimeError(
|
||||
"%s: Not a target state and status message, expecting TC=29" % msg
|
||||
)
|
||||
|
||||
mb = common.hex2bin(msg)[32:]
|
||||
|
||||
subtype = common.bin2int(mb[5:7])
|
||||
|
||||
if subtype == 0:
|
||||
raise RuntimeError(
|
||||
"%s: ADS-B version 1 target state and status message does not "
|
||||
"contain autopilot engagement" % msg
|
||||
)
|
||||
|
||||
if int(mb[46]) == 0:
|
||||
return None
|
||||
|
||||
autopilot = True if int(mb[47]) == 1 else False
|
||||
|
||||
return autopilot
|
||||
|
||||
|
||||
def vnav_mode(msg) -> None | bool:
|
||||
"""Decode VNAV mode.
|
||||
|
||||
Args:
|
||||
msg (str): 28 hexdigits string
|
||||
|
||||
Returns:
|
||||
bool: VNAV mode engaged
|
||||
|
||||
"""
|
||||
|
||||
if common.typecode(msg) != 29:
|
||||
raise RuntimeError(
|
||||
"%s: Not a target state and status message, expecting TC=29" % msg
|
||||
)
|
||||
|
||||
mb = common.hex2bin(msg)[32:]
|
||||
|
||||
subtype = common.bin2int(mb[5:7])
|
||||
|
||||
if subtype == 0:
|
||||
raise RuntimeError(
|
||||
"%s: ADS-B version 1 target state and status message does not "
|
||||
"contain vnav mode, use vertical mode instead" % msg
|
||||
)
|
||||
|
||||
if int(mb[46]) == 0:
|
||||
return None
|
||||
|
||||
vnav_mode = True if int(mb[48]) == 1 else False
|
||||
|
||||
return vnav_mode
|
||||
|
||||
|
||||
def altitude_hold_mode(msg) -> None | bool:
|
||||
"""Decode altitude hold mode.
|
||||
|
||||
Args:
|
||||
msg (str): 28 hexdigits string
|
||||
|
||||
Returns:
|
||||
bool: Altitude hold mode engaged
|
||||
|
||||
"""
|
||||
|
||||
if common.typecode(msg) != 29:
|
||||
raise RuntimeError(
|
||||
"%s: Not a target state and status message, expecting TC=29" % msg
|
||||
)
|
||||
|
||||
mb = common.hex2bin(msg)[32:]
|
||||
|
||||
subtype = common.bin2int(mb[5:7])
|
||||
|
||||
if subtype == 0:
|
||||
raise RuntimeError(
|
||||
"%s: ADS-B version 1 target state and status message does not "
|
||||
"contain altitude hold mode" % msg
|
||||
)
|
||||
|
||||
if int(mb[46]) == 0:
|
||||
return None
|
||||
|
||||
alt_hold_mode = True if int(mb[49]) == 1 else False
|
||||
|
||||
return alt_hold_mode
|
||||
|
||||
|
||||
def approach_mode(msg) -> None | bool:
|
||||
"""Decode approach mode.
|
||||
|
||||
Args:
|
||||
msg (str): 28 hexdigits string
|
||||
|
||||
Returns:
|
||||
bool: Approach mode engaged
|
||||
|
||||
"""
|
||||
|
||||
if common.typecode(msg) != 29:
|
||||
raise RuntimeError(
|
||||
"%s: Not a target state and status message, expecting TC=29" % msg
|
||||
)
|
||||
|
||||
mb = common.hex2bin(msg)[32:]
|
||||
|
||||
subtype = common.bin2int(mb[5:7])
|
||||
|
||||
if subtype == 0:
|
||||
raise RuntimeError(
|
||||
"%s: ADS-B version 1 target state and status message does not "
|
||||
"contain approach mode" % msg
|
||||
)
|
||||
|
||||
if int(mb[46]) == 0:
|
||||
return None
|
||||
|
||||
app_mode = True if int(mb[51]) == 1 else False
|
||||
|
||||
return app_mode
|
||||
|
||||
|
||||
def lnav_mode(msg) -> None | bool:
|
||||
"""Decode LNAV mode.
|
||||
|
||||
Args:
|
||||
msg (str): 28 hexdigits string
|
||||
|
||||
Returns:
|
||||
bool: LNAV mode engaged
|
||||
|
||||
"""
|
||||
|
||||
if common.typecode(msg) != 29:
|
||||
raise RuntimeError(
|
||||
"%s: Not a target state and status message, expecting TC=29" % msg
|
||||
)
|
||||
|
||||
mb = common.hex2bin(msg)[32:]
|
||||
|
||||
subtype = common.bin2int(mb[5:7])
|
||||
|
||||
if subtype == 0:
|
||||
raise RuntimeError(
|
||||
"%s: ADS-B version 1 target state and status message does not "
|
||||
"contain lnav mode, use horizontal mode instead" % msg
|
||||
)
|
||||
|
||||
if int(mb[46]) == 0:
|
||||
return None
|
||||
|
||||
lnav_mode = True if int(mb[53]) == 1 else False
|
||||
|
||||
return lnav_mode
|
||||
|
||||
|
||||
def tcas_operational(msg) -> None | bool:
|
||||
"""Decode TCAS/ACAS operational.
|
||||
|
||||
Args:
|
||||
msg (str): 28 bytes hexadecimal message string
|
||||
|
||||
Returns:
|
||||
bool: TCAS/ACAS operational
|
||||
|
||||
"""
|
||||
|
||||
if common.typecode(msg) != 29:
|
||||
raise RuntimeError(
|
||||
"%s: Not a target state and status message, expecting TC=29" % msg
|
||||
)
|
||||
|
||||
mb = common.hex2bin(msg)[32:]
|
||||
|
||||
subtype = common.bin2int(mb[5:7])
|
||||
|
||||
if subtype == 0:
|
||||
tcas = True if int(mb[51]) == 0 else False
|
||||
else:
|
||||
tcas = True if int(mb[52]) == 1 else False
|
||||
|
||||
return tcas
|
||||
|
||||
|
||||
def tcas_ra(msg) -> bool:
|
||||
"""Decode TCAS/ACAS Resolution advisory.
|
||||
|
||||
Args:
|
||||
msg (str): 28 bytes hexadecimal message string
|
||||
|
||||
Returns:
|
||||
bool: TCAS/ACAS Resolution advisory active
|
||||
|
||||
"""
|
||||
|
||||
if common.typecode(msg) != 29:
|
||||
raise RuntimeError(
|
||||
"%s: Not a target state and status message, expecting TC=29" % msg
|
||||
)
|
||||
|
||||
mb = common.hex2bin(msg)[32:]
|
||||
|
||||
subtype = common.bin2int(mb[5:7])
|
||||
|
||||
if subtype == 1:
|
||||
raise RuntimeError(
|
||||
"%s: ADS-B version 2 target state and status message does not "
|
||||
"contain TCAS/ACAS RA" % msg
|
||||
)
|
||||
|
||||
tcas_ra = True if int(mb[52]) == 1 else False
|
||||
|
||||
return tcas_ra
|
||||
|
||||
|
||||
def emergency_status(msg) -> int:
|
||||
"""Decode aircraft emergency status.
|
||||
|
||||
Value Meaning
|
||||
----- -----------------------
|
||||
0 No emergency
|
||||
1 General emergency
|
||||
2 Lifeguard/medical emergency
|
||||
3 Minimum fuel
|
||||
4 No communications
|
||||
5 Unlawful interference
|
||||
6 Downed aircraft
|
||||
7 Reserved
|
||||
|
||||
Args:
|
||||
msg (str): 28 bytes hexadecimal message string
|
||||
|
||||
Returns:
|
||||
int: Emergency status
|
||||
|
||||
"""
|
||||
|
||||
if common.typecode(msg) != 29:
|
||||
raise RuntimeError(
|
||||
"%s: Not a target state and status message, expecting TC=29" % msg
|
||||
)
|
||||
|
||||
mb = common.hex2bin(msg)[32:]
|
||||
|
||||
subtype = common.bin2int(mb[5:7])
|
||||
|
||||
if subtype == 1:
|
||||
raise RuntimeError(
|
||||
"%s: ADS-B version 2 target state and status message does not "
|
||||
"contain emergency status" % msg
|
||||
)
|
||||
|
||||
return common.bin2int(mb[53:56])
|
||||
@@ -23,16 +23,66 @@ MRAR and MHR
|
||||
"""
|
||||
|
||||
# ELS - elementary surveillance
|
||||
from pyModeS.decoder.bds.bds10 import *
|
||||
from pyModeS.decoder.bds.bds17 import *
|
||||
from pyModeS.decoder.bds.bds20 import *
|
||||
from pyModeS.decoder.bds.bds30 import *
|
||||
from .bds.bds10 import is10, ovc10
|
||||
from .bds.bds17 import is17, cap17
|
||||
from .bds.bds20 import is20, cs20
|
||||
from .bds.bds30 import is30
|
||||
|
||||
# ELS - enhanced surveillance
|
||||
from pyModeS.decoder.bds.bds40 import *
|
||||
from pyModeS.decoder.bds.bds50 import *
|
||||
from pyModeS.decoder.bds.bds60 import *
|
||||
from .bds.bds40 import (
|
||||
is40,
|
||||
selalt40fms,
|
||||
selalt40mcp,
|
||||
p40baro,
|
||||
alt40fms,
|
||||
alt40mcp,
|
||||
)
|
||||
from .bds.bds50 import is50, roll50, trk50, gs50, rtrk50, tas50
|
||||
from .bds.bds60 import is60, hdg60, ias60, mach60, vr60baro, vr60ins
|
||||
|
||||
# MRAR and MHR
|
||||
from pyModeS.decoder.bds.bds44 import *
|
||||
from pyModeS.decoder.bds.bds45 import *
|
||||
from .bds.bds44 import is44, wind44, temp44, p44, hum44, turb44
|
||||
from .bds.bds45 import is45, turb45, ws45, mb45, ic45, wv45, temp45, p45, rh45
|
||||
|
||||
__all__ = [
|
||||
"is10",
|
||||
"ovc10",
|
||||
"is17",
|
||||
"cap17",
|
||||
"is20",
|
||||
"cs20",
|
||||
"is30",
|
||||
"is40",
|
||||
"selalt40fms",
|
||||
"selalt40mcp",
|
||||
"p40baro",
|
||||
"alt40fms",
|
||||
"alt40mcp",
|
||||
"is50",
|
||||
"roll50",
|
||||
"trk50",
|
||||
"gs50",
|
||||
"rtrk50",
|
||||
"tas50",
|
||||
"is60",
|
||||
"hdg60",
|
||||
"ias60",
|
||||
"mach60",
|
||||
"vr60baro",
|
||||
"vr60ins",
|
||||
"is44",
|
||||
"wind44",
|
||||
"temp44",
|
||||
"p44",
|
||||
"hum44",
|
||||
"turb44",
|
||||
"is45",
|
||||
"turb45",
|
||||
"ws45",
|
||||
"mb45",
|
||||
"ic45",
|
||||
"wv45",
|
||||
"temp45",
|
||||
"p45",
|
||||
"rh45",
|
||||
]
|
||||
|
||||
@@ -11,25 +11,56 @@ The EHS wrapper imports all functions from the following modules:
|
||||
|
||||
import warnings
|
||||
|
||||
from pyModeS.decoder.bds.bds40 import *
|
||||
from pyModeS.decoder.bds.bds50 import *
|
||||
from pyModeS.decoder.bds.bds60 import *
|
||||
from pyModeS.decoder.bds import infer
|
||||
from .bds.bds40 import (
|
||||
is40,
|
||||
selalt40fms,
|
||||
selalt40mcp,
|
||||
p40baro,
|
||||
alt40fms,
|
||||
alt40mcp,
|
||||
)
|
||||
from .bds.bds50 import is50, roll50, trk50, gs50, rtrk50, tas50
|
||||
from .bds.bds60 import is60, hdg60, ias60, mach60, vr60baro, vr60ins
|
||||
from .bds import infer
|
||||
|
||||
__all__ = [
|
||||
"is40",
|
||||
"selalt40fms",
|
||||
"selalt40mcp",
|
||||
"p40baro",
|
||||
"alt40fms",
|
||||
"alt40mcp",
|
||||
"is50",
|
||||
"roll50",
|
||||
"trk50",
|
||||
"gs50",
|
||||
"rtrk50",
|
||||
"tas50",
|
||||
"is60",
|
||||
"hdg60",
|
||||
"ias60",
|
||||
"mach60",
|
||||
"vr60baro",
|
||||
"vr60ins",
|
||||
"infer",
|
||||
]
|
||||
|
||||
warnings.simplefilter("once", DeprecationWarning)
|
||||
warnings.warn(
|
||||
"pms.ehs module is deprecated. Please use pms.commb instead.", DeprecationWarning
|
||||
"pms.ehs module is deprecated. Please use pms.commb instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
|
||||
|
||||
def BDS(msg):
|
||||
warnings.warn(
|
||||
"pms.ehs.BDS() is deprecated, use pms.bds.infer() instead.", DeprecationWarning
|
||||
"pms.ehs.BDS() is deprecated, use pms.bds.infer() instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
return infer(msg)
|
||||
|
||||
|
||||
def icao(msg):
|
||||
from pyModeS.decoder.common import icao
|
||||
from . import common
|
||||
|
||||
return icao(msg)
|
||||
return common.icao(msg)
|
||||
|
||||
@@ -10,14 +10,26 @@ The ELS wrapper imports all functions from the following modules:
|
||||
|
||||
"""
|
||||
|
||||
from pyModeS.decoder.bds.bds10 import *
|
||||
from pyModeS.decoder.bds.bds17 import *
|
||||
from pyModeS.decoder.bds.bds20 import *
|
||||
from pyModeS.decoder.bds.bds30 import *
|
||||
|
||||
import warnings
|
||||
|
||||
from .bds.bds10 import is10, ovc10
|
||||
from .bds.bds17 import cap17, is17
|
||||
from .bds.bds20 import cs20, is20
|
||||
from .bds.bds30 import is30
|
||||
|
||||
warnings.simplefilter("once", DeprecationWarning)
|
||||
warnings.warn(
|
||||
"pms.els module is deprecated. Please use pms.commb instead.", DeprecationWarning
|
||||
"pms.els module is deprecated. Please use pms.commb instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"is10",
|
||||
"ovc10",
|
||||
"is17",
|
||||
"cap17",
|
||||
"is20",
|
||||
"cs20",
|
||||
"is30",
|
||||
]
|
||||
|
||||
25
pyModeS/decoder/flarm/__init__.py
Normal file
25
pyModeS/decoder/flarm/__init__.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from typing import TypedDict
|
||||
|
||||
from .decode import flarm as flarm_decode
|
||||
|
||||
__all__ = ["DecodedMessage", "flarm"]
|
||||
|
||||
|
||||
class DecodedMessage(TypedDict):
|
||||
timestamp: int
|
||||
icao24: str
|
||||
latitude: float
|
||||
longitude: float
|
||||
altitude: int
|
||||
vertical_speed: float
|
||||
groundspeed: int
|
||||
track: int
|
||||
type: str
|
||||
sensorLatitude: float
|
||||
sensorLongitude: float
|
||||
isIcao24: bool
|
||||
noTrack: bool
|
||||
stealth: bool
|
||||
|
||||
|
||||
flarm = flarm_decode
|
||||
124
pyModeS/decoder/flarm/core.c
Normal file
124
pyModeS/decoder/flarm/core.c
Normal file
@@ -0,0 +1,124 @@
|
||||
#include "core.h"
|
||||
|
||||
/*
|
||||
*
|
||||
* https://pastebin.com/YK2f8bfm
|
||||
*
|
||||
* NEW ENCRYPTION
|
||||
*
|
||||
* Swiss glider anti-colission system moved to a new encryption scheme: XXTEA
|
||||
* The algorithm encrypts all the packet after the header: total 20 bytes or 5 long int words of data
|
||||
*
|
||||
* XXTEA description and code are found here: http://en.wikipedia.org/wiki/XXTEA
|
||||
* The system uses 6 iterations of the main loop.
|
||||
*
|
||||
* The system version 6 sends two type of packets: position and ... some unknown data
|
||||
* The difference is made by bit 0 of byte 3 of the packet: for position data this bit is zero.
|
||||
*
|
||||
* For position data the key used depends on the time and transmitting device address.
|
||||
* The key is as well obscured by a weird algorithm.
|
||||
* The code to generate the key is:
|
||||
*
|
||||
* */
|
||||
|
||||
void make_key(int *key, long time, long address)
|
||||
{
|
||||
const long key1[4] = {0xe43276df, 0xdca83759, 0x9802b8ac, 0x4675a56b};
|
||||
const long key1b[4] = {0xfc78ea65, 0x804b90ea, 0xb76542cd, 0x329dfa32};
|
||||
const long *table = ((((time >> 23) & 255) & 0x01) != 0) ? key1b : key1;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
key[i] = obscure(table[i] ^ ((time >> 6) ^ address), 0x045D9F3B) ^ 0x87B562F4;
|
||||
}
|
||||
}
|
||||
|
||||
long obscure(long key, unsigned long seed)
|
||||
{
|
||||
unsigned int m1 = seed * (key ^ (key >> 16));
|
||||
unsigned int m2 = seed * (m1 ^ (m1 >> 16));
|
||||
return m2 ^ (m2 >> 16);
|
||||
}
|
||||
|
||||
/*
|
||||
* NEW PACKET FORMAT:
|
||||
*
|
||||
* Byte Bits
|
||||
* 0 AAAA AAAA device address
|
||||
* 1 AAAA AAAA
|
||||
* 2 AAAA AAAA
|
||||
* 3 00aa 0000 aa = 10 or 01
|
||||
*
|
||||
* 4 vvvv vvvv vertical speed
|
||||
* 5 xxxx xxvv
|
||||
* 6 gggg gggg GPS status
|
||||
* 7 tttt gggg plane type
|
||||
*
|
||||
* 8 LLLL LLLL Latitude
|
||||
* 9 LLLL LLLL
|
||||
* 10 aaaa aLLL
|
||||
* 11 aaaa aaaa Altitude
|
||||
*
|
||||
* 12 NNNN NNNN Longitude
|
||||
* 13 NNNN NNNN
|
||||
* 14 xxxx NNNN
|
||||
* 15 FFxx xxxx multiplying factor
|
||||
*
|
||||
* 16 SSSS SSSS as in version 4
|
||||
* 17 ssss ssss
|
||||
* 18 KKKK KKKK
|
||||
* 19 kkkk kkkk
|
||||
*
|
||||
* 20 EEEE EEEE
|
||||
* 21 eeee eeee
|
||||
* 22 PPPP PPPP
|
||||
* 24 pppp pppp
|
||||
* */
|
||||
|
||||
/*
|
||||
* https://en.wikipedia.org/wiki/XXTEA
|
||||
*/
|
||||
|
||||
void btea(uint32_t *v, int n, uint32_t const key[4])
|
||||
{
|
||||
uint32_t y, z, sum;
|
||||
unsigned p, rounds, e;
|
||||
if (n > 1)
|
||||
{ /* Coding Part */
|
||||
/* Unused, should remove? */
|
||||
rounds = 6 + 52 / n;
|
||||
sum = 0;
|
||||
z = v[n - 1];
|
||||
do
|
||||
{
|
||||
sum += DELTA;
|
||||
e = (sum >> 2) & 3;
|
||||
for (p = 0; p < (unsigned)n - 1; p++)
|
||||
{
|
||||
y = v[p + 1];
|
||||
z = v[p] += MX;
|
||||
}
|
||||
y = v[0];
|
||||
z = v[n - 1] += MX;
|
||||
} while (--rounds);
|
||||
}
|
||||
else if (n < -1)
|
||||
{ /* Decoding Part */
|
||||
n = -n;
|
||||
rounds = 6; // + 52 / n;
|
||||
sum = rounds * DELTA;
|
||||
y = v[0];
|
||||
do
|
||||
{
|
||||
e = (sum >> 2) & 3;
|
||||
for (p = n - 1; p > 0; p--)
|
||||
{
|
||||
z = v[p - 1];
|
||||
y = v[p] -= MX;
|
||||
}
|
||||
z = v[n - 1];
|
||||
y = v[0] -= MX;
|
||||
sum -= DELTA;
|
||||
} while (--rounds);
|
||||
}
|
||||
}
|
||||
13
pyModeS/decoder/flarm/core.h
Normal file
13
pyModeS/decoder/flarm/core.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef __CORE_H__
|
||||
#define __CORE_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define DELTA 0x9e3779b9
|
||||
#define MX (((z >> 5 ^ y << 2) + (y >> 3 ^ z << 4)) ^ ((sum ^ y) + (key[(p & 3) ^ e] ^ z)))
|
||||
|
||||
void make_key(int *key, long time, long address);
|
||||
long obscure(long key, unsigned long seed);
|
||||
void btea(uint32_t *v, int n, uint32_t const key[4]);
|
||||
|
||||
#endif
|
||||
4
pyModeS/decoder/flarm/core.pxd
Normal file
4
pyModeS/decoder/flarm/core.pxd
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
cdef extern from "core.h":
|
||||
void make_key(int*, long time, long address)
|
||||
void btea(int*, int, int*)
|
||||
14
pyModeS/decoder/flarm/decode.pyi
Normal file
14
pyModeS/decoder/flarm/decode.pyi
Normal file
@@ -0,0 +1,14 @@
|
||||
from typing import Any
|
||||
|
||||
from . import DecodedMessage
|
||||
|
||||
AIRCRAFT_TYPES: list[str]
|
||||
|
||||
|
||||
def flarm(
|
||||
timestamp: int,
|
||||
msg: str,
|
||||
refLat: float,
|
||||
refLon: float,
|
||||
**kwargs: Any,
|
||||
) -> DecodedMessage: ...
|
||||
146
pyModeS/decoder/flarm/decode.pyx
Normal file
146
pyModeS/decoder/flarm/decode.pyx
Normal file
@@ -0,0 +1,146 @@
|
||||
from cpython cimport array
|
||||
|
||||
from .core cimport make_key as c_make_key, btea as c_btea
|
||||
|
||||
import array
|
||||
import math
|
||||
from ctypes import c_byte
|
||||
from textwrap import wrap
|
||||
|
||||
AIRCRAFT_TYPES = [
|
||||
"Unknown", # 0
|
||||
"Glider", # 1
|
||||
"Tow-Plane", # 2
|
||||
"Helicopter", # 3
|
||||
"Parachute", # 4
|
||||
"Parachute Drop-Plane", # 5
|
||||
"Hangglider", # 6
|
||||
"Paraglider", # 7
|
||||
"Aircraft", # 8
|
||||
"Jet", # 9
|
||||
"UFO", # 10
|
||||
"Balloon", # 11
|
||||
"Airship", # 12
|
||||
"UAV", # 13
|
||||
"Reserved", # 14
|
||||
"Static Obstacle", # 15
|
||||
]
|
||||
|
||||
cdef long bytearray2int(str icao24):
|
||||
return (
|
||||
(int(icao24[4:6], 16) & 0xFF)
|
||||
| ((int(icao24[2:4], 16) & 0xFF) << 8)
|
||||
| ((int(icao24[:2], 16) & 0xFF) << 16)
|
||||
)
|
||||
|
||||
cpdef array.array make_key(long timestamp, str icao24):
|
||||
cdef long addr = bytearray2int(icao24)
|
||||
cdef array.array a = array.array('i', [0, 0, 0, 0])
|
||||
c_make_key(a.data.as_ints, timestamp, (addr << 8) & 0xffffff)
|
||||
return a
|
||||
|
||||
cpdef array.array btea(long timestamp, str msg):
|
||||
cdef int p
|
||||
cdef str icao24 = msg[4:6] + msg[2:4] + msg[:2]
|
||||
cdef array.array key = make_key(timestamp, icao24)
|
||||
|
||||
pieces = wrap(msg[8:], 8)
|
||||
cdef array.array toDecode = array.array('i', len(pieces) * [0])
|
||||
for i, piece in enumerate(pieces):
|
||||
p = 0
|
||||
for elt in wrap(piece, 2)[::-1]:
|
||||
p = (p << 8) + int(elt, 16)
|
||||
toDecode[i] = p
|
||||
|
||||
c_btea(toDecode.data.as_ints, -5, key.data.as_ints)
|
||||
return toDecode
|
||||
|
||||
cdef float velocity(int ns, int ew):
|
||||
return math.hypot(ew / 4, ns / 4)
|
||||
|
||||
def heading(ns, ew, velocity):
|
||||
if velocity < 1e-6:
|
||||
velocity = 1
|
||||
return (math.atan2(ew / velocity / 4, ns / velocity / 4) / 0.01745) % 360
|
||||
|
||||
def turningRate(a1, a2):
|
||||
return ((((a2 - a1)) + 540) % 360) - 180
|
||||
|
||||
def flarm(long timestamp, str msg, float refLat, float refLon, **kwargs):
|
||||
"""Decode a FLARM message.
|
||||
|
||||
Args:
|
||||
timestamp (int)
|
||||
msg (str)
|
||||
refLat (float): the receiver's location
|
||||
refLon (float): the receiver's location
|
||||
|
||||
Returns:
|
||||
a dictionary with all decoded fields. Any extra keyword argument passed
|
||||
is included in the output dictionary.
|
||||
"""
|
||||
cdef str icao24 = msg[4:6] + msg[2:4] + msg[:2]
|
||||
cdef int magic = int(msg[6:8], 16)
|
||||
|
||||
if magic != 0x10 and magic != 0x20:
|
||||
return None
|
||||
|
||||
cdef array.array decoded = btea(timestamp, msg)
|
||||
|
||||
cdef int aircraft_type = (decoded[0] >> 28) & 0xF
|
||||
cdef int gps = (decoded[0] >> 16) & 0xFFF
|
||||
cdef int raw_vs = c_byte(decoded[0] & 0x3FF).value
|
||||
|
||||
noTrack = ((decoded[0] >> 14) & 0x1) == 1
|
||||
stealth = ((decoded[0] >> 13) & 0x1) == 1
|
||||
|
||||
cdef int altitude = (decoded[1] >> 19) & 0x1FFF
|
||||
|
||||
cdef int lat = decoded[1] & 0x7FFFF
|
||||
|
||||
cdef int mult_factor = 1 << ((decoded[2] >> 30) & 0x3)
|
||||
cdef int lon = decoded[2] & 0xFFFFF
|
||||
|
||||
ns = list(
|
||||
c_byte((decoded[3] >> (i * 8)) & 0xFF).value * mult_factor
|
||||
for i in range(4)
|
||||
)
|
||||
ew = list(
|
||||
c_byte((decoded[4] >> (i * 8)) & 0xFF).value * mult_factor
|
||||
for i in range(4)
|
||||
)
|
||||
|
||||
cdef int roundLat = int(refLat * 1e7) >> 7
|
||||
lat = (lat - roundLat) % 0x080000
|
||||
if lat >= 0x040000:
|
||||
lat -= 0x080000
|
||||
lat = (((lat + roundLat) << 7) + 0x40)
|
||||
|
||||
roundLon = int(refLon * 1e7) >> 7
|
||||
lon = (lon - roundLon) % 0x100000
|
||||
if lon >= 0x080000:
|
||||
lon -= 0x100000
|
||||
lon = (((lon + roundLon) << 7) + 0x40)
|
||||
|
||||
speed = sum(velocity(n, e) for n, e in zip(ns, ew)) / 4
|
||||
|
||||
heading4 = heading(ns[0], ew[0], speed)
|
||||
heading8 = heading(ns[1], ew[1], speed)
|
||||
|
||||
return dict(
|
||||
timestamp=timestamp,
|
||||
icao24=icao24,
|
||||
latitude=round(lat * 1e-7, 6),
|
||||
longitude=round(lon * 1e-7, 6),
|
||||
geoaltitude=altitude,
|
||||
vertical_speed=raw_vs * mult_factor / 10,
|
||||
groundspeed=round(speed),
|
||||
track=round(heading4 - 4 * turningRate(heading4, heading8) / 4),
|
||||
type=AIRCRAFT_TYPES[aircraft_type],
|
||||
sensorLatitude=refLat,
|
||||
sensorLongitude=refLon,
|
||||
isIcao24=magic==0x10,
|
||||
noTrack=noTrack,
|
||||
stealth=stealth,
|
||||
**kwargs
|
||||
)
|
||||
@@ -1,5 +1,138 @@
|
||||
"""
|
||||
Warpper for short roll call surveillance replies DF=4/5
|
||||
Decode short roll call surveillance replies, with downlink format 4 or 5
|
||||
"""
|
||||
|
||||
[To be implemented]
|
||||
"""
|
||||
from __future__ import annotations
|
||||
from typing import Callable, TypeVar
|
||||
|
||||
from .. import common
|
||||
|
||||
T = TypeVar("T")
|
||||
F = Callable[[str], T]
|
||||
|
||||
|
||||
def _checkdf(func: F[T]) -> F[T]:
|
||||
"""Ensure downlink format is 4 or 5."""
|
||||
|
||||
def wrapper(msg: str) -> T:
|
||||
df = common.df(msg)
|
||||
if df not in [4, 5]:
|
||||
raise RuntimeError(
|
||||
"Incorrect downlink format, expect 4 or 5, got {}".format(df)
|
||||
)
|
||||
return func(msg)
|
||||
|
||||
return wrapper
|
||||
|
||||
|
||||
@_checkdf
|
||||
def fs(msg: str) -> tuple[int, str]:
|
||||
"""Decode flight status.
|
||||
|
||||
Args:
|
||||
msg (str): 14 hexdigits string
|
||||
Returns:
|
||||
int, str: flight status, description
|
||||
|
||||
"""
|
||||
msgbin = common.hex2bin(msg)
|
||||
fs = common.bin2int(msgbin[5:8])
|
||||
text = ""
|
||||
|
||||
if fs == 0:
|
||||
text = "no alert, no SPI, aircraft is airborne"
|
||||
elif fs == 1:
|
||||
text = "no alert, no SPI, aircraft is on-ground"
|
||||
elif fs == 2:
|
||||
text = "alert, no SPI, aircraft is airborne"
|
||||
elif fs == 3:
|
||||
text = "alert, no SPI, aircraft is on-ground"
|
||||
elif fs == 4:
|
||||
text = "alert, SPI, aircraft is airborne or on-ground"
|
||||
elif fs == 5:
|
||||
text = "no alert, SPI, aircraft is airborne or on-ground"
|
||||
|
||||
return fs, text
|
||||
|
||||
|
||||
@_checkdf
|
||||
def dr(msg: str) -> tuple[int, str]:
|
||||
"""Decode downlink request.
|
||||
|
||||
Args:
|
||||
msg (str): 14 hexdigits string
|
||||
Returns:
|
||||
int, str: downlink request, description
|
||||
|
||||
"""
|
||||
msgbin = common.hex2bin(msg)
|
||||
dr = common.bin2int(msgbin[8:13])
|
||||
|
||||
text = ""
|
||||
|
||||
if dr == 0:
|
||||
text = "no downlink request"
|
||||
elif dr == 1:
|
||||
text = "request to send Comm-B message"
|
||||
elif dr == 4:
|
||||
text = "Comm-B broadcast 1 available"
|
||||
elif dr == 5:
|
||||
text = "Comm-B broadcast 2 available"
|
||||
elif dr >= 16:
|
||||
text = "ELM downlink segments available: {}".format(dr - 15)
|
||||
|
||||
return dr, text
|
||||
|
||||
|
||||
@_checkdf
|
||||
def um(msg: str) -> tuple[int, int, None | str]:
|
||||
"""Decode utility message.
|
||||
|
||||
Utility message contains interrogator identifier and reservation type.
|
||||
|
||||
Args:
|
||||
msg (str): 14 hexdigits string
|
||||
Returns:
|
||||
int, str: interrogator identifier code that triggered the reply, and
|
||||
reservation type made by the interrogator
|
||||
"""
|
||||
msgbin = common.hex2bin(msg)
|
||||
iis = common.bin2int(msgbin[13:17])
|
||||
ids = common.bin2int(msgbin[17:19])
|
||||
if ids == 0:
|
||||
ids_text = None
|
||||
if ids == 1:
|
||||
ids_text = "Comm-B interrogator identifier code"
|
||||
if ids == 2:
|
||||
ids_text = "Comm-C interrogator identifier code"
|
||||
if ids == 3:
|
||||
ids_text = "Comm-D interrogator identifier code"
|
||||
return iis, ids, ids_text
|
||||
|
||||
|
||||
@_checkdf
|
||||
def altitude(msg: str) -> None | int:
|
||||
"""Decode altitude.
|
||||
|
||||
Args:
|
||||
msg (String): 14 hexdigits string
|
||||
|
||||
Returns:
|
||||
int: altitude in ft
|
||||
|
||||
"""
|
||||
return common.altcode(msg)
|
||||
|
||||
|
||||
@_checkdf
|
||||
def identity(msg: str) -> str:
|
||||
"""Decode squawk code.
|
||||
|
||||
Args:
|
||||
msg (String): 14 hexdigits string
|
||||
|
||||
Returns:
|
||||
string: squawk code
|
||||
|
||||
"""
|
||||
return common.idcode(msg)
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
"""Uncertainty parameters.
|
||||
|
||||
See source code at: https://github.com/junzis/pyModeS/blob/master/pyModeS/decoder/uncertainty.py
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
|
||||
if sys.version_info < (3, 8):
|
||||
from typing_extensions import TypedDict
|
||||
else:
|
||||
from typing import TypedDict
|
||||
|
||||
NA = None
|
||||
|
||||
TC_NUCp_lookup = {
|
||||
@@ -26,7 +34,7 @@ TC_NUCp_lookup = {
|
||||
22: 0,
|
||||
}
|
||||
|
||||
TC_NICv1_lookup = {
|
||||
TC_NICv1_lookup: dict[int, int | dict[int, int]] = {
|
||||
5: 11,
|
||||
6: 10,
|
||||
7: 9,
|
||||
@@ -46,7 +54,7 @@ TC_NICv1_lookup = {
|
||||
22: 0,
|
||||
}
|
||||
|
||||
TC_NICv2_lookup = {
|
||||
TC_NICv2_lookup: dict[int, int | dict[int, int]] = {
|
||||
5: 11,
|
||||
6: 10,
|
||||
7: {2: 9, 0: 8},
|
||||
@@ -67,7 +75,13 @@ TC_NICv2_lookup = {
|
||||
}
|
||||
|
||||
|
||||
NUCp = {
|
||||
class NUCpEntry(TypedDict):
|
||||
HPL: None | float
|
||||
RCu: None | int
|
||||
RCv: None | int
|
||||
|
||||
|
||||
NUCp: dict[int, NUCpEntry] = {
|
||||
9: {"HPL": 7.5, "RCu": 3, "RCv": 4},
|
||||
8: {"HPL": 25, "RCu": 10, "RCv": 15},
|
||||
7: {"HPL": 185, "RCu": 93, "RCv": NA},
|
||||
@@ -80,7 +94,13 @@ NUCp = {
|
||||
0: {"HPL": NA, "RCu": NA, "RCv": NA},
|
||||
}
|
||||
|
||||
NUCv = {
|
||||
|
||||
class NUCvEntry(TypedDict):
|
||||
HVE: None | float
|
||||
VVE: None | float
|
||||
|
||||
|
||||
NUCv: dict[int, NUCvEntry] = {
|
||||
0: {"HVE": NA, "VVE": NA},
|
||||
1: {"HVE": 10, "VVE": 15.2},
|
||||
2: {"HVE": 3, "VVE": 4.5},
|
||||
@@ -88,7 +108,13 @@ NUCv = {
|
||||
4: {"HVE": 0.3, "VVE": 0.46},
|
||||
}
|
||||
|
||||
NACp = {
|
||||
|
||||
class NACpEntry(TypedDict):
|
||||
EPU: None | int
|
||||
VEPU: None | int
|
||||
|
||||
|
||||
NACp: dict[int, NACpEntry] = {
|
||||
11: {"EPU": 3, "VEPU": 4},
|
||||
10: {"EPU": 10, "VEPU": 15},
|
||||
9: {"EPU": 30, "VEPU": 45},
|
||||
@@ -103,7 +129,13 @@ NACp = {
|
||||
0: {"EPU": NA, "VEPU": NA},
|
||||
}
|
||||
|
||||
NACv = {
|
||||
|
||||
class NACvEntry(TypedDict):
|
||||
HFOMr: None | float
|
||||
VFOMr: None | float
|
||||
|
||||
|
||||
NACv: dict[int, NACvEntry] = {
|
||||
0: {"HFOMr": NA, "VFOMr": NA},
|
||||
1: {"HFOMr": 10, "VFOMr": 15.2},
|
||||
2: {"HFOMr": 3, "VFOMr": 4.5},
|
||||
@@ -111,7 +143,13 @@ NACv = {
|
||||
4: {"HFOMr": 0.3, "VFOMr": 0.46},
|
||||
}
|
||||
|
||||
SIL = {
|
||||
|
||||
class SILEntry(TypedDict):
|
||||
PE_RCu: None | float
|
||||
PE_VPL: None | float
|
||||
|
||||
|
||||
SIL: dict[int, SILEntry] = {
|
||||
3: {"PE_RCu": 1e-7, "PE_VPL": 2e-7},
|
||||
2: {"PE_RCu": 1e-5, "PE_VPL": 1e-5},
|
||||
1: {"PE_RCu": 1e-3, "PE_VPL": 1e-3},
|
||||
@@ -119,7 +157,12 @@ SIL = {
|
||||
}
|
||||
|
||||
|
||||
NICv1 = {
|
||||
class NICv1Entry(TypedDict):
|
||||
Rc: None | float
|
||||
VPL: None | float
|
||||
|
||||
|
||||
NICv1: dict[int, dict[int, NICv1Entry]] = {
|
||||
# NIC is used as the index at second Level
|
||||
11: {0: {"Rc": 7.5, "VPL": 11}},
|
||||
10: {0: {"Rc": 25, "VPL": 37.5}},
|
||||
@@ -135,7 +178,12 @@ NICv1 = {
|
||||
0: {0: {"Rc": NA, "VPL": NA}},
|
||||
}
|
||||
|
||||
NICv2 = {
|
||||
|
||||
class NICv2Entry(TypedDict):
|
||||
Rc: None | float
|
||||
|
||||
|
||||
NICv2: dict[int, dict[int, NICv2Entry]] = {
|
||||
# Decimal value of [NICa NICb/NICc] is used as the index at second Level
|
||||
11: {0: {"Rc": 7.5}},
|
||||
10: {0: {"Rc": 25}},
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
from pyModeS import common
|
||||
from typing import Optional
|
||||
from .. import common
|
||||
from textwrap import wrap
|
||||
|
||||
|
||||
def uplink_icao(msg):
|
||||
"""Calculate the ICAO address from a Mode-S interrogation (uplink message)"""
|
||||
def uplink_icao(msg: str) -> str:
|
||||
"Calculate the ICAO address from a Mode-S interrogation (uplink message)"
|
||||
p_gen = 0xFFFA0480 << ((len(msg) - 14) * 4)
|
||||
data = int(msg[:-6], 16)
|
||||
PA = int(msg[-6:], 16)
|
||||
@@ -19,7 +21,203 @@ def uplink_icao(msg):
|
||||
return "%06X" % (ad >> 2)
|
||||
|
||||
|
||||
def uf(msg):
|
||||
def uf(msg: str) -> int:
|
||||
"""Decode Uplink Format value, bits 1 to 5."""
|
||||
ufbin = common.hex2bin(msg[:2])
|
||||
return min(common.bin2int(ufbin[0:5]), 24)
|
||||
|
||||
|
||||
def bds(msg: str) -> Optional[str]:
|
||||
"Decode requested BDS register from selective (Roll Call) interrogation."
|
||||
UF = uf(msg)
|
||||
msgbin = common.hex2bin(msg)
|
||||
msgbin_split = wrap(msgbin, 8)
|
||||
mbytes = list(map(common.bin2int, msgbin_split))
|
||||
|
||||
if UF in {4, 5, 20, 21}:
|
||||
|
||||
di = mbytes[1] & 0x7 # DI - Designator Identification
|
||||
RR = mbytes[1] >> 3 & 0x1F
|
||||
if RR > 15:
|
||||
BDS1 = RR - 16
|
||||
if di == 7:
|
||||
RRS = mbytes[2] & 0x0F
|
||||
BDS2 = RRS
|
||||
elif di == 3:
|
||||
RRS = ((mbytes[2] & 0x1) << 3) | ((mbytes[3] & 0xE0) >> 5)
|
||||
BDS2 = RRS
|
||||
else:
|
||||
# for other values of DI, the BDS2 is assumed 0
|
||||
# (as per ICAO Annex 10 Vol IV)
|
||||
BDS2 = 0
|
||||
|
||||
return str(format(BDS1,"X")) + str(format(BDS2,"X"))
|
||||
else:
|
||||
return None
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def pr(msg: str) -> Optional[int]:
|
||||
"""Decode PR (probability of reply) field from All Call interrogation.
|
||||
Interpretation:
|
||||
0 signifies reply with probability of 1
|
||||
1 signifies reply with probability of 1/2
|
||||
2 signifies reply with probability of 1/4
|
||||
3 signifies reply with probability of 1/8
|
||||
4 signifies reply with probability of 1/16
|
||||
5, 6, 7 not assigned
|
||||
8 signifies disregard lockout, reply with probability of 1
|
||||
9 signifies disregard lockout, reply with probability of 1/2
|
||||
10 signifies disregard lockout, reply with probability of 1/4
|
||||
11 signifies disregard lockout, reply with probability of 1/8
|
||||
12 signifies disregard lockout, reply with probability of 1/16
|
||||
13, 14, 15 not assigned.
|
||||
"""
|
||||
msgbin = common.hex2bin(msg)
|
||||
msgbin_split = wrap(msgbin, 8)
|
||||
mbytes = list(map(common.bin2int, msgbin_split))
|
||||
if uf(msg) == 11:
|
||||
return ((mbytes[0] & 0x7) << 1) | ((mbytes[1] & 0x80) >> 7)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def ic(msg: str) -> Optional[str]:
|
||||
"""Decode IC (interrogator code) from a ground-based interrogation."""
|
||||
|
||||
UF = uf(msg)
|
||||
msgbin = common.hex2bin(msg)
|
||||
msgbin_split = wrap(msgbin, 8)
|
||||
mbytes = list(map(common.bin2int, msgbin_split))
|
||||
IC = None
|
||||
if UF == 11:
|
||||
|
||||
codeLabel = mbytes[1] & 0x7
|
||||
icField = (mbytes[1] >> 3) & 0xF
|
||||
|
||||
# Store the Interogator Code
|
||||
ic_switcher = {
|
||||
0: "II" + str(icField),
|
||||
1: "SI" + str(icField),
|
||||
2: "SI" + str(icField + 16),
|
||||
3: "SI" + str(icField + 32),
|
||||
4: "SI" + str(icField + 48),
|
||||
}
|
||||
IC = ic_switcher.get(codeLabel, "")
|
||||
|
||||
if UF in {4, 5, 20, 21}:
|
||||
di = mbytes[1] & 0x7
|
||||
RR = mbytes[1] >> 3 & 0x1F
|
||||
if RR > 15:
|
||||
BDS1 = RR - 16 # noqa: F841
|
||||
if di == 0 or di == 1 or di == 7:
|
||||
# II
|
||||
II = (mbytes[2] >> 4) & 0xF
|
||||
IC = "II" + str(II)
|
||||
elif di == 3:
|
||||
# SI
|
||||
SI = (mbytes[2] >> 2) & 0x3F
|
||||
IC = "SI" + str(SI)
|
||||
return IC
|
||||
|
||||
|
||||
def lockout(msg):
|
||||
"""Decode the lockout command from selective (Roll Call) interrogation."""
|
||||
msgbin = common.hex2bin(msg)
|
||||
msgbin_split = wrap(msgbin, 8)
|
||||
mbytes = list(map(common.bin2int, msgbin_split))
|
||||
|
||||
if uf(msg) in {4, 5, 20, 21}:
|
||||
lockout = False
|
||||
di = mbytes[1] & 0x7
|
||||
if di == 7:
|
||||
# LOS
|
||||
if ((mbytes[3] & 0x40) >> 6) == 1:
|
||||
lockout = True
|
||||
elif di == 3:
|
||||
# LSS
|
||||
if ((mbytes[2] & 0x2) >> 1) == 1:
|
||||
lockout = True
|
||||
return lockout
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def uplink_fields(msg):
|
||||
"""Decode individual fields of a ground-based interrogation."""
|
||||
msgbin = common.hex2bin(msg)
|
||||
msgbin_split = wrap(msgbin, 8)
|
||||
mbytes = list(map(common.bin2int, msgbin_split))
|
||||
PR = ""
|
||||
IC = ""
|
||||
lockout = False
|
||||
di = ""
|
||||
RR = ""
|
||||
RRS = ""
|
||||
BDS = ""
|
||||
if uf(msg) == 11:
|
||||
|
||||
# Probability of Reply decoding
|
||||
|
||||
PR = ((mbytes[0] & 0x7) << 1) | ((mbytes[1] & 0x80) >> 7)
|
||||
|
||||
# Get cl and ic bit fields from the data
|
||||
# Decode the SI or II interrogator code
|
||||
codeLabel = mbytes[1] & 0x7
|
||||
icField = (mbytes[1] >> 3) & 0xF
|
||||
|
||||
# Store the Interogator Code
|
||||
ic_switcher = {
|
||||
0: "II" + str(icField),
|
||||
1: "SI" + str(icField),
|
||||
2: "SI" + str(icField + 16),
|
||||
3: "SI" + str(icField + 32),
|
||||
4: "SI" + str(icField + 48),
|
||||
}
|
||||
IC = ic_switcher.get(codeLabel, "")
|
||||
|
||||
if uf(msg) in {4, 5, 20, 21}:
|
||||
# Decode the DI and get the lockout information conveniently
|
||||
# (LSS or LOS)
|
||||
|
||||
# DI - Designator Identification
|
||||
di = mbytes[1] & 0x7
|
||||
RR = mbytes[1] >> 3 & 0x1F
|
||||
if RR > 15:
|
||||
BDS1 = RR - 16
|
||||
BDS2 = 0
|
||||
if di == 0 or di == 1:
|
||||
# II
|
||||
II = (mbytes[2] >> 4) & 0xF
|
||||
IC = "II" + str(II)
|
||||
elif di == 7:
|
||||
# LOS
|
||||
if ((mbytes[3] & 0x40) >> 6) == 1:
|
||||
lockout = True
|
||||
# II
|
||||
II = (mbytes[2] >> 4) & 0xF
|
||||
IC = "II" + str(II)
|
||||
RRS = mbytes[2] & 0x0F
|
||||
BDS2 = RRS
|
||||
elif di == 3:
|
||||
# LSS
|
||||
if ((mbytes[2] & 0x2) >> 1) == 1:
|
||||
lockout = True
|
||||
# SI
|
||||
SI = (mbytes[2] >> 2) & 0x3F
|
||||
IC = "SI" + str(SI)
|
||||
RRS = ((mbytes[2] & 0x1) << 3) | ((mbytes[3] & 0xE0) >> 5)
|
||||
BDS2 = RRS
|
||||
if RR > 15:
|
||||
BDS = str(format(BDS1,"X")) + str(format(BDS2,"X"))
|
||||
|
||||
return {
|
||||
"DI": di,
|
||||
"IC": IC,
|
||||
"LOS": lockout,
|
||||
"PR": PR,
|
||||
"RR": RR,
|
||||
"RRS": RRS,
|
||||
"BDS": BDS,
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ Speed conversion at altitude H[m] in ISA
|
||||
::
|
||||
|
||||
Mach = tas2mach(Vtas,H) # true airspeed (Vtas) to mach number conversion
|
||||
Vtas = mach2tas(Mach,H) # true airspeed (Vtas) to mach number conversion
|
||||
Vtas = mach2tas(Mach,H) # mach number to true airspeed (Vtas) conversion
|
||||
Vtas = eas2tas(Veas,H) # equivalent airspeed to true airspeed, H in [m]
|
||||
Veas = tas2eas(Vtas,H) # true airspeed to equivent airspeed, H in [m]
|
||||
Vtas = cas2tas(Vcas,H) # Vcas to Vtas conversion both m/s, H in [m]
|
||||
@@ -35,18 +35,18 @@ ft = 0.3048 # ft -> m
|
||||
fpm = 0.00508 # ft/min -> m/s
|
||||
inch = 0.0254 # inch -> m
|
||||
sqft = 0.09290304 # 1 square foot
|
||||
nm = 1852.0 # nautical mile -> m
|
||||
nm = 1852 # nautical mile -> m
|
||||
lbs = 0.453592 # pound -> kg
|
||||
g0 = 9.80665 # m/s2, Sea level gravity constant
|
||||
R = 287.05287 # m2/(s2 x K), gas constant, sea level ISA
|
||||
p0 = 101325.0 # Pa, air pressure, sea level ISA
|
||||
p0 = 101325 # Pa, air pressure, sea level ISA
|
||||
rho0 = 1.225 # kg/m3, air density, sea level ISA
|
||||
T0 = 288.15 # K, temperature, sea level ISA
|
||||
gamma = 1.40 # cp/cv for air
|
||||
gamma1 = 0.2 # (gamma-1)/2 for air
|
||||
gamma2 = 3.5 # gamma/(gamma-1) for air
|
||||
beta = -0.0065 # [K/m] ISA temp gradient below tropopause
|
||||
r_earth = 6371000.0 # m, average earth radius
|
||||
r_earth = 6371000 # m, average earth radius
|
||||
a0 = 340.293988 # m/s, sea level speed of sound ISA, sqrt(gamma*R*T0)
|
||||
|
||||
|
||||
@@ -94,8 +94,8 @@ def distance(lat1, lon1, lat2, lon2, H=0):
|
||||
"""
|
||||
|
||||
# phi = 90 - latitude
|
||||
phi1 = np.radians(90.0 - lat1)
|
||||
phi2 = np.radians(90.0 - lat2)
|
||||
phi1 = np.radians(90 - lat1)
|
||||
phi2 = np.radians(90 - lat2)
|
||||
|
||||
# theta = longitude
|
||||
theta1 = np.radians(lon1)
|
||||
@@ -158,16 +158,16 @@ def tas2eas(Vtas, H):
|
||||
def cas2tas(Vcas, H):
|
||||
"""Calibrated Airspeed to True Airspeed"""
|
||||
p, rho, T = atmos(H)
|
||||
qdyn = p0 * ((1.0 + rho0 * Vcas * Vcas / (7.0 * p0)) ** 3.5 - 1.0)
|
||||
Vtas = np.sqrt(7.0 * p / rho * ((1.0 + qdyn / p) ** (2.0 / 7.0) - 1.0))
|
||||
qdyn = p0 * ((1 + rho0 * Vcas * Vcas / (7 * p0)) ** 3.5 - 1.0)
|
||||
Vtas = np.sqrt(7 * p / rho * ((1 + qdyn / p) ** (2 / 7.0) - 1.0))
|
||||
return Vtas
|
||||
|
||||
|
||||
def tas2cas(Vtas, H):
|
||||
"""True Airspeed to Calibrated Airspeed"""
|
||||
p, rho, T = atmos(H)
|
||||
qdyn = p * ((1.0 + rho * Vtas * Vtas / (7.0 * p)) ** 3.5 - 1.0)
|
||||
Vcas = np.sqrt(7.0 * p0 / rho0 * ((qdyn / p0 + 1.0) ** (2.0 / 7.0) - 1.0))
|
||||
qdyn = p * ((1 + rho * Vtas * Vtas / (7 * p)) ** 3.5 - 1.0)
|
||||
Vcas = np.sqrt(7 * p0 / rho0 * ((qdyn / p0 + 1.0) ** (2 / 7.0) - 1.0))
|
||||
return Vcas
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
import time
|
||||
import traceback
|
||||
import numpy as np
|
||||
import pyModeS as pms
|
||||
from rtlsdr import RtlSdr
|
||||
import time
|
||||
|
||||
try:
|
||||
import rtlsdr # type: ignore
|
||||
except:
|
||||
print("------------------------------------------------------------------------")
|
||||
print("! Warning: pyrtlsdr not installed (required for using RTL-SDR devices) !")
|
||||
print("------------------------------------------------------------------------")
|
||||
|
||||
sampling_rate = 2e6
|
||||
smaples_per_microsec = 2
|
||||
@@ -21,7 +27,7 @@ class RtlReader(object):
|
||||
def __init__(self, **kwargs):
|
||||
super(RtlReader, self).__init__()
|
||||
self.signal_buffer = [] # amplitude of the sample only
|
||||
self.sdr = RtlSdr()
|
||||
self.sdr = rtlsdr.RtlSdr()
|
||||
self.sdr.sample_rate = sampling_rate
|
||||
self.sdr.center_freq = modes_frequency
|
||||
self.sdr.gain = "auto"
|
||||
@@ -31,6 +37,8 @@ class RtlReader(object):
|
||||
self.stop_flag = False
|
||||
self.noise_floor = 1e6
|
||||
|
||||
self.exception_queue = None
|
||||
|
||||
def _calc_noise(self):
|
||||
"""Calculate noise floor"""
|
||||
window = smaples_per_microsec * 100
|
||||
@@ -162,6 +170,7 @@ class RtlReader(object):
|
||||
|
||||
def run(self, raw_pipe_in=None, stop_flag=None, exception_queue=None):
|
||||
self.raw_pipe_in = raw_pipe_in
|
||||
self.exception_queue = exception_queue
|
||||
self.stop_flag = stop_flag
|
||||
|
||||
try:
|
||||
@@ -173,8 +182,8 @@ class RtlReader(object):
|
||||
|
||||
except Exception as e:
|
||||
tb = traceback.format_exc()
|
||||
if exception_queue is not None:
|
||||
exception_queue.put(tb)
|
||||
if self.exception_queue is not None:
|
||||
self.exception_queue.put(tb)
|
||||
raise e
|
||||
|
||||
|
||||
|
||||
@@ -7,11 +7,6 @@ import pyModeS as pms
|
||||
import traceback
|
||||
import zmq
|
||||
|
||||
if sys.version_info > (3, 0):
|
||||
PY_VERSION = 3
|
||||
else:
|
||||
PY_VERSION = 2
|
||||
|
||||
|
||||
class TcpClient(object):
|
||||
def __init__(self, host, port, datatype):
|
||||
@@ -28,6 +23,8 @@ class TcpClient(object):
|
||||
self.raw_pipe_in = None
|
||||
self.stop_flag = False
|
||||
|
||||
self.exception_queue = None
|
||||
|
||||
def connect(self):
|
||||
self.socket = zmq.Context().socket(zmq.STREAM)
|
||||
self.socket.setsockopt(zmq.LINGER, 0)
|
||||
@@ -35,7 +32,7 @@ class TcpClient(object):
|
||||
self.socket.connect("tcp://%s:%s" % (self.host, self.port))
|
||||
|
||||
def stop(self):
|
||||
self.socket.disconnect()
|
||||
self.socket.close()
|
||||
|
||||
def read_raw_buffer(self):
|
||||
""" Read raw ADS-B data type.
|
||||
@@ -255,6 +252,7 @@ class TcpClient(object):
|
||||
|
||||
def run(self, raw_pipe_in=None, stop_flag=None, exception_queue=None):
|
||||
self.raw_pipe_in = raw_pipe_in
|
||||
self.exception_queue = exception_queue
|
||||
self.stop_flag = stop_flag
|
||||
self.connect()
|
||||
|
||||
@@ -262,9 +260,6 @@ class TcpClient(object):
|
||||
try:
|
||||
received = [i for i in self.socket.recv(4096)]
|
||||
|
||||
if PY_VERSION == 2:
|
||||
received = [ord(i) for i in received]
|
||||
|
||||
self.buffer.extend(received)
|
||||
# print(''.join(x.encode('hex') for x in self.buffer))
|
||||
|
||||
@@ -282,9 +277,12 @@ class TcpClient(object):
|
||||
|
||||
# raise RuntimeError("test exception")
|
||||
|
||||
except zmq.error.Again:
|
||||
continue
|
||||
except Exception as e:
|
||||
tb = traceback.format_exc()
|
||||
exception_queue.put(tb)
|
||||
if self.exception_queue is not None:
|
||||
self.exception_queue.put(tb)
|
||||
raise e
|
||||
|
||||
|
||||
@@ -294,4 +292,7 @@ if __name__ == "__main__":
|
||||
port = int(sys.argv[2])
|
||||
datatype = sys.argv[3]
|
||||
client = TcpClient(host=host, port=port, datatype=datatype)
|
||||
client.run()
|
||||
try:
|
||||
client.run()
|
||||
finally:
|
||||
client.stop()
|
||||
|
||||
0
pyModeS/py.typed
Normal file
0
pyModeS/py.typed
Normal file
@@ -1,44 +1,46 @@
|
||||
from typing import Optional
|
||||
|
||||
import numpy as np
|
||||
from textwrap import wrap
|
||||
|
||||
|
||||
def hex2bin(hexstr):
|
||||
"""Convert a hexdecimal string to binary string, with zero fillings."""
|
||||
def hex2bin(hexstr: str) -> str:
|
||||
"""Convert a hexadecimal string to binary string, with zero fillings."""
|
||||
num_of_bits = len(hexstr) * 4
|
||||
binstr = bin(int(hexstr, 16))[2:].zfill(int(num_of_bits))
|
||||
return binstr
|
||||
|
||||
|
||||
def hex2int(hexstr):
|
||||
"""Convert a hexdecimal string to integer."""
|
||||
def hex2int(hexstr: str) -> int:
|
||||
"""Convert a hexadecimal string to integer."""
|
||||
return int(hexstr, 16)
|
||||
|
||||
|
||||
def bin2int(binstr):
|
||||
def bin2int(binstr: str) -> int:
|
||||
"""Convert a binary string to integer."""
|
||||
return int(binstr, 2)
|
||||
|
||||
|
||||
def bin2hex(binstr):
|
||||
"""Convert a binary string to hexdecimal string."""
|
||||
def bin2hex(binstr: str) -> str:
|
||||
"""Convert a binary string to hexadecimal string."""
|
||||
return "{0:X}".format(int(binstr, 2))
|
||||
|
||||
|
||||
def df(msg):
|
||||
def df(msg: str) -> int:
|
||||
"""Decode Downlink Format value, bits 1 to 5."""
|
||||
dfbin = hex2bin(msg[:2])
|
||||
return min(bin2int(dfbin[0:5]), 24)
|
||||
|
||||
|
||||
def crc(msg, encode=False):
|
||||
def crc(msg: str, encode: bool = False) -> int:
|
||||
"""Mode-S Cyclic Redundancy Check.
|
||||
|
||||
Detect if bit error occurs in the Mode-S message. When encode option is on,
|
||||
the checksum is generated.
|
||||
|
||||
Args:
|
||||
msg (string): 28 bytes hexadecimal message string
|
||||
encode (bool): True to encode the date only and return the checksum
|
||||
msg: 28 bytes hexadecimal message string
|
||||
encode: True to encode the date only and return the checksum
|
||||
Returns:
|
||||
int: message checksum, or partity bits (encoder)
|
||||
|
||||
@@ -75,7 +77,7 @@ def crc(msg, encode=False):
|
||||
return result
|
||||
|
||||
|
||||
def crc_legacy(msg, encode=False):
|
||||
def crc_legacy(msg: str, encode: bool = False) -> int:
|
||||
"""Mode-S Cyclic Redundancy Check. (Legacy code, 2x slow)."""
|
||||
# the polynominal generattor code for CRC [1111111111111010000001001]
|
||||
generator = np.array(
|
||||
@@ -103,7 +105,7 @@ def crc_legacy(msg, encode=False):
|
||||
return reminder
|
||||
|
||||
|
||||
def floor(x):
|
||||
def floor(x: float) -> int:
|
||||
"""Mode-S floor function.
|
||||
|
||||
Defined as the greatest integer value k, such that k <= x
|
||||
@@ -113,7 +115,7 @@ def floor(x):
|
||||
return int(np.floor(x))
|
||||
|
||||
|
||||
def icao(msg):
|
||||
def icao(msg: str) -> Optional[str]:
|
||||
"""Calculate the ICAO address from an Mode-S message.
|
||||
|
||||
Applicable only with DF4, DF5, DF20, DF21 messages.
|
||||
@@ -125,6 +127,7 @@ def icao(msg):
|
||||
String: ICAO address in 6 bytes hexadecimal string
|
||||
|
||||
"""
|
||||
addr: Optional[str]
|
||||
DF = df(msg)
|
||||
|
||||
if DF in (11, 17, 18):
|
||||
@@ -139,7 +142,7 @@ def icao(msg):
|
||||
return addr
|
||||
|
||||
|
||||
def is_icao_assigned(icao):
|
||||
def is_icao_assigned(icao: str) -> bool:
|
||||
"""Check whether the ICAO address is assigned (Annex 10, Vol 3)."""
|
||||
if (icao is None) or (not isinstance(icao, str)) or (len(icao) != 6):
|
||||
return False
|
||||
@@ -168,7 +171,7 @@ def is_icao_assigned(icao):
|
||||
return True
|
||||
|
||||
|
||||
def typecode(msg):
|
||||
def typecode(msg: str) -> Optional[int]:
|
||||
"""Type code of ADS-B message
|
||||
|
||||
Args:
|
||||
@@ -184,7 +187,7 @@ def typecode(msg):
|
||||
return bin2int(tcbin[0:5])
|
||||
|
||||
|
||||
def cprNL(lat):
|
||||
def cprNL(lat: float) -> int:
|
||||
"""NL() function in CPR decoding."""
|
||||
|
||||
if np.isclose(lat, 0):
|
||||
@@ -196,17 +199,14 @@ def cprNL(lat):
|
||||
|
||||
nz = 15
|
||||
a = 1 - np.cos(np.pi / (2 * nz))
|
||||
b = np.cos(np.pi / 180.0 * abs(lat)) ** 2
|
||||
b = np.cos(np.pi / 180 * abs(lat)) ** 2
|
||||
nl = 2 * np.pi / (np.arccos(1 - a / b))
|
||||
NL = floor(nl)
|
||||
return NL
|
||||
|
||||
|
||||
def idcode(msg):
|
||||
"""Compute identity (squawk code).
|
||||
|
||||
Applicable only for DF5 or DF21 messages, bit 20-32.
|
||||
credit: @fbyrkjeland
|
||||
def idcode(msg: str) -> str:
|
||||
"""Compute identity code (squawk) encoded in DF5 or DF21 message.
|
||||
|
||||
Args:
|
||||
msg (String): 28 bytes hexadecimal message string
|
||||
@@ -219,20 +219,37 @@ def idcode(msg):
|
||||
raise RuntimeError("Message must be Downlink Format 5 or 21.")
|
||||
|
||||
mbin = hex2bin(msg)
|
||||
idcodebin = mbin[19:32]
|
||||
|
||||
C1 = mbin[19]
|
||||
A1 = mbin[20]
|
||||
C2 = mbin[21]
|
||||
A2 = mbin[22]
|
||||
C4 = mbin[23]
|
||||
A4 = mbin[24]
|
||||
# _ = mbin[25]
|
||||
B1 = mbin[26]
|
||||
D1 = mbin[27]
|
||||
B2 = mbin[28]
|
||||
D2 = mbin[29]
|
||||
B4 = mbin[30]
|
||||
D4 = mbin[31]
|
||||
return squawk(idcodebin)
|
||||
|
||||
|
||||
def squawk(binstr: str) -> str:
|
||||
"""Decode 13 bits identity (squawk) code.
|
||||
|
||||
Args:
|
||||
binstr (String): 13 bits binary string
|
||||
|
||||
Returns:
|
||||
int: altitude in ft
|
||||
|
||||
"""
|
||||
if len(binstr) != 13 or not set(binstr).issubset(set("01")):
|
||||
raise RuntimeError("Input must be 13 bits binary string")
|
||||
|
||||
C1 = binstr[0]
|
||||
A1 = binstr[1]
|
||||
C2 = binstr[2]
|
||||
A2 = binstr[3]
|
||||
C4 = binstr[4]
|
||||
A4 = binstr[5]
|
||||
# X = binstr[6]
|
||||
B1 = binstr[7]
|
||||
D1 = binstr[8]
|
||||
B2 = binstr[9]
|
||||
D2 = binstr[10]
|
||||
B4 = binstr[11]
|
||||
D4 = binstr[12]
|
||||
|
||||
byte1 = int(A4 + A2 + A1, 2)
|
||||
byte2 = int(B4 + B2 + B1, 2)
|
||||
@@ -242,11 +259,8 @@ def idcode(msg):
|
||||
return str(byte1) + str(byte2) + str(byte3) + str(byte4)
|
||||
|
||||
|
||||
def altcode(msg):
|
||||
"""Compute the altitude.
|
||||
|
||||
Applicable only for DF4 or DF20 message, bit 20-32.
|
||||
credit: @fbyrkjeland
|
||||
def altcode(msg: str) -> Optional[int]:
|
||||
"""Compute altitude encoded in DF4 or DF20 message.
|
||||
|
||||
Args:
|
||||
msg (String): 28 bytes hexadecimal message string
|
||||
@@ -255,50 +269,78 @@ def altcode(msg):
|
||||
int: altitude in ft
|
||||
|
||||
"""
|
||||
alt: Optional[int]
|
||||
|
||||
if df(msg) not in [0, 4, 16, 20]:
|
||||
raise RuntimeError("Message must be Downlink Format 0, 4, 16, or 20.")
|
||||
|
||||
# Altitude code, bit 20-32
|
||||
mbin = hex2bin(msg)
|
||||
|
||||
mbit = mbin[25] # M bit: 26
|
||||
qbit = mbin[27] # Q bit: 28
|
||||
altitude_code = mbin[19:32]
|
||||
|
||||
if mbit == "0": # unit in ft
|
||||
if qbit == "1": # 25ft interval
|
||||
vbin = mbin[19:25] + mbin[26] + mbin[28:32]
|
||||
alt = altitude(altitude_code)
|
||||
|
||||
return alt
|
||||
|
||||
|
||||
def altitude(binstr: str) -> Optional[int]:
|
||||
"""Decode 13 bits altitude code.
|
||||
|
||||
Args:
|
||||
binstr (String): 13 bits binary string
|
||||
|
||||
Returns:
|
||||
int: altitude in ft
|
||||
|
||||
"""
|
||||
alt: Optional[int]
|
||||
|
||||
if len(binstr) != 13 or not set(binstr).issubset(set("01")):
|
||||
raise RuntimeError("Input must be 13 bits binary string")
|
||||
|
||||
Mbit = binstr[6]
|
||||
Qbit = binstr[8]
|
||||
|
||||
if bin2int(binstr) == 0:
|
||||
# altitude unknown or invalid
|
||||
alt = None
|
||||
|
||||
elif Mbit == "0": # unit in ft
|
||||
if Qbit == "1": # 25ft interval
|
||||
vbin = binstr[:6] + binstr[7] + binstr[9:]
|
||||
alt = bin2int(vbin) * 25 - 1000
|
||||
if qbit == "0": # 100ft interval, above 50175ft
|
||||
C1 = mbin[19]
|
||||
A1 = mbin[20]
|
||||
C2 = mbin[21]
|
||||
A2 = mbin[22]
|
||||
C4 = mbin[23]
|
||||
A4 = mbin[24]
|
||||
# _ = mbin[25]
|
||||
B1 = mbin[26]
|
||||
# D1 = mbin[27] # always zero
|
||||
B2 = mbin[28]
|
||||
D2 = mbin[29]
|
||||
B4 = mbin[30]
|
||||
D4 = mbin[31]
|
||||
if Qbit == "0": # 100ft interval, above 50187.5ft
|
||||
C1 = binstr[0]
|
||||
A1 = binstr[1]
|
||||
C2 = binstr[2]
|
||||
A2 = binstr[3]
|
||||
C4 = binstr[4]
|
||||
A4 = binstr[5]
|
||||
# M = binstr[6]
|
||||
B1 = binstr[7]
|
||||
# Q = binstr[8]
|
||||
B2 = binstr[9]
|
||||
D2 = binstr[10]
|
||||
B4 = binstr[11]
|
||||
D4 = binstr[12]
|
||||
|
||||
graystr = D2 + D4 + A1 + A2 + A4 + B1 + B2 + B4 + C1 + C2 + C4
|
||||
alt = gray2alt(graystr)
|
||||
|
||||
if mbit == "1": # unit in meter
|
||||
vbin = mbin[19:25] + mbin[26:31]
|
||||
if Mbit == "1": # unit in meter
|
||||
vbin = binstr[:6] + binstr[7:]
|
||||
alt = int(bin2int(vbin) * 3.28084) # convert to ft
|
||||
|
||||
return alt
|
||||
|
||||
|
||||
def gray2alt(codestr):
|
||||
gc500 = codestr[:8]
|
||||
def gray2alt(binstr: str) -> Optional[int]:
|
||||
gc500 = binstr[:8]
|
||||
n500 = gray2int(gc500)
|
||||
|
||||
# in 100-ft step must be converted first
|
||||
gc100 = codestr[8:]
|
||||
gc100 = binstr[8:]
|
||||
n100 = gray2int(gc100)
|
||||
|
||||
if n100 in [0, 5, 6]:
|
||||
@@ -314,9 +356,9 @@ def gray2alt(codestr):
|
||||
return alt
|
||||
|
||||
|
||||
def gray2int(graystr):
|
||||
def gray2int(binstr: str) -> int:
|
||||
"""Convert greycode to binary."""
|
||||
num = bin2int(graystr)
|
||||
num = bin2int(binstr)
|
||||
num ^= num >> 8
|
||||
num ^= num >> 4
|
||||
num ^= num >> 2
|
||||
@@ -324,12 +366,12 @@ def gray2int(graystr):
|
||||
return num
|
||||
|
||||
|
||||
def data(msg):
|
||||
def data(msg: str) -> str:
|
||||
"""Return the data frame in the message, bytes 9 to 22."""
|
||||
return msg[8:-6]
|
||||
|
||||
|
||||
def allzeros(msg):
|
||||
def allzeros(msg: str) -> bool:
|
||||
"""Check if the data bits are all zeros.
|
||||
|
||||
Args:
|
||||
@@ -347,7 +389,7 @@ def allzeros(msg):
|
||||
return True
|
||||
|
||||
|
||||
def wrongstatus(data, sb, msb, lsb):
|
||||
def wrongstatus(data: str, sb: int, msb: int, lsb: int) -> bool:
|
||||
"""Check if the status bit and field bits are consistency.
|
||||
|
||||
This Function is used for checking BDS code versions.
|
||||
@@ -362,3 +404,85 @@ def wrongstatus(data, sb, msb, lsb):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def fs(msg):
|
||||
"""Decode flight status for DF 4, 5, 20, and 21.
|
||||
|
||||
Args:
|
||||
msg (str): 14 hexdigits string
|
||||
Returns:
|
||||
int, str: flight status, description
|
||||
|
||||
"""
|
||||
msgbin = hex2bin(msg)
|
||||
fs = bin2int(msgbin[5:8])
|
||||
text = None
|
||||
|
||||
if fs == 0:
|
||||
text = "no alert, no SPI, aircraft is airborne"
|
||||
elif fs == 1:
|
||||
text = "no alert, no SPI, aircraft is on-ground"
|
||||
elif fs == 2:
|
||||
text = "alert, no SPI, aircraft is airborne"
|
||||
elif fs == 3:
|
||||
text = "alert, no SPI, aircraft is on-ground"
|
||||
elif fs == 4:
|
||||
text = "alert, SPI, aircraft is airborne or on-ground"
|
||||
elif fs == 5:
|
||||
text = "no alert, SPI, aircraft is airborne or on-ground"
|
||||
|
||||
return fs, text
|
||||
|
||||
|
||||
def dr(msg):
|
||||
"""Decode downlink request for DF 4, 5, 20, and 21.
|
||||
|
||||
Args:
|
||||
msg (str): 14 hexdigits string
|
||||
Returns:
|
||||
int, str: downlink request, description
|
||||
|
||||
"""
|
||||
msgbin = hex2bin(msg)
|
||||
dr = bin2int(msgbin[8:13])
|
||||
|
||||
text = None
|
||||
|
||||
if dr == 0:
|
||||
text = "no downlink request"
|
||||
elif dr == 1:
|
||||
text = "request to send Comm-B message"
|
||||
elif dr == 4:
|
||||
text = "Comm-B broadcast 1 available"
|
||||
elif dr == 5:
|
||||
text = "Comm-B broadcast 2 available"
|
||||
elif dr >= 16:
|
||||
text = "ELM downlink segments available: {}".format(dr - 15)
|
||||
|
||||
return dr, text
|
||||
|
||||
|
||||
def um(msg):
|
||||
"""Decode utility message for DF 4, 5, 20, and 21.
|
||||
|
||||
Utility message contains interrogator identifier and reservation type.
|
||||
|
||||
Args:
|
||||
msg (str): 14 hexdigits string
|
||||
Returns:
|
||||
int, str: interrogator identifier code that triggered the reply, and
|
||||
reservation type made by the interrogator
|
||||
"""
|
||||
msgbin = hex2bin(msg)
|
||||
iis = bin2int(msgbin[13:17])
|
||||
ids = bin2int(msgbin[17:19])
|
||||
if ids == 0:
|
||||
ids_text = None
|
||||
if ids == 1:
|
||||
ids_text = "Comm-B interrogator identifier code"
|
||||
if ids == 2:
|
||||
ids_text = "Comm-C interrogator identifier code"
|
||||
if ids == 3:
|
||||
ids_text = "Comm-D interrogator identifier code"
|
||||
return iis, ids, ids_text
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import os
|
||||
import time
|
||||
import traceback
|
||||
import datetime
|
||||
import csv
|
||||
import pyModeS as pms
|
||||
@@ -231,10 +232,13 @@ class Decode:
|
||||
self.acs[icao]["t60"] = t
|
||||
if ias60:
|
||||
self.acs[icao]["ias"] = ias60
|
||||
output_buffer.append([t, icao, "ias60", ias60])
|
||||
if hdg60:
|
||||
self.acs[icao]["hdg"] = hdg60
|
||||
output_buffer.append([t, icao, "hdg60", hdg60])
|
||||
if mach60:
|
||||
self.acs[icao]["mach"] = mach60
|
||||
output_buffer.append([t, icao, "mach60", mach60])
|
||||
|
||||
if roc60baro:
|
||||
output_buffer.append([t, icao, "roc60baro", roc60baro])
|
||||
|
||||
@@ -1,154 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import argparse
|
||||
import curses
|
||||
import signal
|
||||
import multiprocessing
|
||||
from pyModeS.streamer.decode import Decode
|
||||
from pyModeS.streamer.screen import Screen
|
||||
from pyModeS.streamer.source import NetSource, RtlSdrSource
|
||||
|
||||
|
||||
# redirect all stdout to null, avoiding messing up with the screen
|
||||
sys.stdout = open(os.devnull, "w")
|
||||
|
||||
support_rawtypes = ["raw", "beast", "skysense"]
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"--source",
|
||||
help='Choose data source, "rtlsdr" or "net"',
|
||||
required=True,
|
||||
default="net",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--connect",
|
||||
help="Define server, port and data type. Supported data types are: %s"
|
||||
% support_rawtypes,
|
||||
nargs=3,
|
||||
metavar=("SERVER", "PORT", "DATATYPE"),
|
||||
default=None,
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--latlon",
|
||||
help="Receiver latitude and longitude, needed for the surface position, default none",
|
||||
nargs=2,
|
||||
metavar=("LAT", "LON"),
|
||||
default=None,
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--show-uncertainty",
|
||||
dest="uncertainty",
|
||||
help="Display uncertainty values, default off",
|
||||
action="store_true",
|
||||
required=False,
|
||||
default=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--dumpto",
|
||||
help="Folder to dump decoded output, default none",
|
||||
required=False,
|
||||
default=None,
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
SOURCE = args.source
|
||||
LATLON = args.latlon
|
||||
UNCERTAINTY = args.uncertainty
|
||||
DUMPTO = args.dumpto
|
||||
|
||||
if SOURCE == "rtlsdr":
|
||||
pass
|
||||
elif SOURCE == "net":
|
||||
if args.connect is None:
|
||||
print("Error: --connect argument must not be empty.")
|
||||
else:
|
||||
SERVER, PORT, DATATYPE = args.connect
|
||||
if DATATYPE not in support_rawtypes:
|
||||
print("Data type not supported, available ones are %s" % support_rawtypes)
|
||||
|
||||
else:
|
||||
print('Source must be "rtlsdr" or "net".')
|
||||
sys.exit(1)
|
||||
|
||||
if DUMPTO is not None:
|
||||
# append to current folder except root is given
|
||||
if DUMPTO[0] != "/":
|
||||
DUMPTO = os.getcwd() + "/" + DUMPTO
|
||||
|
||||
if not os.path.isdir(DUMPTO):
|
||||
print("Error: dump folder (%s) does not exist" % DUMPTO)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
raw_pipe_in, raw_pipe_out = multiprocessing.Pipe()
|
||||
ac_pipe_in, ac_pipe_out = multiprocessing.Pipe()
|
||||
exception_queue = multiprocessing.Queue()
|
||||
stop_flag = multiprocessing.Value("b", False)
|
||||
|
||||
if SOURCE == "net":
|
||||
source = NetSource(host=SERVER, port=PORT, rawtype=DATATYPE)
|
||||
elif SOURCE == "rtlsdr":
|
||||
source = RtlSdrSource()
|
||||
|
||||
|
||||
recv_process = multiprocessing.Process(
|
||||
target=source.run, args=(raw_pipe_in, stop_flag, exception_queue)
|
||||
)
|
||||
|
||||
|
||||
decode = Decode(latlon=LATLON, dumpto=DUMPTO)
|
||||
decode_process = multiprocessing.Process(
|
||||
target=decode.run, args=(raw_pipe_out, ac_pipe_in, exception_queue)
|
||||
)
|
||||
|
||||
screen = Screen(uncertainty=UNCERTAINTY)
|
||||
screen_process = multiprocessing.Process(
|
||||
target=screen.run, args=(ac_pipe_out, exception_queue)
|
||||
)
|
||||
|
||||
|
||||
def shutdown():
|
||||
stop_flag.value = True
|
||||
curses.endwin()
|
||||
sys.stdout = sys.__stdout__
|
||||
recv_process.terminate()
|
||||
decode_process.terminate()
|
||||
screen_process.terminate()
|
||||
recv_process.join()
|
||||
decode_process.join()
|
||||
screen_process.join()
|
||||
|
||||
|
||||
def closeall(signal, frame):
|
||||
print("KeyboardInterrupt (ID: {}). Cleaning up...".format(signal))
|
||||
shutdown()
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
signal.signal(signal.SIGINT, closeall)
|
||||
|
||||
recv_process.start()
|
||||
decode_process.start()
|
||||
screen_process.start()
|
||||
|
||||
|
||||
while True:
|
||||
if (
|
||||
(not recv_process.is_alive())
|
||||
or (not decode_process.is_alive())
|
||||
or (not screen_process.is_alive())
|
||||
):
|
||||
shutdown()
|
||||
while not exception_queue.empty():
|
||||
trackback = exception_queue.get()
|
||||
print(trackback)
|
||||
|
||||
sys.exit(1)
|
||||
|
||||
time.sleep(0.01)
|
||||
155
pyModeS/streamer/modeslive.py
Executable file
155
pyModeS/streamer/modeslive.py
Executable file
@@ -0,0 +1,155 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import argparse
|
||||
import curses
|
||||
import signal
|
||||
import multiprocessing
|
||||
from pyModeS.streamer.decode import Decode
|
||||
from pyModeS.streamer.screen import Screen
|
||||
from pyModeS.streamer.source import NetSource, RtlSdrSource # , RtlSdrSource24
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
support_rawtypes = ["raw", "beast", "skysense"]
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"--source",
|
||||
help='Choose data source, "rtlsdr", "rtlsdr24" or "net"',
|
||||
required=True,
|
||||
default="net",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--connect",
|
||||
help="Define server, port and data type. Supported data types are: {}".format(
|
||||
support_rawtypes
|
||||
),
|
||||
nargs=3,
|
||||
metavar=("SERVER", "PORT", "DATATYPE"),
|
||||
default=None,
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--latlon",
|
||||
help="Receiver latitude and longitude, needed for the surface position, default none",
|
||||
nargs=2,
|
||||
metavar=("LAT", "LON"),
|
||||
default=None,
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--show-uncertainty",
|
||||
dest="uncertainty",
|
||||
help="Display uncertainty values, default off",
|
||||
action="store_true",
|
||||
required=False,
|
||||
default=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--dumpto",
|
||||
help="Folder to dump decoded output, default none",
|
||||
required=False,
|
||||
default=None,
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
SOURCE = args.source
|
||||
LATLON = args.latlon
|
||||
UNCERTAINTY = args.uncertainty
|
||||
DUMPTO = args.dumpto
|
||||
|
||||
if SOURCE in ["rtlsdr", "rtlsdr24"]:
|
||||
pass
|
||||
elif SOURCE == "net":
|
||||
if args.connect is None:
|
||||
print("Error: --connect argument must not be empty.")
|
||||
else:
|
||||
SERVER, PORT, DATATYPE = args.connect
|
||||
if DATATYPE not in support_rawtypes:
|
||||
print(
|
||||
"Data type not supported, available ones are %s"
|
||||
% support_rawtypes
|
||||
)
|
||||
|
||||
else:
|
||||
print('Source must be "rtlsdr" or "net".')
|
||||
sys.exit(1)
|
||||
|
||||
if DUMPTO is not None:
|
||||
# append to current folder except root is given
|
||||
if DUMPTO[0] != "/":
|
||||
DUMPTO = os.getcwd() + "/" + DUMPTO
|
||||
|
||||
if not os.path.isdir(DUMPTO):
|
||||
print("Error: dump folder (%s) does not exist" % DUMPTO)
|
||||
sys.exit(1)
|
||||
|
||||
# redirect all stdout to null, avoiding messing up with the screen
|
||||
sys.stdout = open(os.devnull, "w")
|
||||
|
||||
raw_pipe_in, raw_pipe_out = multiprocessing.Pipe()
|
||||
ac_pipe_in, ac_pipe_out = multiprocessing.Pipe()
|
||||
exception_queue = multiprocessing.Queue()
|
||||
stop_flag = multiprocessing.Value("b", False)
|
||||
|
||||
if SOURCE == "net":
|
||||
source = NetSource(host=SERVER, port=PORT, rawtype=DATATYPE)
|
||||
elif SOURCE == "rtlsdr":
|
||||
source = RtlSdrSource()
|
||||
# elif SOURCE == "rtlsdr24":
|
||||
# source = RtlSdrSource24()
|
||||
|
||||
recv_process = multiprocessing.Process(
|
||||
target=source.run, args=(raw_pipe_in, stop_flag, exception_queue)
|
||||
)
|
||||
|
||||
decode = Decode(latlon=LATLON, dumpto=DUMPTO)
|
||||
decode_process = multiprocessing.Process(
|
||||
target=decode.run, args=(raw_pipe_out, ac_pipe_in, exception_queue)
|
||||
)
|
||||
|
||||
screen = Screen(uncertainty=UNCERTAINTY)
|
||||
screen_process = multiprocessing.Process(
|
||||
target=screen.run, args=(ac_pipe_out, exception_queue)
|
||||
)
|
||||
|
||||
def shutdown():
|
||||
stop_flag.value = True
|
||||
curses.endwin()
|
||||
sys.stdout = sys.__stdout__
|
||||
recv_process.terminate()
|
||||
decode_process.terminate()
|
||||
screen_process.terminate()
|
||||
recv_process.join()
|
||||
decode_process.join()
|
||||
screen_process.join()
|
||||
|
||||
def closeall(signal, frame):
|
||||
print("KeyboardInterrupt (ID: {}). Cleaning up...".format(signal))
|
||||
shutdown()
|
||||
sys.exit(0)
|
||||
|
||||
signal.signal(signal.SIGINT, closeall)
|
||||
|
||||
recv_process.start()
|
||||
decode_process.start()
|
||||
screen_process.start()
|
||||
|
||||
while True:
|
||||
if (
|
||||
(not recv_process.is_alive())
|
||||
or (not decode_process.is_alive())
|
||||
or (not screen_process.is_alive())
|
||||
):
|
||||
shutdown()
|
||||
while not exception_queue.empty():
|
||||
trackback = exception_queue.get()
|
||||
print(trackback)
|
||||
|
||||
sys.exit(1)
|
||||
|
||||
time.sleep(0.01)
|
||||
64
pyproject.toml
Normal file
64
pyproject.toml
Normal file
@@ -0,0 +1,64 @@
|
||||
[tool.poetry]
|
||||
name = "pyModeS"
|
||||
version = "2.14"
|
||||
description = "Python Mode-S and ADS-B Decoder"
|
||||
authors = ["Junzi Sun <j.sun-1@tudelft.nl>"]
|
||||
license = "GNU GPL v3"
|
||||
readme = "README.rst"
|
||||
classifiers = [
|
||||
"Development Status :: 4 - Beta",
|
||||
"Intended Audience :: Developers",
|
||||
"Topic :: Software Development :: Libraries",
|
||||
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Typing :: Typed",
|
||||
]
|
||||
packages = [
|
||||
{ include = "pyModeS", from = "." },
|
||||
]
|
||||
include = [
|
||||
"LICENSE",
|
||||
"*.pyx",
|
||||
"*.pxd",
|
||||
"*.pyi",
|
||||
"py.typed",
|
||||
{ path = "pyModeS/**/*.so", format = "wheel" }
|
||||
]
|
||||
|
||||
[tool.poetry.build]
|
||||
generate-setup-file = false
|
||||
script = "build.py"
|
||||
|
||||
[tool.poetry.scripts]
|
||||
modeslive = "pyModeS.streamer.modeslive:main"
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.8"
|
||||
numpy = "^1.24"
|
||||
pyzmq = "^24.0"
|
||||
pyrtlsdr = {version = "^0.2.93", optional = true}
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
mypy = "^0.991"
|
||||
flake8 = "^5.0.0"
|
||||
black = "^22.12.0"
|
||||
isort = "^5.11.4"
|
||||
pytest = "^7.2.0"
|
||||
pytest-cov = "^4.0.0"
|
||||
codecov = "^2.1.12"
|
||||
|
||||
[tool.poetry.extras]
|
||||
rtlsdr = ["pyrtlsdr"]
|
||||
|
||||
[tool.black]
|
||||
line-length = 80
|
||||
target_version = ['py38', 'py39', 'py310', 'py311']
|
||||
include = '\.pyi?$'
|
||||
|
||||
[tool.isort]
|
||||
line_length = 80
|
||||
profile = "black"
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core>=1.0.0", "Cython>=0.29.32"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
60
setup.py
60
setup.py
@@ -1,60 +0,0 @@
|
||||
"""A setuptools based setup module.
|
||||
|
||||
See:
|
||||
https://packaging.python.org/en/latest/distributing.html
|
||||
https://github.com/pypa/sampleproject
|
||||
|
||||
Steps for deploying a new version:
|
||||
1. Increase the version number
|
||||
2. remove the old deployment under [dist] and [build] folder
|
||||
3. run: python setup.py sdist
|
||||
4. twine upload dist/*
|
||||
"""
|
||||
|
||||
# Always prefer setuptools over distutils
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
# To use a consistent encoding
|
||||
from codecs import open
|
||||
from os import path
|
||||
|
||||
here = path.abspath(path.dirname(__file__))
|
||||
|
||||
# Get the long description from the README file
|
||||
with open(path.join(here, "README.rst"), encoding="utf-8") as f:
|
||||
long_description = f.read()
|
||||
|
||||
|
||||
details = dict(
|
||||
name="pyModeS",
|
||||
version="2.8",
|
||||
description="Python Mode-S and ADS-B Decoder",
|
||||
long_description=long_description,
|
||||
url="https://github.com/junzis/pyModeS",
|
||||
author="Junzi Sun",
|
||||
author_email="j.sun-1@tudelft.nl",
|
||||
license="GNU GPL v3",
|
||||
classifiers=[
|
||||
"Development Status :: 4 - Beta",
|
||||
"Intended Audience :: Developers",
|
||||
"Topic :: Software Development :: Libraries",
|
||||
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
|
||||
"Programming Language :: Python :: 3",
|
||||
],
|
||||
keywords="Mode-S ADS-B EHS ELS Comm-B",
|
||||
packages=find_packages(exclude=["contrib", "docs", "tests"]),
|
||||
install_requires=["numpy", "pyzmq", "pyrtlsdr"],
|
||||
package_data={"pyModeS": ["*.pyx", "*.pxd"]},
|
||||
scripts=["pyModeS/streamer/modeslive"],
|
||||
)
|
||||
|
||||
try:
|
||||
from setuptools.extension import Extension
|
||||
from Cython.Build import cythonize
|
||||
|
||||
extensions = [Extension("pyModeS.c_common", ["pyModeS/c_common.pyx"])]
|
||||
|
||||
setup(**dict(details, ext_modules=cythonize(extensions)))
|
||||
|
||||
except:
|
||||
setup(**details)
|
||||
@@ -1,11 +1,7 @@
|
||||
import sys
|
||||
import time
|
||||
import csv
|
||||
import time
|
||||
|
||||
if len(sys.argv) > 1 and sys.argv[1] == "cython":
|
||||
from pyModeS.c_decoder import adsb
|
||||
else:
|
||||
from pyModeS.decoder import adsb
|
||||
from pyModeS.decoder import adsb
|
||||
|
||||
print("===== Decode ADS-B sample data=====")
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ def bds_info(BDS, m):
|
||||
)
|
||||
|
||||
else:
|
||||
info = None
|
||||
info = []
|
||||
|
||||
return info
|
||||
|
||||
@@ -87,5 +87,5 @@ def commb_decode_all(df, n=None):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
commb_decode_all(df=20, n=100)
|
||||
commb_decode_all(df=21, n=100)
|
||||
commb_decode_all(df=20, n=500)
|
||||
commb_decode_all(df=21, n=500)
|
||||
|
||||
@@ -43,14 +43,20 @@ def test_adsb_position_with_ref():
|
||||
|
||||
|
||||
def test_adsb_airborne_position_with_ref():
|
||||
pos = adsb.airborne_position_with_ref("8D40058B58C901375147EFD09357", 49.0, 6.0)
|
||||
pos = adsb.airborne_position_with_ref(
|
||||
"8D40058B58C901375147EFD09357", 49.0, 6.0
|
||||
)
|
||||
assert pos == (49.82410, 6.06785)
|
||||
pos = adsb.airborne_position_with_ref("8D40058B58C904A87F402D3B8C59", 49.0, 6.0)
|
||||
pos = adsb.airborne_position_with_ref(
|
||||
"8D40058B58C904A87F402D3B8C59", 49.0, 6.0
|
||||
)
|
||||
assert pos == (49.81755, 6.08442)
|
||||
|
||||
|
||||
def test_adsb_surface_position_with_ref():
|
||||
pos = adsb.surface_position_with_ref("8FC8200A3AB8F5F893096B000000", -43.5, 172.5)
|
||||
pos = adsb.surface_position_with_ref(
|
||||
"8FC8200A3AB8F5F893096B000000", -43.5, 172.5
|
||||
)
|
||||
assert pos == (-43.48564, 172.53942)
|
||||
|
||||
|
||||
@@ -76,10 +82,29 @@ def test_adsb_velocity():
|
||||
vgs_surface = adsb.velocity("8FC8200A3AB8F5F893096B000000")
|
||||
assert vgs == (159, 182.88, -832, "GS")
|
||||
assert vas == (375, 243.98, -2304, "TAS")
|
||||
assert vgs_surface == (19.0, 42.2, 0, "GS")
|
||||
assert vgs_surface == (19, 42.2, 0, "GS")
|
||||
assert adsb.altitude_diff("8D485020994409940838175B284F") == 550
|
||||
|
||||
|
||||
def test_adsb_emergency():
|
||||
assert not adsb.is_emergency("8DA2C1B6E112B600000000760759")
|
||||
assert adsb.emergency_state("8DA2C1B6E112B600000000760759") == 0
|
||||
assert adsb.emergency_squawk("8DA2C1B6E112B600000000760759") == "6513"
|
||||
|
||||
|
||||
def test_adsb_target_state_status():
|
||||
sel_alt = adsb.selected_altitude("8DA05629EA21485CBF3F8CADAEEB")
|
||||
assert sel_alt == (16992, "MCP/FCU")
|
||||
assert adsb.baro_pressure_setting("8DA05629EA21485CBF3F8CADAEEB") == 1012.8
|
||||
assert adsb.selected_heading("8DA05629EA21485CBF3F8CADAEEB") == 66.8
|
||||
assert adsb.autopilot("8DA05629EA21485CBF3F8CADAEEB") is True
|
||||
assert adsb.vnav_mode("8DA05629EA21485CBF3F8CADAEEB") is True
|
||||
assert adsb.altitude_hold_mode("8DA05629EA21485CBF3F8CADAEEB") is False
|
||||
assert adsb.approach_mode("8DA05629EA21485CBF3F8CADAEEB") is False
|
||||
assert adsb.tcas_operational("8DA05629EA21485CBF3F8CADAEEB") is True
|
||||
assert adsb.lnav_mode("8DA05629EA21485CBF3F8CADAEEB") is True
|
||||
|
||||
|
||||
# def test_nic():
|
||||
# assert adsb.nic('8D3C70A390AB11F55B8C57F65FE6') == 0
|
||||
# assert adsb.nic('8DE1C9738A4A430B427D219C8225') == 1
|
||||
|
||||
13
tests/test_allcall.py
Normal file
13
tests/test_allcall.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from pyModeS import allcall
|
||||
|
||||
|
||||
def test_icao():
|
||||
assert allcall.icao("5D484FDEA248F5") == "484FDE"
|
||||
|
||||
|
||||
def test_interrogator():
|
||||
assert allcall.interrogator("5D484FDEA248F5") == "SI6"
|
||||
|
||||
|
||||
def test_capability():
|
||||
assert allcall.capability("5D484FDEA248F5")[0] == 5
|
||||
@@ -1,6 +1,12 @@
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
from pyModeS import bds
|
||||
|
||||
|
||||
# this one fails on GitHub action for some unknown reason
|
||||
# it looks successful on other Windows instances though
|
||||
# TODO fix later
|
||||
@pytest.mark.skipif(sys.platform == "win32", reason="GitHub Action")
|
||||
def test_bds_infer():
|
||||
assert bds.infer("8D406B902015A678D4D220AA4BDA") == "BDS08"
|
||||
assert bds.infer("8FC8200A3AB8F5F893096B000000") == "BDS06"
|
||||
@@ -17,8 +23,8 @@ def test_bds_infer():
|
||||
|
||||
def test_bds_is50or60():
|
||||
assert bds.is50or60("A0001838201584F23468207CDFA5", 0, 0, 0) == None
|
||||
assert bds.is50or60("A0000000FFDA9517000464000000", 182, 237, 1250) == "BDS50"
|
||||
assert bds.is50or60("A0000000919A5927E23444000000", 413, 54, 18700) == "BDS60"
|
||||
assert bds.is50or60("A8001EBCFFFB23286004A73F6A5B", 320, 250, 14000) == "BDS50"
|
||||
assert bds.is50or60("A8001EBCFE1B29287FDCA807BCFC", 320, 250, 14000) == "BDS50"
|
||||
|
||||
|
||||
def test_surface_position():
|
||||
|
||||
@@ -1,62 +1,60 @@
|
||||
from pyModeS import c_common
|
||||
try:
|
||||
from pyModeS import c_common
|
||||
|
||||
def test_conversions():
|
||||
assert c_common.hex2bin("6E") == "01101110"
|
||||
assert c_common.bin2hex("01101110") == "6E"
|
||||
assert c_common.bin2hex("1101110") == "6E"
|
||||
|
||||
def test_crc_decode():
|
||||
|
||||
assert c_common.crc("8D406B902015A678D4D220AA4BDA") == 0
|
||||
assert c_common.crc("8d8960ed58bf053cf11bc5932b7d") == 0
|
||||
assert c_common.crc("8d45cab390c39509496ca9a32912") == 0
|
||||
assert c_common.crc("8d74802958c904e6ef4ba0184d5c") == 0
|
||||
assert c_common.crc("8d4400cd9b0000b4f87000e71a10") == 0
|
||||
assert c_common.crc("8d4065de58a1054a7ef0218e226a") == 0
|
||||
|
||||
assert c_common.crc("c80b2dca34aa21dd821a04cb64d4") == 10719924
|
||||
assert c_common.crc("a800089d8094e33a6004e4b8a522") == 4805588
|
||||
assert c_common.crc("a8000614a50b6d32bed000bbe0ed") == 5659991
|
||||
assert c_common.crc("a0000410bc900010a40000f5f477") == 11727682
|
||||
assert c_common.crc("8d4ca251204994b1c36e60a5343d") == 16
|
||||
assert c_common.crc("b0001718c65632b0a82040715b65") == 353333
|
||||
|
||||
def test_crc_encode():
|
||||
parity = c_common.crc("8D406B902015A678D4D220AA4BDA", encode=True)
|
||||
assert parity == 11160538
|
||||
|
||||
def test_icao():
|
||||
assert c_common.icao("8D406B902015A678D4D220AA4BDA") == "406B90"
|
||||
assert c_common.icao("A0001839CA3800315800007448D9") == "400940"
|
||||
assert c_common.icao("A000139381951536E024D4CCF6B5") == "3C4DD2"
|
||||
assert c_common.icao("A000029CFFBAA11E2004727281F1") == "4243D0"
|
||||
|
||||
def test_modes_altcode():
|
||||
assert c_common.altcode("A02014B400000000000000F9D514") == 32300
|
||||
|
||||
def test_modes_idcode():
|
||||
assert c_common.idcode("A800292DFFBBA9383FFCEB903D01") == "1346"
|
||||
|
||||
def test_graycode_to_altitude():
|
||||
assert c_common.gray2alt("00000000010") == -1000
|
||||
assert c_common.gray2alt("00000001010") == -500
|
||||
assert c_common.gray2alt("00000011011") == -100
|
||||
assert c_common.gray2alt("00000011010") == 0
|
||||
assert c_common.gray2alt("00000011110") == 100
|
||||
assert c_common.gray2alt("00000010011") == 600
|
||||
assert c_common.gray2alt("00000110010") == 1000
|
||||
assert c_common.gray2alt("00001001001") == 5800
|
||||
assert c_common.gray2alt("00011100100") == 10300
|
||||
assert c_common.gray2alt("01100011010") == 32000
|
||||
assert c_common.gray2alt("01110000100") == 46300
|
||||
assert c_common.gray2alt("01010101100") == 50200
|
||||
assert c_common.gray2alt("11011110100") == 73200
|
||||
assert c_common.gray2alt("10000000011") == 126600
|
||||
assert c_common.gray2alt("10000000001") == 126700
|
||||
|
||||
|
||||
def test_conversions():
|
||||
assert c_common.hex2bin("6E") == "01101110"
|
||||
assert c_common.bin2hex("01101110") == "6E"
|
||||
assert c_common.bin2hex("1101110") == "6E"
|
||||
|
||||
|
||||
def test_crc_decode():
|
||||
|
||||
assert c_common.crc("8D406B902015A678D4D220AA4BDA") == 0
|
||||
assert c_common.crc("8d8960ed58bf053cf11bc5932b7d") == 0
|
||||
assert c_common.crc("8d45cab390c39509496ca9a32912") == 0
|
||||
assert c_common.crc("8d74802958c904e6ef4ba0184d5c") == 0
|
||||
assert c_common.crc("8d4400cd9b0000b4f87000e71a10") == 0
|
||||
assert c_common.crc("8d4065de58a1054a7ef0218e226a") == 0
|
||||
|
||||
assert c_common.crc("c80b2dca34aa21dd821a04cb64d4") == 10719924
|
||||
assert c_common.crc("a800089d8094e33a6004e4b8a522") == 4805588
|
||||
assert c_common.crc("a8000614a50b6d32bed000bbe0ed") == 5659991
|
||||
assert c_common.crc("a0000410bc900010a40000f5f477") == 11727682
|
||||
assert c_common.crc("8d4ca251204994b1c36e60a5343d") == 16
|
||||
assert c_common.crc("b0001718c65632b0a82040715b65") == 353333
|
||||
|
||||
|
||||
def test_crc_encode():
|
||||
parity = c_common.crc("8D406B902015A678D4D220AA4BDA", encode=True)
|
||||
assert parity == 11160538
|
||||
|
||||
|
||||
def test_icao():
|
||||
assert c_common.icao("8D406B902015A678D4D220AA4BDA") == "406B90"
|
||||
assert c_common.icao("A0001839CA3800315800007448D9") == "400940"
|
||||
assert c_common.icao("A000139381951536E024D4CCF6B5") == "3C4DD2"
|
||||
assert c_common.icao("A000029CFFBAA11E2004727281F1") == "4243D0"
|
||||
|
||||
|
||||
def test_modes_altcode():
|
||||
assert c_common.altcode("A02014B400000000000000F9D514") == 32300
|
||||
|
||||
|
||||
def test_modes_idcode():
|
||||
assert c_common.idcode("A800292DFFBBA9383FFCEB903D01") == "1346"
|
||||
|
||||
|
||||
def test_graycode_to_altitude():
|
||||
assert c_common.gray2alt("00000000010") == -1000
|
||||
assert c_common.gray2alt("00000001010") == -500
|
||||
assert c_common.gray2alt("00000011011") == -100
|
||||
assert c_common.gray2alt("00000011010") == 0
|
||||
assert c_common.gray2alt("00000011110") == 100
|
||||
assert c_common.gray2alt("00000010011") == 600
|
||||
assert c_common.gray2alt("00000110010") == 1000
|
||||
assert c_common.gray2alt("00001001001") == 5800
|
||||
assert c_common.gray2alt("00011100100") == 10300
|
||||
assert c_common.gray2alt("01100011010") == 32000
|
||||
assert c_common.gray2alt("01110000100") == 46300
|
||||
assert c_common.gray2alt("01010101100") == 50200
|
||||
assert c_common.gray2alt("11011110100") == 73200
|
||||
assert c_common.gray2alt("10000000011") == 126600
|
||||
assert c_common.gray2alt("10000000001") == 126700
|
||||
except:
|
||||
pass
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from pyModeS import bds, commb
|
||||
import pytest
|
||||
|
||||
# from pyModeS import ehs, els # deprecated
|
||||
|
||||
@@ -23,7 +24,7 @@ def test_bds40_functions():
|
||||
|
||||
def test_bds50_functions():
|
||||
assert bds.bds50.roll50("A000139381951536E024D4CCF6B5") == 2.1
|
||||
assert bds.bds50.roll50("A0001691FFD263377FFCE02B2BF9") == -0.4 # signed value
|
||||
assert bds.bds50.roll50("A0001691FFD263377FFCE02B2BF9") == -0.4
|
||||
assert bds.bds50.trk50("A000139381951536E024D4CCF6B5") == 114.258
|
||||
assert bds.bds50.gs50("A000139381951536E024D4CCF6B5") == 438
|
||||
assert bds.bds50.rtrk50("A000139381951536E024D4CCF6B5") == 0.125
|
||||
@@ -38,14 +39,16 @@ def test_bds50_functions():
|
||||
|
||||
|
||||
def test_bds60_functions():
|
||||
assert bds.bds60.hdg60("A00004128F39F91A7E27C46ADC21") == 42.715
|
||||
assert bds.bds60.ias60("A00004128F39F91A7E27C46ADC21") == 252
|
||||
assert bds.bds60.mach60("A00004128F39F91A7E27C46ADC21") == 0.42
|
||||
assert bds.bds60.vr60baro("A00004128F39F91A7E27C46ADC21") == -1920
|
||||
assert bds.bds60.vr60ins("A00004128F39F91A7E27C46ADC21") == -1920
|
||||
msg = "A00004128F39F91A7E27C46ADC21"
|
||||
|
||||
assert commb.hdg60("A00004128F39F91A7E27C46ADC21") == 42.715
|
||||
assert commb.ias60("A00004128F39F91A7E27C46ADC21") == 252
|
||||
assert commb.mach60("A00004128F39F91A7E27C46ADC21") == 0.42
|
||||
assert commb.vr60baro("A00004128F39F91A7E27C46ADC21") == -1920
|
||||
assert commb.vr60ins("A00004128F39F91A7E27C46ADC21") == -1920
|
||||
assert bds.bds60.hdg60(msg) == pytest.approx(42.71484)
|
||||
assert bds.bds60.ias60(msg) == 252
|
||||
assert bds.bds60.mach60(msg) == 0.42
|
||||
assert bds.bds60.vr60baro(msg) == -1920
|
||||
assert bds.bds60.vr60ins(msg) == -1920
|
||||
|
||||
assert commb.hdg60(msg) == pytest.approx(42.71484)
|
||||
assert commb.ias60(msg) == 252
|
||||
assert commb.mach60(msg) == 0.42
|
||||
assert commb.vr60baro(msg) == -1920
|
||||
assert commb.vr60ins(msg) == -1920
|
||||
|
||||
22
tests/test_surv.py
Normal file
22
tests/test_surv.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from pyModeS import surv
|
||||
|
||||
|
||||
def test_fs():
|
||||
assert surv.fs("2A00516D492B80")[0] == 2
|
||||
|
||||
|
||||
def test_dr():
|
||||
assert surv.dr("2A00516D492B80")[0] == 0
|
||||
|
||||
|
||||
def test_um():
|
||||
assert surv.um("200CBE4ED80137")[0] == 9
|
||||
assert surv.um("200CBE4ED80137")[1] == 1
|
||||
|
||||
|
||||
def test_identity():
|
||||
assert surv.identity("2A00516D492B80") == "0356"
|
||||
|
||||
|
||||
def test_altitude():
|
||||
assert surv.altitude("20001718029FCD") == 36000
|
||||
Reference in New Issue
Block a user