File size: 550 Bytes
39b4c8c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import numpy as np
from scipy import signal
from .base import VHRMethod

class LGI(VHRMethod):
    methodName = 'LGI'
    
    def __init__(self, **kwargs):
        super(LGI, self).__init__(**kwargs)
        
    def apply(self, X):

        #M = np.mean(X, axis=1)
        #M = M[:, np.newaxis]
        #Xzero = X - M   # zero mean (row)
        
        U,_,_ = np.linalg.svd(X)

        S = U[:,0].reshape(1,-1) # array 2D shape (1,3)
        P = np.identity(3) - np.matmul(S.T,S)

        Y = np.dot(P,X)
        bvp = Y[1,:]

        return bvp