示例#1
0
 def test_adev_ci_and_noiseID(self):
     """ ADEV with confidence intervals, including noise-ID """
     change_to_test_dir()
     s32rows = testutils.read_stable32(
         resultfile='stable32_ADEV_decade.txt', datarate=1.0)
     for row in s32rows:
         phase = testutils.read_datafile('gps_1pps_phase_data.txt.gz')
         (taus, devs, errs, ns) = allan.adev(phase,
                                             rate=rate,
                                             data_type="phase",
                                             taus=[row['tau']])
         dev = devs[0]
         try:
             # CI including noise-ID
             (lo2,
              hi2) = allan.confidence_interval_noiseID(phase,
                                                       dev,
                                                       af=int(row['m']),
                                                       dev_type="adev",
                                                       data_type="phase")
             assert np.isclose(lo2, row['dev_min'], rtol=1e-2, atol=0)
             assert np.isclose(hi2, row['dev_max'], rtol=1e-2, atol=0)
             print(" CI OK! tau= %f  lo/s32_lo = %f hi/s32_hi = %f " %
                   (row['tau'], lo2 / row['dev_min'], hi2 / row['dev_max']))
         except NotImplementedError:
             print("can't do CI for tau= %f" % row['tau'])
             pass
 def test_phasedat_adev(self):
     s32_rows = testutils.read_stable32( 'phase_dat_adev_octave.txt' , 1.0 )
     phase = np.array( testutils.read_datafile('PHASE.DAT') )
     (taus,devs,errs,ns) = allan.adev(phase, taus=[s32['tau'] for s32 in s32_rows])
     
     # separate CI computation
     los=[]
     his=[]
     for (d,t, n, s32) in zip(devs, taus, ns,s32_rows):
         # Note FIXED alpha here 
         edf2 = allan.edf_greenhall( alpha=0, d=2, m=t, N=len(phase), overlapping = False, modified=False )
         (lo,hi) = allan.confidence_interval( dev=d, edf=edf2 )           
         los.append(lo)
         his.append(hi)
         try:
             (lo2,hi2) = allan.confidence_interval_noiseID(phase, d, af=int(t), dev_type="adev", data_type="phase")
             assert np.isclose( lo2, s32['dev_min'] , rtol=1e-2)
             assert np.isclose( hi2, s32['dev_max'] , rtol=1e-2)
             print(" CI OK! tau= ",t)
         except NotImplementedError:
             print("can't do CI for tau= ",t)
             pass
     
     # compare to Stable32
     print("adev()")
     print("    n   tau dev_min  dev      dev_max ")
     for (s32, t2, d2, lo2, hi2, n2) in zip(s32_rows, taus, devs, los, his, ns):
         print("S32 %03d %03.1f %1.6f %1.6f %1.6f" % (s32['n'], s32['tau'], s32['dev_min'], s32['dev'], s32['dev_max']))
         print("AT  %03d %03.1f %1.6f %1.6f %1.6f" % (n2, t2, round(lo2,5), round(d2,5), round(hi2,5) ))
         testutils.check_approx_equal(s32['n'], n2, tolerance=1e-9)
         testutils.check_approx_equal(s32['dev_min'], lo2, tolerance=1e-3)
         testutils.check_approx_equal(s32['dev'], d2, tolerance=1e-4)
         testutils.check_approx_equal(s32['dev_max'], hi2, tolerance=1e-3)
     print("----")
示例#3
0
 def test_adev_ci_and_noiseID(self):
     """ ADEV with confidence intervals, including noise-ID """
     change_to_test_dir()
     s32rows = testutils.read_stable32(resultfile='adev_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.adev(data,
                                             rate=rate,
                                             data_type="freq",
                                             taus=[row['tau']])
         dev = devs[0]
         try:
             # CI including noise-ID
             (lo2,
              hi2) = allan.confidence_interval_noiseID(data,
                                                       dev,
                                                       af=int(row['m']),
                                                       dev_type="adev",
                                                       data_type="freq")
             assert np.isclose(lo2, row['dev_min'], rtol=1e-2)
             assert np.isclose(hi2, row['dev_max'], rtol=1e-2)
             print(" CI OK! tau= %f  lo/s32_lo = %f hi/s32_hi = %f " %
                   (row['tau'], lo2 / row['dev_min'], hi2 / row['dev_max']))
         except NotImplementedError:
             print("can't do CI for tau= %f" % row['tau'])
             pass
示例#4
0
    def test_phasedat_adev(self):
        s32_rows = testutils.read_stable32('phase_dat_adev_octave.txt', 1.0)
        phase = np.array(testutils.read_datafile('PHASE.DAT'))
        (taus, devs, errs,
         ns) = allan.adev(phase, taus=[s32['tau'] for s32 in s32_rows])

        # separate CI computation
        los = []
        his = []
        for (d, t, n, s32) in zip(devs, taus, ns, s32_rows):
            # Note FIXED alpha here
            edf2 = allan.edf_greenhall(alpha=0,
                                       d=2,
                                       m=t,
                                       N=len(phase),
                                       overlapping=False,
                                       modified=False)
            (lo, hi) = allan.confidence_interval(dev=d, edf=edf2)
            assert np.isclose(lo, s32['dev_min'], rtol=1e-2)
            assert np.isclose(hi, s32['dev_max'], rtol=1e-2)
            print(" alpha=0 FIXED, CI OK! tau = %f" % t)

            los.append(lo)
            his.append(hi)
            try:
                (lo2,
                 hi2) = allan.confidence_interval_noiseID(phase,
                                                          d,
                                                          af=int(t),
                                                          dev_type="adev",
                                                          data_type="phase")
                assert np.isclose(lo2, s32['dev_min'], rtol=1e-2)
                assert np.isclose(hi2, s32['dev_max'], rtol=1e-2)
                print(" ACF_NID CI OK! tau = %f" % t)
            except NotImplementedError:
                print("can't do CI for tau = %f" % t)
                pass

        # compare to Stable32
        print("adev()")
        print("    n   tau dev_min  dev      dev_max ")
        for (s32, t2, d2, lo2, hi2, n2) in zip(s32_rows, taus, devs, los, his,
                                               ns):
            print("S32 %03d %03.1f %1.6f %1.6f %1.6f" %
                  (s32['n'], s32['tau'], s32['dev_min'], s32['dev'],
                   s32['dev_max']))
            print("AT  %03d %03.1f %1.6f %1.6f %1.6f" %
                  (n2, t2, round(lo2, 5), round(d2, 5), round(hi2, 5)))
            testutils.check_approx_equal(s32['n'], n2, tolerance=1e-9)
            testutils.check_approx_equal(s32['dev_min'], lo2, tolerance=1e-3)
            testutils.check_approx_equal(s32['dev'], d2, tolerance=1e-4)
            testutils.check_approx_equal(s32['dev_max'], hi2, tolerance=1e-3)
        print("----")
示例#5
0
 def test_adev_ci_and_noiseID(self):
     """ ADEV with confidence intervals, including noise-ID """
     change_to_test_dir()
     s32rows = testutils.read_stable32(resultfile='stable32_ADEV_decade.txt', datarate=1.0)
     for row in s32rows:
         phase = testutils.read_datafile('gps_1pps_phase_data.txt.gz')
         (taus, devs, errs, ns) = allan.adev(phase, rate=rate, data_type="phase",
                                             taus=[row['tau']])
         dev = devs[0]
         try:
             # CI including noise-ID
             (lo2, hi2) = allan.confidence_interval_noiseID(phase, dev, af=int(row['m']), dev_type="adev", data_type="phase")
             assert np.isclose(lo2, row['dev_min'], rtol=1e-2, atol=0)
             assert np.isclose(hi2, row['dev_max'], rtol=1e-2, atol=0)
             print(" CI OK! tau= %f  lo/s32_lo = %f hi/s32_hi = %f "% (row['tau'], lo2/row['dev_min'], hi2/row['dev_max']))
         except NotImplementedError:
             print("can't do CI for tau= %f"%row['tau'])
             pass
示例#6
0
 def test_adev_ci_and_noiseID(self):
     """ ADEV with confidence intervals, including noise-ID """
     change_to_test_dir()
     s32rows = testutils.read_stable32(resultfile='adev_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.adev(data, rate=rate, data_type="freq",
                                               taus=[ row['tau'] ])
         dev=devs[0]
         try:
             # CI including noise-ID
             (lo2,hi2) = allan.confidence_interval_noiseID(data, dev, af=int(row['m']), dev_type="adev", data_type="freq")
             assert np.isclose( lo2, row['dev_min'] , rtol=1e-2)
             assert np.isclose( hi2, row['dev_max'] , rtol=1e-2)
             print(" CI OK! tau= %.0f lo/s32_lo = %f hi/s32_hi = %f "% (row['tau'], lo2/row['dev_min'], hi2/row['dev_max']) )
         except NotImplementedError:
             print("can't do CI for tau= %f"%row['tau'])
             pass