Commit 5662a69a authored by Fabian Kovac's avatar Fabian Kovac
Browse files

Mean and std attenuation based on dry periods

parent 7231efa1
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -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 <fabian.kovac@fhstp.ac.at> # Author: Fabian Kovac <fabian.kovac@fhstp.ac.at>
# Team: University of Applied Sciences St. Pölten # Team: University of Applied Sciences St. Pölten
# Version: 3.3 # Version: 4.0
# Last changed: 2021-12-15 # Last changed: 2022-01-14
# #
import sys import sys
...@@ -579,18 +579,14 @@ def prep() -> None: ...@@ -579,18 +579,14 @@ def prep() -> None:
_log('\n******************************** CALC POWER LEVELS *************************') _log('\n******************************** CALC POWER LEVELS *************************')
# build df with differences of sending and receiving levels # load dry LINK attenuation statistics
df_diff = df_link[['LINKID', 'TXLEVEL', 'REMOTERXLEVEL']].copy() df_stats = pd.read_csv('00_Link_dry_attnstats.csv', sep = ';')
df_diff['ATTENUATIONMEAN'] = df_diff['REMOTERXLEVEL'] - df_diff['TXLEVEL']
_log('Built dataframe with mean link attenuations')
# get mean of differences per link # merge mean and std attenuation to transmission dataframe
df_diff = df_diff.groupby(['LINKID']).agg({'ATTENUATIONMEAN' : 'mean'}).reset_index() df_link = pd.merge(df_link, df_stats, how = 'left', left_on = 'LINKID', right_on = 'LINKID')
df_link = df_link.dropna(axis = 0, subset = ['ATTENUATIONMEANDRY', 'ATTENUATIONSTDDRY'])
# merge differences to transmission dataframe del df_stats
df_link = pd.merge(df_link, df_diff, how = 'left', left_on = 'LINKID', right_on = 'LINKID') _log('Merged mean and std of link attenuations to link dataframe')
del df_diff
_log('Merged mean link attenuations back to link dataframe')
...@@ -599,8 +595,15 @@ def prep() -> None: ...@@ -599,8 +595,15 @@ def prep() -> None:
_log('Calculated attenuation per transmission') _log('Calculated attenuation per transmission')
# calculate differences from attenuations and mean attenuations # calculate differences from attenuations and mean attenuations
df_link['ATTENUATIONDIFF'] = df_link['ATTENUATION'] - df_link['ATTENUATIONMEAN'] df_link['ATTENUATIONDIFF'] = df_link['ATTENUATION'] - df_link['ATTENUATIONMEANDRY']
_log('Calculated attenuation differences of daily means')
df_std = df_link.groupby(['LINKID']).agg({'ATTENUATION' : 'std'}).reset_index()
df_std = df_std.rename(columns = {'LINKID' : 'LINKID', 'ATTENUATION' : 'ATTENUATIONSTD'})
df_link = pd.merge(df_link, df_std, how = 'left', left_on = 'LINKID', right_on = 'LINKID')
df_link['ATTENUATIONSTDDIFF'] = df_link['ATTENUATIONSTD'] - df_link['ATTENUATIONSTDDRY']
del(df_std)
_log('Calculated attenuation differences of dry means')
# calculate extinction coefficients for links based on attenuation and lengths of the links based on beer-lambert law # calculate extinction coefficients for links based on attenuation and lengths of the links based on beer-lambert law
# Coeff = -ln(10) * (Attenuation/PathLength) # Coeff = -ln(10) * (Attenuation/PathLength)
...@@ -617,8 +620,10 @@ def prep() -> None: ...@@ -617,8 +620,10 @@ def prep() -> None:
'PMAX' : 'RxLevelMax', 'PMAX' : 'RxLevelMax',
'TXLEVEL' : 'TxLevel', 'TXLEVEL' : 'TxLevel',
'ATTENUATION' : 'Attn', 'ATTENUATION' : 'Attn',
'ATTENUATIONMEAN' : 'AttnMean', 'ATTENUATIONMEANDRY' : 'AttnMeanDry',
'ATTENUATIONSTDDRY' : 'AttnStdDry',
'ATTENUATIONDIFF' : 'AttnDiff', 'ATTENUATIONDIFF' : 'AttnDiff',
'ATTENUATIONSTDDIFF' : 'AttnStdDiff',
'EXTINCTIONCOEFF' : 'ExtinctionCoeff', 'EXTINCTIONCOEFF' : 'ExtinctionCoeff',
'SPEED' : 'Speed', 'SPEED' : 'Speed',
'CURRRXBITRATE' : 'RxBitrate', 'CURRRXBITRATE' : 'RxBitrate',
......
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