Example #1
0
File: mrs.py Project: wk1984/gimli
 def calcMCM(self):
     ''' compute model covariance matrix '''
     J = gmat2numpy( self.f.jacobian() ) # (linear) jacobian matrix
     D = np.diag( 1 / self.error )
     DJ = D.dot( J )
     JTJ = DJ.T.dot( DJ )
     MCM = inv( JTJ )   # model covariance matrix
     varVG = np.sqrt( np.diag( MCM ) ) # standard deviations from main diagonal
     di = ( 1. / varVG )  # variances as column vector
     MCMs = di.reshape(len(di),1) * MCM * di  # scaled model covariance (=correlation) matrix
     return varVG, MCMs
Example #2
0
 def calcMCM(self):
     """Compute linear model covariance matrix."""
     J = gmat2numpy(self.fop.jacobian())  # (linear) jacobian matrix
     D = np.diag(1 / self.error)
     DJ = D.dot(J)
     JTJ = DJ.T.dot(DJ)
     MCM = np.linalg.inv(JTJ)  # model covariance matrix
     var = np.sqrt(np.diag(MCM))  # standard deviations from main diagonal
     di = (1. / var)  # variances as column vector
     # scaled model covariance (=correlation) matrix
     MCMs = di.reshape(len(di), 1) * MCM * di
     return var, MCMs