Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
oeigner
LINK - Forschungsprojekt Repo
Commits
6a343afa
Commit
6a343afa
authored
Jul 05, 2021
by
Fabian Kovac
Browse files
[f] added instantanious values Pinst for RAINLINK
parent
47fcc23a
Changes
1
Hide whitespace changes
Inline
Side-by-side
FHSTP/prep.py
View file @
6a343afa
...
...
@@ -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:
1.5
# Last changed: 2021-0
6-28
# Version:
2.1
# Last changed: 2021-0
7-05
#
import
sys
...
...
@@ -253,9 +253,9 @@ def lambert_to_inca_idx(x: np.array, y: np.array) -> tuple:
x
/=
1000
y
/=
1000
# convert coordinates to INCA index (coordinates as int)
ix
=
x
.
astype
(
int
)
iy
=
y
.
astype
(
int
)
# convert coordinates to INCA index (
nearest
coordinates as int)
ix
=
np
.
round
(
x
,
decimals
=
0
)
.
astype
(
int
)
iy
=
np
.
round
(
y
,
decimals
=
0
)
.
astype
(
int
)
return
ix
,
iy
...
...
@@ -431,10 +431,10 @@ def prep() -> None:
# convert RXFREQUENCY and TXFREQUENCY to float and from MHz to GHz
# check if columns exists (only present with 2021-05)
if
'TXFREQUENCY'
in
df_config
.
columns
and
'RXFREQUENCY'
in
df_config
.
columns
:
df_config
[
'TXFREQUENCY'
]
=
df_config
[
'TXFREQUENCY'
].
astype
(
'float'
)
df_config
[
'TXFREQUENCY'
]
=
df_config
[
'TXFREQUENCY'
]
/
1000
df_config
[
'RXFREQUENCY'
]
=
df_config
[
'RXFREQUENCY'
].
astype
(
'float'
)
df_config
[
'RXFREQUENCY'
]
=
df_config
[
'RXFREQUENCY'
]
/
1000
df_config
[
'TXFREQUENCY'
]
=
df_config
[
'TXFREQUENCY'
].
astype
(
'float'
)
df_config
[
'TXFREQUENCY'
]
=
df_config
[
'TXFREQUENCY'
]
/
1000
_log
(
'Converted RXFREQUENCY and TXFREQUENCY to float and GHz'
)
...
...
@@ -470,13 +470,13 @@ def prep() -> None:
# convert 3min windows to 15min windows
group_cols
=
[
df_link
[
'BEGINTIME'
].
dt
.
floor
(
'15Min'
),
'RADIOLINKID'
]
agg_cols
=
{
'TXLEVEL'
:
'mean'
,
'REMOTERXLEVEL'
:
'mean'
,
'PMIN'
:
'min'
,
'PMAX'
:
'max'
,
'REMOTERXLEVEL'
:
'mean'
,
'TXLEVEL'
:
'mean'
,
'SPEED'
:
'mean'
,
'CURR
T
XBITRATE'
:
'mean'
,
'CURR
R
XBITRATE'
:
'mean'
'CURR
R
XBITRATE'
:
'mean'
,
'CURR
T
XBITRATE'
:
'mean'
}
df_link
=
df_link
.
groupby
(
group_cols
).
agg
(
agg_cols
).
reset_index
()
_log
(
'Converted 3min windows to 15min windows'
)
...
...
@@ -488,17 +488,24 @@ def prep() -> None:
# build df with differences of sending and receiving levels
df_diff
=
df_link
[[
'RADIOLINKID'
,
'TXLEVEL'
,
'REMOTERXLEVEL'
]].
copy
()
df_diff
[
'
MEANLINKDIFFLEVEL
'
]
=
df_diff
[
'TXLEVEL'
]
-
df_diff
[
'REMOTERXLEVEL'
]
df_diff
[
'
PINSTMEAN
'
]
=
df_diff
[
'TXLEVEL'
]
-
df_diff
[
'REMOTERXLEVEL'
]
_log
(
'Built dataframe with mean link difference levels of TXLEVEL and REMOTERXLEVEL'
)
# get mean of differences
df_diff
=
df_diff
.
groupby
([
'RADIOLINKID'
]).
agg
({
'
MEANLINKDIFFLEVEL
'
:
'mean'
}).
reset_index
()
# get mean of differences
per link
df_diff
=
df_diff
.
groupby
([
'RADIOLINKID'
]).
agg
({
'
PINSTMEAN
'
:
'mean'
}).
reset_index
()
_log
(
'Merged mean link difference levels back to link dataframe'
)
# merge differences to transmission dataframe
df_link
=
pd
.
merge
(
df_link
,
df_diff
,
how
=
'inner'
,
left_on
=
'RADIOLINKID'
,
right_on
=
'RADIOLINKID'
)
df_link
[
'DIFFLEVEL'
]
=
df_link
[
'TXLEVEL'
]
-
df_link
[
'REMOTERXLEVEL'
]
-
df_link
[
'MEANLINKDIFFLEVEL'
]
_log
(
'Calculated DIFFLEVEL as TXLEVEL - REMOTERXLEVEL - MEANLINKDIFFLEVEL'
)
# calculate instantaneous values from transmitted and received signal strength
df_link
[
'PINST'
]
=
df_link
[
'TXLEVEL'
]
-
df_link
[
'REMOTERXLEVEL'
]
_log
(
'Calculated instantaneous values PINST from transmitted and received signal strength'
)
# calculate differences from instantaneous values and mean link diff. levels
df_link
[
'PDIFF'
]
=
df_link
[
'PINST'
]
-
df_link
[
'PINSTMEAN'
]
# merge config and link dataframe
...
...
@@ -513,12 +520,13 @@ def prep() -> None:
'PMIN'
:
'Pmin'
,
'PMAX'
:
'Pmax'
,
'REMOTERXLEVEL'
:
'Pmean'
,
'PINST'
:
'Pinst'
,
'PINSTMEAN'
:
'PinstMean'
,
'PDIFF'
:
'Pdiff'
,
'TXLEVEL'
:
'TxLevel'
,
'MEANLINKDIFFLEVEL'
:
'MeanLinkDiffLevel'
,
'DIFFLEVEL'
:
'DiffLevel'
,
'SPEED'
:
'Speed'
,
'CURRTXBITRATE'
:
'TxBitrate'
,
'CURRRXBITRATE'
:
'RxBitrate'
,
'CURRTXBITRATE'
:
'TxBitrate'
,
'LONGITUDE_A'
:
'XStart'
,
'LATITUDE_A'
:
'YStart'
,
'LONGITUDE_MID'
:
'XMid'
,
...
...
@@ -532,8 +540,8 @@ def prep() -> None:
# check if RXFREQUENCY and TXFREQUENCY exists (only present with 2021-05)
if
'TXFREQUENCY'
in
df_link
.
columns
and
'RXFREQUENCY'
in
df_link
.
columns
:
name_cols
.
update
({
'
T
XFREQUENCY'
:
'
T
xFrequency'
,
'
R
XFREQUENCY'
:
'
R
xFrequency'
'
R
XFREQUENCY'
:
'
R
xFrequency'
,
'
T
XFREQUENCY'
:
'
T
xFrequency'
})
df_link
=
df_link
.
rename
(
columns
=
name_cols
).
reindex
(
columns
=
list
(
name_cols
.
values
()))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment