Add mean bottle size, mathematical model

This commit is contained in:
2025-03-12 16:31:16 +01:00
parent be1f0aa784
commit 3181b2ac4e
4 changed files with 227 additions and 40 deletions

View File

@@ -0,0 +1,45 @@
import numpy as np
import pandas as pd
filename_participants = "res/full_participant_measurement.csv"
filename_left = "res/flowrate_left.csv"
filename_right = "res/flowrate_right.csv"
filename_both = "res/flowrate_both.csv"
def main():
# Get bottle fillup times
df_part = pd.read_csv(filename_participants)
times_left = np.array(df_part[df_part["button"] == "left"]["time"])
times_right = np.array(df_part[df_part["button"] == "right"]["time"])
times_both = np.array(df_part[df_part["button"] == "both"]["time"])
# Get mean flowrates
df_left = pd.read_csv(filename_left)
df_right = pd.read_csv(filename_right)
df_both = pd.read_csv(filename_both)
flowrate_left = np.mean(np.array(df_left["flowrate"]))
flowrate_right = np.mean(np.array(df_right["flowrate"]))
flowrate_both = np.mean(np.array(df_both["flowrate"]))
# Calculate mean bottle size
sizes_left = times_left * flowrate_left
sizes_right = times_right * flowrate_right
sizes_both = times_both * flowrate_both
sizes = np.concatenate([sizes_left, sizes_right, sizes_both])
mean_size = np.mean(sizes)
print(f"Mean bottle size: {mean_size}")
if __name__ == "__main__":
main()

View File

@@ -16,7 +16,7 @@ def main():
flowrate_right = np.array(df_right["flowrate"])
df_both = pd.read_csv(filename_both)
flowrate_both = np.array(df_right["flowrate"])
flowrate_both = np.array(df_both["flowrate"])
U_lr, p_lr = mannwhitneyu(flowrate_left, flowrate_both, method="exact")
U_rb, p_rb = mannwhitneyu(flowrate_right, flowrate_both, method="exact")