Commit 622807c9 authored by Fabian Kovac's avatar Fabian Kovac
Browse files

[i] back to grouped 15min time-windows (better results)

parent 60a79edf
......@@ -2,8 +2,8 @@
# Title: Data Preparation for LINK Configs and Transmissions
# Author: Fabian Kovac <ds191008@fhstp.ac.at>
# Team: University of Applied Sciences St. Pölten
# Version: 3.0
# Last changed: 2021-10-22
# Version: 3.1
# Last changed: 2021-11-03
#
import sys
......@@ -273,7 +273,7 @@ def get_inca_data(datetimes: np.array, lon_a: np.array, lat_a: np.array, lon_b:
lat_a (np.array): Vector containing latitude values of LINK site a
lon_b (np.array): Vector containing longitude values of LINK site b
lat_b (np.array): Vector containing latiotude values of LINK site b
length (np.array): Vector containing distance between sites in m
length (np.array): Vector containing distance between sites in km
Returns:
inca_RR (np.array): Vector containing INCA RR data for each transmission
......@@ -494,30 +494,26 @@ def prep() -> None:
# copy REMOTERXLEVEL to PMIN and PMAX (for aggregation in 15min time window)
df_link_window = df_link[['BEGINTIME', 'RADIOLINKID', 'REMOTERXLEVEL']].copy()
df_link_window['PMIN'] = df_link_window['REMOTERXLEVEL']
df_link_window['PMAX'] = df_link_window['REMOTERXLEVEL']
df_link_window['PMEAN'] = df_link_window['REMOTERXLEVEL']
df_link_window = df_link_window.drop('REMOTERXLEVEL', axis = 1)
_log('Created PMIN, PMAX and PMEAN of REMOTERXLEVEL')
df_link['PMIN'] = df_link['REMOTERXLEVEL']
df_link['PMAX'] = df_link['REMOTERXLEVEL']
_log('Created PMIN, PMAX and mean REMOTERXLEVEL')
# convert 3min windows to 15min windows to get min, max and mean power levels
group_cols = [df_link_window['BEGINTIME'].dt.round('15Min'), 'RADIOLINKID']
group_cols = [df_link['BEGINTIME'].dt.round('15Min'), 'RADIOLINKID']
agg_cols = {
'PMIN' : 'min',
'PMAX' : 'max',
'PMEAN' : 'mean'
'REMOTERXLEVEL' : 'mean',
'TXLEVEL' : 'mean',
'SPEED' : 'median',
'CURRRXBITRATE' : 'median',
'CURRTXBITRATE' : 'median',
'CURRRXPROFILE' : 'median',
'CURRTXPROFILE' : 'median'
}
df_link_window = df_link_window.groupby(group_cols).agg(agg_cols).reset_index()
df_link = df_link.groupby(group_cols).agg(agg_cols).reset_index()
_log('Converted 3min windows to 15min windows to get min, max and mean power levels')
# merge min, max and mean power levels for 15min windows back to link dataframe
# only get minutes 00, 15, 30 and 45 (PMIN, PMAX and PMEAN are not NaN --> faster than filtering datetime)
df_link = pd.merge(df_link, df_link_window, how = 'left', left_on = ['BEGINTIME', 'RADIOLINKID'], right_on = ['BEGINTIME', 'RADIOLINKID'])
del df_link_window
_log('Merged min, max and mean power levels for 15min windows back to link dataframe')
df_link = df_link.dropna(subset = ['PMIN', 'PMAX', 'PMEAN'])
_log('Use only transmissions in minutes 00, 15, 30 and 45')
# convert BEGINTIME to format "%Y%m%d%H%M"
df_link['BEGINTIME'] = df_link['BEGINTIME'].dt.strftime('%Y%m%d%H%M')
......@@ -568,7 +564,6 @@ def prep() -> None:
'REMOTERXLEVEL' : 'RxLevel',
'PMIN' : 'RxLevelMin',
'PMAX' : 'RxLevelMax',
'PMEAN' : 'RxLevelMean',
'TXLEVEL' : 'TxLevel',
'ATTENUATION' : 'Attn',
'ATTENUATIONMEAN' : 'AttnMean',
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment