Exemple #1
0
        public void StartExperiment()
        {
            // Most of what happens in the class will happen within the constructor, I think
            ASEN.ExperimentDirectory initialDirectory = new ASEN.ExperimentDirectory(experimentPath);
            string statePath = "";
            int    csvCount  = 0;

            using (StreamReader sr = new StreamReader(csvPath))
            {
                string currentLine;
                // currentLine will be null when the StreamReader reaches the end of file
                while ((currentLine = sr.ReadLine()) != null)
                {
                    if (csvCount == 0)
                    {
                    }
                    else
                    {
                        // Parsing data from the string
                        string[] valInput = currentLine.Split(',');
                        double[] inPut    = Array.ConvertAll(valInput, double.Parse);

                        // Adding a new state to the directory
                        statePath = initialDirectory.CreateNewState();

                        // calling the state constructor
                        currentState = new State(inPut, ISASI, statePath, this.serials, this.COMPort, this.pyPath, this.ipyPath);
                        currentState.RunState();
                    }

                    csvCount++;
                }
            }
        }
        public void StartExperiment()
        {
            // Most of what happens in the class will happen within the constructor, I think
            ASEN.ExperimentDirectory initialDirectory = new ASEN.ExperimentDirectory(experimentPath);
            string statePath = "";
            int    csvCount  = 0;
            double prevMX    = -1;
            double prevMY    = -1;
            int    stateNum  = 0;

            using (StreamReader sr = new StreamReader(csvPath))
            {
                string currentLine;
                // currentLine will be null when the StreamReader reaches the end of file
                while ((currentLine = sr.ReadLine()) != null)
                {
                    if (csvCount == 0)
                    {
                    }
                    else
                    {
                        stateNum++;
                        // Parsing data from the string
                        string[] valInput = currentLine.Split(',');
                        double[] inPut    = Array.ConvertAll(valInput, double.Parse);

                        // Adding a new state to the directory
                        statePath = initialDirectory.CreateNewState();
                        string parameterPath = statePath + "\\parameters.csv";
                        File.WriteAllText(parameterPath, currentLine);
                        Console.WriteLine("\nTrial Number: " + Convert.ToString(stateNum) + "\n");
                        // calling the state constructor
                        currentState = new State(inPut, cameraInUse, statePath, this.serials, this.COMPort, this.pyPath, this.ipyPath, gain, prevMX, prevMY);
                        currentState.RunState();
                        prevMX = inPut[4];
                        prevMY = inPut[5];
                    }

                    csvCount++;
                }
            }
        }