Package: csiread
csireadAfastchannel state information parser for Intel, Atheros, Nexmon, ESP32 and PicoScenes in Python.Full support forLinux 802.11n CSI Tool,Atheros CSI Tool,nexmon_csiandESP32-CSI-ToolSupport forPicoScenesisexperimental.At least 15 times faster than the implementation in MatlabReal-time parsing and visualization.real-time plottingIntroductionVarious CSI Tools only provide Matlab API parsing CSI data files. Those who want to process CSI with Python have to install Matlab to convert.datto.mat. This process is redundant and inefficient. Therefore,Python APIis 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 with40kpackets on the same computer.FunctionMatlabPython3+Numpycsireadfile sizeNexmon.read:bcm43393.2309s0.2739s0.0703s44.0MBNexmon.read:bcm43583.5987s23.0025s0.1227s44.0MBAtheros.read3.3081s14.6021s0.0956s76.3MBIntel.read1.6102s7.6624s0.0479s21.0MBIntel.get_total_rss0.1786s0.0030s0.0030sIntel.get_scaled_csi0.5497s0.1225s0.0376s/0.0278sIntel.get_scaled_csi_sm5.0097s0.3627s0.0778s/0.0465sThis tool is not only the translation of the Matlab API, but also aCSI toolbox. I added some utilities, real-time visualization and algorithms code in theexamplesfolder. These would be useful for Python-based CSI researchers.Installpip3installcsireadQuickstartimportcsiread# Linux 802.11n CSI Toolcsifile="../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 Toolcsifile="../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_csicsifile="../material/nexmon/dataset/example.pcap"csidata=csiread.Nexmon(csifile,chip='4358',bw=80)csidata.read()print(csidata.csi.shape)# ESP32-CSI-Toolcsifile="../material/esp32/dataset/example_csi.csv"csidata=csiread.ESP32(csifile,csi_only=True)csidata.read()print(csidata.csi.shape)# PicoScenescsifile="../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)examplesare the best usage instructions. The API documentation can be found indocstringof filecore.py, so we won't repeat them here.Build from sourcecdcsiread
pip3install-rrequirements.txt
python3setup.pysdistbdist_wheel
pip3install-Udist/csiread*.whl*is a shell wildcard. After runningpython3 setup.py sdist bdist_wheel,there will be a wheel file likecsiread-1.3.4-cp36-cp36m-win_amd64.whlin thedistfolder. Replacecsiread*.whlwith it.csiread is written in Cython, Cython requires a C compiler to be present on the system. You can refer toInstalling Cythonfor 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 inGithub-Actions-Python package-Artifacts: csiread_distDesigncsiread provides 7 classes:Intel, Atheros, Nexmon, AtherosPull10, NexmonPull46, ESP32 and Picoscenes. Each class has 4 key methods:read(), seek(),pmsg()anddisplay()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.utilsprovides some common functions.Nexmon CSIcsiread.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):c037576b7035619e2716229c7622f4e8c511635fTheNexmon.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-Toolpandas.read_csvandcsiread.ESP32have the similar performance, butpandas.read_csvis much more flexible.PicoScenesThe support for Picoscenes is anexperimentalfeature. PicoScenes is still under active development, csiread cannot be updated synchronously.csidata.rawis astructured arrayin numpy and stores the parsed result.MagandPhasefileds have been removed, usenp.absandnp.angleinstead.Callcheck()method afterread(), Then setpl_sizeaccording to the report.Edge padding are applied toraw["xxx"]["SubcarrierIndex"]for plotting.The methodpmsghas been implemented, but not yet ready.Accessing CSI likecsidata.CSI.CSIis only available after callingreadmethod.5-10 times faster than beforeparseCSIMVM(...)in_picoscenes.pyxmay be incorrect.csiread.Picoscenesis based on the PicoScenes MATLAB Toolbox(PMT)(Last modified at 2022-01-21).