Skip to content

Commit

Permalink
created analysis ipynb & renamed stats script
Browse files Browse the repository at this point in the history
  • Loading branch information
Raúl De La Fuente committed Jan 18, 2023
1 parent b010aba commit d086bb6
Show file tree
Hide file tree
Showing 4 changed files with 452 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.csv
*.json
venv
__pycache__
.ipynb_checkpoints
14 changes: 13 additions & 1 deletion calibration.py → calibration_stats.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
"""
Utility script for calibration of the devices.
"""


import sys
import numpy as np
import matplotlib.pyplot as plt
import warnings
import datetime

warnings.filterwarnings("ignore")

Expand All @@ -14,12 +20,15 @@ def get_cropped_dataset(filename, N):
with open(f"{filename}") as f:
lines = f.readlines()[1:]
for line in lines:
mac, _, temp = line.strip().split(",")
mac, timestamp, temp = line.strip().split(",")
dt_format = "%Y-%m-%d %H:%M:%S.%f"
timestamp = datetime.datetime.strptime(timestamp, dt_format)
temp = float(temp)

if mac not in dataset:
dataset[mac] = {
"samples": [],
"timestamps": [],
"mean": 0.0,
"median": 0.0,
"stddev": 0.0,
Expand All @@ -28,6 +37,7 @@ def get_cropped_dataset(filename, N):

if N < 0 or len(dataset[mac]["samples"]) < N:
dataset[mac]["samples"].append(temp)
dataset[mac]["timestamps"].append(timestamp)

# if N < 0 is provided then we take the min_samples_len as its value
if N < 0:
Expand Down Expand Up @@ -194,6 +204,8 @@ def main(inside_csv, outside_csv, gt_in, gt_out, N):
generate_output_csv(dataset_in, gt_in, f"results_in_office.csv")
generate_output_csv(dataset_out, gt_out, f"results_out_office.csv")

for name in dataset_in:
print(get_device_name(name))

if __name__ == "__main__":
inside_csv, outside_csv, gt_in, gt_out, N = sys.argv[1:]
Expand Down
420 changes: 420 additions & 0 deletions data_analysis.ipynb

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
contourpy==1.0.7
cycler==0.11.0
fonttools==4.38.0
fpdf==1.7.2
kiwisolver==1.4.4
matplotlib==3.6.3
numpy==1.24.1
packaging==23.0
pandas==1.5.2
Pillow==9.4.0
pyparsing==3.0.9
python-dateutil==2.8.2
pytz==2022.7.1
six==1.16.0

0 comments on commit d086bb6

Please sign in to comment.