| 1 | First we import the required packages: |
| 2 | {{{#!python |
| 3 | import warpnet.wlan_exp_log.log_util as log_util |
| 4 | import warpnet.wlan_exp_log.log_util_hdf as hdf_util |
| 5 | import numpy as np |
| 6 | }}} |
| 7 | |
| 8 | Next define the names of the two log files we will process: |
| 9 | {{{#!python |
| 10 | AP_LOGFILE = 'example_logs/ap_log_stats_2014_03_20.hdf5' |
| 11 | STA_LOGFILE = 'example_logs/sta_log_stats_2014_03_20.hdf5' |
| 12 | }}} |
| 13 | |
| 14 | Then we extract the log data and the associated log indexes from the log files: |
| 15 | {{{#!python |
| 16 | log_data_ap = hdf_util.hdf5_to_log_data(filename=AP_LOGFILE) |
| 17 | log_data_index_ap = hdf_util.hdf5_to_log_data_index(filename=AP_LOGFILE) |
| 18 | |
| 19 | log_data_sta = hdf_util.hdf5_to_log_data(filename=STA_LOGFILE) |
| 20 | log_data_index_sta = hdf_util.hdf5_to_log_data_index(filename=STA_LOGFILE) |
| 21 | }}} |
| 22 | |
| 23 | 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. |
| 24 | |
| 25 | In this example we create log indexes (one for each log file) that refer to only the Tx and OFDM Rx log entries: |
| 26 | |
| 27 | {{{#!python |
| 28 | log_index_txrx_ap = log_util.filter_log_index(log_data_index_ap, include_only=['RX_OFDM', 'TX']) |
| 29 | log_index_txrx_sta = log_util.filter_log_index(log_data_index_sta, include_only=['RX_OFDM', 'TX']) |
| 30 | }}} |
| 31 | |
| 32 | Finally we parse the actual log data, extracting arrays for each type of log entry in our filtered index: |
| 33 | |
| 34 | {{{#!python |
| 35 | log_np_ap = log_util.log_data_to_np_arrays(log_data_ap, log_index_txrx_ap) |
| 36 | log_np_sta = log_util.log_data_to_np_arrays(log_data_sta, log_index_txrx_sta) |
| 37 | }}} |
| 38 | |
| 39 | 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: |
| 40 | {{{#!python |
| 41 | tx_ap = log_np_ap['TX'] |
| 42 | tx_sta = log_np_sta['TX'] |
| 43 | |
| 44 | rx_ap = log_np_ap['RX_OFDM'] |
| 45 | rx_sta = log_np_sta['RX_OFDM'] |
| 46 | }}} |
| 47 | |