Mercurial > hg > segmentation
diff cnmf.py @ 18:b4bf37f94e92
prepared to add another annotation
author | mitian |
---|---|
date | Wed, 09 Dec 2015 16:27:10 +0000 |
parents | c01fcb752221 |
children |
line wrap: on
line diff
--- a/cnmf.py Fri Aug 21 10:15:29 2015 +0100 +++ b/cnmf.py Wed Dec 09 16:27:10 2015 +0000 @@ -138,13 +138,13 @@ while True: if bound_idxs is None: try: - if CNMF: F, G = cnmf(X, rank, niter=niter) - else: F, G = nmf(X, rank, niter=niter) + if CNMF: F, G0 = cnmf(X, rank, niter=niter) + else: F, G0 = nmf(X, rank, niter=niter) except: - return np.empty(0), [1] + return np.empty(0), np.empty(0), [1] # Filter G - G = filter_activation_matrix(G.T, R) + G = filter_activation_matrix(G0.T, R) if bound_idxs is None: bound_idxs = np.where(np.diff(G) != 0)[0] + 1 @@ -153,5 +153,8 @@ bound_idxs = None else: break - - return G, bound_idxs + + # Obtain decomposition matrices Rd + R = F.dot(G0) + print 'R, F, G', R.shape, F.shape, G.shape + return F, G0, R, bound_idxs