class SignalProcessor(object):
    def __init__(self, verbose=False):
        config = ConfigProvider().getProcessingConfig()
        self.maxNaNValues = config.get("maxNaNValues")
        self.lowerBound = config.get("lowerBound")
        self.upperBound = config.get("upperBound")
        self.normalize = config.get("normalize")
        self.mean = config.get("mean")
        self.samplingRate = ConfigProvider().getEmotivConfig().get(
            "samplingRate")
        self.windowSeconds = ConfigProvider().getCollectorConfig().get(
            "windowSeconds")
        self.qualUtil = QualityUtil()
        self.sigUtil = SignalUtil()
        self.verbose = verbose

    def process(self, raw, quality):
        # remove outliners
        proc = self.qualUtil.replaceOutliners(raw, NaN)

        # too much outliners?
        if self.qualUtil.isInvalidData(proc, len(raw) / self.windowSeconds):
            return None, True

        # center signal (mean = 0)
        #proc = self.sigUtil.center(proc, self.mean)

        # normalize date between -1 and 1
        #proc = self.sigUtil.normalize(proc)

        # replace Nans with zero (for fft)
        proc = self.qualUtil.replaceNans(proc)
        return proc, False
 def __init__(self, verbose=False):
     config = ConfigProvider().getProcessingConfig()
     self.maxNaNValues = config.get("maxNaNValues")
     self.lowerBound = config.get("lowerBound")
     self.upperBound = config.get("upperBound")
     self.normalize = config.get("normalize")
     self.samplingRate = ConfigProvider().getEmotivConfig().get("samplingRate")
     self.qualUtil = QualityUtil()
     self.sigUtil = SignalUtil()
     self.verbose = verbose
 def __init__(self, verbose=False):
     self.samplingRate = ConfigProvider().getEmotivConfig().get(
         "samplingRate")
     self.qualUtil = QualityUtil()
     self.fftUtil = FFTUtil()
     self.eegUtil = EEGUtil()
     self.verbose = verbose
Beispiel #4
0
    def _getData(self, signal):
        raw = self.eegData.getColumn(signal)
        qual = self.eegData.getQuality(signal)
        samplingRate = self.eegData.getSamplingRate()

        proc, _ = self.chain.process(raw, qual)
        proc = QualityUtil().replaceNans(proc)
        return self.eegUtil.getDeltaWaves(proc, samplingRate)
 def setUp(self):
     self.chain = SignalProcessor()
     self.qualUtil = QualityUtil()
     config = ConfigProvider().getProcessingConfig()
     self.upperBound = config.get("upperBound")
     self.lowerBound = config.get("lowerBound")
     self.minQuality = config.get("minQual")
     self.maxNaNValues = config.get("maxNaNValues")
class SignalProcessor(object):
    def __init__(self, verbose=False):
        config = ConfigProvider().getProcessingConfig()
        self.maxNaNValues = config.get("maxNaNValues")
        self.lowerBound = config.get("lowerBound")
        self.upperBound = config.get("upperBound")
        self.normalize = config.get("normalize")
        self.samplingRate = ConfigProvider().getEmotivConfig().get("samplingRate")
        self.qualUtil = QualityUtil()
        self.sigUtil = SignalUtil()
        self.verbose = verbose

    def process(self, raw, quality):
        proc = self.qualUtil.replaceOutliners(raw, 0)
        proc = self.sigUtil.normalize(proc, self.normalize)

        invalid = self.qualUtil.isInvalidData(proc)
        return proc, invalid
    def __init__(self):
        self.mneUtil = MNEUtil()
        config = ConfigProvider().getProcessingConfig()
        self.lowerFreq = config.get("lowerFreq")
        self.upperFreq = config.get("upperFreq")
        self.windowSeconds = ConfigProvider().getCollectorConfig().get(
            "windowSeconds")
        self.resampleFreq = config.get("resamplingRate")
        self.eegFields = ConfigProvider().getEmotivConfig().get("eegFields")

        self.si = SignalUtil()
        self.qu = QualityUtil()
        self.eog = EOGExtractor()
class FFTProcessor(object):
    def __init__(self, verbose=False):
        self.samplingRate = ConfigProvider().getEmotivConfig().get("samplingRate")
        self.qualUtil = QualityUtil()
        self.fftUtil = FFTUtil()
        self.eegUtil = EEGUtil()
        self.verbose = verbose

    def process(self, proc):
        fft = self.fftUtil.fft(proc)
        chan = self.eegUtil.getChannels(fft)
        invalid = self.qualUtil.isInvalidData(fft)
        return chan, invalid
    def __init__(self, queue, filePath, signals=None, save=True, plot=True, logScale=False, name=""):
        self.queue = queue
        self.filePath = filePath
        self._initStatsDict()
        self.config = ConfigProvider()
        self.eegData = FileUtil().getDto(filePath)
        self._initSignals(signals)
        self.su = SignalUtil()
        self.qu = QualityUtil()
        self.eu = EEGUtil()
        self.fft = FFTUtil()
        self._initFields()
        self.save = save
        self.plot = plot
        self.name = name
        self._initPlotter(logScale)
        self.ssPrint = SignalStatisticPrinter(filePath)
        self.preProcessor = SignalPreProcessor()
        self.processor = SignalProcessor()

        windowSeconds = self.config.getCollectorConfig().get("windowSeconds")
        self.windowSize = EEGDataCollector.calcWindowSize(windowSeconds, self.eegData.samplingRate)