Exemplo n.º 1
0
        public void add(float power)
        {
            if (powerSamples.Count >= sampleSize)
            {
                powerSamples.RemoveAt(0);
            }

            powerSamples.Add(power);

            if (dynamicMax)
            {
                max = powerSamples.Max();
            }
            else
            {
                max = manager.settings.noramlizingMax;
            }

            if (dynamicMin)
            {
                min = powerSamples.Min();
            }
            else
            {
                min = manager.settings.noramlizingMin;
            }



            lastPowerNormalized = Util4Everything.getNormalizeValue(power, max, min, maxScaled, minScaled);
        }
Exemplo n.º 2
0
    public void HandleOSCMeassage(OscMessage msg, int msgNumber)
    {
        if (msg.Address.Equals("/power4calibration"))
        {
            foreach (float f in msg.Arguments)
            {
                //res += (f + ",");

                if (computeEyesOpen || computeEyesClosed)
                {
                    float realF;
                    realF = f;

                    data.Add(f);
                    if(!writingStatistics) {
                    TextWriter file = new StreamWriter(filenameCallibration, true);
                    file.Write(DateTime.Now.TimeOfDay);
                    file.Write(";");
                    file.Write(Util4Everything.getCurrentDayMilliseconds());
                    file.Write(";");
                    file.Write(Convert.ToString(realF).Replace('.', ','));
                    file.Write(";");
                    file.WriteLine("");
                    file.Close();
                    }
                }

            }
        }
    }
Exemplo n.º 3
0
    void IncreaseScale(float increase)
    {
        float oldScaleX = trans.localScale.x;
        float oldScaleY = trans.localScale.y;

        trans.localScale = Util4Everything.getIncreseScaleVector(increase, oldScaleX, oldScaleY, maxScale, minScale);
    }
Exemplo n.º 4
0
    void ReduceScale(float reduce)
    {
        float oldScaleX = trans.localScale.x;
        float oldScaleY = trans.localScale.y;

        trans.localScale = Util4Everything.getReduceScaleVector(reduce, oldScaleX, oldScaleY, minScale);
    }
Exemplo n.º 5
0
 public void computeEyesClosedStatistics()
 {
     if (computeEyesOpen)
         return;
     computeEyesClosed = true;
     startTimeInMs = Util4Everything.getCurrentDayMilliseconds();
     timeIntervalInMs = GameManager.instance.settings.calibTimer;
     subject = GameManager.instance.settings.subjectName;
     data = new List<float>();
     filenameCallibration = "./Assets/PowerLog/Testing/" + subject + "_EyesClosed_" + DateTime.Now.ToFileTimeUtc() + ".csv";
     writeHeader4Statistics();
 }
Exemplo n.º 6
0
    // Update is called once per frame
    void Update()
    {
        if (computeEyesOpen || computeEyesClosed)
        {
            //if (data != null && data.Count > 1)
            //    Debug.Log("Mean" + data.RootMeanSquare() + "Dev:" + data.StandardDeviation() + "Variance"+ data.Variance());

            uint currenttime = Util4Everything.getCurrentDayMilliseconds();

            uint distance = currenttime - startTimeInMs;
            lastDistance = distance;

            if (distance > timeIntervalInMs)
            {
                if (!isFinished)
                {

                    isFinished = true;
                    Debug.Log("done");

                    while (writingStatistics) {

                    }

                    writeStatistics();

                    computeEyesOpen = false;
                    computeEyesClosed = false;

                    if (data != null && data.Count > 1)
                        Debug.Log("Mean:" + data.Average() + " Mean^2:" + data.RootMeanSquare() + " Dev:" + data.StandardDeviation() + " Variance:" + data.Variance());

                }

            }
            else {
                //Debug.Log("logginggggg");
            }

        }
    }