Skip to content
Snippets Groups Projects
Commit 9cba6dfa authored by VulcanixFR's avatar VulcanixFR
Browse files

Tweak database

parent f324afdf
No related merge requests found
......@@ -347,7 +347,7 @@ class Database:
# Format columns
print(prefix, "Formatting file", f.file_name, end=" ... ")
Extractor.auto_fit_trace_positions()
# Extractor.auto_fit_trace_positions()
Extractor.apply_correction()
# Get the output
......
......@@ -25,7 +25,8 @@ COMPUTED_COLUMS = [
"Class",
"Date",
"Axis",
"RMS", "KMeans", "PeakFactor", "MeanTemperature"
"RMS", "KMeans", "PeakFactor", "MeanTemperature",
"Health"
]
# for m in range(1,7):
# for v in [ "RMS", "KMeans", "PeakFactor", "MeanTemperature" ]:
......@@ -44,26 +45,7 @@ def compute_run (DB: Database, robot: int, run: int, t0: int, date: str, next: C
data = DB.robot(robot).by_run(run).run()
# Compute sub-arrays
subs: List[pd.DataFrame] = [
data[data["MovingMotor"] == m] for m in range(1,7)
]
runTime = t0 + mktime(datetime.strptime(date, "%Y-%m-%d").timetuple())
# Compute for whole experiment
# line = [ t0, 0 ]
for m in range(1,7):
sub = subs[m - 1]
c = sub[f"Current_A{m}"].to_numpy()
temp = sub[f"Temperature_A{m}"].to_numpy()
line = [
# *line,
runTime, runTime, 0, data["Class"][0], date,
f"A{m}", RMS(c), kmeans(c), peak_factor(c), np.mean(temp)
]
out.append(line)
# out.append(line)
# Compute for each speed
speeds = data['Speed'].unique()
......@@ -72,21 +54,23 @@ def compute_run (DB: Database, robot: int, run: int, t0: int, date: str, next: C
]
for i, s in enumerate(speeds):
d = speed_data[i]
# time = d["Sample_time"].to_numpy()[0] + t0
# line = [ time, s ]
for m in range(1,7):
sub = d[d["MovingMotor"] == m]
time = d["Sample_time"].to_numpy()[0] + runTime
c = sub[f"Current_A{m}"].to_numpy()
temp = sub[f"Temperature_A{m}"].to_numpy()
rms, km, pf = RMS(c), kmeans(c), peak_factor(c)
# THE HEALTH INDEX IS COMPUTED HERE
health = rms - km - pf
line = [
# *line,
time, runTime, s, data["Class"][0], date,
f"A{m}", RMS(c), kmeans(c), peak_factor(c), np.mean(temp)
f"A{m}", rms, km, pf, np.mean(temp),
health
]
out.append(line)
# out.append(line)
return out
......
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