float[] GetTensor()
 {
     float[] tmpTensor = new[]
     {
         (float)eyeData.GetGDLX(), (float)eyeData.GetGDLY(), (float)eyeData.GetGDLZ(),
         (float)eyeData.GetGDRX(), (float)eyeData.GetGDRY(), (float)eyeData.GetGDRZ(),
         (float)eyeData.GetPDL(), (float)eyeData.GetPDR(), (float)naos.GetHeartRate(),
         (float)naos.GetGsr()
     };
     return(tmpTensor);
 }
    public void FixedUpdate()
    {
        if (naos.GetConnection() && obtainingBaseline && HR_Buff.Count < BaseLineTime && once)
        {
            print("start mouse thing");
            StartCoroutine(CalculateBaseline());
            once = false;
        }

        if (running && eyeData != null && naos.GetConnection())
        {
            if (
                eyeData.GetGDLX() != 0 &&
                eyeData.GetGDLY() != 0 &&
                eyeData.GetGDLZ() != 0 &&
                eyeData.GetGDRX() != 0 &&
                eyeData.GetGDRY() != 0 &&
                eyeData.GetGDRZ() != 0 &&
                eyeData.GetPDL() != 0 &&
                eyeData.GetPDR() != 0 &&
                naos.GetHeartRate() != 0 &&
                naos.GetGsr() != 0
                )
            {
                gdlX.Add(eyeData.GetGDLX());
                gdlY.Add(eyeData.GetGDLY());
                gdlZ.Add(eyeData.GetGDLZ());
                gdrX.Add(eyeData.GetGDRX());
                gdrY.Add(eyeData.GetGDRY());
                gdrZ.Add(eyeData.GetGDRZ());
                pdl.Add(eyeData.GetPDL());
                pdr.Add(eyeData.GetPDR());
                HR.Add(naos.GetHeartRate() - HR_Base);
                GSR.Add(naos.GetGsr());
                PredictedConation.Add(KerasBrain.prediction);
            }
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (stream.GetConnection() == true)
        {
            time += Time.deltaTime;
            // for every update heart rate and gsr is saved in an array and send through UDP to another application.
            biometrics [0] = stream.GetHeartRate();
            biometrics [1] = stream.GetAvgHeartRate();
            biometrics [2] = stream.GetMaxHeartRate();
            biometrics [3] = stream.GetGsr();
            //udpSender.sendDoubleArr (biometrics);

            // here we "record" all the biometrics and the triggers
            // however, as a standard the trigger is 0 until something else is send.
            timeList.Add(time);
            hrArrList.Add(stream.GetHeartRate());
            avgHrArrList.Add(stream.GetAvgHeartRate());
            maxHrArrList.Add(stream.GetMaxHeartRate());
            gsrArrList.Add(stream.GetGsr());
            triggers.Add(0);

            //is this how a trigger can be placed and the two needed statements needed to only place one is created.
            if (time > 2.0 && time < 2.1 && triggerEnabled)
            {
                SetTrigger(2);
                triggerEnabled = false;
            }
            if (time > 2.1 && time < 2.2)
            {
                triggerEnabled = true;
            }
            //baselineTime is up to change. for now it is 10, being 10 seconds.
            // after that the baseline is found, which enables finding change score and percentage difference from the baseline.
            //
            if (time > baselineTime && captureBaseline == true)
            {
                captureBaseline = false;
                hrBase          = MeasureBaseLine(hrArrList);
                avghrBase       = MeasureBaseLine(avgHrArrList);
                maxhrBase       = MeasureBaseLine(maxHrArrList);
                gsrBase         = MeasureBaseLine(gsrArrList);
                time            = 0.0f;
                Debug.Log("Baseline Found");
            }
            //as mentioned above when we got the baseline we are now capable of finding differnt important features.
            // it is always recomended to have a baseline corection in regards to analysis and online feedback systems.
            // for sufisticated online analysis tools can be created
            // this create the fundamentals for what you might want to do in the end.
            if (hrBase != 0.0)
            {
                triggersWithBaseLine.Add(0);
                hrCSArrList.Add(LiveChangeScore(stream.GetHeartRate(), hrBase));
                avgHrCSArrList.Add(LiveChangeScore(stream.GetAvgHeartRate(), avghrBase));
                maxHrCSArrList.Add(LiveChangeScore(stream.GetMaxHeartRate(), maxhrBase));
                gsrCSArrList.Add(LiveChangeScore(stream.GetGsr(), gsrBase));
                timeCSList.Add(time);

                hrPDArrList.Add(LivePercentageDiffFromBase(stream.GetHeartRate(), hrBase));
                avgHrPDArrList.Add(LivePercentageDiffFromBase(stream.GetAvgHeartRate(), avghrBase));
                maxHrPDArrList.Add(LivePercentageDiffFromBase(stream.GetMaxHeartRate(), maxhrBase));
                gsrPDArrList.Add(LivePercentageDiffFromBase(stream.GetGsr(), gsrBase));

                if (time > 3.0 && time < 3.1 && triggerEnabled)
                {
                    SetTrigger(3);
                    triggerEnabled = false;
                }
                if (time > 3.1 && time < 3.2)
                {
                    triggerEnabled = true;
                }
                if (time > 4.0 && time < 4.1 && triggerEnabled)
                {
                    SetTrigger(4);
                    triggerEnabled = false;
                }
                if (time > 4.1 && time < 4.2)
                {
                    triggerEnabled = true;
                }
                // if we have reach a certain tiume. this can be anything else
                // create files with recordings you have just gathered.
                if (time > 11 && printTxts == true)
                {
                    printTxts = false;
                    string filenameRaw = "part" + participantID + "bioMeasure.txt";
                    string filenameCS  = "part" + participantID + "ChangeScore.txt";
                    string filenamePD  = "part" + participantID + "PercentageDifferenceFromBase.txt";
                    CreateTxtContent(timeList, hrArrList, avgHrArrList, maxHrArrList, gsrArrList, triggers, filenameRaw);
                    CreateTxtContent(timeCSList, hrCSArrList, avgHrCSArrList, maxHrCSArrList, gsrCSArrList, triggersWithBaseLine, filenameCS);
                    CreateTxtContent(timeCSList, hrPDArrList, avgHrPDArrList, maxHrPDArrList, gsrPDArrList, triggersWithBaseLine, filenamePD);
                    Debug.Log("Text Files Printed");
                }
            }
        }
    }