wiki:802.11/wlan_exp/log/examples/txrx_walkthrough

Version 1 (modified by murphpo, 10 years ago) (diff)

--

First we import the required packages:

import warpnet.wlan_exp_log.log_util as log_util
import warpnet.wlan_exp_log.log_util_hdf as hdf_util
import numpy as np

Next define the names of the two log files we will process:

AP_LOGFILE = 'example_logs/ap_log_stats_2014_03_20.hdf5'
STA_LOGFILE = 'example_logs/sta_log_stats_2014_03_20.hdf5'

Then we extract the log data and the associated log indexes from the log files:

log_data_ap = hdf_util.hdf5_to_log_data(filename=AP_LOGFILE)
log_data_index_ap = hdf_util.hdf5_to_log_data_index(filename=AP_LOGFILE)

log_data_sta = hdf_util.hdf5_to_log_data(filename=STA_LOGFILE)
log_data_index_sta = hdf_util.hdf5_to_log_data_index(filename=STA_LOGFILE)

Before we can process the log data, we need to translate and filter the raw log indexes. This step replaces the hard-to-understand entry type codes (like 10) with easy entry type names (like RX_OFDM). It also filters out log entries we don't need for this example.

In this example we create log indexes (one for each log file) that refer to only the Tx and OFDM Rx log entries:

log_index_txrx_ap = log_util.filter_log_index(log_data_index_ap, include_only=['RX_OFDM', 'TX'])
log_index_txrx_sta = log_util.filter_log_index(log_data_index_sta, include_only=['RX_OFDM', 'TX'])

Finally we parse the actual log data, extracting arrays for each type of log entry in our filtered index:

log_np_ap = log_util.log_data_to_np_arrays(log_data_ap, log_index_txrx_ap)
log_np_sta = log_util.log_data_to_np_arrays(log_data_sta, log_index_txrx_sta)

Now we have four numpy arrays (Tx/Rx for AP/STA), stored in two dictionaries. Let's assign these arrays to dedicated variables for easier code:

tx_ap = log_np_ap['TX']
tx_sta = log_np_sta['TX']

rx_ap = log_np_ap['RX_OFDM']
rx_sta = log_np_sta['RX_OFDM']

Attachments (2)

Download all attachments as: .zip