# don't overwrite... results = [ [] for h in hs] means = np.zeros(np.arange(0.2, 1.0, 0.1).shape) stdevs = np.zeros(np.arange(0.2, 1.0, 0.1).shape) for H_i, H in enumerate(hs): print(H) for j in range(0,stat_n): print(" ",j) z2d = fract.fbm2D_spectral(H, N) res1 = 0 try: det_H = fract.higuchi_H(z2d, data=False) print(" ",det_H) except Exception as ex: det_H = np.nan print("Exception ", ex) results[H_i].append(det_H) np_res = np.array(results) if first_time == False: disk_np_res = np.hstack(( disk_np_res, np_res )) elif first_time == True: disk_np_res = np_res
nhs = len(np.arange(start,stop=stop,step=step)) res = np.zeros( (nhs, 3)) for (i,H) in enumerate( np.arange(start,stop=stop,step=step) ): # H = start + i*step stat_res = np.zeros(stat_n) print("H", H) for j in range(1, stat_n): # generate # Random.seed!(729 + i*34); data = fract.fbm2D(H,N=N) # dfa h_detected = fract.higuchi_H(data, data=False) stat_res[j] = h_detected # print(" ", j) av_h_detected = np.mean(stat_res) std_h_detected = np.std(stat_res) print(" av. H detected =", av_h_detected) newrow = np.transpose([H, av_h_detected, std_h_detected]) res[i,:] = newrow # res = np.loadtxt("results1.txt") plt.errorbar(res[:,0], res[:,1], yerr=res[:,2]); plt.xlabel("generation H") plt.ylabel("detected H") linex = [0.075,0.925]
means = np.zeros(np.arange(0.2, 1.0, 0.1).shape) stdevs = np.zeros(np.arange(0.2, 1.0, 0.1).shape) for H_i, H in enumerate(np.arange(0.2, 1.0, 0.1)): gen_params = fract.save_fbm2D_exact_generator_params(H,N) print(H) for j in range(0,stat_n//2): print(" ",j) z2d1, z2d2 = fract.fbm2D_exact_from_generator(*gen_params) res1 = 0 res2 = 0 try: detect_H1 = fract.higuchi_H(z2d1, data=False) print(" ",detect_H1) except Exception as ex: res1 = np.nan print("Exception ", ex) try: detect_H2 = fract.higuchi_H(z2d2, data=False) # print(" ",res2) except Exception as ex: res2 = np.nan print("Exception ", ex) results[H_i].append(detect_H1) results[H_i].append(detect_H2)