def run_observer(self, i): #self.term1[:,i] = squeeze(colwise(dot(self.FO, self.X_tilde[:,i-1]))) self.term1[:,i] = squeeze(colwise(dot(self.G, self.X_tilde[:,i-1]))) self.term2[:,i] = squeeze(colwise(self.H*self.vvect[i-1])) Y_tilde_float_i = squeeze(dot(self.C, self.X_tilde[:,i-1])) #Y_tilde_int_i = Y_tilde_float_i.astype(int) #self.term3[:,i] = squeeze(colwise(dot(self.Ke, self.Yvect[:,i]-Y_tilde_int_i))) self.term3[:,i] = squeeze(colwise(dot(self.Ke, self.Yvect[:,i-1]-Y_tilde_float_i))) ## if term1.any() or term2.any() or term3.any(): ## Pdb().set_trace() next_x_tilde = self.term1[:,i] + self.term2[:,i] + self.term3[:,i] #colwise(dot(self.Ke, self.Yvect[:,i-1])) ## if term1.any() or term2.any() or term3.any(): ## if self.debug_ind < 2: ## print('i = '+str(i)) ## print('term1 = ' + str(term1)) ## print('term2 = ' + str(term2)) ## print('term3 = ' + str(term3)) ## print('next_x_tilde = ' + str(next_x_tilde)) ## print('-'*20) ## self.debug_ind += 1 self.X_tilde[:,i] = squeeze(next_x_tilde)
def plot_states_from_verification(self, fi=3, clear=False, \ attr='X_tilde', \ label_attr=None): if label_attr is None: label_attr = attr mat = getattr(self, attr) mat = colwise(mat) nr, nc = mat.shape for n in range(nc): cur_col = mat[:,n] label = label_attr + '%i' % n ax = self._prep_ax(fi=fi, clear=clear) ax.plot(self.t, cur_col, label=label) #ax.set_title(label) fi += 1