p_entropy.py
def ordinal_patterns(ts, embdim, embdelay):
    ''' This function computes the ordinal patterns of a time series for a given embedding dimension and embedding delay.
    USAGE: ordinal_patterns(ts, embdim, embdelay)
    ARGS: ts = Numeric vector representing the time series, embdim = embedding dimension (3<=embdim<=7 prefered range), embdelay =  embdding delay
    OUPTUT: A numeric vector representing frequencies of ordinal patterns'''
    m, t = embdim, embdelay
    x = ts if isinstance(ts, np.ndarray) else np.array(ts) 

    tmp = np.zeros((x.shape[0], m))
    for i in range(m):
        tmp[:, i] = np.roll(x, i*t)
    partition = tmp[(t*m-1):, :] 
    permutation = np.argsort(partition)
    idx = _hash(permutation)

    counts = np.zeros(np.math.factorial(m))
    for i in range(counts.shape[0]):
        counts[i] = (idx == i).sum()
    return list(counts[counts != 0].astype(int))
 This function computes the ordinal patterns of a time series for a given embedding dimension and embedding delay.
    USAGE: ordinal_patterns(ts, embdim, embdelay)
    ARGS: ts = Numeric vector representing the time series, embdim = embedding dimension (3<=embdim<=7 prefered range), embdelay =  embdding delay
    OUPTUT: A numeric vector representing frequencies of ordinal patterns
This function computes the ordinal patterns of a time series for a given embedding dimension and embedding delay.
This function computes the ordinal patterns of a time series for a given embedding dimension and embedding delay .
def ordinal_patterns(ts, embdim, embdelay):
    m, t = embdim, embdelay
    x = ts if isinstance(ts, np.ndarray) else np.array(ts) 
    tmp = np.zeros((x.shape[0], m))
    for i in range(m):
        tmp[:, i] = np.roll(x, i*t)
    partition = tmp[(t*m-1):, :] 
    permutation = np.argsort(partition)
    idx = _hash(permutation)
    counts = np.zeros(np.math.factorial(m))
    for i in range(counts.shape[0]):
        counts[i] = (idx == i).sum()
    return list(counts[counts != 0].astype(int))
def ordinal_patterns ( ts , embdim , embdelay ) : m , t = embdim , embdelay x = ts if isinstance ( ts , np . ndarray ) else np . array ( ts ) tmp = np . zeros ( ( x . shape [ 0 ] , m ) ) for i in range ( m ) : tmp [ : , i ] = np . roll ( x , i * t ) partition = tmp [ ( t * m - 1 ) : , : ] permutation = np . argsort ( partition ) idx = _hash ( permutation ) counts = np . zeros ( np . math . factorial ( m ) ) for i in range ( counts . shape [ 0 ] ) : counts [ i ] = ( idx == i ) . sum ( ) return list ( counts [ counts != 0 ] . astype ( int ) )
This function computes the ordinal patterns of a time series for a given embedding dimension and embedding delay.
This function computes the ordinal patterns of a time series for a given embedding dimension and embedding delay .
''' This function computes the ordinal patterns of a time series for a given embedding dimension and embedding delay.
    USAGE: ordinal_patterns(ts, embdim, embdelay)
    ARGS: ts = Numeric vector representing the time series, embdim = embedding dimension (3<=embdim<=7 prefered range), embdelay =  embdding delay
    OUPTUT: A numeric vector representing frequencies of ordinal patterns'''
ts
embdim
embdelay