Skip to content

Commit

Permalink
Add antenna RSSI data from the field
Browse files Browse the repository at this point in the history
  • Loading branch information
tryuan99 committed Jul 17, 2024
1 parent cb14a75 commit 42af62e
Show file tree
Hide file tree
Showing 5 changed files with 357 additions and 1 deletion.
2 changes: 1 addition & 1 deletion analysis/scum/adc/mux/adc_mux_all_types_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def plot_muxed_adc_data(data: str, adc_config: AdcConfig) -> None:

# Plot the muxed ADC readouts and time constants.
plt.style.use(["science", "grid"])
fig, ax1 = plt.subplots(figsize=(12, 6))
fig, ax1 = plt.subplots(figsize=(12, 8))
ax2 = ax1.twinx()
df[adc_output_columns].plot(ax=ax1, color="C0", style=["-.", ":"])
df[time_constant_columns].plot(ax=ax2, color="C3", style=["--", "-"])
Expand Down
15 changes: 15 additions & 0 deletions analysis/scum/antenna/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
load("@pip_deps//:requirements.bzl", "requirement")

package(default_visibility = ["//visibility:public"])

py_binary(
name = "antenna_rssi_main",
srcs = ["antenna_rssi_main.py"],
data = ["//analysis/scum/antenna/data:antenna_rssi_data"],
deps = [
requirement("absl-py"),
requirement("matplotlib"),
requirement("pandas"),
requirement("SciencePlots"),
],
)
43 changes: 43 additions & 0 deletions analysis/scum/antenna/antenna_rssi_main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import matplotlib.pyplot as plt
import pandas as pd
import scienceplots
from absl import app, flags, logging

FLAGS = flags.FLAGS


def plot_antenna_rssi(data: str) -> None:
"""Plots the antenna RSSI.
Each column in the data corresponds to an antenna.
Args:
data: Data filename.
"""
# Open the antenna RSSI data file.
df = pd.read_csv(data, comment="#")
logging.info(df.describe())
distance_column = df.columns[0]

# Group by antenna.
df_by_antenna = df.groupby(distance_column)

# Plot the mean and standard deviation of the RSSI.
plt.style.use(["science", "grid"])
fig, ax = plt.subplots(figsize=(12, 8))
df_by_antenna.mean().plot(ax=ax, yerr=df_by_antenna.std(), marker="^")
ax.set_ylabel("RSSI [dBm]")
plt.show()


def main(argv):
assert len(argv) == 1
plot_antenna_rssi(FLAGS.data)


if __name__ == "__main__":
flags.DEFINE_string(
"data", "analysis/scum/antenna/data/antenna_rssi_data_field.csv",
"Data filename.")

app.run(main)
6 changes: 6 additions & 0 deletions analysis/scum/antenna/data/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package(default_visibility = ["//visibility:public"])

filegroup(
name = "antenna_rssi_data",
srcs = glob(["antenna_rssi_data_*.csv"]),
)
292 changes: 292 additions & 0 deletions analysis/scum/antenna/data/antenna_rssi_data_field.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,292 @@
# 20240716
# M2
# SCuM TX, OpenMote RX
# Measured at the Delta field site on Bouldin Island

Distance [m],Rubber ducky [dBm],Solid ground PCB [dBm],Solid ground PCB rotated by 90° [dBm],Solid ground PCB over corn [dBm]
1,-48,-58,
1,-48,-58,
1,-47,-58,
1,-48,-58,
1,-48,-58,
1,-48,-58,
1,-48,-58,
1,-48,-58,
1,-48,-58,
1,-47,-58,
1,-47,-58,
1,-47,-58,
1,-48,-58,
1,-48,-60,
1,-48,-61,
1,-47,-60,
1,-48,-61,
1,-48,-61,
1,-48,-61,
1,-48,-61,
1,-48,-60,
1,-48,-60,
1,-48,-60,
1,-48,-60,
1,-48,-60,
1,-49,-60,
1,-48,-60,
1,-48,-59,
1,-48,-60,
1,-48,-59,
1,-48,-60,
1,-48,-62,
1,-48,-58,
1,-49,,
1,-49,,
1,-49,,
1,-49,,
1,-49,,
5,-63,-77,
5,-63,-75,
5,-65,-76,
5,-65,-74,
5,-66,-75,
5,-63,-73,
5,-63,-75,
5,-63,-74,
5,-63,-74,
5,-65,-75,
5,-64,-76,
5,-62,-73,
5,-66,-76,
5,-62,-75,
5,-63,-75,
5,-64,-75,
5,-64,-74,
5,-65,-74,
5,-64,-74,
5,-64,-75,
5,-65,-76,
5,-65,-76,
5,-66,-75,
5,-65,-76,
5,-64,-76,
5,-63,-75,
5,-64,-76,
5,-63,-76,
5,-65,-75,
5,-65,-74,
5,-64,-75,
5,-66,-74,
5,-66,-75,
5,-65,-75,
5,-64,-76,
5,-64,,
5,-64,,
10,-67,-80,
10,-66,-80,
10,-67,-80,
10,-67,-80,
10,-67,-80,
10,-67,-80,
10,-67,-80,
10,-67,-79,
10,-67,-79,
10,-67,-79,
10,-67,-80,
10,-68,-79,
10,-67,-80,
10,-68,-79,
10,-67,-80,
10,-67,-80,
10,-67,-80,
10,-66,-80,
10,-67,-80,
10,-67,-81,
10,-67,-80,
10,-67,-80,
10,-67,-79,
10,-67,-80,
10,-66,-80,
10,-67,-81,
10,-67,-81,
10,-67,-81,
10,-67,-81,
10,-67,-81,
10,-66,-81,
10,-66,-80,
10,-66,-81,
10,-67,-79,
10,-67,-79,
10,-66,,
10,-66,,
15,-71,-84,
15,-72,-85,
15,-72,-84,
15,-73,-84,
15,-72,-85,
15,-72,-85,
15,-72,-84,
15,-71,-85,
15,-70,-85,
15,-70,-86,
15,-69,-84,
15,-71,-85,
15,-71,-86,
15,-70,-87,
15,-69,-85,
15,-69,-83,
15,-71,-84,
15,-70,-85,
15,-70,-87,
15,-69,-86,
15,-69,-85,
15,-69,-87,
15,-69,-86,
15,-70,-84,
15,-70,-84,
15,-68,-87,
15,-69,-86,
15,-68,-86,
15,-68,-87,
15,-67,-89,
15,-68,-86,
15,-69,-85,
15,-69,-84,
15,-70,-86,
15,-72,,
20,-75,-93,,-92
20,-75,-89,,-89
20,-74,-94,,-91
20,-75,-92,,-90
20,-75,-91,,-92
20,-75,-91,,-95
20,-74,-93,,-89
20,-76,-92,,-90
20,-76,-99,,-91
20,-75,-94,,-91
20,-76,-93,,-94
20,-75,-93,,-92
20,-74,-89,,-91
20,-75,-91,,-95
20,-76,-95,,-91
20,-75,-91,,-94
20,-75,-92,,-90
20,-75,-91,,-90
20,-77,-90,,-90
20,-77,-91,,-90
20,-80,-91,,-90
20,-80,-90,,-90
20,-80,-91,,-89
20,-80,-92,,-92
20,-80,-92,,-93
20,-78,-90,,-91
20,-78,-93,
20,-78,-92,
20,-78,-94,
20,-78,-95,
20,-77,-95,
20,-77,-94,
20,-78,-93,
20,-80,-93,
20,,-93,
25,-76,-86,-92
25,-78,-90,-92
25,-77,-89,-92
25,-78,-89,-91
25,-75,-86,-93
25,-77,-89,-90
25,-76,-90,-90
25,-77,-89,-90
25,-79,-90,-90
25,-79,-88,-88
25,-78,-89,-91
25,-78,-90,-89
25,-78,-90,-93
25,-75,-92,-91
25,-76,-92,-91
25,-75,-89,-90
25,-76,-94,-93
25,-75,-92,-91
25,-77,-93,-91
25,-75,-91,-90
25,-75,-90,-92
25,-75,-88,-91
25,-76,-87,-93
25,-76,-88,-90
25,-76,-88,-92
25,-76,-87,-92
25,-78,-89,-90
25,-76,-89,-91
25,-76,-89,-90
25,-76,-90,-92
25,-77,-89,-91
25,-76,-88,-91
25,-76,-88,-90
25,-77,-88,-91
25,-78,-88,-90
50,-86,-96,-97
50,-90,-97,-94
50,-89,-98,-91
50,-88,-98,-93
50,-88,-96,-93
50,-89,-95,-97
50,-85,-94,-95
50,-85,-96,-95
50,-83,-96,-95
50,-85,-95,-95
50,-85,-95,-99
50,-83,-96,-97
50,-85,-96,-98
50,-84,-97,-99
50,-87,-96,-97
50,-86,-97,-97
50,-90,-96,-98
50,-91,-98,-97
50,-89,-98,-99
50,-90,-96,-98
50,-84,-98,-99
50,-84,-97,-99
50,-87,-98,-99
50,-86,-97,-99
50,-87,-97,-99
50,-84,-96,-99
50,-85,-96,-99
50,-82,-96,-99
50,-82,-96,-99
50,-82,-95,-99
50,-88,-96,-98
50,-86,-96,-99
50,-85,-96,-98
50,-86,-95,-99
50,-86,-97,
75,-90,-100,
75,-87,-98,
75,-85,-98,
75,-85,-97,
75,-85,-98,
75,-85,-98,
75,-85,-98,
75,-86,-99,
75,-84,-99,
75,-84,-99,
75,-84,-98,
75,-89,-99,
75,-86,-98,
75,-83,-99,
75,-84,-98,
75,-84,-98,
75,-82,-99,
75,-84,-98,
75,-82,-98,
75,-82,-98,
75,-81,-98,
75,-81,-98,
75,-81,-97,
75,-81,-98,
75,-81,-98,
75,-81,-99,
75,-81,-98,
75,-82,-97,
75,-82,-99,
75,-81,-99,
75,-81,-98,
75,-80,-99,
75,-83,-98,
75,-82,-98,

0 comments on commit 42af62e

Please sign in to comment.