Skip to content

Shannon Entropy

getEntropy(series, base=2, nBits=None)

Obtain Shannon Entropy estimate from a vector values/time series.

Parameters:

Name Type Description Default
series ndarray

Phases signal array for all parcels/voxels in the format [N, Tmax].

required
base double

Base of logarithm for Shannon entropy expression. Standard value is 2.

2
Return

double: Shannon entropy.

References

.. [1]

Source code in dynfc/getEntropy.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
def getEntropy(series, base = 2, nBits = None):
    """Obtain Shannon Entropy estimate from a vector values/time series.

    Args:
        series (ndarray): Phases signal array for all parcels/voxels in the format [N, Tmax].
        base (double, optional): Base of logarithm for Shannon entropy expression. Standard value is 2.

    Return:
        double: Shannon entropy.

    References
    ----------

    .. [1] 


    """

    if nBits != None:
        series = round_(multiply(series, 2 ** nBits))

    mags, probs = unique(series, 
                         return_counts=True)
    entr = entropy(probs, base=base)

    return entr