예제 #1
0
 def __init__(self,A,C,Q,R):
   '''
   Initialsie by setting the state and observation matricies and covariances.
   '''
   # system matrix, as in x[:,t+1] = dot(A,x[:,t])
   if type(A)==str:
     self.A=unserialiseArray(A) 
   else:
     self.A=array(A)
   # observation matrix as in y = dot(C,x)
   if type(C)==str:
     self.C=unserialiseArray(C) 
   else:
     self.C=array(C)
   # the system covariance matrix (positive definite)
   if type(Q)==str:
     self.Q=unserialiseArray(Q) 
   else:
     self.Q=array(Q)
   # the observation covariance (positive definite)
   if type(R)==str:
     self.R=unserialiseArray(R)
   else:
     self.R=array(R)
   self.ss = self.C.shape[1]
   self.os = self.C.shape[0]
예제 #2
0
 def __init__(self,x,y,Ntrain,maxN=None,ytf=None,ydf=None,ytp=None,ydp=None,
   yt=None,yd=None,dtran=None
 ):
   if type(x)==str:
     self.x = unserialiseArray(x)
     self.y = unserialiseArray(y)
   else:
     self.x = array(x)
     self.y = array(y)
   self.Ntrain = Ntrain
   self.maxN = maxN
   self.yt0 = self.y[:Ntrain]
   self.yd0 = self.y[Ntrain:self.maxN]
   self.xt = self.x[:Ntrain]
   self.xd = self.x[Ntrain:self.maxN]
   # Filtered
   self.ytf = ytf
   self.ydf = ydf
   # Z-scored (normalized)
   self.yt = yt
   self.yd = yd
   # PCAed
   self.ytp = ytp
   self.ydp = ydp
   if dtran is None:
     self.dtran = DataTransformStack()
   else:
     self.dtran = dtran
예제 #3
0
 def __init__(self,ga,gb,f):
   if type(ga)==str:
     self.ga = unserialiseArray(ga)
   else:
     self.ga = ga
   if type(gb)==str:
     self.gb = unserialiseArray(gb)    
   else:
     self.gb = gb
   self.f = f
   self.split = self.ga.shape[0]-1
   self.D = self.ga.shape[0]+self.gb.shape[0]-2
예제 #4
0
 def __init__(self,x,dx=None):
   '''
   A pair of points and tangent vectors to a flow
   at those points.
   x numpy NxDxM array Co-ordinates on some manifold
   dx numpy NxDxM tangent vectors at those points
   '''
   if type(x)==str:
     self._x = unserialiseArray(x)
     self._dx = unserialiseArray(dx)
   else:
     self._x = x
     self._dx = dx
   self._tx = None
   self._tdx = None
   self.checkInput()
예제 #5
0
 def __init__(self,T,S):
   '''
   T: The transition matrix for the SDE
   in time.The first co-ordinate is the phase, the
   second is a radial component and the remaining
   terms are orthogonal directions.
   S: The covariance matrix for the noise.
   '''
   if type(T)==str:
     self.T = unserialiseArray(T)    
   else:
     self.T = T      
   if type(S)==str:
     self.S = unserialiseArray(S)
   else:
     self.S = S
예제 #6
0
 def __init__(self, p, c, dc, s, par=None, fixedPar=0):
     if type(p) == str:
         super(CompositeRBForm, self).__init__(p, par, fixedPar)
         self.p = unserialiseArray(p)
         self.c = unserialiseArray(c)
         self.dc = unserialiseArray(dc)
         self.s = unserialiseArray(s)
     else:
         if p.ndim == 2:
             super(CompositeRBForm, self).__init__(hstack(p), par, fixedPar)
             self.p = hstack(p)
             self.c = vstack(c)
             self.dc = vstack(dc)
             self.s = hstack(s)
         else:
             super(CompositeRBForm, self).__init__(p, par, fixedPar)
             self.p = p
             self.c = c
             self.dc = dc
             self.s = s
예제 #7
0
 def __init__(self, H, A):
   '''
   Instantiate with the HMaps and transformations that make up the chain.
   '''
   if type(H)==list:
     self.H = H
   else:
     self.H = eval(H)
   if type(A)==list:
     self.A = A
   else:
     self.A = eval(A)
   self.A = [unserialiseArray(a) if type(a)==str else a for a in self.A]