コード例 #1
0
This module is responsible for making 

Author: Dawid Laszuk
Contact: [email protected]
"""

from multiplexer.multiplexer_constants import peers, types
from obci.control.peer.configured_multiplexer_server import ConfiguredMultiplexerServer
from obci.configs import settings, variables_pb2
import random, time, sys

from obci.interfaces import interfaces_logging as logger
from obci.gui.ugm import ugm_helper
from obci.utils.openbci_logging import log_crash

LOGGER = logger.get_logger("text_display", "debug")


class TextDisplay(ConfiguredMultiplexerServer):
    @log_crash
    def __init__(self, addresses):
        super(TextDisplay, self).__init__(addresses=addresses,
                                          type=peers.P300_ANALYSIS)

        self.initConst()
        self.ready()

    def initConst(self):
        self.display_time = float(self.config.get_param("display_time"))
        self.decCount = float(self.config.get_param("dec_count"))
コード例 #2
0
ファイル: csp_helper.py プロジェクト: BrainTech/openbci
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author:
#     Mateusz Kruszyński <*****@*****.**>
#
import pickle
import numpy as np

from obci.interfaces import interfaces_logging as logger
LOGGER = logger.get_logger("csp_helper")

from obci.acquisition import acquisition_helper


def get_csp_config(path, name):
    file_name = acquisition_helper.get_file_path(path, name)
    csp_file = file_name+'.csp'
    f = open(csp_file, 'r')
    d = pickle.load(f)
    f.close()
    LOGGER.info("Got csp config:")
    LOGGER.info(str(d))
    return d

def set_csp_config(path, name, config):
    csp_file = acquisition_helper.get_file_path(path, name)+'.csp'
    f = open(csp_file, 'w')
    pickle.dump(config, f)
    f.close()

コード例 #3
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author:
#     Mateusz Kruszyński <*****@*****.**>
#
import pickle
import numpy as np

from obci.interfaces import interfaces_logging as logger
LOGGER = logger.get_logger("ssvep_csp_helper")

from obci.acquisition import acquisition_helper


def get_csp_config(path, name):
    file_name = acquisition_helper.get_file_path(path, name)
    csp_file = file_name + '.csp'
    f = open(csp_file, 'r')
    d = pickle.load(f)
    f.close()
    LOGGER.info("Got csp config:")
    LOGGER.info(str(d))
    return d


def set_csp_config(path, name, config):
    csp_file = acquisition_helper.get_file_path(path, name) + '.csp'
    f = open(csp_file, 'w')
    pickle.dump(config, f)
    f.close()
コード例 #4
0
ファイル: p300_fda_peer.py プロジェクト: BrainTech/openbci
from multiplexer.multiplexer_constants import peers, types
from obci.control.peer.configured_multiplexer_server import ConfiguredMultiplexerServer

from obci.configs import settings, variables_pb2
from obci.devices import appliance_helper
from obci.acquisition import acquisition_helper
from obci.gui.ugm import ugm_helper
from obci.interfaces import interfaces_logging as logger
from obci.analysis.buffers import auto_blink_buffer
from obci.interfaces.bci.p300_fda import bci_p300_fda_analysis

from obci.interfaces.bci.ssvep_csp import ssvep_csp_helper
from obci.utils import streaming_debug

LOGGER = logger.get_logger("bci_p300_csp", "info")
DEBUG = True


class BCIP300Csp(ConfiguredMultiplexerServer):
    def send_results(self, results):
        """Send dec message to the system (probably to LOGIC peer).
        dec is of integer type."""
        LOGGER.info("Sending dec message: "+str(dec))
        self._last_dec_time = time.time()
        #self.buffer.clear() dont do it in p300 - just ignore some blinks sometimes ...
        #self.buffer.clear_blinks()
        #ugm_helper.send_stop_blinking(self.conn)
        
        r = variables_pb2.Sample()
        t.timestamp = time.time()
コード例 #5
0
ファイル: display_text.py プロジェクト: niklasrogers/openbci
"""
This module is responsible for making 

Author: Dawid Laszuk
Contact: [email protected]
"""

from multiplexer.multiplexer_constants import peers, types
from obci.control.peer.configured_multiplexer_server import ConfiguredMultiplexerServer
from obci.configs import settings, variables_pb2
import random, time, sys

from obci.interfaces import interfaces_logging as logger
from obci.gui.ugm import ugm_helper

LOGGER = logger.get_logger("text_display", "debug")


class TextDisplay(ConfiguredMultiplexerServer):
    def __init__(self, addresses):
        super(TextDisplay, self).__init__(addresses=addresses,
                                     type=peers.P300_ANALYSIS)        

        self.initConst()
        self.ready()    
    
    def initConst(self):
        self.display_time = float(self.config.get_param("display_time"))
        self.decCount = float(self.config.get_param("dec_count"))
        
        self.dec = -1
コード例 #6
0
ファイル: csp_helper.py プロジェクト: BrainTech/openbci
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author:
#     Mateusz Kruszyński <*****@*****.**>
#
import pickle
import numpy as np

from obci.interfaces import interfaces_logging as logger
LOGGER = logger.get_logger("ssvep_csp_helper")

from obci.acquisition import acquisition_helper


def get_csp_config(path, name):
    file_name = acquisition_helper.get_file_path(path, name)
    csp_file = file_name+'.csp'
    f = open(csp_file, 'r')
    d = pickle.load(f)
    f.close()
    LOGGER.info("Got csp config:")
    LOGGER.info(str(d))
    return d

def set_csp_config(path, name, config):
    csp_file = acquisition_helper.get_file_path(path, name)+'.csp'
    f = open(csp_file, 'w')
    pickle.dump(config, f)
    f.close()

コード例 #7
0
# -*- coding: utf-8 -*-

##
# Author: Dawid Laszuk
# Contact: [email protected]
##

import random, time
from obci.interfaces import interfaces_logging as logger
import numpy as np

from obci.interfaces.bci.p300_fda.p300_fda import P300_analysis
from obci.interfaces.bci.p300_fda.p300_draw import P300_draw
from signalAnalysis import DataAnalysis

LOGGER = logger.get_logger("bci_p300_fda_analysis", "info")
DEBUG = False


class BCIP300FdaAnalysis(object):
    def __init__(self, send_func, cfg, montage_matrix, sampling):

        self.send_func = send_func
        self.last_time = time.time()
        self.fs = sampling
        self.montage_matrix = montage_matrix

        self.nPole = np.zeros(8)
        self.nMin = 5
        self.nMax = 10
コード例 #8
0
# -*- coding: utf-8 -*-

##
# Author: Dawid Laszuk
# Contact: [email protected]
##

import random, time
from obci.interfaces import interfaces_logging as logger
import numpy as np

from obci.interfaces.bci.p300_fda.p300_fda import P300_analysis
from obci.interfaces.bci.p300_fda.p300_draw import P300_draw
from signalAnalysis import DataAnalysis

LOGGER = logger.get_logger("bci_p300_fda_analysis", "info")
DEBUG = False

class BCIP300FdaAnalysis(object):
    def __init__(self, send_func, cfg, montage_matrix, sampling):
        
        self.send_func = send_func
        self.last_time = time.time()
        self.fs = sampling
        self.montage_matrix = montage_matrix

        self.nPole = np.zeros(8)
        self.nMin = 5
        self.nMax = 10

        cfg['nMin'] = self.nMin
コード例 #9
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from multiplexer.multiplexer_constants import peers, types
from obci.control.peer.configured_multiplexer_server import ConfiguredMultiplexerServer
from obci.configs import settings, variables_pb2
import random, time, sys
import numpy as np

from obci.interfaces import interfaces_logging as logger

LOGGER = logger.get_logger("p300_etr_decision", "debug")


class P300EtrDecision(ConfiguredMultiplexerServer):
    def __init__(self, addresses):
        super(P300EtrDecision, self).__init__(addresses=addresses,
                                     type=peers.RESULTS_ANALYSIS)
        self.ready()

    def initConst(self):
        
        self.fields = 8
        self.tresholdValue = 0.95
        

    def handle_message(self, mxmsg):
        LOGGER.info("P300EtrDecision\n")
        if mxmsg.type == types.ETR_ANALYSIS_RESULTS:
            res = variables_pb2.Sample()
            res.ParseFromString(mxmsg.message)
コード例 #10
0
from multiplexer.multiplexer_constants import peers, types
from obci.control.peer.configured_multiplexer_server import ConfiguredMultiplexerServer

from obci.configs import settings, variables_pb2
from obci.devices import appliance_helper
from obci.acquisition import acquisition_helper
from obci.gui.ugm import ugm_helper
from obci.interfaces import interfaces_logging as logger
from obci.analysis.buffers import auto_blink_buffer
from obci.interfaces.bci.p300_fda import bci_p300_fda_analysis

from obci.interfaces.bci.ssvep_csp import ssvep_csp_helper
from obci.utils import streaming_debug

LOGGER = logger.get_logger("bci_p300_csp", "info")
DEBUG = True


class BCIP300Csp(ConfiguredMultiplexerServer):
    def send_results(self, results):
        """Send dec message to the system (probably to LOGIC peer).
        dec is of integer type."""
        LOGGER.info("Sending dec message: " + str(dec))
        self._last_dec_time = time.time()
        #self.buffer.clear() dont do it in p300 - just ignore some blinks sometimes ...
        #self.buffer.clear_blinks()
        #ugm_helper.send_stop_blinking(self.conn)

        r = variables_pb2.Sample()
        t.timestamp = time.time()
コード例 #11
0
# To have:
# class squares:
#    count - returns number of squares
#


from multiplexer.multiplexer_constants import peers, types
from obci.control.peer.configured_multiplexer_server import ConfiguredMultiplexerServer
from obci.configs import settings, variables_pb2
import random, time, sys

from obci.interfaces import interfaces_logging as logger

import numpy as np

LOGGER = logger.get_logger("etr_analysis", "info")


class EtrAnalysis(ConfiguredMultiplexerServer):
    def __init__(self, addresses):
        super(EtrAnalysis, self).__init__(addresses=addresses, type=peers.ETR_P300_ANALYSIS)

        self.initConstants()
        self.ready()

    def initConstants(self):
        """
        Initiates constants values.
        """

        bufforLen = 10
コード例 #12
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from multiplexer.multiplexer_constants import peers, types
from obci.control.peer.configured_multiplexer_server import ConfiguredMultiplexerServer
from obci.configs import settings, variables_pb2
import random, time, sys
import numpy as np

from obci.interfaces import interfaces_logging as logger

LOGGER = logger.get_logger("p300_etr_decision", "debug")


class P300EtrDecision(ConfiguredMultiplexerServer):
    def __init__(self, addresses):
        super(P300EtrDecision, self).__init__(addresses=addresses,
                                              type=peers.RESULTS_ANALYSIS)
        self.ready()

    def initConst(self):

        self.fields = 8
        self.tresholdValue = 0.95

    def handle_message(self, mxmsg):
        LOGGER.info("P300EtrDecision\n")
        if mxmsg.type == types.ETR_ANALYSIS_RESULTS:
            res = variables_pb2.Sample()
            res.ParseFromString(mxmsg.message)
            LOGGER.debug("GOT ETR ANALYSIS RESULTS: " + str(res.channels))
コード例 #13
0
#####
# To have:
# class squares:
#    count - returns number of squares
#

from multiplexer.multiplexer_constants import peers, types
from obci.control.peer.configured_multiplexer_server import ConfiguredMultiplexerServer
from obci.configs import settings, variables_pb2
import random, time, sys

from obci.interfaces import interfaces_logging as logger

import numpy as np

LOGGER = logger.get_logger("etr_analysis", "info")


class EtrAnalysis(ConfiguredMultiplexerServer):
    def __init__(self, addresses):
        super(EtrAnalysis, self).__init__(addresses=addresses,
                                          type=peers.ETR_P300_ANALYSIS)

        self.initConstants()
        self.ready()

    def initConstants(self):
        """
        Initiates constants values.
        """
コード例 #14
0
ファイル: csp_helper.py プロジェクト: vjenissr/openbci
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author:
#     Mateusz Kruszyński <*****@*****.**>
#
import pickle
import numpy as np

from obci.interfaces import interfaces_logging as logger
LOGGER = logger.get_logger("csp_helper")

from obci.acquisition import acquisition_helper


def get_csp_config(path, name):
    file_name = acquisition_helper.get_file_path(path, name)
    csp_file = file_name + '.csp'
    f = open(csp_file, 'r')
    d = pickle.load(f)
    f.close()
    LOGGER.info("Got csp config:")
    LOGGER.info(str(d))
    return d


def set_csp_config(path, name, config):
    csp_file = acquisition_helper.get_file_path(path, name) + '.csp'
    f = open(csp_file, 'w')
    pickle.dump(config, f)
    f.close()