diff --git a/labs/51/processor.py b/labs/51/processor.py index dc5ceea..815e9a4 100644 --- a/labs/51/processor.py +++ b/labs/51/processor.py @@ -1,3 +1,4 @@ +import math import sys import os @@ -19,6 +20,7 @@ if not os.path.exists(sys.argv[1]): # defining functions def avg(a): + #print(a) return sum(a) / len(a) def get_max_len(a): @@ -66,11 +68,11 @@ for i in tables: new_line = [] new_line.append(round(j[0]*tables[i]['r1']*9.81, r)) new_line.append(round(avg(j[1:4]), r)) - new_line.append(round(2/(tables[i]['r1']*new_line[1]), r)) + new_line.append(round(2/(tables[i]['r1']*(new_line[1]**2)), r)) new_line.append(round(j[0]*tables[i]['r2']*9.81, r)) - new_line.append(round(avg(j[4:8]), r)) - new_line.append(round(2/(tables[i]['r2']*new_line[4]), r)) + new_line.append(round(avg(j[4:7]), r)) + new_line.append(round(2/(tables[i]['r2']*(new_line[4]**2)), r)) required_data[i]["stats"].append(new_line) @@ -136,3 +138,16 @@ for i in tables: tables[i]['stats'][j][6], required_data[i]['stats'][j][4], required_data[i]['stats'][j][5]])) )) + +sigma_beta1 = round(math.sqrt(avg(list(map(lambda x: x**2, list(zip(*required_data["1"]['stats']))[2]))) + avg(list(zip(*required_data["1"]['stats']))[2])**2), r) +sigma_beta2 = round(math.sqrt(avg(list(map(lambda x: x**2, list(zip(*required_data["1"]['stats']))[5]))) + avg(list(zip(*required_data["1"]['stats']))[5])**2), r) +sigma_beta3 = round(math.sqrt(avg(list(map(lambda x: x**2, list(zip(*required_data["2"]['stats']))[2]))) + avg(list(zip(*required_data["2"]['stats']))[2])**2), r) +sigma_beta4 = round(math.sqrt(avg(list(map(lambda x: x**2, list(zip(*required_data["2"]['stats']))[5]))) + avg(list(zip(*required_data["2"]['stats']))[5])**2), r) + +sigma_t1 = round(math.sqrt(avg(list(map(lambda x: x**2, list(zip(*required_data["1"]['stats']))[1]))) + avg(list(zip(*required_data["1"]['stats']))[1])**2), r) +sigma_t2 = round(math.sqrt(avg(list(map(lambda x: x**2, list(zip(*required_data["1"]['stats']))[3]))) + avg(list(zip(*required_data["1"]['stats']))[3])**2), r) +sigma_t3 = round(math.sqrt(avg(list(map(lambda x: x**2, list(zip(*required_data["2"]['stats']))[1]))) + avg(list(zip(*required_data["2"]['stats']))[1])**2), r) +sigma_t4 = round(math.sqrt(avg(list(map(lambda x: x**2, list(zip(*required_data["2"]['stats']))[3]))) + avg(list(zip(*required_data["2"]['stats']))[3])**2), r) + +print("σβ (1-4) (DO NOT USE):", sigma_beta1/avg(list(zip(*required_data["1"]['stats']))[2]), sigma_beta2/avg(list(zip(*required_data["1"]['stats']))[5]), sigma_beta3/avg(list(zip(*required_data["2"]['stats']))[2]), sigma_beta4/avg(list(zip(*required_data["2"]['stats']))[5])) +print("σt (1-4) (DO NOT USE):", sigma_t1/avg(list(zip(*required_data["1"]['stats']))[1]), sigma_t2/avg(list(zip(*required_data["1"]['stats']))[3]), sigma_t3/avg(list(zip(*required_data["2"]['stats']))[1]), sigma_t4/avg(list(zip(*required_data["2"]['stats']))[3])) diff --git a/labs/51/samples/v2.txt b/labs/51/samples/v2.txt index 5a007c5..f5f959a 100644 --- a/labs/51/samples/v2.txt +++ b/labs/51/samples/v2.txt @@ -2,8 +2,8 @@ # table 1 # set_unit mass kilogram -# r2 0.02 -# r1 0.035 +# r1 0.02 +# r2 0.035 0.0852 15.91 16.57 16.62 8.11 8.09 8.00 0.11602 11.63 11.47 11.49 6.68 6.6 6.95 @@ -15,8 +15,8 @@ # table 2 # set_unit mass gram -# r2 0.02 -# r1 0.035 +# r1 0.02 +# r2 0.035 85.2 6.51 6.3 6.61 3.6 3.8 3.93 116.02 5.27 5.25 5.47 2.86 3.02 2.99