def __init__(self, _grid, _power, _noiselevel, _dt): self.grid = _grid # self.dt = min([self.grid.dx**2, self.grid.dy**2]) * self.cfl self.dt = _dt SkelSimulation.__init__(self, _noiselevel, self.dt, self.grid.shape) self.power = _power # compute matrix self.calcmat() self.calcmatbc() # rhs and boundary conditions self.field = np.zeros([self.size]) self.calcbc(self.It,self.field) if self.isimplicit: # self.Mat = np.linalg.inv(self.Mat) self.Mat = inv(self.Mat) indx = self.grid.indx self.staticfield = np.zeros([self.size]) wx = 2. * math.pi / self.grid.Lx wy = 2. * math.pi / self.grid.Ly for i in range(self.grid.nx): for j in range(self.grid.ny): x = self.grid.coordx[i][j] y = self.grid.coordy[i][j] self.staticfield[indx(i, j)] = math.sin(wx * x) * math.sin(wy * y) gc_clean()
def __init__(self, _noiselevel, _dt, _shape): self.noiselevel = _noiselevel self.dt = _dt self.addnoisev = np.vectorize(self.addnoise) self.size = np.prod(_shape) self.field = np.zeros(_shape) gc_clean()
def __init__(self): self.simulation = SkelSimulation(self.noise_sim, self.dt, [0]) self.kalsim = SkelSimulation(self.noise_sim, self.dt, [0]) self.dt = self.simulation.dt self.reality = SkelReality(self.noise_real, self.dt, [0]) self.kalman = SkelKalmanWrapper(self.reality, self.kalsim) gc_clean()
def __init__(self): EDP.__init__(self) self.reinit() gc_clean() print("cfl = ", max([self.dt / (self.grid.dx**2), self.dt / (self.grid.dy**2)])) print("dt = ", self.dt) print("Norme H1 | reality | simu | kalman")
def __init__(self, _noiselevel, _dt, _shape): self.noiselevel = _noiselevel self.dt = _dt self.size = np.product(_shape) self.field = np.zeros(_shape) self.Mat = np.zeros(self.size) self.rhs = np.zeros(self.size) gc_clean()
def __init__(self, _grid, _power, _noiselevel, _dt): self.grid = _grid SkelReality.__init__(self, _noiselevel, _dt, _grid.shape) self.power = _power wx = 2. * math.pi / self.grid.Lx wy = 2. * math.pi / self.grid.Ly self.initfield = np.zeros([self.grid.nx, self.grid.ny]) for i in range(self.grid.nx): for j in range(self.grid.ny): x = self.grid.coordx[i][j] y = self.grid.coordy[i][j] self.initfield[i][j] = math.sin(wx * x) \ * math.sin(wy * y) gc_clean()
def __init__(self, _reality, _sim): self.reality = _reality self.kalsim = _sim self.It = self.kalsim.It self.nIt = self.kalsim.nIt self.err = self.kalsim.err self.dt = self.kalsim.dt self.size = self.kalsim.size _M = self.getwindow() # Observation matrix. self.kalman = KalmanFilterObservator(self.kalsim, _M) # Initial covariance estimate. self.kalman.S = np.empty([self.kalman.size_s]) # Estimated error in measurements. self.kalman.R = np.empty([self.kalman.size_o]) self.kalman.R.fill(self.reality.noiselevel ** 2) # Estimated error in process. self.kalman.Q = np.empty([self.kalman.size_s]) self.kalman.Q.fill(self.kalsim.noiselevel ** 2) gc_clean()
def __init__(self, _reality, _sim): SkelKalmanWrapper.__init__(self, _reality, _sim) self.size = self.kalsim.size _M = self.getwindow() # Observation matrix. self.kalman = KalmanFilterObservator(self.kalsim, _M) indx = self.kalsim.grid.indx # # Initial covariance estimate. # self.kalman.S = np.eye(self.kalman.size_s) * \ # 0. ** 2 # # Estimated error in measurements. # self.kalman.R = np.eye(self.kalman.size_o) * \ # self.reality.noiselevel ** 2 # Estimated error in process. # G = np.zeros([self.kalman.size_s, 1]) # for i in range(self.kalsim.grid.nx): # for j in range(self.kalsim.grid.ny): # G[indx(i, j)] = self.kalsim.grid.dx ** 4 / 24. \ # + self.kalsim.grid.dy ** 4 / 24. \ # + self.kalsim.dt ** 2 / 2. # # G[indx(i, j)] = self.kalsim.dt # # self.kalman.Q = G.dot(np.transpose(G)) * self.kalsim.noiselevel ** 2 # self.kalman.Q = np.eye(self.kalman.size_s) * \ # self.kalnoise ** 2 self.kalman.S = np.empty([self.kalman.size_s]) self.kalman.R = np.empty([self.kalman.size_o]) self.kalman.Q = np.empty([self.kalman.size_s]) self.kalman.R.fill(self.reality.noiselevel ** 2) self.kalman.Q.fill(self.reality.noiselevel ** 2) gc_clean()