コード例 #1
0
# recon_labels = np.where(np.array(bo_s.label) != 'observed')
#
# corrs = _corr_column(bo.get_data().values, bo_s.get_data().values)
#
# print('correlations with predict function = ' + str(corrs[recon_labels].mean()))
#
# assert np.allclose(corrs, corrs_1)

########## debug case 1 - null set ##################

# set random seed to default and noise to 0
random_seed = np.random.seed(123)
noise = 0

# locs
locs = se.simulate_locations(n_elecs=100, set_random_seed=random_seed)

# create model locs from 75 locations
mo_locs = locs.sample(75,
                      random_state=random_seed).sort_values(['x', 'y', 'z'])

# create covariance matrix from random seed
c = se.create_cov(cov='random', n_elecs=100)

# pull out model from covariance matrix
data = c[:, mo_locs.index][mo_locs.index, :]

# create model from subsetted covariance matrix and locations
model = se.Model(data=data, locs=mo_locs, n_subs=1)

# create brain object from the remaining locations - first find remaining 25 locations
コード例 #2
0
In this example, we demonstrate the simulate_bo function.
First, we'll load in some example locations. Then we'll simulate 1
brain object specifying a noise parameter and the correlational structure
of the data (a toeplitz matrix). We'll then subsample 10 locations from the
original brain object.

"""

# Code source: Lucy Owen & Andrew Heusser
# License: MIT

import supereeg as se

# simulate 100 locations
locs = se.simulate_locations(n_elecs=100)

# simulate brain object
bo = se.simulate_bo(n_samples=1000,
                    sample_rate=1000,
                    cov='toeplitz',
                    locs=locs,
                    noise=.3)

# sample 10 locations, and get indices
sub_locs = locs.sample(10, replace=False).sort_values(['x', 'y', 'z'])

R = se.create_cov(cov='random', n_elecs=len(sub_locs))
toe_model = se.Model(data=R, locs=sub_locs)

bo_s = toe_model.predict(bo, nearest_neighbor=False)
コード例 #3
0
def test_simulate_locations():
    locs = se.simulate_locations(10)
    assert isinstance(locs, pd.DataFrame)