def test_totdev_ci(self): s32rows = testutils.read_stable32(resultfile='totdev_decade.txt', datarate=1.0) for row in s32rows: data = testutils.read_datafile(data_file) (taus, devs, errs, ns) = allan.totdev(data, rate=rate, taus=[row['tau']]) edf = allan.edf_totdev(N=len(data), m=row['m'], alpha=row['alpha']) #,d=3,m=row['m'],N=len(data),overlapping=True, modified = False, verbose=True) (lo, hi) = allan.confidence_intervals(devs[0], ci=0.68268949213708585, edf=edf) print("n check: ", testutils.check_equal(ns[0], row['n'])) print("dev check: ", testutils.check_approx_equal(devs[0], row['dev'])) print( "min dev check: ", lo, row['dev_min'], testutils.check_approx_equal(lo, row['dev_min'], tolerance=1e-3)) print( "max dev check: ", hi, row['dev_max'], testutils.check_approx_equal(hi, row['dev_max'], tolerance=1e-3))
def test_totdev_ci(self): print("totdev()") s32rows = testutils.read_stable32(resultfile='totdev_octave.txt', datarate=1.0) for row in s32rows: data = testutils.read_datafile(data_file) data = allan.frequency2fractional(data, mean_frequency=1.0e7) (taus, devs, errs, ns) = allan.totdev(data, rate=rate, data_type="freq", taus=[row['tau']]) edf = allan.edf_totdev(N=len(data), m=row['m'], alpha=row['alpha']) (lo, hi) = allan.confidence_interval(devs[0], edf=edf) print("n check: ", testutils.check_equal(ns[0], row['n'])) print( "dev check: ", testutils.check_approx_equal(devs[0], row['dev'], tolerance=2e-3)) print("min dev check: %.4g %.4g %d" % (lo, row['dev_min'], testutils.check_approx_equal( lo, row['dev_min'], tolerance=2e-3))) print("max dev check: %.4g %.4g %d" % (hi, row['dev_max'], testutils.check_approx_equal( hi, row['dev_max'], tolerance=2e-3)))
def test_phasedat_totdev(self): (s32_taus, s32_devs, s32_devs_lo, s32_devs_hi, s32_ns) = read_stable32('phase_dat_totdev_octave.txt', 1.0) phase = read_datafile('PHASE.DAT') (taus, devs, errs, ns) = allan.totdev(phase, taus=s32_taus) los = [] his = [] for (d, t, n) in zip(devs, taus, ns): #edf = greenhall_simple_edf( alpha=0, d=3, m=t, S=1, F=t, N=len(phase) ) #edf2 = greenhall_edf( alpha=0, d=3, m=int(t), N=len(phase), overlapping = True, modified=False ) #print(edf,edf2,edf2/edf) edf = allan.edf_totdev(len(phase), t, alpha=0) (lo, hi) = allan.confidence_intervals(dev=d, ci=0.68268949213708585, edf=edf) # 0.68268949213708585 #allan.uncertainty_estimate(len(phase), t, d,ci=0.683,noisetype='wf') los.append(lo) his.append(hi) for (t1, d1, lo1, hi1, n1, t2, d2, lo2, hi2, n2) in zip(s32_taus, s32_devs, s32_devs_lo, s32_devs_hi, s32_ns, taus, devs, los, his, ns): print("s32 %03d %03f %1.6f %1.6f %1.6f" % (n1, t1, lo1, d1, hi1)) print("at %03d %03f %1.6f %1.6f %1.6f" % (n2, t2, round(lo2, 7), round(d2, 7), round(hi2, 7))) approx_equal(lo1, lo2, tolerance=1e-3) approx_equal(hi1, hi2, tolerance=1e-3) print("----")
def test_phasedat_totdev(self): s32_rows = testutils.read_stable32('phase_dat_totdev_octave.txt', 1.0) phase = testutils.read_datafile('PHASE.DAT') (taus, devs, errs, ns) = allan.totdev(phase, taus=[s32['tau'] for s32 in s32_rows]) los = [] his = [] for (d, t, n) in zip(devs, taus, ns): #edf = greenhall_simple_edf( alpha=0, d=3, m=t, S=1, F=t, N=len(phase) ) #edf2 = greenhall_edf( alpha=0, d=3, m=int(t), N=len(phase), overlapping = True, modified=False ) #print(edf,edf2,edf2/edf) edf = allan.edf_totdev(len(phase), t, alpha=0) (lo, hi) = allan.confidence_interval(dev=d, edf=edf) #allan.uncertainty_estimate(len(phase), t, d,ci=0.683,noisetype='wf') los.append(lo) his.append(hi) print("totdev()") for (s32, t2, d2, lo2, hi2, n2) in zip(s32_rows, taus, devs, los, his, ns): print("s32 %03d %03f %1.6f %1.6f %1.6f" % (s32['n'], s32['tau'], s32['dev_min'], s32['dev'], s32['dev_max'])) print("at %03d %03f %1.6f %1.6f %1.6f" % (n2, t2, round(lo2, 5), round(d2, 5), round(hi2, 5))) testutils.check_approx_equal(s32['dev_min'], lo2, tolerance=1e-3) testutils.check_approx_equal(s32['dev_max'], hi2, tolerance=1e-3) print("----")
def test_totdev_ci(self): s32rows = testutils.read_stable32(resultfile='totdev_decade.txt', datarate=1.0) for row in s32rows: data = testutils.read_datafile(data_file) (taus, devs, errs, ns) = allan.totdev(data, rate=rate, taus=[ row['tau'] ]) edf = allan.edf_totdev(N=len(data),m=row['m'], alpha=row['alpha']) #,d=3,m=row['m'],N=len(data),overlapping=True, modified = False, verbose=True) (lo,hi) = allan.confidence_intervals(devs[0],ci=0.68268949213708585, edf=edf) print("n check: ", testutils.check_equal( ns[0], row['n'] ) ) print("dev check: ", testutils.check_approx_equal( devs[0], row['dev'] ) ) print("min dev check: ", lo, row['dev_min'], testutils.check_approx_equal( lo, row['dev_min'], tolerance=1e-3 ) ) print("max dev check: ", hi, row['dev_max'], testutils.check_approx_equal( hi, row['dev_max'], tolerance=1e-3 ) )
def test_totdev_ci(self): print("totdev()") s32rows = testutils.read_stable32(resultfile='totdev_octave.txt', datarate=1.0) for row in s32rows: data = testutils.read_datafile(data_file) data = allan.frequency2fractional(data, mean_frequency=1.0e7) (taus, devs, errs, ns) = allan.totdev(data, rate=rate, data_type="freq", taus=[ row['tau'] ]) edf = allan.edf_totdev(N=len(data),m=row['m'], alpha=row['alpha']) (lo,hi) = allan.confidence_interval(devs[0], edf=edf) print("n check: ", testutils.check_equal( ns[0], row['n'] ) ) print("dev check: ", testutils.check_approx_equal( devs[0], row['dev'], tolerance=2e-3 ) ) print("min dev check: %.4g %.4g %d" %( lo, row['dev_min'], testutils.check_approx_equal( lo, row['dev_min'], tolerance=2e-3 ) ) ) print("max dev check: %.4g %.4g %d" %( hi, row['dev_max'], testutils.check_approx_equal( hi, row['dev_max'], tolerance=2e-3 ) ) )
def test_phasedat_totdev(self): s32_rows = testutils.read_stable32( 'phase_dat_totdev_octave.txt' , 1.0 ) phase = testutils.read_datafile('PHASE.DAT') (taus,devs,errs,ns) = allan.totdev(phase, taus=[s32['tau'] for s32 in s32_rows]) los=[] his=[] for (d,t, n) in zip(devs, taus, ns): #edf = greenhall_simple_edf( alpha=0, d=3, m=t, S=1, F=t, N=len(phase) ) #edf2 = greenhall_edf( alpha=0, d=3, m=int(t), N=len(phase), overlapping = True, modified=False ) #print(edf,edf2,edf2/edf) edf = allan.edf_totdev(len(phase), t, alpha=0) (lo,hi) = allan.confidence_interval( dev=d, edf=edf ) #allan.uncertainty_estimate(len(phase), t, d,ci=0.683,noisetype='wf') los.append(lo) his.append(hi) print("totdev()") for (s32, t2, d2, lo2, hi2, n2) in zip(s32_rows, taus, devs, los, his, ns): print("s32 %03d %03f %1.6f %1.6f %1.6f" % (s32['n'], s32['tau'], s32['dev_min'], s32['dev'], s32['dev_max'])) print("at %03d %03f %1.6f %1.6f %1.6f" % (n2, t2, round(lo2,5), round(d2,5), round(hi2,5) )) testutils.check_approx_equal(s32['dev_min'], lo2, tolerance=1e-3) testutils.check_approx_equal(s32['dev_max'], hi2, tolerance=1e-3) print("----")