def test_pca_mssa(self): data = setup_data2(nx=30, ny=20) span = Analyzer(data, nmssa=2) self.assertTrue(npy.allclose( span.mssa_ev(), npy.array([ 2482.65882191, 2355.53413819]))) pc = span.mssa_pc() self.assertTrue(npy.allclose( span.mssa_pc()[:,:2].ravel(), npy.array([-19.47701848, -20.97653195, 2.99480916, -0.20444392]))) self.assertAlmostEqual(span.mssa_eof()[1,2,3,4], 0.0041007559488027926)
def test_pca_mssa_ec(self): data = setup_data2(nx=30, ny=20) span = Analyzer(data) span.mssa(nmssa=4) ec = span.mssa_ec(xeof=span.mssa_eof(), xdata=data) pc = span.mssa_pc() self.assertTrue(npy.allclose(ec, pc))
def test_ssa_xrec(self): data = setup_data0() span = Analyzer(data, nmssa=6) rec = span.mssa_rec() eof = span.mssa_eof() pc = span.mssa_pc() xrec = span.mssa_rec(xeof=eof, xpc=pc) self.assertTrue(npy.allclose(rec,xrec))
def test_pca_mssa_xrec(self): data = setup_data2(nx=30, ny=20) span = Analyzer(data) rec = span.mssa_rec(nmssa=4) xeof = span.mssa_eof() xpc = span.mssa_pc() xrec = span.mssa_rec(xeof=xeof, xpc=xpc) self.assertTrue(npy.allclose(rec, xrec))