def Generatetest(wa, wp, f = dCPL(), dbao = dBAO()): f.update(wa= wa, wp = wp) dic = {"z":[], "theta":[], "a":[]} for z in np.arange(0.1,2.1,.1): dic["z"].append(z) dic["theta"].append(dbao.cal(f.cal(z))) dic["a"].append(1/(1+z)) df = pd.DataFrame(dic) print(df) df.to_csv("data/data_test.csv")
for y, x in zip(Y, X): a += math.pow((y - (db.lbao * x)), 2) b += math.pow(y - mean, 2) rs.append([r, 1 - (a / b)]) for r in rs: if r[1] > 1 or r[1] < 0: rs.remove(r) rsmin = max([item[1] for item in rs]) for r in rs: if rsmin == r[1]: print(r) d = dCPL() step = .00005 # Initial stepsize tolerance = 0.1 iP = [-.1, -0.99] # Initial point ranges = [[-0.11, -.1], [-1., -.8]] inpdata = obtaindata("data") wa = iP[0] wp = iP[1] wa, wp, step = LineMethod(wa, wp, tolerance, step, inpdata, d) fwa = wa