comparison allan.py @ 1:ebc4e1d7c32f

Add convenience functions to generate an integration times vector
author Daniele Nicolodi <daniele@grinta.net>
date Tue, 24 Mar 2015 18:10:10 +0100
parents 3dcd4cfd8f82
children ff2192f47448
comparison
equal deleted inserted replaced
0:3dcd4cfd8f82 1:ebc4e1d7c32f
2 from scipy import polyfit, polyval 2 from scipy import polyfit, polyval
3 import matplotlib.pyplot as plt 3 import matplotlib.pyplot as plt
4 import numexpr 4 import numexpr
5 5
6 __all__ = ['outliers', 'detrend', 'fastdetrend', 6 __all__ = ['outliers', 'detrend', 'fastdetrend',
7 'adev', 'xadev', 'xmdev', 'xtdev', 'xavar', 'xmvar', ] 7 'adev', 'xadev', 'xmdev', 'xtdev', 'xavar', 'xmvar', 'tau' ]
8 8
9 9
10 def outliers(y, alpha=6, remove=False): 10 def outliers(y, alpha=6, remove=False):
11 """Detect and optionally remove outliers""" 11 """Detect and optionally remove outliers"""
12 12
46 expr = "y - (%s)" % " + ".join(expr) 46 expr = "y - (%s)" % " + ".join(expr)
47 47
48 # evaluate expression 48 # evaluate expression
49 y = numexpr.evaluate(expr, local_dict=args) 49 y = numexpr.evaluate(expr, local_dict=args)
50 return y 50 return y
51
52
53 def tau(expmin=0, expmax=4):
54 return np.ravel(np.power(10, np.arange(expmin, expmax))[:,np.newaxis] * np.arange(0, 10))
55
56
57 def tau124(expmin=0, expmax=4):
58 return np.ravel(np.power(10.0, np.arange(expmin, expmax))[:,np.newaxis] * np.array([1, 2, 4]))
51 59
52 60
53 def adev(x, tau, sampl=1.0): 61 def adev(x, tau, sampl=1.0):
54 """Allan deviation""" 62 """Allan deviation"""
55 63