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(self): data = setup_data0() span = Analyzer(data) span.mssa(nmssa=4) self.assertTrue(npy.allclose( span._mssa_raw_ev[0], npy.array([ 20.25648796, 16.57547325, 16.51572589, 16.31088181]))) self.assertTrue(npy.allclose( span._mssa_raw_pc[0][:2,:2], npy.array([[ 6.9105607 , 0.32054539], [ 5.77266597, 2.92740569]]))) self.assertTrue(npy.allclose( span._mssa_raw_eof[0][:2,:2], npy.array([[ 0.13637961, -0.12778613], [ 0.13417614, 0.13187513]])))
def test_mssa(self): data = setup_data2(nx=3, ny=2) span = Analyzer(data) span.mssa(nmssa=4) print data.reshape(120, 6).mask # self.assertTrue(npy.allclose( # span._mssa_raw_ev, # npy.array([ 84.65284564, 39.94531834, 36.70936929, 21.49023578]))) print span._mssa_raw_pc[:2,:2] self.assertTrue(npy.allclose( span._mssa_raw_pc[:2,:2], npy.array([[-13.66377591, 2.62887011], [-13.28622293, 2.74443558]]))) self.assertTrue(npy.allclose( span._mssa_raw_eof[:2,:2], npy.array([[ 0.05067246, 0.10596479], [ 0.05300994, 0.10764546]])))