Ejemplo n.º 1
0
    def root2widget(root):
        window = 1.0

        device = Dummy()
        mask_controller = MaskController(device.n_chans)
        stream_inlet = device.get_stream_inlet(timeout=1)
        signal_interface = WindowedSignal(stream_inlet, window)
        widget = visualizer(root, signal_interface, mask_controller)
        return widget
Ejemplo n.º 2
0
    def root2widget(root):
        window = 1.0

        device = Dummy()
        mask_controller = MaskController(device.n_chans)
        stream_inlet = device.get_stream_inlet(timeout=1)
        signal_interface = WindowedSignal(stream_inlet, window)
        widget = Spectrogram(root, signal_interface, mask_controller)
        return widget
Ejemplo n.º 3
0
    def root2widget(root):
        window = 1.0

        device = Dummy()
        mask_controller = MaskController(device.n_chans)
        stream_inlet = device.get_stream_inlet(timeout=1)
        windowed_signal = WindowedSignal(stream_inlet, window)
        widget = Analyser(
            root, build_analyser=build_analyser, windowed_signal=windowed_signal, mask_controller=mask_controller
        )
        return widget
Ejemplo n.º 4
0
    def root2widget(root):
        window = 1.0

        device = Dummy()
        mask_controller = MaskController(device.n_chans)
        stream_inlet = device.get_stream_inlet(timeout=1)
        windowed_signal = WindowedSignal(stream_inlet, window)
        widget = Analyser(root,
                          build_analyser=build_analyser,
                          windowed_signal=windowed_signal,
                          mask_controller=mask_controller)
        return widget
Ejemplo n.º 5
0
def test_signal_interface():
    window = 0.1
    tol = 0.1

    device = Dummy()
    stream_inlet = device.get_stream_inlet(timeout=1)
    signal_interface = WindowedSignal(stream_inlet, window)

    data = signal_interface.get_epoch()
    time.sleep(window)
    data = signal_interface.get_epoch()

    for i in range(3):
        time.sleep(window)
        data = signal_interface.get_epoch()
        relative_val = (len(data)-device.sfreq*window) / device.sfreq*window
        assert abs(relative_val) < tol
Ejemplo n.º 6
0
def test_signal_interface():
    window = 0.1
    tol = 0.1

    device = Dummy()
    stream_inlet = device.get_stream_inlet(timeout=1)
    signal_interface = WindowedSignal(stream_inlet, window)

    data = signal_interface.get_epoch()
    time.sleep(window)
    data = signal_interface.get_epoch()

    for i in range(3):
        time.sleep(window)
        data = signal_interface.get_epoch()
        relative_val = (len(data) -
                        device.sfreq * window) / device.sfreq * window
        assert abs(relative_val) < tol
Ejemplo n.º 7
0
def test_monitor():
    sleeping_time = 0.5

    p = Process(target=start_monitor, args=(
        Dummy(),
        1.0,
    ))
    p.start()
    time.sleep(sleeping_time)
    exitcode = p.exitcode
    assert exitcode is None or exitcode == 0
    p.terminate()
Ejemplo n.º 8
0
"""Example program to show how to read a multi-channel time series from LSL."""

from pylsl import StreamInlet, resolve_byprop

from hci.sources import Dummy

import time
# first resolve an EEG stream on the lab network
print("looking for an EEG stream...")

#source_id = Experiment.source_id
#stream = resolve_byprop('source_id', source_id, timeout=1)[0]

# create a new inlet to read from the stream
#print(stream)
dummy = Dummy()
inlet = dummy.get_stream_inlet()

while True:
    # get a new sample (you can also omit the timestamp part if you're not
    # interested in it)
    time.sleep(1)
    sample, timestamp = inlet.pull_chunk()
    print(len(timestamp))
Ejemplo n.º 9
0
        self.spectrogram = Spectrogram(self.root, windowed_signal,
                                       self.mask_controller)

        self.analysis = Analyser(self.root,
                                 windowed_signal=windowed_signal,
                                 mask_controller=self.mask_controller)
        self.spectrogram.pack(side=tk.LEFT, expand=tk.YES, fill=tk.BOTH)
        self.analysis.pack(side=tk.BOTTOM, expand=tk.YES, fill=tk.BOTH)
        self.signal_visualizer.pack(side=tk.LEFT, expand=tk.YES, fill=tk.BOTH)

        self.right_frame = tk.Frame(self.root)
        self.right_frame.pack(side=tk.RIGHT, expand=tk.TRUE, fill=tk.BOTH)
        self.control_panel = MaskControllerAPI(self.right_frame,
                                               self.mask_controller)
        self.control_panel.pack(side=tk.TOP, expand=tk.FALSE, fill=tk.X)

    def start_mainloop(self):
        self.root.mainloop()


def start_monitor(source: Source, window):
    stream_inlet = source.get_stream_inlet(timeout=1)
    signal_interface = WindowedSignal(stream_inlet, window)

    monitor = Monitor(signal_interface)
    monitor.start_mainloop()


if __name__ == '__main__':
    start_monitor(Dummy(), 1.0)