Example #1
0
def simulate_pac_default(n_points=128,
                         fs=200.,
                         high_fq=50.,
                         low_fq=3.,
                         low_fq_width=1.,
                         noise_level=0.1,
                         random_state=42,
                         *args,
                         **kwargs):
    """Call simulate_pac with default values, used for testing only."""
    return simulate_pac(n_points,
                        fs,
                        high_fq,
                        low_fq,
                        low_fq_width,
                        noise_level,
                        random_state=random_state,
                        *args,
                        **kwargs)
Example #2
0
from pactools.simulate_pac import simulate_pac

# Parameters used for the simulated signal in the test
low_fq_range = [1., 3., 5., 7.]
high_fq_range = [25., 50., 75.]
n_low = len(low_fq_range)
n_high = len(high_fq_range)
high_fq = high_fq_range[1]
low_fq = low_fq_range[1]
n_points = 1024
fs = 200.

signal = simulate_pac(n_points=n_points,
                      fs=fs,
                      high_fq=high_fq,
                      low_fq=low_fq,
                      low_fq_width=1.,
                      noise_level=0.1,
                      random_state=0)


def fast_peak_locking(low_sig=signal,
                      high_sig=None,
                      mask=None,
                      fs=fs,
                      low_fq=low_fq,
                      *args,
                      **kwargs):
    return PeakLocking(fs=fs, low_fq=low_fq, *args,
                       **kwargs).fit(low_sig=low_sig,
                                     high_sig=high_sig,
Example #3
0
ALL_MODELS = [DAR, AR, HAR, StableDAR]

# Parameters used for the simulated sigin in the test
low_fq_range = [1., 3., 5., 7.]
high_fq_range = [25., 50., 75.]
n_low = len(low_fq_range)
n_high = len(high_fq_range)
high_fq = high_fq_range[1]
low_fq = low_fq_range[1]
n_points = 1024
fs = 200.

_sigin = simulate_pac(n_points=n_points,
                      fs=fs,
                      high_fq=high_fq,
                      low_fq=low_fq,
                      low_fq_width=1.,
                      noise_level=0.3,
                      random_state=0)
_sigdriv = simulate_pac(n_points=n_points,
                        fs=fs,
                        high_fq=high_fq,
                        low_fq=low_fq,
                        low_fq_width=1.,
                        noise_level=0.,
                        random_state=0,
                        high_fq_amp=0,
                        return_driver=True)
_sigdriv_imag = np.imag(_sigdriv)
_sigdriv = np.real(_sigdriv)
_noise = np.random.RandomState(0).randn(n_points)