Skip to main content

A fast and simple decoder for Nexmon_CSI

Project description

Nexcsi

Nexcsi is a fast and simple CSI decoder for Nexmon_CSI files written in Python.

pip install nexcsi

Usage

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:

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.

import numpy as np

csi = np.delete(csi, csi.dtype.metadata['nulls'], axis=1)
csi = np.delete(csi, csi.dtype.metadata['pilots'], axis=1)

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

nexcsi-0.5.2.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

nexcsi-0.5.2-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file nexcsi-0.5.2.tar.gz.

File metadata

  • Download URL: nexcsi-0.5.2.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.6 Linux/6.0.6-76060006-generic

File hashes

Hashes for nexcsi-0.5.2.tar.gz
Algorithm Hash digest
SHA256 cba218e68a1eb1b92854bc5387903bafbb96b9e10ea8ff10f3a6e50dc87ad10c
MD5 694ad821b1fe973e8990465103deef36
BLAKE2b-256 c67b09e8533b7b02e2676005e6cf4b1308efe6efea433eb9939d9dca1e7507a6

See more details on using hashes here.

File details

Details for the file nexcsi-0.5.2-py3-none-any.whl.

File metadata

  • Download URL: nexcsi-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.6 Linux/6.0.6-76060006-generic

File hashes

Hashes for nexcsi-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0a7bc28da9b68b33e0ea3cfc8471f65f6534789bba77204d1c22fc36ad15a257
MD5 49beb15f9148f50487af514cf3629071
BLAKE2b-256 36b21144d7b251c9a3dd3f6311b148d2dfd26eac7e0012babe69cd1617960f2a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page