Example #1
0
        public DacMeasurement parseDacFile()
        {
            String[] lines = File.ReadAllLines(strDacFilePath);

            DacMeasurement dac = new DacMeasurement(lines.Length);

            // fTime = new float[lines.Length];
            // fDAC = new float[lines.Length];

            for (int i = 0; i < lines.Length; i++)
            {
                String[] parameters = lines[i].Split(' ');
                if (parameters.Length != 2)
                {
                    continue;
                }
                dac.fTime[i] = float.Parse(parameters[0], System.Globalization.CultureInfo.InvariantCulture);
                dac.fDAC[i]  = float.Parse(parameters[1], System.Globalization.CultureInfo.InvariantCulture);
            }

            Console.WriteLine("Found: " + dac.fTime.Length + " DAC measurements");
            return(dac); // fTime.Length;
        }
Example #2
0
        public void parseFiles(String fileName)
        {
            FileParser parser = new FileParser();

            parser.setFileNames(fileName);

            DacMeasurement dacMeasur = parser.parseDacFile();

            if (dacMeasur != null)
            {
                for (int i = 0; i < dacMeasur.fDAC.Length; i++)
                {
                    AddDacToGraph(dacMeasur.fTime[i], dacMeasur.fDAC[i]);
                }
            }

            fPhase = parser.parsePhaseFile();
            if (fPhase != null)
            {
                fPhaseAvg      = new float[fPhase.Length];
                fPhaseDerivAvg = new float[fPhase.Length];

                for (int i = 0; i < fPhase.Length; i++)
                {
                    if (i == 11693)
                    {
                        i = i;
                    }
                    AddPhaseToGraph(dacMeasur.fTime[0] + i, fPhase[i] * 1000000000);   //Phase is measured each second (?). Use DAC first time as start point. Phase is in [ns]

                    fPhaseAvg[i] = phaseAvg.calculateAvg(fPhase[i]);
                    if (fPhaseAvg[i] < -180)
                    {
                        fPhaseAvg[i] = fPhaseAvg[i];
                    }

                    AddPhaseAvgToGraph(dacMeasur.fTime[0] + i, fPhaseAvg[i] * 1000000000);//* 1000000000);
                }

                for (int i = 20; i < fPhase.Length; i++)
                {
                    float fPhaseDeriv = calculatePhaseFirstDerivation(i);
                    AddPhaseFirstDeviationToGraph(dacMeasur.fTime[0] + i, fPhaseDeriv);
                    fPhaseDerivAvg[i] = phaseDevAvg.calculateAvg(fPhaseDeriv);
                    AddPhaseSecondDeviationToGraph(dacMeasur.fTime[0] + i, calculatePhaseSecondDerivation(i));
                }
            }

            TemperMeasurment temper = parser.parseTemperartureFile();

            if (temper != null)
            {
                for (int i = 0; i < temper.fTemper.Length; i++)
                {
                    AddTemperatureToGraph(temper.fTimeTemper[i], temper.fTemper[i]);
                }
            }


            /*  graphPainter.autozoom(0);
             * graphPainter.autozoom(3);
             * graphPainter.autozoom(4);
             * graphPainter.autozoom(5);
             */
            Console.WriteLine("finished reading");
        }