question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot understand the meaning of the amplitude.

See original GitHub issue

Thanks for your work, I am using your library to read CSI packets generated from Nexmon CSI, but I have some questions about the data.

  1. The channel statement information in 802.11 is calculated by H = Y/X, where H is the CSI. The value of this should have ranged from 0 to 1, 0 means the signal faded significantly and 1 means the signal has no fading after the channel. Due to the multipath channel, the value could be a little bit larger than 1. But the original data obtained by CSIKit are very big, the image below shows the CSI amplitude data in a linear format. image
  2. The data looks reasonable after setting the scaled to True, csi_data = my_reader.read_file("DATASET-pi-2\Empty-21.pcap", scaled=True). Could you explain how is the scale works?

Thanks in advance!!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
Gi-zcommented, May 17, 2021

Following the above thread I am trying to visualize the CSI (esp32 data) as you have shown in the visualizations. Could you share the code so I could complete the visualization?

Hi, yes, I’ll provide both code and the data used for this example. Data: https://drive.google.com/file/d/1MUuTdWIGMB03Vv1avKK6PBdga0bKS4A2/view?usp=sharing

from CSIKit.reader import CSVBeamformReader
from CSIKit.util.matlab import db, dbinv

import matplotlib.pyplot as plt
import numpy as np

def scale_csi_frame(csi: np.array, rssi: int) -> np.array:
    # This is not a true SNR ratio as is the case for the Intel scaling.
    # We do not have agc or noise values so it's just about establishing a scale against RSSI.

    # TODO: Find out whether it's RSS or RSSI being supplied with most CSI Frames.
    # I thought RSSI wasn't negative?

    subcarrier_count = csi.shape[0]

    rssi_pwr = dbinv(int(rssi))

    csi_sq = np.multiply(csi, np.conj(csi))
    csi_pwr = np.sum(csi_sq)
    csi_pwr = np.real(csi_pwr)

    # This implementation is based on the equation shown in https://doi.org/10.1109/JIOT.2020.3022573.
    # scaling_coefficient = sqrt(10^(RSS/10) / sum(CSIi^2))

    scale = rssi_pwr / (csi_pwr / subcarrier_count)
    return csi * np.sqrt(scale)

reader = CSVBeamformReader()
csi_data = reader.read_file("rss_test.csv")

rssis = [x.rssi for x in csi_data.frames]
sub1_data_unscaled = [db(abs(x.csi_matrix[-1])) for x in csi_data.frames]
sub1_data_scaled = [db(abs(scale_csi_frame(x.csi_matrix, x.rssi)[-1])) for x in csi_data.frames]

plt.title("Sub1 Unscaled")
plt.plot(sub1_data_unscaled)
plt.show()

plt.title("RSS")
plt.plot(rssis)
plt.show()

plt.title("Sub1 Scaled")
plt.plot(sub1_data_scaled)
plt.show()
0reactions
Gi-zcommented, May 19, 2021

There is good reason to believe that AGC process is being reversed with the CRISLoc method, however without a measure of CSI before AGC has been applied there isn’t definitive proof. I’ve got a couple of experiments planned to test this out, however it’ll be a little while before I can get the proper equipment. Hoping to have something on this soon. I’ll implement CRISLoc scaling as an optional feature in CSIKit shortly.

Going to close this issue now, but feel free to re-open and/or let me know if there’s anything else I can clear up.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is the Amplitude of a Wave? - Video & Lesson Transcript
The definition of amplitude is a measurement of energy transferred by a wave; the higher the energy put into a wave, the higher...
Read more >
Definition of amplitude and period (video) - Khan Academy
David defines the terms amplitude and period for simple harmonic motion and ... but i don't know how the acting forces will cause...
Read more >
Definition of Amplitude and Period | Physics | Khan Academy
Your browser can't play this video. Learn more. Switch camera.
Read more >
Sound: Wavelength, Frequency and Amplitude. - YouTube
Your browser can't play this video. Learn more.
Read more >
Understanding Sound - Natural Sounds (U.S. National Park ...
Amplitude is the relative strength of sound waves (transmitted vibrations ), which we perceive as loudness or volume. · Decibels · Acoustic ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found