repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
NeuroKit | NeuroKit-master/neurokit2/signal/signal_decompose.py | import numpy as np
from ..misc import as_vector
def signal_decompose(signal, method="emd", n_components=None, **kwargs):
"""**Decompose a signal**
Signal decomposition into different sources using different methods, such as Empirical Mode
Decomposition (EMD) or Singular spectrum analysis (SSA)-based sig... | 6,075 | 31.148148 | 148 | py |
NeuroKit | NeuroKit-master/neurokit2/signal/signal_interpolate.py | # -*- coding: utf-8 -*-
from warnings import warn
import numpy as np
import pandas as pd
import scipy.interpolate
from ..misc import NeuroKitWarning
def signal_interpolate(
x_values, y_values=None, x_new=None, method="quadratic", fill_value=None
):
"""**Interpolate a signal**
Interpolate a signal using... | 8,348 | 40.745 | 103 | py |
NeuroKit | NeuroKit-master/neurokit2/signal/signal_changepoints.py | import numpy as np
from ..events import events_plot
from ..misc import as_vector
from .signal_plot import signal_plot
def signal_changepoints(signal, change="meanvar", penalty=None, show=False):
"""**Change Point Detection**
Only the PELT method is implemented for now.
Parameters
-----------
si... | 4,929 | 28.878788 | 102 | py |
NeuroKit | NeuroKit-master/neurokit2/signal/signal_rate.py | # -*- coding: utf-8 -*-
from .signal_period import signal_period
def signal_rate(
peaks, sampling_rate=1000, desired_length=None, interpolation_method="monotone_cubic"
):
"""**Compute Signal Rate**
Calculate signal rate (per minute) from a series of peaks. It is a general function that works
for any ... | 3,728 | 42.360465 | 100 | py |
NeuroKit | NeuroKit-master/neurokit2/signal/signal_phase.py | # -*- coding: utf-8 -*-
import itertools
import numpy as np
import scipy.signal
def signal_phase(signal, method="radians"):
"""**Compute the phase of the signal**
The real phase has the property to rotate uniformly, leading to a uniform distribution density.
The prophase typically doesn't fulfill this p... | 3,303 | 30.769231 | 119 | py |
NeuroKit | NeuroKit-master/neurokit2/signal/signal_fillmissing.py | import pandas as pd
def signal_fillmissing(signal, method="both"):
"""**Handle missing values**
Fill missing values in a signal using specific methods.
Parameters
----------
signal : Union[list, np.array, pd.Series]
The signal (i.e., a time series) in the form of a vector of values.
... | 1,105 | 27.358974 | 94 | py |
NeuroKit | NeuroKit-master/neurokit2/signal/signal_formatpeaks.py | # -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
def signal_formatpeaks(info, desired_length, peak_indices=None, other_indices=None):
"""**Format Peaks**
Transforms a peak-info dict to a signal of given length
"""
if peak_indices is None:
peak_indices = [key for key in info.key... | 4,331 | 33.110236 | 104 | py |
NeuroKit | NeuroKit-master/neurokit2/signal/signal_zerocrossings.py | # -*- coding: utf-8 -*-
import numpy as np
def signal_zerocrossings(signal, direction="both"):
"""**Locate the indices where the signal crosses zero**
Note that when the signal crosses zero between two points, the first index is returned.
Parameters
----------
signal : Union[list, np.array, pd.S... | 1,564 | 26.946429 | 92 | py |
NeuroKit | NeuroKit-master/neurokit2/signal/signal_smooth.py | # -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
import scipy.ndimage
import scipy.signal
from ..stats import fit_loess
def signal_smooth(signal, method="convolution", kernel="boxzen", size=10, alpha=0.1):
"""**Signal smoothing**
Signal smoothing can be achieved using either the convolution of... | 5,358 | 33.352564 | 100 | py |
NeuroKit | NeuroKit-master/neurokit2/microstates/microstates_dynamic.py | # -*- coding: utf-8 -*-
import pandas as pd
from ..markov import transition_matrix
from ..misc import as_vector
def microstates_dynamic(microstates, show=False):
"""**Dynamic Properties of Microstates**
This computes statistics related to the transition pattern (based on the
:func:`.transition_matrix`).... | 2,081 | 26.394737 | 95 | py |
NeuroKit | NeuroKit-master/neurokit2/microstates/microstates_peaks.py | # -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
import scipy.signal
from ..eeg import eeg_gfp
def microstates_peaks(eeg, gfp=None, sampling_rate=None, distance_between=0.01, **kwargs):
"""**Find peaks of stability using the GFP**
Peaks in the global field power (GFP) are often used to find mi... | 3,783 | 30.798319 | 110 | py |
NeuroKit | NeuroKit-master/neurokit2/microstates/microstates_complexity.py | # -*- coding: utf-8 -*-
import pandas as pd
from ..complexity import entropy_shannon
from ..misc import as_vector
def microstates_complexity(microstates, show=False):
"""**Complexity of Microstates Pattern**
This computes the complexity related to the sequence of the microstates pattern.
.. note::
... | 1,692 | 26.754098 | 94 | py |
NeuroKit | NeuroKit-master/neurokit2/microstates/microstates_clean.py | # -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
from ..eeg import eeg_gfp
from ..stats import standardize
from .microstates_peaks import microstates_peaks
def microstates_clean(
eeg,
sampling_rate=None,
train="gfp",
standardize_eeg=True,
normalize=True,
gfp_method="l1",
**k... | 3,329 | 32.636364 | 98 | py |
NeuroKit | NeuroKit-master/neurokit2/microstates/microstates_findnumber.py | # -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from ..misc import find_knee, progress_bar
from ..stats.cluster_quality import _cluster_quality_dispersion
from .microstates_segment import microstates_segment
def microstates_findnumber(
eeg, n_max=12, method="GEV", c... | 4,713 | 34.179104 | 98 | py |
NeuroKit | NeuroKit-master/neurokit2/microstates/microstates_segment.py | # -*- coding: utf-8 -*-
import numpy as np
from ..misc import check_random_state
from ..stats import cluster
from ..stats.cluster_quality import _cluster_quality_gev
from .microstates_classify import microstates_classify
from .microstates_clean import microstates_clean
def microstates_segment(
eeg,
n_microst... | 11,449 | 38.482759 | 108 | py |
NeuroKit | NeuroKit-master/neurokit2/microstates/__init__.py | """Submodule for NeuroKit."""
from .microstates_clean import microstates_clean
from .microstates_peaks import microstates_peaks
from .microstates_static import microstates_static
from .microstates_dynamic import microstates_dynamic
from .microstates_complexity import microstates_complexity
from .microstates_segment im... | 813 | 34.391304 | 58 | py |
NeuroKit | NeuroKit-master/neurokit2/microstates/microstates_classify.py | # -*- coding: utf-8 -*-
import numpy as np
from ..misc import replace
def microstates_classify(segmentation, microstates):
"""**Reorder (sort) the microstates (experimental)**
Reorder (sort) the microstates (experimental) based on the pattern of values in the vector of
channels (thus, depends on how cha... | 2,460 | 28.650602 | 97 | py |
NeuroKit | NeuroKit-master/neurokit2/microstates/microstates_static.py | # -*- coding: utf-8 -*-
import matplotlib.gridspec
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from ..misc import as_vector, find_groups
def microstates_static(microstates, sampling_rate=1000, show=False):
"""**Static Properties of Microstates**
The duration of each microstat... | 6,410 | 27.878378 | 112 | py |
NeuroKit | NeuroKit-master/neurokit2/microstates/microstates_plot.py | # -*- coding: utf-8 -*-
import matplotlib
import matplotlib.gridspec
import matplotlib.pyplot as plt
import numpy as np
def microstates_plot(microstates, segmentation=None, gfp=None, info=None, epoch=None):
"""**Visualize Microstates**
Plots the clustered microstates.
Parameters
----------
micro... | 4,154 | 31.460938 | 99 | py |
NeuroKit | NeuroKit-master/neurokit2/markov/markov_test_random.py | # -*- coding: utf-8 -*-
import pandas as pd
import scipy.stats
from .transition_matrix import _sanitize_tm_input
def markov_test_random(fm):
"""**Is the Markov process random?**
This function computes the expected (theoretical) transition matrix if the order of appearance
of each state was governed only... | 1,865 | 26.850746 | 98 | py |
NeuroKit | NeuroKit-master/neurokit2/markov/markov_simulate.py | # -*- coding: utf-8 -*-
import numpy as np
from ..misc import check_random_state
from .transition_matrix import _sanitize_tm_input
def markov_simulate(tm, n=10, random_state=None):
"""**Markov Chain Simulation**
Given a :func:`transition_matrix`, this function simulates the corresponding sequence of states
... | 1,606 | 23.348485 | 106 | py |
NeuroKit | NeuroKit-master/neurokit2/markov/transition_matrix.py | # -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from ..misc import as_vector
def transition_matrix(sequence, order=1, adjust=True, show=False):
"""**Transition Matrix**
A **Transition Matrix** (also known as a stochastic matrix or a **Markov matrix**) is a
... | 6,349 | 31.070707 | 102 | py |
NeuroKit | NeuroKit-master/neurokit2/markov/markov_mixingtime.py | # -*- coding: utf-8 -*-
import numpy as np
from .transition_matrix import _sanitize_tm_input
def markov_mixingtime(tm):
"""**Markov Chain Mixing Time**
The Mixing time (also known as relaxation time) is the inverse of spectral gap, which is the
difference between the two largest eigenvalues of the trans... | 1,380 | 22.016667 | 97 | py |
NeuroKit | NeuroKit-master/neurokit2/markov/__init__.py | """Submodule for NeuroKit."""
from .markov_mixingtime import markov_mixingtime
from .markov_simulate import markov_simulate
from .markov_test_homogeneity import markov_test_homogeneity
from .markov_test_markovity import markov_test_markovity
from .markov_test_random import markov_test_random
from .markov_test_symmetry... | 600 | 29.05 | 60 | py |
NeuroKit | NeuroKit-master/neurokit2/markov/markov_test_homogeneity.py | # -*- coding: utf-8 -*-
import numpy as np
import scipy.stats
def markov_test_homogeneity(sequence, size=10):
"""**Is the Markov process homogeneous?**
Performs a homogeneity test that tests the null hypothesis that the samples are
homogeneous, i.e., from the same - but unspecified - population, against ... | 2,506 | 29.204819 | 95 | py |
NeuroKit | NeuroKit-master/neurokit2/markov/markov_test_markovity.py | import numpy as np
import pandas as pd
import scipy.stats
from .transition_matrix import transition_matrix
def markov_test_markovity(sequence):
"""**Test of Markovity**
The Markovity (also known as Markovianity) of a symbolic sequence.
.. note::
We would like to extend this to different orders (... | 3,341 | 25.52381 | 99 | py |
NeuroKit | NeuroKit-master/neurokit2/markov/markov_test_symmetry.py | # -*- coding: utf-8 -*-
import numpy as np
import scipy.stats
from .transition_matrix import _sanitize_tm_input
def markov_test_symmetry(fm):
"""**Is the Markov process symmetric?**
Performs a symmetry test, to test if for instance if the transitions A -> B and B -> A occur
with the same probability. If... | 1,737 | 25.333333 | 98 | py |
NeuroKit | NeuroKit-master/neurokit2/epochs/epochs_to_df.py | # -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
def epochs_to_df(epochs):
"""**Convert epochs to a DataFrame**
Convert epochs to a DataFrame.
Parameters
----------
epochs : dict
A dict containing one DataFrame per event/trial. Usually obtained via `epochs_create()`.
... | 1,721 | 25.090909 | 96 | py |
NeuroKit | NeuroKit-master/neurokit2/epochs/epochs_to_array.py | # -*- coding: utf-8 -*-
import numpy as np
def epochs_to_array(epochs):
"""**Epochs to Array**
Convert epochs to a numpy array.
.. note::
TODO: We would like to make it work with uneven epochs (not the same length).
Parameters
----------
epochs : dict
A dict containing one ... | 1,626 | 25.672131 | 106 | py |
NeuroKit | NeuroKit-master/neurokit2/epochs/epochs_plot.py | # -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
from .epochs_to_df import epochs_to_df
def epochs_plot(epochs, legend=True, **kwargs):
"""**Epochs visualization**
Plot epochs.
Parameters
----------
epochs : dict
A dict containing one DataFrame per event/trial. Usually obtained v... | 4,230 | 30.574627 | 116 | py |
NeuroKit | NeuroKit-master/neurokit2/epochs/epochs_create.py | # -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
from ..events.events_find import _events_find_label
from ..misc import listify
def epochs_create(
data,
events=None,
sampling_rate=1000,
epochs_start=0,
epochs_end="from_events",
event_labels=None,
event_conditions=None,
b... | 7,510 | 33.454128 | 98 | py |
NeuroKit | NeuroKit-master/neurokit2/epochs/__init__.py | """Submodule for NeuroKit."""
from .epochs_average import epochs_average
from .epochs_create import epochs_create
from .epochs_plot import epochs_plot
from .epochs_to_array import epochs_to_array
from .epochs_to_df import epochs_to_df
__all__ = ["epochs_create", "epochs_to_df", "epochs_to_array", "epochs_average", "e... | 333 | 32.4 | 95 | py |
NeuroKit | NeuroKit-master/neurokit2/epochs/eventrelated_utils.py | # -*- coding: utf-8 -*-
from warnings import warn
import numpy as np
import pandas as pd
from ..misc import NeuroKitWarning, find_closest
from ..stats import fit_polynomial
from .epochs_to_df import _df_to_epochs
def _eventrelated_sanitizeinput(epochs, what="ecg", silent=False):
# Sanity checks
if isinstanc... | 4,183 | 33.295082 | 98 | py |
NeuroKit | NeuroKit-master/neurokit2/epochs/epochs_average.py | # -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
from .epochs_to_df import epochs_to_df
def epochs_average(epochs, which=None, show=False, **kwargs):
"""**Compute Grand Average**
Average epochs and returns the grand average, as well as the SD and the confidence interval.
Parameters
---------... | 2,383 | 26.402299 | 96 | py |
NeuroKit | NeuroKit-master/neurokit2/eog/eog_clean.py | # -*- coding: utf-8 -*-
from warnings import warn
import numpy as np
import pandas as pd
import scipy.ndimage
from ..misc import NeuroKitWarning, as_vector
from ..signal import signal_filter
def eog_clean(eog_signal, sampling_rate=1000, method="neurokit"):
"""**Clean an EOG signal**
Prepare a raw EOG signa... | 8,170 | 33.045833 | 113 | py |
NeuroKit | NeuroKit-master/neurokit2/eog/eog_intervalrelated.py | # -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
def eog_intervalrelated(data):
"""**EOG analysis on longer periods of data**
Performs EOG analysis on longer periods of data (typically > 10 seconds), such as resting-state
data.
Parameters
----------
data : Union[dict, pd.DataFr... | 3,245 | 28.779817 | 99 | py |
NeuroKit | NeuroKit-master/neurokit2/eog/eog_findpeaks.py | # -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
from ..epochs import epochs_create, epochs_to_array
from ..misc import as_vector
from ..signal import signal_findpeaks, signal_fixpeaks
from ..stats import fit_rmse, rescale
from .eog_features import _eog_features_delineate
from .eog_simulate i... | 10,326 | 34.245734 | 101 | py |
NeuroKit | NeuroKit-master/neurokit2/eog/eog_analyze.py | # -*- coding: utf-8 -*-
import pandas as pd
from .eog_eventrelated import eog_eventrelated
from .eog_intervalrelated import eog_intervalrelated
def eog_analyze(data, sampling_rate=1000, method="auto"):
"""**EOG Analysis**
Performs EOG analysis on either epochs (event-related analysis) or on longer periods o... | 3,868 | 33.855856 | 124 | py |
NeuroKit | NeuroKit-master/neurokit2/eog/eog_features.py | # -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
from ..epochs import epochs_create
from ..signal import signal_zerocrossings
def eog_features(eog_cleaned, peaks, sampling_rate=1000):
"""**Extracts Features of EOG Eye Blinks**
Extracts features of EOG eye blinks e.g., velocity measures, blink-... | 8,542 | 38.009132 | 116 | py |
NeuroKit | NeuroKit-master/neurokit2/eog/eog_simulate.py | import numpy as np
import scipy.stats
# ==============================================================================
# THIS IS WIP and we would like to implement an EOG simulator. Please help!
# ==============================================================================
def _eog_simulate_blink(sampling_rate=1000... | 1,892 | 34.055556 | 97 | py |
NeuroKit | NeuroKit-master/neurokit2/eog/eog_process.py | # -*- coding: utf-8 -*-
import pandas as pd
from ..misc import as_vector
from ..signal import signal_rate
from ..signal.signal_formatpeaks import _signal_from_indices
from .eog_clean import eog_clean
from .eog_findpeaks import eog_findpeaks
def eog_process(veog_signal, sampling_rate=1000, **kwargs):
"""**Process... | 2,741 | 30.159091 | 104 | py |
NeuroKit | NeuroKit-master/neurokit2/eog/eog_eventrelated.py | # -*- coding: utf-8 -*-
from warnings import warn
import numpy as np
from ..epochs.eventrelated_utils import (
_eventrelated_addinfo,
_eventrelated_rate,
_eventrelated_sanitizeinput,
_eventrelated_sanitizeoutput,
)
from ..misc import NeuroKitWarning
def eog_eventrelated(epochs, silent=False):
""... | 3,862 | 29.65873 | 100 | py |
NeuroKit | NeuroKit-master/neurokit2/eog/__init__.py | """Submodule for NeuroKit."""
from ..signal import signal_rate as eog_rate
from .eog_analyze import eog_analyze
from .eog_clean import eog_clean
from .eog_eventrelated import eog_eventrelated
from .eog_features import eog_features
from .eog_findpeaks import eog_findpeaks
from .eog_intervalrelated import eog_intervalre... | 638 | 23.576923 | 52 | py |
NeuroKit | NeuroKit-master/neurokit2/eog/eog_peaks.py | from ..signal import signal_formatpeaks
from .eog_findpeaks import eog_findpeaks
def eog_peaks(veog_cleaned, sampling_rate=None, method="mne", **kwargs):
"""**Locate EOG eye blinks**
Parameters
----------
veog_cleaned : Union[list, np.array, pd.Series]
The cleaned vertical EOG channel. Note t... | 3,523 | 32.245283 | 109 | py |
NeuroKit | NeuroKit-master/neurokit2/eog/eog_plot.py | # -*- coding: utf-8 -*-
import matplotlib.gridspec
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from ..epochs import epochs_create, epochs_to_array, epochs_to_df
from ..stats import standardize
def eog_plot(eog_signals, peaks=None, sampling_rate=None):
"""**Visualize EOG data**
Par... | 4,808 | 32.165517 | 99 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/utils_complexity_ordinalpatterns.py | import numpy as np
from .utils_complexity_embedding import complexity_embedding
def complexity_ordinalpatterns(signal, delay=1, dimension=3, algorithm="quicksort", **kwargs):
"""**Find Ordinal Patterns for Permutation Procedures**
The seminal work by Bandt and Pompe (2002) introduced a symbolization approac... | 3,626 | 33.216981 | 109 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/complexity.py | import numpy as np
import pandas as pd
from .complexity_hjorth import complexity_hjorth
from .entropy_attention import entropy_attention
from .entropy_bubble import entropy_bubble
from .entropy_multiscale import entropy_multiscale
from .entropy_permutation import entropy_permutation
from .entropy_svd import entropy_sv... | 8,255 | 40.074627 | 118 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/fractal_dfa.py | # -*- coding: utf-8 -*-
from warnings import warn
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from ..misc import find_knee
def fractal_dfa(
signal,
scale="default",
overlap=True,
integrate=True,
order=1,
multifractal=False,
q="default",
ma... | 25,243 | 38.567398 | 112 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/entropy_kolmogorov.py | import numpy as np
import pandas as pd
from .utils_complexity_embedding import complexity_embedding
from .optim_complexity_tolerance import complexity_tolerance
def entropy_kolmogorov(signal=None, delay=1, dimension=3, tolerance="sd"):
"""**Kolmogorov Entropy (K2 or K2En)**
Kolmogorov Entropy, also known as... | 3,190 | 29.390476 | 98 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/entropy_bubble.py | # -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
from .entropy_permutation import _entropy_permutation
from .entropy_renyi import entropy_renyi
def entropy_bubble(signal, delay=1, dimension=3, alpha=2, **kwargs):
"""**Bubble Entropy (BubblEn)**
Introduced by Manis et al. (2017) with the goal o... | 2,990 | 32.606742 | 110 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/entropy_distribution.py | import numpy as np
import pandas as pd
import scipy.stats
from .utils_complexity_embedding import complexity_embedding
from .entropy_shannon import entropy_shannon
def entropy_distribution(signal=None, delay=1, dimension=3, bins="Sturges", base=2):
"""**Distribution Entropy (DistrEn)**
Distribution Entropy ... | 3,817 | 31.913793 | 98 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/entropy_hierarchical.py | import matplotlib.cm
import matplotlib.gridspec
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from .entropy_sample import entropy_sample
from .optim_complexity_tolerance import complexity_tolerance
def entropy_hierarchical(
signal, scale="default", dimension=2, tolerance="sd", show=False... | 7,284 | 35.243781 | 100 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/fractal_linelength.py | # -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
def fractal_linelength(signal):
"""**Line Length (LL)**
Line Length (LL, also known as curve length), stems from a modification of the
:func:`Katz fractal dimension <fractal_katz>` algorithm, with the goal of making it more
efficient and ... | 2,149 | 28.861111 | 99 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/entropy_sample.py | # -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
from .optim_complexity_tolerance import complexity_tolerance
from .utils import _phi, _phi_divide
def entropy_sample(signal, delay=1, dimension=2, tolerance="sd", **kwargs):
"""**Sample Entropy (SampEn)**
Compute the sample entropy (SampEn) of a... | 3,187 | 32.914894 | 98 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/optim_complexity_tolerance.py | # -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import matplotlib.ticker
import numpy as np
import scipy.spatial
import sklearn.neighbors
from ..stats import density
from .utils import _phi
from .utils_complexity_embedding import complexity_embedding
def complexity_tolerance(
signal, method="maxApEn", r_... | 19,419 | 36.929688 | 101 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/entropy_increment.py | import numpy as np
import pandas as pd
from .utils_complexity_embedding import complexity_embedding
from .entropy_shannon import entropy_shannon
def entropy_increment(signal, dimension=2, q=4, **kwargs):
"""**Increment Entropy (IncrEn) and its Multiscale variant (MSIncrEn)**
Increment Entropy (IncrEn) quant... | 5,168 | 41.02439 | 99 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/fractal_higuchi.py | # -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from .optim_complexity_k import _complexity_k_slope, complexity_k
def fractal_higuchi(signal, k_max="default", show=False, **kwargs):
"""**Higuchi's Fractal Dimension (HFD)**
The Higuchi's Fractal Dimension (HFD) ... | 5,361 | 32.304348 | 100 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/complexity_lempelziv.py | # -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
from .utils_complexity_ordinalpatterns import complexity_ordinalpatterns
from .utils_complexity_symbolize import complexity_symbolize
def complexity_lempelziv(
signal,
delay=1,
dimension=2,
permutation=False,
symbolize="mean",
**k... | 8,876 | 39.167421 | 109 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/entropy_shannon_joint.py | import numpy as np
import scipy.stats
from .entropy_shannon import _entropy_freq
def entropy_shannon_joint(x, y, base=2):
"""**Shannon's Joint Entropy**
The joint entropy measures how much entropy is contained in a joint system of two random
variables.
Parameters
----------
x : Union[list, ... | 1,440 | 24.732143 | 93 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/optim_complexity_delay.py | # -*- coding: utf-8 -*-
import itertools
from warnings import warn
import matplotlib
import matplotlib.collections
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy.signal
import scipy.spatial
import scipy.stats
from ..misc import NeuroKitWarning, find_closest
from ..signal import (s... | 30,487 | 37.987212 | 109 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/entropy_renyi.py | import numpy as np
from .entropy_shannon import _entropy_freq
def entropy_renyi(signal=None, alpha=1, symbolize=None, show=False, freq=None, **kwargs):
"""**Rényi entropy (REn or H)**
In information theory, the Rényi entropy *H* generalizes the Hartley entropy, the Shannon
entropy, the collision entropy... | 2,898 | 30.857143 | 103 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/fractal_sevcik.py | import numpy as np
import pandas as pd
from ..stats import rescale
def fractal_sevcik(signal):
"""**Sevcik Fractal Dimension (SFD)**
The SFD algorithm was proposed to calculate the fractal dimension of waveforms by Sevcik
(1998). This method can be used to quickly measure the complexity and randomness o... | 2,856 | 33.841463 | 100 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/utils_complexity_simulate.py | # -*- coding: utf-8 -*-
import numpy as np
from .utils_complexity_attractor import _attractor_lorenz
def complexity_simulate(
duration=10, sampling_rate=1000, method="ornstein", hurst_exponent=0.5, **kwargs
):
"""**Simulate chaotic time series**
This function generates a chaotic signal using different a... | 9,912 | 31.395425 | 118 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/fractal_katz.py | # -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
def fractal_katz(signal):
"""**Katz's Fractal Dimension (KFD)**
Computes Katz's Fractal Dimension (KFD). The euclidean distances between successive points in
the signal are summed and averaged, and the maximum distance between the starting po... | 2,915 | 26.771429 | 99 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/entropy_cosinesimilarity.py | import numpy as np
import pandas as pd
from ..stats import rescale
from .utils_complexity_embedding import complexity_embedding
from .optim_complexity_tolerance import complexity_tolerance
def entropy_cosinesimilarity(signal=None, delay=1, dimension=3, tolerance="sd"):
"""**Cosine Similarity Entropy (CoSiEn) and... | 4,292 | 34.775 | 99 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/utils_complexity_symbolize.py | # -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy.cluster.vq
import scipy.special
from ..stats import standardize
from .optim_complexity_tolerance import complexity_tolerance
def complexity_symbolize(signal, method="mean", c=3, show=False, **kwargs):
"""... | 10,984 | 37.54386 | 100 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/complexity_hjorth.py | import numpy as np
import pandas as pd
def complexity_hjorth(signal):
"""**Hjorth's Complexity and Parameters**
Hjorth Parameters are indicators of statistical properties initially introduced by Hjorth
(1970) to describe the general characteristics of an EEG trace in a few quantitative terms, but
whi... | 3,457 | 31.933333 | 100 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/utils_recurrence_matrix.py | import matplotlib.pyplot as plt
import matplotlib.ticker
import numpy as np
import scipy.spatial
from .optim_complexity_tolerance import complexity_tolerance
from .utils_complexity_embedding import complexity_embedding
def recurrence_matrix(signal, delay=1, dimension=3, tolerance="default", show=False):
"""**Rec... | 4,884 | 35.729323 | 100 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/fractal_correlation.py | # -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import sklearn.metrics.pairwise
from ..misc import expspace
from .utils_complexity_embedding import complexity_embedding
def fractal_correlation(signal, delay=1, dimension=2, radius=64, show=False, **kwargs):
"""**Corr... | 6,393 | 37.751515 | 99 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/entropy_kl.py | import numpy as np
import pandas as pd
import scipy.spatial
import scipy.special
from .utils_complexity_embedding import complexity_embedding
def entropy_kl(signal, delay=1, dimension=2, norm="euclidean", **kwargs):
"""**Kozachenko-Leonenko (K-L) Differential entropy (KLEn)**
The Kozachenko-Leonenko (K-L) e... | 4,914 | 37.100775 | 98 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/utils.py | # -*- coding: utf-8 -*-
import numpy as np
import sklearn.metrics
import sklearn.neighbors
from packaging import version
from .utils_complexity_embedding import complexity_embedding
# =============================================================================
# Phi
# ================================================... | 5,241 | 30.769697 | 99 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/fractal_sda.py | # -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from ..signal import signal_detrend
def fractal_sda(signal, scales=None, show=False):
"""**Standardised Dispersion Analysis (SDA)**
SDA is part of a family of dispersion techniques used to compute fractal dimensio... | 5,048 | 34.307692 | 100 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/information_gain.py | import numpy as np
from .utils_complexity_embedding import complexity_embedding
from .utils_complexity_symbolize import complexity_symbolize
def information_gain(signal, delay=1, dimension=4, symbolize="mean"):
"""**Mean Information Gain (MIG)** and **Fluctuation Complexity (FC)**
Mean Information Gain (MIG... | 4,307 | 39.641509 | 99 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/entropy_power.py | import numpy as np
import pandas as pd
import scipy.integrate
from ..stats import density
def entropy_power(signal, **kwargs):
"""**Entropy Power (PowEn)**
The Shannon Entropy Power (PowEn or SEP) is a measure of the effective variance of a random
vector. It is based on the estimation of the density of ... | 3,166 | 31.649485 | 106 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/information_mutual.py | # -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
import scipy.ndimage
import scipy.special
import scipy.stats
import sklearn.metrics
import sklearn.neighbors
def mutual_information(x, y, method="varoquaux", bins="default", **kwargs):
"""**Mutual Information (MI)**
Computes the mutual informatio... | 8,843 | 34.376 | 98 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/TODO_entropy_wiener.py | import numpy as np
import pandas as pd
from ..signal.signal_timefrequency import signal_timefrequency
def entropy_wiener(signal, sampling_rate=1000, **kwargs):
"""Wiener Entropy (WE, also known as Spectral Flatness)
The Wiener entropy (also known as Spectral Flatness, or tonality coefficient in sound
pr... | 3,002 | 35.180723 | 115 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/entropy_shannon.py | import numpy as np
import pandas as pd
import scipy.stats
from .utils_complexity_symbolize import complexity_symbolize
def entropy_shannon(signal=None, base=2, symbolize=None, show=False, freq=None, **kwargs):
"""**Shannon entropy (SE or ShanEn)**
Compute Shannon entropy (SE). Entropy is a measure of unpred... | 4,866 | 34.268116 | 99 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/entropy_grid.py | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from .entropy_shannon import entropy_shannon
def entropy_grid(signal, delay=1, k=3, show=False, **kwargs):
"""**Grid Entropy (GridEn)**
Grid Entropy (GridEn or GDEn) is defined as a gridded descriptor of a :func:`Poincaré plot <.hrv_nonl... | 4,579 | 30.156463 | 113 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/entropy_range.py | from .entropy_approximate import entropy_approximate
from .entropy_sample import entropy_sample
def entropy_range(signal, dimension=3, delay=1, tolerance="sd", approximate=False, **kwargs):
"""**Range Entropy (RangEn)**
Introduced by Omidvarnia et al. (2018), Range Entropy (RangEn or RangeEn) refers to a mod... | 4,172 | 37.638889 | 98 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/entropy_angular.py | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy.stats
from .utils_complexity_embedding import complexity_embedding
def entropy_angular(signal, delay=1, dimension=2, show=False, **kwargs):
"""**Angular entropy (AngEn)**
The Angular Entropy (AngEn) is the name that we use i... | 5,376 | 35.331081 | 99 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/optim_complexity_dimension.py | # -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
import scipy.spatial
from .fractal_correlation import fractal_correlation
from .utils_complexity_embedding import complexity_embedding
def complexity_dimension(signal, delay=1, dimension_max=20, method="afnn", show=False, **kwargs):
"""**... | 18,101 | 39.954751 | 118 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/optim_complexity_k.py | from warnings import warn
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from ..misc import NeuroKitWarning, find_plateau
def complexity_k(signal, k_max="max", show=False):
"""**Automated selection of k for Higuchi Fractal Dimension (HFD)**
The optimal *k-max* is computed based on t... | 6,280 | 33.13587 | 119 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/entropy_ofentropy.py | import numpy as np
import pandas as pd
from .entropy_shannon import entropy_shannon
def entropy_ofentropy(signal, scale=10, bins=10, **kwargs):
"""**Entropy of entropy (EnofEn)**
Entropy of entropy (EnofEn or EoE) combines the features of :func:`MSE <entropy_multiscale>`
with an alternate measure of inf... | 3,216 | 35.146067 | 98 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/entropy_cumulativeresidual.py | import itertools
import numpy as np
import pandas as pd
from .entropy_shannon import _entropy_freq
def entropy_cumulativeresidual(signal, symbolize=None, show=False, freq=None):
"""**Cumulative residual entropy (CREn)**
The cumulative residual entropy is an alternative to the Shannon
differential entro... | 3,365 | 32 | 101 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/complexity_relativeroughness.py | import numpy as np
import pandas as pd
from ..signal import signal_autocor
def complexity_relativeroughness(signal, **kwargs):
"""**Relative Roughness (RR)**
Relative Roughness is a ratio of local variance (autocovariance at lag-1) to global variance
(autocovariance at lag-0) that can be used to classif... | 1,865 | 30.627119 | 98 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/entropy_attention.py | from warnings import warn
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy.signal
from ..misc import NeuroKitWarning
def entropy_attention(signal, show=False, **kwargs):
"""**Attention Entropy (AttEn)**
Yang et al. (2020) propose a conceptually new approach called **Atten... | 4,975 | 30.897436 | 99 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/complexity_decorrelation.py | import numpy as np
import pandas as pd
from ..signal import signal_autocor
def complexity_decorrelation(signal):
"""**Decorrelation Time (DT)**
The decorrelation time (DT) is defined as the time (in samples) of the first zero crossing of
the autocorrelation sequence. A shorter decorrelation time corresp... | 2,275 | 30.611111 | 98 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/fractal_tmf.py | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy.stats
from packaging import version
from ..signal import signal_surrogate
from .fractal_dfa import fractal_dfa
def fractal_tmf(signal, n=40, show=False, **kwargs):
"""**Multifractal Nonlinearity (tMF)**
The Multifractal Nonl... | 4,893 | 36.358779 | 99 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/entropy_fuzzy.py | # -*- coding: utf-8 -*-
from .entropy_approximate import entropy_approximate
from .entropy_sample import entropy_sample
def entropy_fuzzy(signal, delay=1, dimension=2, tolerance="sd", approximate=False, **kwargs):
"""**Fuzzy Entropy (FuzzyEn)**
Fuzzy entropy (FuzzyEn) of a signal stems from the combination b... | 3,166 | 33.053763 | 100 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/utils_complexity_coarsegraining.py | # -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
import scipy.ndimage.filters
from ..signal import signal_interpolate
def complexity_coarsegraining(signal, scale=2, method="nonoverlapping", show=False, **kwargs):
"""**Coarse-graining of a signal**
The goal of coarse-graining is to ... | 9,547 | 39.457627 | 101 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/entropy_svd.py | import numpy as np
import pandas as pd
from .utils_complexity_embedding import complexity_embedding
def entropy_svd(signal, delay=1, dimension=2, show=False):
"""**Singular Value Decomposition (SVD) Entropy**
SVD entropy (SVDEn) can be intuitively seen as an indicator of how many eigenvectors are needed
... | 2,732 | 35.932432 | 102 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/entropy_slope.py | import numpy as np
import pandas as pd
from .entropy_shannon import entropy_shannon
def entropy_slope(signal, dimension=3, thresholds=[0.1, 45], **kwargs):
"""**Slope Entropy (SlopEn)**
Slope Entropy (SlopEn) uses an alphabet of three symbols, 0, 1, and 2, with positive (+) and
negative versions (-) of ... | 3,938 | 34.486486 | 104 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/optim_complexity_optimize.py | import matplotlib
import matplotlib.collections
import matplotlib.pyplot as plt
import numpy as np
from .entropy_approximate import entropy_approximate
from .optim_complexity_delay import (
_embedding_delay_metric,
_embedding_delay_plot,
_embedding_delay_select,
)
from .optim_complexity_dimension import (
... | 9,977 | 31.501629 | 100 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/fractal_nld.py | from warnings import warn
import numpy as np
import pandas as pd
from ..misc import NeuroKitWarning
from ..stats import standardize
def fractal_nld(signal, corrected=False):
"""**Fractal dimension via Normalized Length Density (NLDFD)**
NLDFD is a very simple index corresponding to the average absolute con... | 4,552 | 32.233577 | 100 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/__init__.py | """Submodule for NeuroKit."""
import functools
from .complexity import complexity
from .complexity_decorrelation import complexity_decorrelation
from .complexity_hjorth import complexity_hjorth
from .complexity_lempelziv import complexity_lempelziv
from .complexity_lyapunov import complexity_lyapunov
from .complexity_... | 7,448 | 33.971831 | 90 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/entropy_phase.py | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from .entropy_shannon import entropy_shannon
def entropy_phase(signal, delay=1, k=4, show=False, **kwargs):
"""**Phase Entropy (PhasEn)**
Phase entropy (PhasEn or PhEn) has been developed by quantifying the distribution of the signal
... | 4,979 | 33.825175 | 119 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/TODO_fractal_capacity.py | # flake8: noqa
# WIP ================================================================
# -0*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
import scipy.interpolate
import scipy.misc
from .utils_complexity_embedding import complexity_embedding
def fractal_capacity(signal, delay=1, rounding=3, s... | 3,403 | 26.901639 | 100 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/fractal_psdslope.py | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from ..signal import signal_detrend, signal_psd
def fractal_psdslope(signal, method="voss1988", show=False, **kwargs):
"""**Fractal dimension via Power Spectral Density (PSD) slope**
Fractal exponent can be computed from Power Spectral D... | 5,899 | 37.815789 | 118 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/entropy_dispersion.py | import numpy as np
import pandas as pd
from .entropy_shannon import entropy_shannon
from .utils_complexity_embedding import complexity_embedding
from .utils_complexity_symbolize import complexity_symbolize
def entropy_dispersion(
signal, delay=1, dimension=3, c=6, symbolize="NCDF", fluctuation=False, rho=1, **kw... | 4,292 | 35.07563 | 98 | py |
NeuroKit | NeuroKit-master/neurokit2/complexity/entropy_differential.py | import numpy as np
import pandas as pd
import scipy.stats
def entropy_differential(signal, base=2, **kwargs):
"""**Differential entropy (DiffEn)**
Differential entropy (DiffEn; also referred to as continuous entropy) started as an
attempt by Shannon to extend Shannon entropy. However, differential entrop... | 2,600 | 31.924051 | 100 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.