Пример #1
0
def test_detect_slowwave_Ngo2015():
    detsw = DetectSlowWave(method='Ngo2015')
    detsw.invert = True
    assert repr(detsw) == 'detsw_Ngo2015_0.50-1.20Hz'

    sw = detsw(data)
    assert len(sw.events) == 4
Пример #2
0
def test_detect_slowwave_AASM_Massimini2004():
    detsw = DetectSlowWave(method='AASM/Massimini2004')
    detsw.invert = True
    assert repr(detsw) == 'detsw_AASM/Massimini2004_0.10-4.00Hz'

    sw = detsw(data)
    assert len(sw.events) == 15
Пример #3
0
def test_detect_slowwave_to_data():
    detsw = DetectSlowWave()
    detsw.invert = True
    sw = detsw(data)

    sw_data = sw.to_data('count')
    assert sw_data(0)[1] == 1

    sw_ptp = sw.to_data('ptp')
    assert approx(sw_ptp(0)[1]) == 63.0
Пример #4
0
def test_detect_slowwave_to_data():
    detsw = DetectSlowWave()
    sw = detsw(data)

    sw_data = sw.to_data('count')
    assert sw_data(0)[1] == 2

    sw_auc = sw.to_data('area_under_curve')
    assert approx(sw_auc(0)[1]) == -16.454917436089122

    sw_ptp = sw.to_data('ptp')
    assert approx(sw_ptp(0)[1]) == 84.0
Пример #5
0
    """
    out, _, _ = detect_Moelle2011(data, sf, time, opts_spin)
    indices = np.zeros((len(out), 2))
    for i, k in enumerate(out):
        indices[i, 0] = k['start']
        indices[i, 1] = k['end']
    indices *= sf
    return indices.astype(int)


###############################################################################
# Slow-waves function
# ~~~~~~~~~~~~~~~~~~~

# Define a DetectSlowWave instance :
opts_sw = DetectSlowWave('Massimini2004')


# Define the function to replace :
def fcn_slowwave(data, sf, time, hypno):  # noqa
    """New slowwave detection function.

    See : https://wonambi-python.github.io/api/wonambi.detect.slowwave.html
    for an exhaustive list of implemented detections inside wonambi.
    """
    out = detect_Massimini2004(data, sf, time, opts_sw)
    indices = np.zeros((len(out), 2))
    for i, k in enumerate(out):
        indices[i, 0] = k['start']
        indices[i, 1] = k['end']
    indices *= sf
Пример #6
0
def test_detect_slowwave_Massimini2004():
    detsw = DetectSlowWave()
    assert repr(detsw) == 'detsw_Massimini2004_0.10-4.00Hz'

    sw = detsw(data)
    assert len(sw.events) == 2