<gh_stars>0
import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal

from context import braingraphgeo as bgg


def test_geomsurr(sample_W_1, sample_D):
    W = sample_W_1.values
    d = sample_D.values
    Wgeo = bgg.surrogates.geomsurr(W, d, rs=2021)
    result = np.array([[0., 0.00072248, 0.00041477, 0.00033229, 0.00117053,
                        0.00055464, 0.00036433, 0.00056055],
                       [0.00072248, 0., 0.00057277, 0.0002278, 0.00030153,
                        0.00046146, 0.00016146, 0.00036927],
                       [0.00041477, 0.00057277, 0., 0.00048042, 0.00045515,
                        0.00033993, 0.00037418, 0.00065622],
                       [0.00033229, 0.0002278, 0.00048042, 0., 0.000422,
                        0.00063961, 0.00049343, 0.00052139],
                       [0.00117053, 0.00030153, 0.00045515, 0.000422, 0.,
                        0.00067446, 0.00056217, 0.00054075],
                       [0.00055464, 0.00046146, 0.00033993, 0.00063961, 0.00067446,
                        0., 0.00050643, 0.00012118],
                       [0.00036433, 0.00016146, 0.00037418, 0.00049343, 0.00056217,
                        0.00050643, 0., 0.00035025],
                       [0.00056055, 0.00036927, 0.00065622, 0.00052139, 0.00054075,
                        0.00012118, 0.00035025, 0.]])
    assert_array_almost_equal(Wgeo, result)


def test_randomsurr(sample_W_1):
    W = sample_W_1.values
    Wrand = bgg.surrogates.randomsurr(W, rs=2021)
    result = np.array([[0., 0.00051785, 0.00048846, 0.00030557, 0.0009939,
                        0.00062903, 0.00050726, 0.0006635],
                       [0.00051785, 0., 0.00062675, 0.00057998, 0.00049284,
                        0.00040059, 0.00016569, 0.00032815],
                       [0.00048846, 0.00062675, 0., 0.00049396, 0.00038688,
                        0.00012943, 0.00028872, 0.00041774],
                       [0.00030557, 0.00057998, 0.00049396, 0., 0.00045934,
                        0.00066296, 0.00040632, 0.00036962],
                       [0.0009939, 0.00049284, 0.00038688, 0.00045934, 0.,
                        0.00052429, 0.0005764, 0.00069369],
                       [0.00062903, 0.00040059, 0.00012943, 0.00066296, 0.00052429,
                        0., 0.00041742, 0.00037452],
                       [0.00050726, 0.00016569, 0.00028872, 0.00040632, 0.0005764,
                        0.00041742, 0., 0.00045061],
                       [0.0006635, 0.00032815, 0.00041774, 0.00036962, 0.00069369,
                        0.00037452, 0.00045061, 0.]])
    assert_array_almost_equal(Wrand, result)

import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal

from context import braingraphgeo as bgg


def test_geomsurr(sample_W_1, sample_D):
    W = sample_W_1.values
    d = sample_D.values
    Wgeo = bgg.surrogates.geomsurr(W, d, rs=2021)
    result = np.array([[0., 0.00072248, 0.00041477, 0.00033229, 0.00117053,
                        0.00055464, 0.00036433, 0.00056055],
                       [0.00072248, 0., 0.00057277, 0.0002278, 0.00030153,
                        0.00046146, 0.00016146, 0.00036927],
                       [0.00041477, 0.00057277, 0., 0.00048042, 0.00045515,
                        0.00033993, 0.00037418, 0.00065622],
                       [0.00033229, 0.0002278, 0.00048042, 0., 0.000422,
                        0.00063961, 0.00049343, 0.00052139],
                       [0.00117053, 0.00030153, 0.00045515, 0.000422, 0.,
                        0.00067446, 0.00056217, 0.00054075],
                       [0.00055464, 0.00046146, 0.00033993, 0.00063961, 0.00067446,
                        0., 0.00050643, 0.00012118],
                       [0.00036433, 0.00016146, 0.00037418, 0.00049343, 0.00056217,
                        0.00050643, 0., 0.00035025],
                       [0.00056055, 0.00036927, 0.00065622, 0.00052139, 0.00054075,
                        0.00012118, 0.00035025, 0.]])
    assert_array_almost_equal(Wgeo, result)


def test_randomsurr(sample_W_1):
    W = sample_W_1.values
    Wrand = bgg.surrogates.randomsurr(W, rs=2021)
    result = np.array([[0., 0.00051785, 0.00048846, 0.00030557, 0.0009939,
                        0.00062903, 0.00050726, 0.0006635],
                       [0.00051785, 0., 0.00062675, 0.00057998, 0.00049284,
                        0.00040059, 0.00016569, 0.00032815],
                       [0.00048846, 0.00062675, 0., 0.00049396, 0.00038688,
                        0.00012943, 0.00028872, 0.00041774],
                       [0.00030557, 0.00057998, 0.00049396, 0., 0.00045934,
                        0.00066296, 0.00040632, 0.00036962],
                       [0.0009939, 0.00049284, 0.00038688, 0.00045934, 0.,
                        0.00052429, 0.0005764, 0.00069369],
                       [0.00062903, 0.00040059, 0.00012943, 0.00066296, 0.00052429,
                        0., 0.00041742, 0.00037452],
                       [0.00050726, 0.00016569, 0.00028872, 0.00040632, 0.0005764,
                        0.00041742, 0., 0.00045061],
                       [0.0006635, 0.00032815, 0.00041774, 0.00036962, 0.00069369,
                        0.00037452, 0.00045061, 0.]])
    assert_array_almost_equal(Wrand, result)