def SteelWire(m, C_plus, C_sub, D, L, H, b): C = [] for i in range(0,9,1): C.append((C_plus[i] + C_sub[i]) / 2) delta_C = [] for i in range(4): delta_C.append(C[i+5] - C[i]) ave_delta_C = sum(delta_C) / 4 delta_C.append(round(ave_delta_C,2)) ave_D = sum(D) / 5 D.append(ave_D) delta_m = 10 E = 16 * 9.8 * L * delta_m * H * pow(10,6) / (pi * pow(ave_D,2) * b * ave_delta_C) ua_delta_C = phylab.Ua(delta_C,ave_delta_C,4)#cm ub_delta_C = 0.05 / sqrt(3)#cm u_delta_C = sqrt(ua_delta_C**2 + ub_delta_C**2)#cm ua_D = phylab.Ua(D,ave_D,5)#mm ub_D = 0.005 / sqrt(3)#mm u_D = sqrt(ua_D**2 + ub_D**2)#mm u_b = 0.02 / sqrt(3)#cm u_L = 0.3 / sqrt(3)#cm u_H = 0.5 / sqrt(3)#cm u_E_E = sqrt(pow(u_L / L,2)+pow(u_H / H,2)+pow(2 * u_D / ave_D,2)+pow(u_b / b,2)+pow(u_delta_C / ave_delta_C,2)) u_E = u_E_E * E final = phylab.BitAdapt(E,u_E) return final
def SteelWire(m, C_plus, C_sub, D, L, H, b, source): # m为等差数列,一般从10到24 单位:kg # C 单位:cm # D 单位:mm # L 单位:cm # H 单位:cm # b 单位:cm C = [] for i in range(0, len(C_plus), 1): C.append((C_plus[i] + C_sub[i]) / 2) delta_C = [] for i in range(4): delta_C.append(C[i + 4] - C[i]) ave_delta_C = sum(delta_C) / 4 delta_C.append(round(ave_delta_C, 2)) ave_D = round(sum(D) / len(D), 3) D.append(ave_D) delta_m = m[4] - m[0] E = 16 * 9.8 * L * delta_m * H * pow( 10, 6) / (pi * pow(ave_D, 2) * b * ave_delta_C) ua_delta_C = phylab.Ua(delta_C, ave_delta_C, 4) #cm ub_delta_C = 0.05 / sqrt(3) #cm u_delta_C = sqrt(ua_delta_C**2 + ub_delta_C**2) #cm ua_D = phylab.Ua(D, ave_D, len(D) - 1) #mm ub_D = 0.005 / sqrt(3) #mm u_D = sqrt(ua_D**2 + ub_D**2) #mm u_b = 0.02 / sqrt(3) #cm u_L = 0.3 / sqrt(3) #cm u_H = 0.5 / sqrt(3) #cm u_E_E = sqrt( pow(u_L / L, 2) + pow(u_H / H, 2) + pow(2 * u_D / ave_D, 2) + pow(u_b / b, 2) + pow(u_delta_C / ave_delta_C, 2)) u_E = u_E_E * E final = phylab.BitAdapt(E, u_E) return env.from_string(source).render(L=L, H=H, b=b, D=D[:-1], ave_D=ave_D, m=m, delta_m=delta_m, C_plus=C_plus, C_sub=C_sub, C=C, ave_delta_C=ave_delta_C, E=phylab.ToScience(E), ua_D=phylab.ToScience(ua_D), u_D=phylab.ToScience(u_D), ua_C=phylab.ToScience(ua_delta_C), u_C=phylab.ToScience(u_delta_C), u_E_E=phylab.ToScience(u_E_E), u_E=phylab.ToScience(u_E), final=final)
def CollimatedConvex(exper): f = [] sum_f = 0 delta = 35.5 for i in range(5): aver = (exper[i][1] + exper[i][2]) / 2 exper[i].append(aver) temp_f = exper[i][0] - aver - delta sum_f += temp_f f.append(temp_f) average_f = sum_f / 5 ua_f = phylab.Ua(f, average_f, len(f)) ub_f = 0.5 / sqrt(3) uf = sqrt(pow(ua_f, 2) + pow(ub_f, 2)) res = [average_f, uf] return res
def LloydSodium(lx, bmin, bmax, loc): tenx = phylab.DWM(lx) delta_x = [] for a in tenx: delta_x.append(a / 10.0) delta_x.append(sum(delta_x) / len(delta_x)) ua_x = phylab.Ua(delta_x, delta_x[len(delta_x) - 1], len(delta_x) - 1) ub_x = 0.005 / sqrt(3) u_x = sqrt(ub_x**2 + ua_x**2) ave_bi = abs(bmin[0] - bmin[1] + bmin[2] - bmin[3]) / 2 bmin.append(ave_bi) ave_ba = abs(bmax[0] - bmax[1] + bmax[2] - bmax[3]) / 2 bmax.append(ave_ba) ua_bmin = sqrt( pow(ave_bi - (bmin[0] - bmin[1]), 2) / 2 + pow(ave_bi - (bmin[2] - bmin[3]), 2) / 2) ua_bmax = sqrt( pow(ave_ba - (bmax[0] - bmax[1]), 2) / 2 + pow(ave_ba - (bmax[2] - bmax[3]), 2) / 2) u_bmin = sqrt( pow(0.025 * ave_bi / sqrt(3), 2) + pow(0.005 / sqrt(3), 2) + pow(ua_bmin, 2)) u_bmax = sqrt( pow(0.025 * ave_ba / sqrt(3), 2) + pow(0.005 / sqrt(3), 2) + pow(ua_bmax, 2)) smin = abs(loc[0] - loc[4]) * 10 smax = abs(loc[0] - loc[3]) * 10 u_smin = sqrt(pow(0.5 / sqrt(3), 2) + pow(0.05 / sqrt(3), 2)) u_smax = sqrt(pow(0.5 / sqrt(3), 2) + pow(0.05 / sqrt(3), 2)) lbd = delta_x[len(delta_x) - 1] * sqrt( ave_bi * ave_ba) / (smin + smax) * pow(10, 6) temp = pow(u_x / delta_x[len(delta_x) - 1], 2) temp += pow(u_bmin / 2 / ave_bi, 2) temp += pow(u_bmax / 2 / ave_ba, 2) temp += pow(u_smin / 10 / (smin + smax), 2) temp += pow(u_smax / 10 / (smin + smax), 2) u_lbd = lbd * sqrt(temp) res = phylab.BitAdapt(lbd, u_lbd) return res
def DoubleBridge(R1, R2, RN, LR, d): temp = [] for i in range(len(LR[0])): ave = (LR[1][i] + LR[2][i]) / 2 temp.append(ave) LR.append(temp) ave_d = sum(d) / len(d) d.append(ave_d) t = RN / R1 x = [] x2 = [] y = [] y2 = [] xy = [] for i in range(len(LR[0])): x.append(LR[3][i]) x2.append(LR[3][i]**2) y.append(LR[0][i]) y2.append(LR[0][i]**2) xy.append(LR[0][i] * LR[3][i]) x.append(sum(x) / len(x)) x2.append(sum(x2) / len(x2)) y.append(sum(y) / len(y)) y2.append(sum(y2) / len(y2)) xy.append(sum(xy) / len(xy)) res = phylab.ULR(x, y) b = res[0] / t r = res[1] P = pi * pow(ave_d, 2) / 4 / b fP = P / pow(10, 3) ua_bb = sqrt((1 / pow(r, 2) - 1) / (len(x) - 3)) ua_d = phylab.Ua(d, ave_d, len(d) - 1) uP = sqrt(pow(2 * ua_d / ave_d, 2) + pow(ua_bb, 2)) u_P = uP * fP res = [fP, u_P] return res
def LloydSodium(lx, bmin, bmax, loc): tenx = phylab.DWM(lx) delta_x = [] for a in tenx: delta_x.append(a / 10.0) delta_x.append(sum(delta_x) / len(delta_x)) ua_x = phylab.Ua(delta_x, delta_x[len(delta_x) - 1], len(delta_x) - 1) ub_x = 0.005 / sqrt(3) u_x = sqrt(ub_x**2 + ua_x**2) ave_bi = abs(bmin[0] - bmin[1] + bmin[2] - bmin[3]) / 2 bmin.append(ave_bi) ave_ba = abs(bmax[0] - bmax[1] + bmax[2] - bmax[3]) / 2 bmax.append(ave_ba) u_bmin = sqrt(pow(0.025 * ave_bi / sqrt(3), 2) + pow(0.005 / sqrt(3), 2)) u_bmax = sqrt(pow(0.025 * ave_ba / sqrt(3), 2) + pow(0.005 / sqrt(3), 2)) smin = abs(loc[0] - loc[4]) smax = abs(loc[0] - loc[3]) u_smin = 2.8 u_smax = 2.8 lbd = delta_x[len(delta_x) - 1] * sqrt( ave_bi * ave_ba) / (smin + smax) * pow(10, 5) temp = pow(u_x / delta_x[len(delta_x) - 1], 2) temp += pow(u_bmin / 2 / ave_bi, 2) temp += pow(u_bmax / 2 / ave_ba, 2) temp += pow(u_smin / 10 / (smin + smax), 2) temp += pow(u_smax / 10 / (smin + smax), 2) u_lbd = lbd * sqrt(temp) res = phylab.BitAdapt(lbd, u_lbd) print "res: " + str(res) phylab.RoundOne(lx, 3) print "lx: " + str(lx) phylab.RoundOne(tenx, 3) print "tenx: " + str(tenx) phylab.RoundOne(delta_x, 4) print "delta_x: " + str(delta_x) ua_x = round(ua_x, 5) print "ua_x: " + str(ua_x) ub_x = round(ub_x, 5) print "ub_x: " + str(ub_x) u_x = round(u_x, 5) print "u_x: " + str(u_x) phylab.RoundOne(bmin, 3) print "bmin: " + str(bmin) phylab.RoundOne(bmax, 3) print "bmax: " + str(bmax) u_bmin = round(u_bmin, 4) print "u_bmin: " + str(u_bmin) u_bmax = round(u_bmax, 4) print "u_bmax: " + str(u_bmax) phylab.RoundOne(loc, 1) print "loc: " + str(loc) smin = round(smin, 1) print "smin: " + str(smin) smax = round(smax, 1) print "smax: " + str(smax) u_smin = round(u_smin, 1) print "u_smin: " + str(u_smin) u_smax = round(u_smax, 1) print "u_smax: " + str(u_smax) lbd = round(lbd, 3) print "lbd: " + str(lbd) u_lbd = round(u_lbd, 3) print "u_lbd: " + str(u_lbd)