# Nexcsi
Nexcsi is a fast and simple CSI decoder for Nexmon_CSI files written in Python.
``` bash
pip install nexcsi
```
# Usage
``` python
from nexcsi import decoder
device = "raspberrypi" # nexus5, nexus6p, rtac86u
samples = decoder(device).read_pcap('pcap/output10k.pcap')
print(samples['rssi']) # [-75 -77 -77 ... -77 -76 -76]
print(samples['fctl']) # [128 148 148 ... 148 148 148]
print(samples['csi']) # [[ 19489 0 -19200 -96 -42 ...
# samples is a Numpy Structured Array
print(samples.dtype)
# [
# ('ts_sec', '<u4'), ('ts_usec', '<u4'), ('saddr', '>u4'),
# ('daddr', '>u4'), ('sport', '>u2'), ('dport', '>u2'),
# ('magic', '<u2'), ('rssi', 'i1'), ('fctl', 'u1'),
# ('mac', 'u1', (6,)), ('seq', '<u2'), ('css', '<u2'),
# ('csp', '<u2'), ('cvr', '<u2'), ('csi', '<i2', (512,))
# ]
# Accessing CSI as type complex64
csi = decoder(device).unpack(samples['csi'])
```
### Null and Pilot subcarriers
CSI values of some subcarriers contain large and arbitrary values.
Removing or zeroing them can make the changes in CSI better visible.
To zero the values of Null and Pilot subcarriers:
``` python
csi = decoder(device).unpack(samples['csi'], zero_nulls=True, zero_pilots=True)
```
Alternatively you can completely delete the columns of those subcarriers.
Although I don't recommend this, because it changes the indexes of other subcarriers.
``` python
import numpy as np
csi = np.delete(csi, csi.dtype.metadata['nulls'], axis=1)
csi = np.delete(csi, csi.dtype.metadata['pilots'], axis=1)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/nexmonster/nexcsi.git",
"name": "nexcsi",
"maintainer": "Aravind Reddy Voggu",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "zerodividedby0@gmail.com",
"keywords": "Nexmon,CSI,Nexmon_CSI,WiFi",
"author": "Aravind Reddy Voggu",
"author_email": "zerodividedby0@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/c6/7b/09e8533b7b02e2676005e6cf4b1308efe6efea433eb9939d9dca1e7507a6/nexcsi-0.5.2.tar.gz",
"platform": null,
"description": "# Nexcsi\n\nNexcsi is a fast and simple CSI decoder for Nexmon_CSI files written in Python.\n\n``` bash\npip install nexcsi\n```\n\n# Usage\n\n``` python\nfrom nexcsi import decoder\n\ndevice = \"raspberrypi\" # nexus5, nexus6p, rtac86u\n\nsamples = decoder(device).read_pcap('pcap/output10k.pcap')\n\nprint(samples['rssi']) # [-75 -77 -77 ... -77 -76 -76]\nprint(samples['fctl']) # [128 148 148 ... 148 148 148]\nprint(samples['csi']) # [[ 19489 0 -19200 -96 -42 ...\n\n# samples is a Numpy Structured Array\nprint(samples.dtype)\n\n# [\n# ('ts_sec', '<u4'), ('ts_usec', '<u4'), ('saddr', '>u4'), \n# ('daddr', '>u4'), ('sport', '>u2'), ('dport', '>u2'),\n# ('magic', '<u2'), ('rssi', 'i1'), ('fctl', 'u1'),\n# ('mac', 'u1', (6,)), ('seq', '<u2'), ('css', '<u2'),\n# ('csp', '<u2'), ('cvr', '<u2'), ('csi', '<i2', (512,))\n# ]\n\n# Accessing CSI as type complex64\ncsi = decoder(device).unpack(samples['csi'])\n```\n\n### Null and Pilot subcarriers\n\nCSI values of some subcarriers contain large and arbitrary values.\nRemoving or zeroing them can make the changes in CSI better visible.\n\nTo zero the values of Null and Pilot subcarriers:\n\n``` python\ncsi = decoder(device).unpack(samples['csi'], zero_nulls=True, zero_pilots=True)\n```\n\nAlternatively you can completely delete the columns of those subcarriers.\nAlthough I don't recommend this, because it changes the indexes of other subcarriers.\n\n``` python\nimport numpy as np\n\ncsi = np.delete(csi, csi.dtype.metadata['nulls'], axis=1)\ncsi = np.delete(csi, csi.dtype.metadata['pilots'], axis=1)\n```",
"bugtrack_url": null,
"license": "MIT",
"summary": "A fast and simple decoder for Nexmon_CSI",
"version": "0.5.2",
"split_keywords": [
"nexmon",
"csi",
"nexmon_csi",
"wifi"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "49beb15f9148f50487af514cf3629071",
"sha256": "0a7bc28da9b68b33e0ea3cfc8471f65f6534789bba77204d1c22fc36ad15a257"
},
"downloads": -1,
"filename": "nexcsi-0.5.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "49beb15f9148f50487af514cf3629071",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 8608,
"upload_time": "2022-12-15T07:09:22",
"upload_time_iso_8601": "2022-12-15T07:09:22.597418Z",
"url": "https://files.pythonhosted.org/packages/36/b2/1144d7b251c9a3dd3f6311b148d2dfd26eac7e0012babe69cd1617960f2a/nexcsi-0.5.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "694ad821b1fe973e8990465103deef36",
"sha256": "cba218e68a1eb1b92854bc5387903bafbb96b9e10ea8ff10f3a6e50dc87ad10c"
},
"downloads": -1,
"filename": "nexcsi-0.5.2.tar.gz",
"has_sig": false,
"md5_digest": "694ad821b1fe973e8990465103deef36",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 6059,
"upload_time": "2022-12-15T07:09:24",
"upload_time_iso_8601": "2022-12-15T07:09:24.117055Z",
"url": "https://files.pythonhosted.org/packages/c6/7b/09e8533b7b02e2676005e6cf4b1308efe6efea433eb9939d9dca1e7507a6/nexcsi-0.5.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-15 07:09:24",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "nexmonster",
"github_project": "nexcsi.git",
"lcname": "nexcsi"
}