示例#1
0
    void setup()
    {
        slider.maxValue = Start_Screen.sliderLength;

        reader = new BasicEmotivReader(device, false);
        Application.runInBackground = true;

        ssvepOn();
        createTestArray();

        //Creates the timeline and timeline checkpoints
        timelineCheckPoints = new long[(ect.Length + 2)][];
        timeline            = new Timeline <IEmotivState>();

        for (int i = 0; i < ect.Length; i++)
        {
            timelineCheckPoints[i] = new long[2];
        }

        //Starts reading from the device
        reader.OnRead += (e) => timeline.Register(e);
        reader.StartReading();
        incrementSlider = true;
        accuracyLogger  = new CsvLogger("Accuracy.csv");
        accuracyLogger.add(Start_Screen.profile);
        accuracyFalsePositiveLogger = new CsvLogger("AccuracyFalsePositiveLogger.csv");

        Activate();
    }
示例#2
0
    //Displays the results to the user in the UI for Accuracy
    private void setAccuracyResultText(int[] commandCounter, int[] commandTotal)
    {
        int percent;

        int[] neutralHolder = new int[results.Length / 2];
        int   counter       = 0;

        ssvepOff();
        resultText.text = "Accuracy Results";

        for (int i = 0; i < results.Length; i++)
        {
            if (commandTotal[i] > 0)
            {
                percent = ((commandCounter[i] * 100) / commandTotal[i]);

                results[i].text = ect[i] + ": " + percent + "%";

                if (ect[i] == EmotivCommandType.NEUTRAL)
                {
                    neutralHolder[counter] = percent;
                    counter++;
                }
                else
                {
                    accuracyLogger.add(percent.ToString());
                }
            }
            else
            {
                results[i].text = ect[i] + ": " + "0%";
            }
        }

        foreach (int per in neutralHolder)
        {
            accuracyLogger.add(per.ToString());
        }

        accuracyLogger.write();
        //accuracyFalsePositiveLogger.write();
    }
示例#3
0
    //Calculates the number of times the user gave the correct command in each interval
    private int[][] analyzeData()
    {
        IEnumerable <IEmotivState>[] states = new IEnumerable <IEmotivState> [ect.Length];

        int[][] data                    = new int[2][];
        int[]   commandCounter          = new int[ect.Length];
        int[]   commandTotal            = new int[ect.Length];
        float   totalFalsePositivePower = 0;
        float   falsePostiveCounter     = 0;

        for (int i = 0; i < ect.Length; i++)
        {
            states[i] = timeline.GetInterval(timelineCheckPoints[i][0], timelineCheckPoints[i][1]).ToArray();

            commandCounter[i] = 0;
            foreach (IEmotivState x in states[i])
            {
                if (x.Command == ect[i])
                {
                    commandCounter[i] += 1;
                }
                else
                {
                    if (x.Command == EmotivCommandType.NEUTRAL)
                    {
                        if (x.Power > 0)
                        {
                            totalFalsePositivePower += (x.Power * 100);
                            falsePostiveCounter++;
                        }
                    }
                }
                commandTotal[i] += 1;
            }
        }
        accuracyFalsePositiveLogger.add(((falsePostiveCounter)).ToString());
        data[0] = commandCounter;
        data[1] = commandTotal;

        return(data);
    }