// 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(); }
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(); }
public void RunState() { // Here's where we call the other methods // ASEN_SHA // ASEN_MotorControl Set Up this.motor1 = new ASEN_MotorControl(serials[0], this.velocity); //ASEN_MotorControl motor2 = new ASEN_MotorControl(serials[1], this.velocity); //ASEN_MotorControl motor3 = new ASEN_MotorControl(serials[2], this.velocity); Dictionary <string, string> SettingValues = new Dictionary <string, string>(); MotorConfiguration motorConfig = new MotorConfiguration(serials[0]); motorConfig = motor1.GetMotorConfiguration(serials[0], 1); // Initializing each motor one-by-one motor1.InitializeMotor(); //motor2.InitializeMotor(); //motor3.InitializeMotor(); // Homing the motors first motor1.HomeMotor(); //motor2.HomeMotor(); //motor3.HomeMotor(); // Now we move to whatever positon we desire motor1.MoveMotor(RCWS_DFORE); //motor2.MoveMotor(MA_X); //motor3.MoveMotor(MA_Y); // ASEN_RCWS Initializing Camera this.currentRCWS = new ASEN_RCWS(cameraInUse); currentRCWS.InitializeCamera(); /* * // ASEN_SHA Initializing Device * this.currentSHA = new ASEN_SHA(); * currentSHA.CameraConnectionAndSetup(); * * * * // ASEN_Environmental * this.teensy = new ASEN_ENV(this.teensyPort, path); * this.READ = true; * * * * Task teensyRead = Task.Factory.StartNew(() => TeensyParallel(ref this.teensyLock)); * Task imageRead = Task.Factory.StartNew(() => ImagingParallel()); * * Task.WaitAll(imageRead); * * // After the image is done reading, we have to set READ to false. * // Note that we have to block access to this variable as it is also shared by teensy read * lock (this.teensyLock) * { * this.READ = false; * } * * Task.WaitAll(teensyRead); * * currentRCWS.Disconnect(); * //currentSHA.CloseCamera(); */ }