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 @@ ...@@ -2,8 +2,8 @@
# Title: Data Preparation for LINK Configs and Transmissions # Title: Data Preparation for LINK Configs and Transmissions
# Author: Fabian Kovac <ds191008@fhstp.ac.at> # Author: Fabian Kovac <ds191008@fhstp.ac.at>
# Team: University of Applied Sciences St. Pölten # Team: University of Applied Sciences St. Pölten
# Version: 3.0 # Version: 3.1
# Last changed: 2021-10-22 # Last changed: 2021-11-03
# #
import sys import sys
...@@ -273,7 +273,7 @@ def get_inca_data(datetimes: np.array, lon_a: np.array, lat_a: np.array, lon_b: ...@@ -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 lat_a (np.array): Vector containing latitude values of LINK site a
lon_b (np.array): Vector containing longitude values of LINK site b lon_b (np.array): Vector containing longitude values of LINK site b
lat_b (np.array): Vector containing latiotude 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: Returns:
inca_RR (np.array): Vector containing INCA RR data for each transmission inca_RR (np.array): Vector containing INCA RR data for each transmission
...@@ -494,30 +494,26 @@ def prep() -> None: ...@@ -494,30 +494,26 @@ def prep() -> None:
# copy REMOTERXLEVEL to PMIN and PMAX (for aggregation in 15min time window) # copy REMOTERXLEVEL to PMIN and PMAX (for aggregation in 15min time window)
df_link_window = df_link[['BEGINTIME', 'RADIOLINKID', 'REMOTERXLEVEL']].copy() df_link['PMIN'] = df_link['REMOTERXLEVEL']
df_link_window['PMIN'] = df_link_window['REMOTERXLEVEL'] df_link['PMAX'] = df_link['REMOTERXLEVEL']
df_link_window['PMAX'] = df_link_window['REMOTERXLEVEL'] _log('Created PMIN, PMAX and mean 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')
# convert 3min windows to 15min windows to get min, max and mean power levels # 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 = { agg_cols = {
'PMIN' : 'min', 'PMIN' : 'min',
'PMAX' : 'max', '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') _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" # convert BEGINTIME to format "%Y%m%d%H%M"
df_link['BEGINTIME'] = df_link['BEGINTIME'].dt.strftime('%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: ...@@ -568,7 +564,6 @@ def prep() -> None:
'REMOTERXLEVEL' : 'RxLevel', 'REMOTERXLEVEL' : 'RxLevel',
'PMIN' : 'RxLevelMin', 'PMIN' : 'RxLevelMin',
'PMAX' : 'RxLevelMax', 'PMAX' : 'RxLevelMax',
'PMEAN' : 'RxLevelMean',
'TXLEVEL' : 'TxLevel', 'TXLEVEL' : 'TxLevel',
'ATTENUATION' : 'Attn', 'ATTENUATION' : 'Attn',
'ATTENUATIONMEAN' : 'AttnMean', '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