def get_coi_df(dbcon, time_before): df_list = [] cell_col_prefix_renamed = ["ARFCN", "VALUE"] worst_col_prefix_sr = pd.Series(["gsm_coi_worst_arfcn_1", "gsm_coi_worst"]) parameter_to_columns_list = [ ("Time", ["time"]), ( "Worst", list(worst_col_prefix_sr), ), ] df = params_disp_df.get( dbcon, parameter_to_columns_list, time_before, default_table="gsm_coi_per_chan", not_null_first_col=True, custom_lookback_dur_millis=gc.DEFAULT_LOOKBACK_DUR_MILLIS, ) df.columns = ["CellGroup"] + cell_col_prefix_renamed df_list.append(df) avg_col_prefix_sr = pd.Series(["gsm_coi_arfcn_", "gsm_coi_"]) avg_n_param = 32 avg = sum( map( lambda y: list( map(lambda x: x + "{}".format(y + 1), avg_col_prefix_sr)), range(avg_n_param), ), [], ) parameter_to_columns_list = [ ("Avg", ['""']), ( list(map(lambda x: "", range(avg_n_param))), avg, ), ] df = params_disp_df.get( dbcon, parameter_to_columns_list, time_before, default_table="gsm_coi_per_chan", not_null_first_col=True, custom_lookback_dur_millis=gc.DEFAULT_LOOKBACK_DUR_MILLIS, ) df.columns = ["CellGroup"] + cell_col_prefix_renamed df_list.append(df) final_df = pd.concat(df_list, sort=False) return final_df
def get_wcdma_radio_params_disp_df(dbcon, time_before): parameter_to_columns_list = [ ( ["Time", "Tx Power", "Max Tx Power"], [ "time," "wcdma_txagc", "wcdma_maxtxpwr", ], "wcdma_tx_power", ), ("RSSI", ["wcdma_rssi"], "wcdma_rx_power"), ("SIR", ["wcdma_sir"], "wcdma_sir"), ("RRC State", ["wcdma_rrc_state"], "wcdma_rrc_state"), ( ["Speech Codec TX", "Speech Codec RX"], ["gsm_speechcodectx", "gsm_speechcodecrx"], "vocoder_info", ), ( ["Cell ID", "RNC ID"], ["android_cellid", "android_rnc_id"], "android_info_1sec", ), ] return params_disp_df.get( dbcon, parameter_to_columns_list, time_before, not_null_first_col=False, custom_lookback_dur_millis=gc.DEFAULT_LOOKBACK_DUR_MILLIS, )
def get_bler_sum_disp_df(dbcon, time_before): parameter_to_columns_list = [ ( [ "Time", "BLER Average Percent", "BLER Calculation Window Size", "BLER N Transport Channels", ], [ "time," "wcdma_bler_average_percent_all_channels", "wcdma_bler_calculation_window_size", "wcdma_bler_n_transport_channels", ], "wcdma_bler", ), ] return params_disp_df.get( dbcon, parameter_to_columns_list, time_before, not_null_first_col=False, custom_lookback_dur_millis=gc.DEFAULT_LOOKBACK_DUR_MILLIS, )
def get_volte_disp_df(dbcon, time_before): n_param_args = 4 parameter_to_columns_list = [ ("Time", ["time"], "lte_volte_stats"), ( [ "Codec:", "AMR SpeechCodec-RX", "AMR SpeechCodec-TX", "Delay interval avg:", "Audio Packet delay (ms.)", ], [ '"" as unused0', "gsm_speechcodecrx", "gsm_speechcodectx", '"" as unused1', "vocoder_amr_audio_packet_delay_avg", ], "vocoder_info", ), ( [ "RTP Packet delay (ms.)", "RTCP SR Params:", "RTCP Round trip time (ms.)", "RTCP SR Params - Jitter DL:", "RTCP SR Jitter DL (ts unit)", "RTCP SR Jitter DL (ms.)", "RTCP SR Params - Jitter UL:", "RTCP SR Jitter UL (ts unit)", "RTCP SR Jitter UL (ms.)", "RTCP SR Params - Packet loss rate:", "RTCP SR Packet loss DL (%)", "RTCP SR Packet loss UL (%)", ], [ "lte_volte_rtp_pkt_delay_avg", '"" as unused2', "lte_volte_rtp_round_trip_time", '"" as unused3', "lte_volte_rtp_jitter_dl", "lte_volte_rtp_jitter_dl_millis", '"" as unused4', "lte_volte_rtp_jitter_ul", "lte_volte_rtp_jitter_ul_millis", '"" as unused5', "lte_volte_rtp_packet_loss_rate_dl", "lte_volte_rtp_packet_loss_rate_ul", ], "lte_volte_stats", ), ] return params_disp_df.get( dbcon, parameter_to_columns_list, time_before, not_null_first_col=False, custom_lookback_dur_millis=gc.DEFAULT_LOOKBACK_DUR_MILLIS, )
def get_gsm_current_channel_disp_df(dbcon, time_before): df_list = [] parameter_to_columns_list = [ ( [ "Time", "Cellname", "CGI", ], [ "time," "gsm_cellfile_matched_cellname", "gsm_cgi", ], "gsm_cell_meas", ), ("Channel Type", ["gsm_channeltype"], "gsm_rr_chan_desc"), ("Sub Channel Number", ["gsm_subchannelnumber"], "gsm_rr_subchan"), ( [ "Mobile Allocation Index Offset (MAIO)", "Hopping Sequence Number (HSN)" ], ["gsm_maio", "gsm_hsn"], "gsm_rr_chan_desc", ), ("Cipering Algorithm", ["gsm_cipheringalgorithm"], "gsm_rr_cipher_alg"), ("MS Power Control Level", ["gsm_ms_powercontrollevel"], "gsm_rr_power_ctrl"), ("Channel Mode", ["gsm_channelmode"], "gsm_chan_mode"), ( ["Speech Codec TX", "Speech Codec RX"], ["gsm_speechcodectx", "gsm_speechcodecrx"], "vocoder_info", ), ("Hopping Frequencies", ["gsm_hoppingfrequencies"], "gsm_hopping_list"), ("ARFCN BCCH", ["gsm_arfcn_bcch"], "gsm_cell_meas"), ("ARFCN TCH", ["gsm_arfcn_tch"], "gsm_rr_chan_desc"), ("Time Slot", ["gsm_timeslot"], "gsm_rr_chan_desc"), ] df = params_disp_df.get( dbcon, parameter_to_columns_list, time_before, not_null_first_col=False, custom_lookback_dur_millis=gc.DEFAULT_LOOKBACK_DUR_MILLIS, ) df.columns = ["Parameter", "Value"] df_list.append(df) final_df = pd.concat(df_list, sort=False) return final_df
def get_nr_radio_params_disp_df(dbcon, time_before): n_param_args = 8 parameter_to_columns_list = [ ("Time", ["time"]), ( # these params below come together so query them all in one query ["Band", "ARFCN", "PCI", "RSRP", "RSRQ", "SINR"], list(map(lambda x: "nr_band_{}".format(x + 1), range(n_param_args))) + list(map(lambda x: "nr_dl_arfcn_{}".format(x + 1), range(n_param_args))) + list( map( lambda x: "nr_servingbeam_pci_{}".format(x + 1), range(n_param_args) ) ) + list( map( lambda x: "nr_servingbeam_ss_rsrp_{}".format(x + 1), range(n_param_args), ) ) + list( map( lambda x: "nr_servingbeam_ss_rsrq_{}".format(x + 1), range(n_param_args), ) ) + list( map( lambda x: "nr_servingbeam_ss_sinr_{}".format(x + 1), range(n_param_args), ) ), ), ( # these params below come together but not same row with rsrp etc above so query them all in their own set below ["PUSCH TxPower", "PUCCH TxPower", "SRS TxPower"], list( map(lambda x: "nr_pusch_tx_power_{}".format(x + 1), range(n_param_args)) ) + list( map(lambda x: "nr_pucch_tx_power_{}".format(x + 1), range(n_param_args)) ) + list( map(lambda x: "nr_srs_tx_power_{}".format(x + 1), range(n_param_args)) ), ), ] return params_disp_df.get( dbcon, parameter_to_columns_list, time_before, default_table="nr_cell_meas", not_null_first_col=True, custom_lookback_dur_millis=gc.DEFAULT_LOOKBACK_DUR_MILLIS, )
def get_lte_rlc_disp_df(dbcon, time_before): n_param_args = 4 parameter_to_columns_list = [ ( ["Time", "DL TP(Mbps)", "DL TP(Kbps)", "N Bearers"], [ "time", "lte_rlc_dl_tp_mbps", "lte_rlc_dl_tp", "lte_rlc_n_bearers" ], "lte_rlc_stats", ), ( # these params below come together so query them all in one query [ "Mode", "Type", "RB-ID", "Index", "TP Mbps", ], list( map( lambda x: "lte_rlc_per_rb_dl_rb_mode_{}".format(x + 1), range(n_param_args), )) + list( map( lambda x: "lte_rlc_per_rb_dl_rb_type_{}".format(x + 1), range(n_param_args), )) + list( map( lambda x: "lte_rlc_per_rb_dl_rb_id_{}".format(x + 1), range(n_param_args), )) + list( map( lambda x: "lte_rlc_per_rb_cfg_index_{}".format(x + 1), range(n_param_args), )) + list( map( lambda x: "lte_rlc_per_rb_dl_tp_{}".format(x + 1), range(n_param_args), )), "lte_rlc_stats", ), ] return params_disp_df.get( dbcon, parameter_to_columns_list, time_before, not_null_first_col=True, custom_lookback_dur_millis=gc.DEFAULT_LOOKBACK_DUR_MILLIS, )
def test(): azmfp = "../example_logs/nr_exynos_drive1/354569110588585-18_08_2020-13_54_22.azm" dbfp = integration_test_helpers.unzip_azm_to_tmp_get_dbfp(azmfp) n_param_args = 8 parameter_to_columns_list = [( ["Band", "ARFCN", "PCI"], list(map(lambda x: "nr_band_{}".format(x + 1), range(n_param_args))) + list(map(lambda x: "nr_dl_arfcn_{}".format(x + 1), range(n_param_args))) + list( map(lambda x: "nr_servingbeam_pci_{}".format(x + 1), range(n_param_args))), )] with sqlite3.connect(dbfp) as dbcon: # valid time time_before = "2020-08-18 13:47:42.382" df_pdd = params_disp_df.get( dbcon, parameter_to_columns_list, time_before, default_table="nr_cell_meas", not_null_first_col=True, custom_lookback_dur_millis=4000, ) print("df_pdd.head():\n", df_pdd.head()) assert df_pdd.iloc[0, 1] == 41 # invalid time df_pdd = params_disp_df.get( dbcon, parameter_to_columns_list, "2020-08-05 18:51:38.000", default_table="nr_cell_meas", not_null_first_col=True, custom_lookback_dur_millis=4000, ) print("empty df_pdd.head():\n", df_pdd.head())
def get_lte_radio_params_disp_df(dbcon, time_before): n_param_args = 4 parameter_to_columns_list = [ ("Time", ["time"], "lte_cell_meas"), ( # these params below come together so query them all in one query ["Band", "EARFCN", "PCI", "RSRP", "RSRQ", "SINR", "RSSI"], list( map(lambda x: "lte_band_{}".format(x + 1), range(n_param_args))) + list( map(lambda x: "lte_earfcn_{}".format(x + 1), range(n_param_args))) + list( map( lambda x: "lte_physical_cell_id_{}".format(x + 1), range(n_param_args), )) + list( map(lambda x: "lte_inst_rsrp_{}".format(x + 1), range(n_param_args))) + list( map(lambda x: "lte_inst_rsrq_{}".format(x + 1), range(n_param_args))) + list( map(lambda x: "lte_sinr_{}".format(x + 1), range(n_param_args))) + list( map(lambda x: "lte_inst_rssi_{}".format(x + 1), range(n_param_args))), "lte_cell_meas", ), ([ "TxPower", ], [ "lte_tx_power", ], "lte_tx_power"), (["PUSCH TxPower"], [ "lte_pusch_tx_power", ], "lte_pusch_tx_info"), (["PUCCH TxPower"], [ "lte_pucch_tx_power", ], "lte_pucch_tx_info"), (["TA"], [ "lte_ta", ], "lte_frame_timing"), ] return params_disp_df.get( dbcon, parameter_to_columns_list, time_before, not_null_first_col=True, custom_lookback_dur_millis=gc.DEFAULT_LOOKBACK_DUR_MILLIS, )
def get_wcdma_bearers_df(dbcon, time_before): df_list = [] cell_col_prefix_renamed = [ "Bearers ID", "Bearers Rate DL", "Bearers Rate UL" ] cell_col_prefix_sr = pd.Series([ "data_wcdma_bearer_id_", "data_wcdma_bearer_rate_dl_", "data_wcdma_bearer_rate_ul_", ]) n_param = 10 bearer = sum( map( lambda y: list( map(lambda x: x + "{}".format(y + 1), cell_col_prefix_sr)), range(n_param), ), [], ) parameter_to_columns_list = [ ( list(map(lambda x: " {}".format(x + 1), range(n_param))), bearer, "wcdma_bearers", ), ] df = params_disp_df.get( dbcon, parameter_to_columns_list, time_before, default_table="wcdma_bearers", not_null_first_col=False, custom_lookback_dur_millis=gc.DEFAULT_LOOKBACK_DUR_MILLIS, ) # print("df.head():\n%s" % df.head()) df.columns = ["Bearer"] + cell_col_prefix_renamed # print("df.head():\n%s" % df.head()) df_list.append(df) final_df = pd.concat(df_list, sort=False) return final_df
def get_lte_rrc_sib_states_df(dbcon, time_before): parameter_to_columns_list = [ ( [ "Time", "SIB1 MCC", "SIB1 MNC", "SIB1 TAC", "SIB1 ECI (Cell ID)", "SIB1 eNodeB ID", "SIB1 LCI", ], [ "time", "lte_sib1_mcc", "lte_sib1_mnc", "lte_sib1_tac", "lte_sib1_eci", "lte_sib1_enb_id", "lte_sib1_local_cell_id", ], "lte_sib1_info", ), ( ["Time", "Transmission Mode (RRC-tm)"], [ "time", "lte_transmission_mode_l3", ], "lte_rrc_transmode_info", ), (["Time", "RRC State"], [ "time", "lte_rrc_state", ], "lte_rrc_state"), ] return params_disp_df.get( dbcon, parameter_to_columns_list, time_before, not_null_first_col=True, custom_lookback_dur_millis=24 * 3600, )
def get_wcdma_bler_transport_channel_df(dbcon, time_before): df_list = [] cell_col_prefix_renamed = ["Transport Channel", "Percent", "Err", "Rcvd"] cell_col_prefix_sr = pd.Series([ "wcdma_bler_channel_", "wcdma_bler_percent_", "wcdma_bler_err_", "wcdma_bler_rcvd_", ]) n_param = 16 bler = sum( map( lambda y: list( map(lambda x: x + "{}".format(y + 1), cell_col_prefix_sr)), range(n_param), ), [], ) parameter_to_columns_list = [ (list(map(lambda x: "{}".format(x + 1), range(n_param))), bler, "wcdma_bler"), ] df = params_disp_df.get( dbcon, parameter_to_columns_list, time_before, default_table="wcdma_bler", not_null_first_col=False, custom_lookback_dur_millis=gc.DEFAULT_LOOKBACK_DUR_MILLIS, ) # print("df.head():\n%s" % df.head()) df.columns = ["Channel"] + cell_col_prefix_renamed # print("df.head():\n%s" % df.head()) df_list.append(df) final_df = pd.concat(df_list, sort=False) return final_df
def get_gsm_radio_params_disp_df(dbcon, time_before): df_list = [] parameter_to_columns_list = [ ( [ "Time", "RxLev Full", "RxLev Sub", "RxQual Full", "RxQual Sub", ], [ "time," "gsm_rxlev_full_dbm", "gsm_rxlev_sub_dbm", "gsm_rxqual_full", "gsm_rxqual_sub", ], "gsm_cell_meas", ), ("TA", ["gsm_ta"], "gsm_tx_meas"), ("RLT (Max)", ["gsm_radiolinktimeout_max"], "gsm_rl_timeout_counter"), ("RLT (Current)", ["gsm_radiolinktimeout_current"], "gsm_rlt_counter"), ("DTX Used", ["gsm_dtxused"], "gsm_rr_measrep_params"), ("TxPower", ["gsm_txpower"], "gsm_tx_meas"), ("FER", ["gsm_fer"], "vocoder_info"), ] df = params_disp_df.get( dbcon, parameter_to_columns_list, time_before, not_null_first_col=False, custom_lookback_dur_millis=gc.DEFAULT_LOOKBACK_DUR_MILLIS, ) df.columns = ["Parameter", "Value"] df_list.append(df) final_df = pd.concat(df_list, sort=False) return final_df
def get_lte_serv_and_neigh_disp_df(dbcon, time_before): df_list = [] pcell_scell_col_prefix_sr = pd.Series([ "lte_earfcn_", "lte_physical_cell_id_", "lte_inst_rsrp_", "lte_inst_rsrq_", "lte_sinr_", ]) pcell_scell_col_prefix_renamed = ["EARFCN", "PCI", "RSRP", "RSRQ", "SINR"] parameter_to_columns_list = [ ("Time", ["time"]), ( ["PCell", "SCell1", "SCell2", "SCell3"], list(pcell_scell_col_prefix_sr + "1") + list(pcell_scell_col_prefix_sr + "2") + list(pcell_scell_col_prefix_sr + "3") + list(pcell_scell_col_prefix_sr + "4"), "lte_cell_meas", ), ] df = params_disp_df.get( dbcon, parameter_to_columns_list, time_before, default_table="lte_cell_meas", not_null_first_col=True, custom_lookback_dur_millis=gc.DEFAULT_LOOKBACK_DUR_MILLIS, ) # print("df.head():\n%s" % df.head()) df.columns = ["CellGroup"] + pcell_scell_col_prefix_renamed # print("df.head():\n%s" % df.head()) df_list.append(df) # neigh pcell_scell_col_prefix_sr = pd.Series([ "lte_neigh_earfcn_", "lte_neigh_physical_cell_id_", "lte_neigh_rsrp_", "lte_neigh_rsrq_", ]) pcell_scell_col_prefix_renamed = ["ARFCN", "PCI", "RSRP", "RSRQ"] parameter_to_columns_list = [( [ "Neigh1", "Neigh2", "Neigh3", "Neigh4", "Neigh5", "Neigh6", "Neigh7", "Neigh8", ], list(pcell_scell_col_prefix_sr + "1") + list(pcell_scell_col_prefix_sr + "2") + list(pcell_scell_col_prefix_sr + "3") + list(pcell_scell_col_prefix_sr + "4") + list(pcell_scell_col_prefix_sr + "5") + list(pcell_scell_col_prefix_sr + "6") + list(pcell_scell_col_prefix_sr + "7") + list(pcell_scell_col_prefix_sr + "8"), "lte_neigh_meas", )] df = params_disp_df.get( dbcon, parameter_to_columns_list, time_before, not_null_first_col=True, custom_lookback_dur_millis=gc.DEFAULT_LOOKBACK_DUR_MILLIS, ) # print("df.head():\n%s" % df.head()) df.columns = ["CellGroup"] + pcell_scell_col_prefix_renamed # print("df.head():\n%s" % df.head()) df_list.append(df) final_df = pd.concat(df_list, sort=False) return final_df
def get_lte_pucch_pdsch_disp_df(dbcon, time_before): n_param_args = 4 parameter_to_columns_list = [ ( [ "---- PUCCH ----", "CQI CW 0", "CQI CW 1", "CQI N Sub-bands", "Rank Indicator", ], list( map(lambda x: '"" as unused_{}'.format(x + 1), range(n_param_args))) + list( map(lambda x: "lte_cqi_cw0_{}".format(x + 1), range(n_param_args))) + list( map(lambda x: "lte_cqi_cw1_{}".format(x + 1), range(n_param_args))) + list( map(lambda x: "lte_cqi_n_subbands_{}".format(x + 1), range(n_param_args))) + list( map( lambda x: "lte_rank_indication_{}".format(x + 1), range(n_param_args), )), "lte_cqi", ), ( [ "---- PDSCH ----", "PDSCH Serving Cell ID", "PDSCH RNTI ID", "PDSCH RNTI Type", "PDSCH Serving N Tx Antennas", "PDSCH Serving N Rx Antennas", "PDSCH Transmission Mode Current", "PDSCH Spatial Rank", "PDSCH Rb Allocation Slot 0", "PDSCH Rb Allocation Slot 1", "PDSCH PMI Type", "PDSCH PMI Index", "PDSCH Stream[0] Block Size", "PDSCH Stream[0] Modulation", "PDSCH Traffic To Pilot Ratio", "PDSCH Stream[1] Block Size", "PDSCH Stream[1] Modulation", ], list( map(lambda x: '"" as unused_{}'.format(x + 1), range(n_param_args))) + list( map( lambda x: "lte_pdsch_serving_cell_id_{}".format(x + 1), range(n_param_args), )) + list( map(lambda x: "lte_pdsch_rnti_id_{}".format(x + 1), range(n_param_args))) + list( map( lambda x: "lte_pdsch_rnti_type_{}".format(x + 1), range(n_param_args), )) + list( map( lambda x: "lte_pdsch_serving_n_tx_antennas_{}".format( x + 1), range(n_param_args), )) + list( map( lambda x: "lte_pdsch_serving_n_rx_antennas_{}". format(x + 1), range(n_param_args), )) + list( map( lambda x: "lte_pdsch_transmission_mode_current_{}".format( x + 1), range(n_param_args), )) + list( map( lambda x: "lte_pdsch_spatial_rank_{}".format(x + 1), range(n_param_args), )) + list( map( lambda x: "lte_pdsch_rb_allocation_slot0_{}".format(x + 1), range(n_param_args), )) + list( map( lambda x: "lte_pdsch_rb_allocation_slot1_{}".format(x + 1), range(n_param_args), )) + list( map(lambda x: "lte_pdsch_pmi_type_{}".format(x + 1), range(n_param_args))) + list( map( lambda x: "lte_pdsch_pmi_index_{}".format(x + 1), range(n_param_args), )) + list( map( lambda x: "lte_pdsch_stream0_transport_block_size_bits_{}". format(x + 1), range(n_param_args), )) + list( map( lambda x: "lte_pdsch_stream0_modulation_{}".format(x + 1), range(n_param_args), )) + list( map( lambda x: "lte_pdsch_traffic_to_pilot_ratio_{}".format( x + 1), range(n_param_args), )) + list( map( lambda x: "lte_pdsch_stream1_transport_block_size_bits_{}". format(x + 1), range(n_param_args), )) + list( map( lambda x: "lte_pdsch_stream1_modulation_{}".format(x + 1), range(n_param_args), )), "lte_pdsch_meas", ), ] return params_disp_df.get( dbcon, parameter_to_columns_list, time_before, not_null_first_col=False, custom_lookback_dur_millis=gc.DEFAULT_LOOKBACK_DUR_MILLIS, )
def get_wcdma_acive_monitored_df(dbcon, time_before): df_list = [] cell_col_prefix_renamed = [ "Cell ID", "Cell Name", "PSC", "Ec/Io", "RSCP ", "UARFCN", ] aset_col_prefix_sr = pd.Series([ "wcdma_aset_cellfile_matched_cellid_", "wcdma_aset_cellfile_matched_cellname_", "wcdma_aset_sc_", "wcdma_aset_ecio_", "wcdma_aset_rscp_", "wcdma_aset_cellfreq_", ]) aset_n_param = 3 aset = sum( map( lambda y: list( map(lambda x: x + "{}".format(y + 1), aset_col_prefix_sr)), range(aset_n_param), ), [], ) parameter_to_columns_list = [ ("Time", ["time"]), ( list(map(lambda x: "Aset{}".format(x + 1), range(aset_n_param))), aset, # list(map(lambda x: "wcdma_aset_cellfile_matched_cellid_{}".format(x+1), range(aset_n_param))) + # list(map(lambda x: "wcdma_aset_cellfile_matched_cellname_{}".format(x+1), range(aset_n_param))) + # list(map(lambda x: "wcdma_aset_sc_{}".format(x+1), range(aset_n_param))) + # list(map(lambda x: "wcdma_aset_ecio_{}".format(x+1), range(aset_n_param))) + # list(map(lambda x: "wcdma_aset_rscp_{}".format(x+1), range(aset_n_param))) + # list(map(lambda x: "wcdma_aset_cellfreq_{}".format(x+1), range(aset_n_param))), "wcdma_cell_meas", ), ] df = params_disp_df.get( dbcon, parameter_to_columns_list, time_before, default_table="wcdma_cell_meas", not_null_first_col=False, custom_lookback_dur_millis=gc.DEFAULT_LOOKBACK_DUR_MILLIS, ) # print("df.head():\n%s" % df.head()) df.columns = ["CellGroup"] + cell_col_prefix_renamed # print("df.head():\n%s" % df.head()) df_list.append(df) mset_col_prefix_sr = pd.Series([ "wcdma_mset_cellfile_matched_cellid_", "wcdma_mset_cellfile_matched_cellname_", "wcdma_mset_sc_", "wcdma_mset_ecio_", "wcdma_mset_rscp_", "wcdma_mset_cellfreq_", ]) mset_n_param = 6 mset = sum( map( lambda y: list( map(lambda x: x + "{}".format(y + 1), mset_col_prefix_sr)), range(mset_n_param), ), [], ) parameter_to_columns_list = [ ( list(map(lambda x: "Mset{}".format(x + 1), range(mset_n_param))), mset, "wcdma_cell_meas", ), ] df = params_disp_df.get( dbcon, parameter_to_columns_list, time_before, default_table="wcdma_cell_meas", not_null_first_col=False, custom_lookback_dur_millis=gc.DEFAULT_LOOKBACK_DUR_MILLIS, ) df.columns = ["CellGroup"] + cell_col_prefix_renamed df_list.append(df) dset_col_prefix_sr = pd.Series([ "wcdma_dset_cellfile_matched_cellid_", "wcdma_dset_cellfile_matched_cellname_", "wcdma_dset_sc_", "wcdma_dset_ecio_", "wcdma_dset_rscp_", "wcdma_dset_cellfreq_", ]) dset_n_param = 4 dset = sum( map( lambda y: list( map(lambda x: x + "{}".format(y + 1), dset_col_prefix_sr)), range(dset_n_param), ), [], ) parameter_to_columns_list = [ ( list(map(lambda x: "Dset{}".format(x + 1), range(dset_n_param))), dset, "wcdma_cell_meas", ), ] df = params_disp_df.get( dbcon, parameter_to_columns_list, time_before, default_table="wcdma_cell_meas", not_null_first_col=False, custom_lookback_dur_millis=gc.DEFAULT_LOOKBACK_DUR_MILLIS, ) df.columns = ["CellGroup"] + cell_col_prefix_renamed df_list.append(df) final_df = pd.concat(df_list, sort=False) return final_df
def get_nr_serv_and_neigh_disp_df(dbcon, time_before): df_list = [] pcell_scell_col_prefix_sr = pd.Series( [ "nr_dl_arfcn_", "nr_servingbeam_pci_", "nr_servingbeam_ss_rsrp_", "nr_servingbeam_ss_rsrq_", "nr_servingbeam_ss_sinr_", ] ) pcell_scell_col_prefix_renamed = ["ARFCN", "PCI", "RSRP", "RSRQ", "SINR"] parameter_to_columns_list = [ ("Time", ["time"]), ( [ "PCell", "SCell1", "SCell2", "SCell3", "SCell4", "SCell5", "SCell6", "SCell7", ], list(pcell_scell_col_prefix_sr + "1") + list(pcell_scell_col_prefix_sr + "2") + list(pcell_scell_col_prefix_sr + "3") + list(pcell_scell_col_prefix_sr + "4") + list(pcell_scell_col_prefix_sr + "5") + list(pcell_scell_col_prefix_sr + "6") + list(pcell_scell_col_prefix_sr + "7") + list(pcell_scell_col_prefix_sr + "8"), ), ] df = params_disp_df.get( dbcon, parameter_to_columns_list, time_before, default_table="nr_cell_meas", not_null_first_col=True, custom_lookback_dur_millis=gc.DEFAULT_LOOKBACK_DUR_MILLIS, ) # print("df.head():\n%s" % df.head()) df.columns = ["CellGroup"] + pcell_scell_col_prefix_renamed # print("df.head():\n%s" % df.head()) df_list.append(df) dcell_col_suffix_sr = pd.Series( ["_pci_1", "_ss_rsrp_1", "_ss_rsrq_1", "_ss_sinr_1"] ) # a mistake during elm sheets made this unnecessary _1 required dcell_col_renamed = ["PCI", "RSRP", "RSRQ", "SINR"] dparameter_to_columns_list = [ ( ["DCell1", "DCell2", "DCell3", "DCell4"], list("nr_detectedbeam1" + dcell_col_suffix_sr) + list("nr_detectedbeam2" + dcell_col_suffix_sr) + list("nr_detectedbeam3" + dcell_col_suffix_sr) + list("nr_detectedbeam4" + dcell_col_suffix_sr), ) ] dcell_df = params_disp_df.get( dbcon, dparameter_to_columns_list, time_before, default_table="nr_cell_meas", not_null_first_col=True, custom_lookback_dur_millis=gc.DEFAULT_LOOKBACK_DUR_MILLIS, ) # print("0dcell_df.head():\n%s" % dcell_df.head()) dcell_df.columns = ["CellGroup"] + dcell_col_renamed # print("dcell_df.head():\n%s" % dcell_df.head()) df_list.append(dcell_df) final_df = pd.concat(df_list, sort=False) return final_df
def get_gsm_serv_and_neigh__df(dbcon, time_before): df_list = [] cell_col_prefix_renamed = [ "Cell Name", "BSIC", "ARFCN ", "RxLev", "C1", "C2", "C31", "C32", ] serv_col_prefix_sr = pd.Series([ "gsm_cellfile_matched_cellname", "gsm_bsic", "gsm_arfcn_bcch", "gsm_rxlev_sub_dbm", "gsm_c1", "gsm_c2", "gsm_c31", "gsm_c32", ]) parameter_to_columns_list = [ ( "serv", list(serv_col_prefix_sr), ), ] df = params_disp_df.get( dbcon, parameter_to_columns_list, time_before, default_table="gsm_cell_meas", not_null_first_col=False, custom_lookback_dur_millis=gc.DEFAULT_LOOKBACK_DUR_MILLIS, ) df.columns = ["CellGroup"] + cell_col_prefix_renamed df_list.append(df) lac_col_prefix_sr = pd.Series([ "gsm_lac", ]) parameter_to_columns_list = [ ( "serv", list(lac_col_prefix_sr), ), ] df2 = params_disp_df.get( dbcon, parameter_to_columns_list, time_before, default_table="gsm_serv_cell_info", not_null_first_col=False, custom_lookback_dur_millis=gc.DEFAULT_LOOKBACK_DUR_MILLIS, ) df2.columns = ["CellGroup", "LAC"] df.insert(2, "LAC", df2["LAC"]) neigh_col_prefix_sr = pd.Series([ "gsm_cellfile_matched_neighbor_cellname", "gsm_cellfile_matched_neighbor_lac_", "gsm_neighbor_bsic_", "gsm_neighbor_arfcn_", "gsm_neighbor_rxlev_dbm_", "gsm_neighbor_c1_", "gsm_neighbor_c2_", "gsm_neighbor_c31_", "gsm_neighbor_c32_", ]) neigh_n_param = 32 def name_map(x, y): if x == "gsm_cellfile_matched_neighbor_cellname": if y == 0: return "gsm_cellfile_matched_neighbor_cellname" else: return '"" as unsed_{}'.format(y + 1) return x + "{}".format(y + 1) neigh = sum( map( lambda y: list(map(lambda x: name_map(x, y), neigh_col_prefix_sr)), range(neigh_n_param), ), [], ) parameter_to_columns_list = [ ( list(map(lambda x: "neigh{}".format(x + 1), range(neigh_n_param))), neigh, ), ] df = params_disp_df.get( dbcon, parameter_to_columns_list, time_before, default_table="gsm_cell_meas", not_null_first_col=False, custom_lookback_dur_millis=gc.DEFAULT_LOOKBACK_DUR_MILLIS, ) df.columns = [ "CellGroup", "Cell Name", "LAC", "BSIC", "ARFCN ", "RxLev", "C1", "C2", "C31", "C32", ] df_list.append(df) final_df = pd.concat(df_list, sort=False) return final_df
def test(): azmfp = "../example_logs/nr_exynos_drive1/354569110588585-18_08_2020-13_54_22.azm" dbfp = integration_test_helpers.unzip_azm_to_tmp_get_dbfp(azmfp) n_param_args = 8 # below example RUNS ONE QUERY FOR EACH PARAM - WHICH MUST BE AVOIDED - HERE WE USE FOR TESTING ONLY - see better example in nr_query.get_nr_radio_params_disp_df() called from test_nr_radio_params.py parameter_to_columns_list = [ ("Band", list(map(lambda x: "nr_band_{}".format(x + 1), range(n_param_args)))), ( "ARFCN", list( map(lambda x: "nr_dl_arfcn_{}".format(x + 1), range(n_param_args))), ), ( "PCI", list( map(lambda x: "nr_servingbeam_pci_{}".format(x + 1), range(n_param_args))), ), ( "RSRP", list( map( lambda x: "nr_servingbeam_ss_rsrp_{}".format(x + 1), range(n_param_args), )), ), ( "RSRQ", list( map( lambda x: "nr_servingbeam_ss_rsrq_{}".format(x + 1), range(n_param_args), )), ), ( "SINR", list( map( lambda x: "nr_servingbeam_ss_sinr_{}".format(x + 1), range(n_param_args), )), ), ( "PUSCH Power", list( map(lambda x: "nr_pusch_tx_power_{}".format(x + 1), range(n_param_args))), ), ( "PUCCH Power", list( map(lambda x: "nr_pucch_tx_power_{}".format(x + 1), range(n_param_args))), ), ( "SRS Power", list( map(lambda x: "nr_srs_tx_power_{}".format(x + 1), range(n_param_args))), ), ] with sqlite3.connect(dbfp) as dbcon: #################### test query separately # valid time time_before = "2020-08-18 13:47:42.382" ret = params_disp_df.get( dbcon, parameter_to_columns_list, time_before, default_table="nr_cell_meas", not_null_first_col=True, custom_lookback_dur_millis=4000, ) print("valid time df ret.head():\n", ret.head()) print("ret.iloc[0,1]:", ret.iloc[0, 1]) assert ret.iloc[0, 1] == 41 # invalid time must ret empty df ret = params_disp_df.get( dbcon, parameter_to_columns_list, "2018-08-05 18:51:38.000", default_table="nr_cell_meas", not_null_first_col=True, custom_lookback_dur_millis=4000, ) print("invalid time df must be empty ret.head():\n", ret.head()) assert ret.iloc[0, 1] == None # invalid table must ret empty df ret = params_disp_df.get( dbcon, parameter_to_columns_list, "2018-08-05 18:51:38.000", default_table="some_non_existant_table", not_null_first_col=True, custom_lookback_dur_millis=4000, ) print("invalid time df must be empty ret.head():\n", ret.head()) assert ret.iloc[0, 1] == None ########################### test query together n_param_args = 8 parameter_to_columns_list = [ ("Time", ["time"]), ( # these params below come together so query them all in one query ["Band", "ARFCN", "PCI", "RSRP", "RSRQ", "SINR"], list( map(lambda x: "nr_band_{}".format(x + 1), range(n_param_args))) + list( map(lambda x: "nr_dl_arfcn_{}".format(x + 1), range(n_param_args))) + list( map( lambda x: "nr_servingbeam_pci_{}".format(x + 1), range(n_param_args), )) + list( map( lambda x: "nr_servingbeam_ss_rsrp_{}".format(x + 1), range(n_param_args), )) + list( map( lambda x: "nr_servingbeam_ss_rsrq_{}".format(x + 1), range(n_param_args), )) + list( map( lambda x: "nr_servingbeam_ss_sinr_{}".format(x + 1), range(n_param_args), )), ), ( # these params below come together but not same row with rsrp etc above so query them all in their own set below ["PUSCH TxPower", "PUCCH TxPower", "SRS TxPower"], list( map( lambda x: "nr_pusch_tx_power_{}".format(x + 1), range(n_param_args), )) + list( map( lambda x: "nr_pucch_tx_power_{}".format(x + 1), range(n_param_args), )) + list( map( lambda x: "nr_srs_tx_power_{}".format(x + 1), range(n_param_args), )), ), ] # existing table ret = params_disp_df.get( dbcon, parameter_to_columns_list, time_before, default_table="nr_cell_meas", not_null_first_col=True, custom_lookback_dur_millis=gc.DEFAULT_LOOKBACK_DUR_MILLIS, ) print("query together ret.head(10):\n", ret.head(10)) df = ret assert df.iloc[1, 1] == 41 assert len(df) == 10 assert len(df.columns) == 9 # non-existing table ret = params_disp_df.get( dbcon, parameter_to_columns_list, time_before, default_table="non_existant_table", not_null_first_col=True, custom_lookback_dur_millis=gc.DEFAULT_LOOKBACK_DUR_MILLIS, ) df = ret print("query together ret.head(10):\n", ret.head(10)) assert pd.isnull(ret.iloc[1, 1]) assert len(df) == 10 assert len(df.columns) == 9
def get_lte_data_disp_df(dbcon, time_before): n_param_args = 4 df_list = [] parameter_to_columns_list = [ ([ "RRC State", ], [ "lte_rrc_state", ], "lte_rrc_state"), ] df_rrc = params_disp_df.get( dbcon, parameter_to_columns_list, time_before, default_table="lte_rrc_state", not_null_first_col=False, custom_lookback_dur_millis=gc.DEFAULT_LOOKBACK_DUR_MILLIS, ) df_list.append(df_rrc) parameter_to_columns_list = [ ( [ "L1 Combined (Mbps)", "L1 Combined (Kbps)", ], [ "lte_l1_dl_throughput_all_carriers_mbps", "lte_l1_dl_throughput_all_carriers", ], "lte_l1_dl_tp", ), ( [ "L1 Combined (Mbps)", "L1 Combined (Kbps)", ], [ "lte_l1_ul_throughput_all_carriers_mbps_1", "lte_l1_ul_throughput_all_carriers_1", ], "lte_l1_ul_tp", ), ] df_tp = params_disp_df.get( dbcon, parameter_to_columns_list, time_before, not_null_first_col=False, custom_lookback_dur_millis=gc.DEFAULT_LOOKBACK_DUR_MILLIS, ) df_t = pd.DataFrame(columns=["param", 1, 2]) df_t.loc[0] = ["Throughput", "DL", "UL"] df_t.loc[1] = ["L1 Combined (Mbps)", df_tp.iloc[0, 1], df_tp.iloc[2, 1]] df_t.loc[2] = ["L1 Combined (kbps)", df_tp.iloc[1, 1], df_tp.iloc[3, 1]] df_list.append(df_t) parameter_to_columns_list = [ ( [ "PDCP (Mbps)", "PDCP (kbps)", ], [ "lte_pdcp_dl_throughput_mbps", "lte_pdcp_ul_throughput_mbps", "lte_pdcp_dl_throughput", "lte_pdcp_ul_throughput", ], "lte_pdcp_stats", ), ( [ "RLC (Mbps)", "RLC (kbps)", ], [ "lte_rlc_dl_tp_mbps", "lte_rlc_ul_tp_mbps", "lte_rlc_dl_tp", "lte_rlc_ul_tp", ], "lte_rlc_stats", ), ([ "MAC (Kbps)", ], [ "lte_mac_dl_tp", "lte_mac_ul_tp", ], "lte_mac_ul_tx_stat"), ] df_pdcp = params_disp_df.get( dbcon, parameter_to_columns_list, time_before, not_null_first_col=False, custom_lookback_dur_millis=gc.DEFAULT_LOOKBACK_DUR_MILLIS, ) df_list.append(df_pdcp) parameter_to_columns_list = [ ( [ "TransMode RRC tm", ], [ "lte_transmission_mode_l3", ], "lte_rrc_transmode_info", ), ] df_tran = params_disp_df.get( dbcon, parameter_to_columns_list, time_before, not_null_first_col=False, custom_lookback_dur_millis=gc.DEFAULT_LOOKBACK_DUR_MILLIS, ) df_list.append(df_tran) df_cell = pd.DataFrame(columns=["param", 1, 2, 3, 4]) df_cell.loc[1] = ["", "PCC", "SCC0", "SCC1", "SCC2"] df_list.append(df_cell) parameter_to_columns_list = [ ( [ "L1 DL TP (Mbps)", ], list( map( lambda x: "lte_l1_throughput_mbps_{}".format(x + 1), range(n_param_args), )), "lte_l1_dl_tp", ), ( [ "L1 UL TP (Mbps)", ], list( map( lambda x: "lte_l1_ul_throughput_mbps_{}".format(x + 1), range(n_param_args), )), "lte_l1_ul_tp", ), ( [ "TransMode Cur", ], list( map( lambda x: "lte_pdsch_transmission_mode_current_{}".format( x + 1), range(n_param_args), )), "lte_pdsch_meas", ), ( [ "EARFCN", ], list( map(lambda x: "lte_earfcn_{}".format(x + 1), range(n_param_args))), "lte_cell_meas", ), ( [ "PCI", ], list( map( lambda x: "lte_pdsch_serving_cell_id_{}".format(x + 1), range(n_param_args), )), "lte_pdsch_meas", ), ( [ "PUSCH Stats:", "PRB Alloc UL", "MCS Index UL", "Modulation UL", "L1 UL Bler", ], list( map(lambda x: '"" as unused_{}'.format(x + 1), range(n_param_args))) + list( map(lambda x: "lte_l1_ul_n_rbs_{}".format(x + 1), range(n_param_args))) + list( map(lambda x: "lte_ul_mcs_index_{}".format(x + 1), range(n_param_args))) + list( map( lambda x: "lte_pusch_modulation_{}".format(x + 1), range(n_param_args), )) + list( map(lambda x: "lte_l1_ul_bler_{}".format(x + 1), range(n_param_args))), "lte_l1_ul_tp", ), ( [ "DCI", ], list( map(lambda x: "lte_pdcch_dci_{}".format(x + 1), range(n_param_args))), "lte_pdcch_dec_result", ), ( [ "PDSCH Stats:", "BLER", ], list( map(lambda x: '"" as unused_{}'.format(x + 1), range(n_param_args))) + list( map(lambda x: "lte_bler_{}".format(x + 1), range(n_param_args))), "lte_l1_dl_tp", ), ( ["Serv N Tx Ant", "Serv N Tx Ant", "Spatial Rank"], list( map( lambda x: "lte_pdsch_serving_n_tx_antennas_{}".format(x + 1 ), range(n_param_args), )) + list( map( lambda x: "lte_pdsch_serving_n_rx_antennas_{}".format( x + 1), range(n_param_args), )) + list( map( lambda x: "lte_pdsch_spatial_rank_{}".format(x + 1), range(n_param_args), )), "lte_pdsch_meas", ), ( ["Rank Ind", "CQI CW0", "CQI CW1"], list( map( lambda x: "lte_rank_indication_{}".format(x + 1), range(n_param_args), )) + list( map(lambda x: "lte_cqi_cw0_{}".format(x + 1), range(n_param_args))) + list( map(lambda x: "lte_cqi_cw1_{}".format(x + 1), range(n_param_args))), "lte_cqi", ), ( ["PRB Alloc"], list( map( lambda x: "lte_pdsch_n_rb_allocated_latest_{}".format(x + 1 ), range(n_param_args), )), "lte_pdsch_meas", ), ( ["PRB Ma"], list( map(lambda x: "lte_mib_max_n_rb_{}".format(x + 1), range(n_param_args))), "lte_mib_info", ), ( ["PRB Util (alloc/bw) %"], list( map( lambda x: "lte_prb_alloc_in_bandwidth_percent_latest_{}". format(x + 1), range(n_param_args), )), "lte_pdsch_meas", ), ( ["DL Bandwidth (MHz)"], list( map( lambda x: "lte_mib_dl_bandwidth_mhz_{}".format(x + 1), range(n_param_args), )), "lte_mib_info", ), (["PCC UL Bw (Mhz)"], ["lte_sib2_ul_bandwidth_mhz"], "lte_sib2_info"), ( ["Time Scheduled %", "MCS Index"], list( map( lambda x: "lte_pdsch_sched_percent_{}".format(x + 1), range(n_param_args), )) + list( map(lambda x: "lte_mcs_index_{}".format(x + 1), range(n_param_args))), "lte_l1_dl_tp", ), ( [ "BlockSizeBits[0]", "Modulation[0]", "BlockSizeBits[1]", "Modulation[1]", "TrafficToPilot Ratio", "RNTI Type", "RNTI ID", "PMI Type", "PMI Index", ], list( map( lambda x: "lte_pdsch_stream0_transport_block_size_bits_{}". format(x + 1), range(n_param_args), )) + list( map( lambda x: "lte_pdsch_stream0_modulation_{}".format(x + 1), range(n_param_args), )) + list( map( lambda x: "lte_pdsch_stream1_transport_block_size_bits_{}". format(x + 1), range(n_param_args), )) + list( map( lambda x: "lte_pdsch_stream1_modulation_{}".format(x + 1), range(n_param_args), )) + list( map( lambda x: "lte_pdsch_traffic_to_pilot_ratio_{}".format( x + 1), range(n_param_args), )) + list( map( lambda x: "lte_pdsch_rnti_type_{}".format(x + 1), range(n_param_args), )) + list( map(lambda x: "lte_pdsch_rnti_id_{}".format(x + 1), range(n_param_args))) + list( map(lambda x: "lte_pdsch_pmi_type_{}".format(x + 1), range(n_param_args))) + list( map( lambda x: "lte_pdsch_pmi_index_{}".format(x + 1), range(n_param_args), )), "lte_pdsch_meas", ), ] df_tran = params_disp_df.get( dbcon, parameter_to_columns_list, time_before, not_null_first_col=False, custom_lookback_dur_millis=gc.DEFAULT_LOOKBACK_DUR_MILLIS, ) df_list.append(df_tran) final_df = pd.concat(df_list, sort=False) return final_df