Esempio n. 1
0
def FeatureExtraction(Sample,Feature,Data_Array):
    # Append the data
    Data_Array = np.append(Data_Array,Sample,axis=0)
           
    # Common Average Reference
    Sample[:,range(1,9)] = Process.Common_Average_Reference(Sample[:,range(1,9)])

    # Feature Extraction
    if ALPHA:
        Feature = np.append(Feature,Process.AlphaDifference(Sample,([5,6],[7,8]),250))
    else:
        Feature = np.append(Feature,Process.PowerExtraction(Sample[:,3],[8,12],250))

    return (Feature,Data_Array)
Esempio n. 2
0
            EEG_Recording = Sample
        else:
            EEG_Recording = np.append(EEG_Recording, Sample, axis=0)

        # Common Average Reference
        Sample[:, range(1, 9)] = Process.Common_Average_Reference(
            Sample[:, range(1, 9)])

        # Feature Extraction
        if ALPHA:
            Feature = np.append(
                Feature, Process.AlphaDifference(Sample, ([5, 6], [7, 8]),
                                                 250))
        else:
            Feature = np.append(
                Feature, Process.PowerExtraction(Sample[:, 3], [8, 12], 250))

FIFO.Rewrite(Trigger_Log, "Calibration On")
Trigger = np.array([[len(Feature), CALIBRATION_START]])

print "Calibration Stage 1"
Current_Index = len(Feature)
"""""" """""" """""" """""" """""" """""" """""" """
Resting State. Movement Range Calculation.
""" """""" """""" """""" """""" """""" """""" """"""
while len(Feature) - Current_Index < 5 * TaskSetting['Calibration']:
    if not Data_Queue.empty():
        Sample = Data_Queue.get()
        Feature, EEG_Recording = FeatureExtraction(Sample, Feature,
                                                   EEG_Recording)
Esempio n. 3
0
Generator.start()
#Board = bci.OpenBCIBoard_Recording(thread=True,port=port,baud=115200,Queue=Data_Queue,binSize=125)
#Board.start()

screenWidth, screenHeight = gui.size()
gui.FAILSAFE = False
MovementRange_X = [-5.0 * (screenWidth / 100.0), 5.0 * (screenWidth / 100.0)]
MovementRange_Y = [-5.0 * (screenHeight / 100.0), 5.0 * (screenHeight / 100.0)]

while True:
    if not Data_Queue.empty():
        Sample = Data_Queue.get()
        Sample[:, range(1, 9)] = Process.Common_Average_Reference(
            Sample[:, range(1, 9)])
        Feature1.append(
            Process.PowerExtraction(Sample[:, 4], FS, Frequency_Range))
        Feature2.append(
            Process.PowerExtraction(Sample[:, 7], FS, Frequency_Range))
        Classifier_X, Offset_X = Process.Linear_Regression(
            Feature1, MovementRange_X)
        Classifier_Y, Offset_Y = Process.Linear_Regression(
            Feature2, MovementRange_Y)
        if not Classifier_X == np.inf and not Classifier_Y == np.inf:
            break

while len(Feature1) < 70:
    if not Data_Queue.empty():
        Sample = Data_Queue.get()
        Sample[:, range(1, 9)] = Process.Common_Average_Reference(
            Sample[:, range(1, 9)])
        Feature1.append(