Пример #1
0
def mce_def(info):  # noqa
    mce_def = MCE()
    parent = FileSource()
    parent.mne_info = info
    parent.output = np.random.rand(info['nchan'], 1)
    mce_def.parent = parent
    return mce_def
Пример #2
0
def inv_model_def(info):  # noqa
    inv_model_def = InverseModel()
    parent = FileSource()
    parent.mne_info = info
    parent.output = np.random.rand(info['nchan'], 1)
    inv_model_def.parent = parent
    return inv_model_def
Пример #3
0
def beamformer_default(info):  # noqa
    beamformer_default = Beamformer()
    parent = FileSource()
    parent.mne_info = info
    parent.output = np.random.rand(info['nchan'], 1)
    beamformer_default.parent = parent
    return beamformer_default
Пример #4
0
def env_extractor(info, data_path):  # noqa
    env_extractor = EnvelopeExtractor()
    env_extractor.mne_info = info
    N_SEN = len(info['ch_names'])
    env_extractor.input = np.random.rand(N_SEN)
    parent = FileSource(data_path)
    parent.output = np.random.rand(info['nchan'], 1)
    parent.mne_info = info
    env_extractor.parent = parent
    return env_extractor
Пример #5
0
def lin_filter(info, data_path):  # noqa
    lin_filter = LinearFilter()
    lin_filter.mne_info = info
    N_SEN = len(info['ch_names'])
    lin_filter.input = np.random.rand(N_SEN)
    parent = FileSource(data_path)
    parent.output = np.random.rand(info['nchan'], 1)
    parent.mne_info = info
    lin_filter.parent = parent
    return lin_filter
Пример #6
0
def coh_computer(info, data_path):  # noqa
    coh_computer = Coherence()
    coh_computer.mne_info = info
    N_SEN = len(info['ch_names'])
    coh_computer.input = np.random.rand(N_SEN)
    parent = FileSource(data_path)
    parent.output = np.random.rand(info['nchan'], 1)
    parent.mne_info = info
    coh_computer.parent = parent
    return coh_computer
Пример #7
0
def ica_rejector(info, data_path):  # noqa
    ica_rejector = ICARejection()
    ica_rejector.mne_info = info
    N_SEN = len(info['ch_names'])
    ica_rejector.input = np.random.rand(N_SEN)
    parent = FileSource(data_path)
    parent.output = np.random.rand(info['nchan'], 1)
    parent.mne_info = info
    ica_rejector.parent = parent
    return ica_rejector
Пример #8
0
def lsl_streamer(info, data_path):  # noqa
    lsl_streamer = LSLStreamOutput()
    lsl_streamer.mne_info = info
    N_SEN = len(info['ch_names'])
    lsl_streamer.input = np.random.rand(N_SEN)
    parent = FileSource(data_path)
    parent.output = np.random.rand(info['nchan'], 1)
    parent.mne_info = info
    lsl_streamer.parent = parent
    return lsl_streamer
Пример #9
0
def signal_viewer(info, data_path):  # noqa
    signal_viewer = SignalViewer()
    signal_viewer.mne_info = info
    N_SEN = len(info['ch_names'])
    signal_viewer.input = np.random.rand(N_SEN)
    parent = FileSource(data_path)
    parent.output = np.random.rand(info['nchan'], 1)
    parent.mne_info = info
    signal_viewer.parent = parent
    return signal_viewer
Пример #10
0
def beamformer(info, fwd_model_path, data_path):  # noqa
    is_adaptive = True
    beamformer = Beamformer(fwd_path=fwd_model_path, is_adaptive=is_adaptive)
    beamformer.mne_info = info
    N_SEN = len(info['ch_names'])
    beamformer.input = np.random.rand(N_SEN)
    parent = FileSource(data_path)
    parent.output = np.random.rand(info['nchan'], 1)
    parent.mne_info = info
    beamformer.parent = parent
    return beamformer
Пример #11
0
def mne_gcs(info, fwd_model_path, data_path):  # noqa
    snr = 1
    mne_gcs = MneGcs(snr=snr, fwd_path=fwd_model_path, seed=0)
    mne_gcs.mne_info = info
    N_SEN = len(info['ch_names'])
    mne_gcs.input = np.random.rand(N_SEN)
    parent = FileSource(data_path)
    parent.output = np.random.rand(info['nchan'], 1)
    parent.mne_info = info
    mne_gcs.parent = parent
    return mne_gcs
Пример #12
0
def file_outputter(info, data_path, tmp_path):  # noqa
    output_path = op.join(tmp_path, 'output.h5')
    file_outputter = FileOutput(output_path)
    file_outputter.mne_info = info
    N_SEN = len(info['ch_names'])
    file_outputter.input = np.random.rand(N_SEN)
    parent = FileSource(data_path)
    parent.output = np.random.rand(info['nchan'], 1)
    parent.mne_info = info
    file_outputter.parent = parent
    return file_outputter
Пример #13
0
def mce(info, fwd_model_path):  # noqa
    n_comp = 10
    print(fwd_model_path)
    mce = MCE(fwd_model_path, n_comp)
    mce.mne_info = info
    N_SEN = len(info['ch_names'])
    mce.input = np.random.rand(N_SEN)
    parent = FileSource()
    parent.output = np.random.rand(info['nchan'], 1)
    parent.mne_info = info
    mce.parent = parent
    return mce
Пример #14
0
def inv_model(info, fwd_model_path):  # noqa
    snr = 1
    method = 'MNE'
    inv_model = InverseModel(
        snr=snr, forward_model_path=fwd_model_path, method=method)
    inv_model.mne_info = info
    N_SEN = len(info['ch_names'])
    inv_model.input = np.random.rand(N_SEN)
    parent = FileSource()
    parent.output = np.random.rand(info['nchan'], 1)
    parent.mne_info = info
    inv_model.parent = parent
    return inv_model
Пример #15
0
def preprocessor(info, data_path):  # noqa
    preprocessor = Preprocessing()
    preprocessor.mne_info = info
    N_SEN = len(info['ch_names'])
    preprocessor.input = np.random.rand(N_SEN)
    parent = FileSource(data_path)
    parent.output = np.random.rand(info['nchan'], 1)
    parent.mne_info = info
    preprocessor.parent = parent

    app = QCoreApplication(sys.argv)
    parent.updater = AsyncUpdater(app, parent)
    return preprocessor
Пример #16
0
linear_filter.input_node = source
linear_filter.initialize()
linear_filter.update()

# this linear filter should at least remove DC. Thus, new means should be somewhat close to zero
means = np.abs(np.mean(linear_filter.output, axis=TIME_AXIS))
mean_max = np.mean(np.max(linear_filter.output, axis=TIME_AXIS))
assert(np.all(means < 0.1 * mean_max))

linear_filter.lower_cutoff = None
linear_filter.initialize()
linear_filter.update()

assert(linear_filter.output is source.output)


# Envelope extractor

envelope_extractor = EnvelopeExtractor()
envelope_extractor.input_node = linear_filter
envelope_extractor.initialize()
envelope_extractor.update()

# TODO: come up with an actual way to test this stuff
assert(envelope_extractor.output is not None)


from cognigraph.nodes.sources import FileSource
source = FileSource(r"C:\Users\evgenii\Downloads\brainvision\Bulavenkova_A_2017-10-24_15-33-18_Rest.vmrk")
source.update()