A **fast** channel state information parser for Intel, Atheros, Nexmon, ESP32 and PicoScenes in Python.
Project description
csiread 
A fast channel state information parser for Intel, Atheros, Nexmon, ESP32 and PicoScenes in Python.
- Full support for Linux 802.11n CSI Tool, Atheros CSI Tool, nexmon_csi and ESP32-CSI-Tool
- Support for PicoScenes is experimental.
- At least 15 times faster than the implementation in Matlab
- Real-time parsing and visualization.
Introduction
Various CSI Tools only provide Matlab API parsing CSI data files. Those who want to process CSI with Python have to install Matlab to convert .dat to .mat. This process is redundant and inefficient. Therefore, Python API is recommended. Unfortunately, the API implemented in pure Python is inefficient. With this in mind, I implemented csiread in Cython(Pybind11 may be another great choice). The table below shows the performance of different implementations. They were all tested with 40k packets on the same computer.
| Function | Matlab | Python3+Numpy | csiread | file size |
|---|---|---|---|---|
| Nexmon.read:bcm4339 | 3.2309s | 0.2739s | 0.0703s | 44.0MB |
| Nexmon.read:bcm4358 | 3.5987s | 23.0025s | 0.1227s | 44.0MB |
| Atheros.read | 3.3081s | 14.6021s | 0.0956s | 76.3MB |
| Intel.read | 1.6102s | 7.6624s | 0.0479s | 21.0MB |
| Intel.get_total_rss | 0.1786s | 0.0030s | 0.0030s | |
| Intel.get_scaled_csi | 0.5497s | 0.1225s | 0.0376s/0.0278s | |
| Intel.get_scaled_csi_sm | 5.0097s | 0.3627s | 0.0778s/0.0465s |
This tool is not only the translation of the Matlab API, but also a CSI toolbox. I added some utilities, real-time visualization and algorithms code in the examples folder. These would be useful for Python-based CSI researchers.
Install
pip3 install csiread
Quickstart
import csiread
# Linux 802.11n CSI Tool
csifile = "../material/5300/dataset/sample_0x1_ap.dat"
csidata = csiread.Intel(csifile, nrxnum=3, ntxnum=2, pl_size=10)
csidata.read()
csi = csidata.get_scaled_csi()
print(csidata.csi.shape)
# Atheros CSI Tool
csifile = "../material/atheros/dataset/ath_csi_1.dat"
csidata = csiread.Atheros(csifile, nrxnum=3, ntxnum=2, pl_size=10, tones=56)
csidata.read(endian='little')
print(csidata.csi.shape)
# nexmon_csi
csifile = "../material/nexmon/dataset/example.pcap"
csidata = csiread.Nexmon(csifile, chip='4358', bw=80)
csidata.read()
print(csidata.csi.shape)
# ESP32-CSI-Tool
csifile = "../material/esp32/dataset/example_csi.csv"
csidata = csiread.ESP32(csifile, csi_only=True)
csidata.read()
print(csidata.csi.shape)
# PicoScenes
csifile = "../material/picoscenes/dataset/rx_by_iwl5300.csi"
csidata = csiread.Picoscenes(csifile, {'CSI': [30, 3, 2], 'MPDU': 1522})
csidata.read()
csidata.check()
print(csidata.raw['CSI']['CSI'].shape)
examples are the best usage instructions. The API documentation can be found in docstring of file core.py, so we won't repeat them here.
Build from source
cd csiread
pip3 install -r requirements.txt
python3 setup.py sdist bdist_wheel
pip3 install -U dist/csiread*.whl
* is a shell wildcard. After running python3 setup.py sdist bdist_wheel,there will be a wheel file like csiread-1.3.4-cp36-cp36m-win_amd64.whl in the dist folder. Replace csiread*.whl with it.
csiread is written in Cython, Cython requires a C compiler to be present on the system. You can refer to Installing Cython for more details. If you don't want to install a C compiler, just fork the project and push a tag to the latest commit. Then wheel files can be found in Github-Actions-Python package-Artifacts: csiread_dist
Design
csiread provides 7 classes: Intel, Atheros, Nexmon, AtherosPull10, NexmonPull46, ESP32 and Picoscenes. Each class has 4 key methods: read(), seek(), pmsg() and display() which are used for reading a file, reading a file from a specific position, real-time parsing and viewing the contents of a packet respectively. csiread.utils provides some common functions.
Nexmon CSI
csiread.Nexmonis based on the commit of nexmon_csi(Aug 29, 2020):ba99ce12a6a42d7e4ec75e6f8ace8f610ed2eb60csiread.NexmonPull256is the same ascsiread.NexmonPull46. It works with the latest master branch (Dec 11, 2021):c037576b7035619e2716229c7622f4e8c511635f- The
Nexmon.groupis experimental, it may be incorrect due tocoreandspatial.coreandspatialare ZERO or not recorded correctly in some files. I don't know how to solve it.
ESP32-CSI-Tool
pandas.read_csvandcsiread.ESP32have the similar performance, butpandas.read_csvis much more flexible.
PicoScenes
The support for Picoscenes is an experimental feature. PicoScenes is still under active development, csiread cannot be updated synchronously.
csidata.rawis a structured array in numpy and stores the parsed result.MagandPhasefileds have been removed, usenp.absandnp.angleinstead.- Call
check()method afterread(), Then setpl_sizeaccording to the report. - Edge padding are applied to
raw["xxx"]["SubcarrierIndex"]for plotting. - The method
pmsghas been implemented, but not yet ready. - Accessing CSI like
csidata.CSI.CSIis only available after callingreadmethod. - 5-10 times faster than before
parseCSIMVM(...)in_picoscenes.pyxmay be incorrect.
csiread.Picoscenes is based on the PicoScenes MATLAB Toolbox(PMT)(Last modified at 2022-01-21).
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file csiread-1.4.1.tar.gz.
File metadata
- Download URL: csiread-1.4.1.tar.gz
- Upload date:
- Size: 168.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5159c81d160c4fa581acc58944bf29d34d712f40721469125a8573bd0f5bbcb7
|
|
| MD5 |
a550582cd2a03abf8c31eaf8979f9a84
|
|
| BLAKE2b-256 |
084c94f9d0d788548e6fffbed0491ea7dbc1e83864491e37101c1a2d7cdc9ef4
|
File details
Details for the file csiread-1.4.1-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: csiread-1.4.1-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 268.1 kB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45b06eb453725d5122347451e1e2150b90583c63ee003540abf54465983a3791
|
|
| MD5 |
7b5e6a2ca8c3e8b0741487f0db8a09b9
|
|
| BLAKE2b-256 |
26a4a1eb613b51dd1205f6de58b48ae73b819c780fbada80462e72a16c857258
|
File details
Details for the file csiread-1.4.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: csiread-1.4.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 363.6 kB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66d709f51818c50ef35aff89728bc28b7ea30b123ffe071aca9d0d4be3101d35
|
|
| MD5 |
b6c821d21d002d38774fd4c1a12fa87a
|
|
| BLAKE2b-256 |
c345add1fa6aa4f93f06e14b5f03faad16b40bf47c756684f3cadb9398fc410f
|
File details
Details for the file csiread-1.4.1-cp313-cp313-macosx_10_13_universal2.whl.
File metadata
- Download URL: csiread-1.4.1-cp313-cp313-macosx_10_13_universal2.whl
- Upload date:
- Size: 554.0 kB
- Tags: CPython 3.13, macOS 10.13+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
554937422a91a1fc78aaad220f2816ab821508e23ff47282ac3c4fb72a058f49
|
|
| MD5 |
0e97083d2a363a768e9ab829a4be7b7d
|
|
| BLAKE2b-256 |
52f7a0efc6b1ad52d638b4b317a903422a568466287bee16abd779bad001150d
|
File details
Details for the file csiread-1.4.1-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: csiread-1.4.1-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 268.5 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87036d52613b673ba0b8ea53910b1033af9a873f0d853a4d0f97036cfe9bafaf
|
|
| MD5 |
2a7aea6c14c645e039b299701765e909
|
|
| BLAKE2b-256 |
ad3be36b8754129be81f669b59312696d49e8d6bb351c5f49e66409f2c0a4a95
|
File details
Details for the file csiread-1.4.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: csiread-1.4.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 364.7 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21b71d571c4d706bd6d9210be3ec9a3dad901458e81b714c05b29d8eb8a83ba5
|
|
| MD5 |
9c6ddc0922c5767858b3262c044dd183
|
|
| BLAKE2b-256 |
8c259f100c9ce9bb6c8674500a10e9dbe604bf9adc00ea1ab932802522239c70
|
File details
Details for the file csiread-1.4.1-cp312-cp312-macosx_10_13_universal2.whl.
File metadata
- Download URL: csiread-1.4.1-cp312-cp312-macosx_10_13_universal2.whl
- Upload date:
- Size: 559.2 kB
- Tags: CPython 3.12, macOS 10.13+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc9734630c174fb634c4edc4bf2daf06e48fb97baf0db09360d0a42245b5d6dc
|
|
| MD5 |
c4e7870da32c222f220958b30e9db5a6
|
|
| BLAKE2b-256 |
c98ac640daaacb2a933a9680afe6e45cabaac386bb7ec29a5f406c8961eaea50
|
File details
Details for the file csiread-1.4.1-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: csiread-1.4.1-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 273.8 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7a8ab285f39ab9b7d32afcb52fc4dbef4b68540ae1e14edc9ad1d2fa9b7a94c
|
|
| MD5 |
45082b1a1f40ed8f47e967d466d4b116
|
|
| BLAKE2b-256 |
474f3694008acfd31b7b6d82cc47864d6ecdfc05607cf5911425b2d865e6266c
|
File details
Details for the file csiread-1.4.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: csiread-1.4.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 378.8 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0499946134e703b422c4d9cc51f998338dfbf544a2b73ea96c8deef95e5e458b
|
|
| MD5 |
3b2d0e9af838ee9c314378b407c0eb4e
|
|
| BLAKE2b-256 |
d14e30c282a732ae7c144887465600643938bb1b9ebe852495d1a629175f1078
|
File details
Details for the file csiread-1.4.1-cp311-cp311-macosx_10_9_universal2.whl.
File metadata
- Download URL: csiread-1.4.1-cp311-cp311-macosx_10_9_universal2.whl
- Upload date:
- Size: 560.2 kB
- Tags: CPython 3.11, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5247d2c21b3f6eb15e36b2e57b308116b0c9991ac765ca5040085f889c7e378b
|
|
| MD5 |
2ad21d9358832a2c1143d6234d0013ca
|
|
| BLAKE2b-256 |
f716b7ab650fe1de554a5f49081ae439634b1aaadfcc4db6bd82ce4be8e4d02d
|
File details
Details for the file csiread-1.4.1-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: csiread-1.4.1-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 272.7 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
603234077183ceba592a3176c9a75c0758f961688d9362eab12f07af095cdc64
|
|
| MD5 |
60233aa10a1aea78826fb59a6c6282a0
|
|
| BLAKE2b-256 |
6db14e028b526d3f926e8a50fe0ac4bc86a75f905cdf00999729176fac68ff5e
|
File details
Details for the file csiread-1.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: csiread-1.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 378.3 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1cc09bc47f2126ba46dff84c419f59037b0aaebc76e2486599032a6a59866178
|
|
| MD5 |
5c87749736a2f109a397adbb237eead7
|
|
| BLAKE2b-256 |
862ba9a7657617d20c4699f17b704c75cde36d3b12122a29949411523415c94f
|
File details
Details for the file csiread-1.4.1-cp310-cp310-macosx_10_9_universal2.whl.
File metadata
- Download URL: csiread-1.4.1-cp310-cp310-macosx_10_9_universal2.whl
- Upload date:
- Size: 559.1 kB
- Tags: CPython 3.10, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2915b2e5250bcd86a2ca6fb60f42d3c74e6a4d67a5f7aab4ae23d65741a81b91
|
|
| MD5 |
480ea2a3f1874aa58ad3e49aba4ea9cc
|
|
| BLAKE2b-256 |
fbdabee2cc062cd34fad42bd143d2e542b01241c09c4bb9a6e7dea700ab34126
|
File details
Details for the file csiread-1.4.1-cp39-cp39-win_amd64.whl.
File metadata
- Download URL: csiread-1.4.1-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 310.7 kB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e71402eb064f8376414bbff5a6858789e0b54845f844d9cf1b13ee1dff1441c8
|
|
| MD5 |
cfd37b876763f692f587a377f8b0f3f8
|
|
| BLAKE2b-256 |
bc94d749065d044211d302c2c6b3503c25a9bd0ba693c6f904c78ee4c3d73cad
|
File details
Details for the file csiread-1.4.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: csiread-1.4.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 379.2 kB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a1dc1c1e40c74dfea518c5faaf02058274da724b228a004ca99d33c15ad9617
|
|
| MD5 |
d935297dc6e6076184ad3f4ff68ad15c
|
|
| BLAKE2b-256 |
e0294d196455c665de327cd0a1f5e979c112ea851512311f8e3a4a0418a0a29f
|
File details
Details for the file csiread-1.4.1-cp39-cp39-macosx_10_9_universal2.whl.
File metadata
- Download URL: csiread-1.4.1-cp39-cp39-macosx_10_9_universal2.whl
- Upload date:
- Size: 561.2 kB
- Tags: CPython 3.9, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f44bf15438097df2d7c0ff29f6833d30cc5e34ade128ad4f0fa1830b256f92f9
|
|
| MD5 |
fd4b5866cc118ed596e63e7420727edc
|
|
| BLAKE2b-256 |
f08c7863e81e94a11c816a35f27292b5b58c6484c6244c4c1169590393199cb7
|
File details
Details for the file csiread-1.4.1-cp38-cp38-win_amd64.whl.
File metadata
- Download URL: csiread-1.4.1-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 311.8 kB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d32f2f97da0db030d467668bb9b2ea4094ea871eaec78d644ab5bc3852736e9f
|
|
| MD5 |
cbb81ee702386e05d3686d5d7893be07
|
|
| BLAKE2b-256 |
fece291b7a140a744475b1c7dbe2075fe6e2b281fd90df98953927709a20e252
|
File details
Details for the file csiread-1.4.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: csiread-1.4.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 384.6 kB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5d036096ef54b7140345fef8aa965d7690030dbd7adbd53463586dfb0b69160
|
|
| MD5 |
4ce77935655ab75060462274355cbb98
|
|
| BLAKE2b-256 |
7b9c0eaa12a6ca6dc33807a74680e8d70987197f8af1995cadf5071667d587d2
|
File details
Details for the file csiread-1.4.1-cp38-cp38-macosx_11_0_universal2.whl.
File metadata
- Download URL: csiread-1.4.1-cp38-cp38-macosx_11_0_universal2.whl
- Upload date:
- Size: 558.2 kB
- Tags: CPython 3.8, macOS 11.0+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fda9619c35111c646c6c4cfcf22732167b718736f067be6b199bb946b07e45c7
|
|
| MD5 |
012220bc2ffe0bb3b1606449e30e7e72
|
|
| BLAKE2b-256 |
42847f6fd30b158547e4088ee5c0461bc20a6de622b86275f84b6fe8776aff30
|