示例#1
0
        // Process with methods to be called when using the ASI camera
        private void ASICamera(string foreFile, string aftFile)
        {
            // Name of the ASCOM driver for the ASI
            cameraInUse = "ASCOM.ASICamera2.Camera";
            ASEN_RCWS currCamera = new ASEN_RCWS(cameraInUse);

            currCamera.InitializeCamera();

            // Starting the environmental sensors process
            var envProcess = Process.Start(this.Py);

            // Take a capture of the image at the fore distance
            currCamera.Capture(RCWS_EXPT, true);
            currCamera.SaveImage(foreFile + ".csv");

            // Taking a caputre with the SHA at the fore distance
            byte[]  spotFieldFore = currentSHA.GatherCameraData(SHA_EXPT, SHAPath + "\\img_fore.csv");
            float[] zernikesFore  = currentSHA.ProcessCameraData(SHAPath + "\\wft_fore.csv", SHAPath + "\\spt_fore", SHAPath + "\\zernikes_fore.csv");

            // Moving the RCWS motor to the aft location
            motor1.MoveMotorLinear(RCWS_DAFT);

            // Taking a capture of the image at the aft distance
            currCamera.Capture(RCWS_EXPT, true);
            currCamera.SaveImage(aftFile + ".csv");

            // Taking a capture with the SHA at the aft distance
            byte[]  spotFieldAft = currentSHA.GatherCameraData(SHA_EXPT, SHAPath + "\\img_aft.csv");
            float[] zernikesAft  = currentSHA.ProcessCameraData(SHAPath + "\\wft_aft.csv", SHAPath + "\\spt_aft", SHAPath + "\\zernikes_aft.csv");


            // Ending the env. sensors process
            envProcess.StandardInput.Close();

            // Disconnecting from the ASI
            currCamera.Disconnect();
        }
示例#2
0
        public void RunState()
        {
            // Want to create the filenames sans-extensions
            string RCWSForePath = this.RCWSPath + "\\img_RCWS_fore";
            string RCWSAftPath  = this.RCWSPath + "\\img_RCWS_aft";

            /*
             * // Motor Control Setup
             * this.motor1 = new ASEN_MotorControl(serials[0], this.velocity);
             * this.motor2 = new ASEN_MotorControl(serials[1], this.velocity);
             * this.motor3 = new ASEN_MotorControl(serials[2], this.velocity);
             *
             * // Initializing the motors
             * motor1.InitializeMotor();
             * motor2.InitializeMotor();
             * motor3.InitializeMotor();
             *
             * // Initializing the process info for the python process to run for the Env Sensors
             * Py = new ProcessStartInfo(); // Initializing the process start info
             * Py.FileName = pyPath;  // Path to the python exe
             * Py.Arguments = "SerialReader.py" + " " + this.path + " " + this.teensyPort;  // The .py script to run and its arguments
             * Py.UseShellExecute = false;// Do not use OS shell
             * Py.CreateNoWindow = true; // We don't need new window
             * Py.RedirectStandardOutput = true; // Redirecting output from the python stdout
             * Py.RedirectStandardInput = true;  // Redirecting input from the python stdin
             * Py.RedirectStandardOutput = true;// Any output, generated by application will be redirected back
             * Py.RedirectStandardError = true; // Any error in standard output will be redirected back (for example exceptions)
             *
             * // Initial homing of the motors
             * motor1.HomeMotor();
             * motor2.HomeMotor();
             * motor3.HomeMotor();
             *
             * // Now we move the motors to their initial position.
             * // This means the tilt-tip stage is moved to its proper position, while the linear
             * // stage is moved to the RCWS's specified fore defocus position
             * motor1.MoveMotorLinear(RCWS_DFORE);
             * motor2.MoveMotorPitch(MA_X);
             * motor3.MoveMotorYaw(MA_Y);
             *
             * // ASEN_SHA Initializing Device
             * currentSHA = new ASEN_SHA();
             * currentSHA.CameraConnectionAndSetup();
             *
             * // Running the correct camera process depending on which camera was selected in the GUI
             * if (ISASI) { ASICamera(RCWSForePath, RCWSAftPath); }
             * else { QHYCamera(RCWSForePath, RCWSAftPath); }
             *
             *
             * currentSHA.CloseCamera();
             * motor1.DisconnectMotor();
             * motor2.DisconnectMotor();
             * motor3.DisconnectMotor();
             */
            ASEN_RCWS camera = new ASEN_RCWS("ASCOM.QHYCCD.Camera");

            camera.InitializeCamera();
            camera.Capture(0.05, true);
            camera.SaveImage(@"C:\Users\sheph\Desktop\QHYASOMTestFile.csv");
            camera.Disconnect();
        }