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)
    SamplingData = Random_Data['GenericData']
    Board = gen.Generic_Generator(Queue=Data_Queue,
                                  binSize=50,
                                  Data=SamplingData)
    Board.start()

while len(Feature) < 5 * TaskSetting['Initiation']:
    if not Data_Queue.empty():
        Sample = Data_Queue.get()
        if not EEG_Recording.any():
            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)