public StarProspects(double searchAreaDeg) { //Creates a list of star prospects from the associated observing list //Set StarChart FOV to something reasonable for this search sky6StarChart tsxsc = new sky6StarChart { FieldOfView = searchAreaDeg }; //Determine if search database file exists, if not, create it //if (!IsDBQInstalled()) //{ InstallDBQ(); } //Load the path, open and run the selected search database query sky6DataWizard tsxdw = new sky6DataWizard(); tsxdw.Path = GetDBQPath(); tsxdw.Open(); sky6ObjectInformation tsxoi = tsxdw.RunQuery; //Create a star list array for population of data //Fill in data arrays (for speed purposes) for (int i = 0; i < tsxoi.Count; i++) { tsxoi.Index = i; tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_NAME1); string starName = (tsxoi.ObjInfoPropOut); tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_RA_2000); double starRA = (tsxoi.ObjInfoPropOut); tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_DEC_2000); double starDec = (tsxoi.ObjInfoPropOut); tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_MAG); double starMag = (tsxoi.ObjInfoPropOut); DBQStar newStar = new DBQStar { StarName = starName, StarRA = starRA, StarDec = starDec, StarMag = starMag }; starProspectList.Add(newStar); } return; }
public DBQStar OffsetCenter(DBQStar tgtStar, double imagePA) { /*Calculates an offset position that places the input position in the center * of the guider FOV. * * Note that the bearing for moving off the target star is opposite for different * sides of the pier. If the scope is peering over the meridian, then this wont work * well. */ //Set the star chart FOV 4 times the y distance (arcmin) center of the ccd // fov to the center of the guider fov -- not really needed but helps viewing during processing SetStarChartSize(); // Convert target star RA and Dec to radians and place in RA/Dec structure double tgtRA = Transform.HoursToRadians(tgtStar.StarRA); double tgtDec = Transform.DegreesToRadians(tgtStar.StarDec); Celestial.RADec tgtStarPosition = new Celestial.RADec(tgtRA, tgtDec); // Compute the rotation (radians) associated with any guider FOV offset from the image PA double gRotationR = -Math.Atan2(gfov.CenterX, gfov.CenterY); // Increment the image PA by the guider offset double bearingR = gRotationR + Transform.DegreesToRadians(imagePA); // Reverse bearing if the mount is pointing east //if (!pierEast) { bearingR = -bearingR; } // Compute the distance beween the center of the Image FOV and the center of the Guider FOV double distanceR = Transform.DegreesToRadians((SumOfSquares(gfov.CenterX, gfov.CenterY)) / 60.0); // Calculate an offset position such that the guider FOV will have the target star in its center //Celestial.RADec endPosition = Celestial.Travel(tgtStarPosition, -gVectorR, gRotationR); Celestial.RADec endPosition = Celestial.ComputePositionFromBearingAndRange(tgtStarPosition, bearingR, -distanceR); // Convert this position back to hours and degrees (RA and Dec) and return the result // as a DBQStar structure DBQStar endStar = new DBQStar() { StarRA = Transform.RadiansToHours(endPosition.RA), StarDec = Transform.RadiansToDegrees(endPosition.Dec) }; return(endStar); }
public static void CalibrateGuider() { //AtGuider2 Application for automated guider camera calibration /* * This application locates a suitable calibration star for guider calibration, * slews the mount to frame the star in the guider FOV, * adjusts the guide camera exposure for the targer, * runs a calibration. * */ const double InitialGuiderExposure = 0.5; //Initial exposure level for guider camera images. const double OptGuiderADU = 20000; //Target ADU for guide star in guider camera images. //Open text output form LogEvent lg = new LogEvent(); SessionControl openSession = new SessionControl(); //Lets get started... //plate solve current location to prime target star search and to acquire image camera position angle lg.LogIt("Plate Solving for current position and position angle"); double imagePA = PlateSolve(); lg.LogIt("Position Angle: " + imagePA.ToString("0.000")); //Create an FOV object for the guider from the "My equipment.txt" Field of View Indicators file lg.LogIt("Parsing My equipment.txt file for FOVI definitions"); FOVMiracles guiderFOV = new FOVMiracles(); lg.LogIt("Active Guider found: " + guiderFOV.FOVName); //Set the chart size for something pleasant around the FOVI's guiderFOV.SetStarChartSize(); //Find a calibration star near the current position // that is sufficiently isolated from other similar stars lg.LogIt("Looking for proximate star to use for calibration"); DBQStar foundStar = FindStar(guiderFOV.FOVIsolation); if (foundStar == null) { lg.LogIt("No calibration star found. Try another location."); } else { lg.LogIt("Calibration star found: " + foundStar.StarName); //Closed Loop Slew (following standard slew -- see notes) to the target guide star lg.LogIt("Centering imaging camera on calibration star"); bool slewDone1 = SlewToStar(foundStar.StarName, foundStar.StarRA, foundStar.StarDec); if (slewDone1) { lg.LogIt("Calibration star centered"); } else { lg.LogIt("There was a problem centering the calibration star"); } //Calculate a pointing position that would put the target star in the guider FOV lg.LogIt("Calculating offset for centering star in guider FOV"); DBQStar tgtPosition = guiderFOV.OffsetCenter(foundStar, imagePA); lg.LogIt("Offset calculated for pointing at " + tgtPosition.StarRA.ToString("0.000") + " , " + tgtPosition.StarDec.ToString("0.000")); //Closed Loop Slew (following standard slew -- see notes) to that offset position lg.LogIt("Centering calibration star in guider FOV"); bool slewDone = SlewToPosition(tgtPosition.StarRA, tgtPosition.StarDec); if (slewDone1) { lg.LogIt("Calibration star centered in guider FOV"); } else { lg.LogIt("Could not recenter the calibration star"); } //plate solve current location -- not necessary but it sets up the star chart nicely for viewing // note that we are not in such a hurry that we can't mess around a bit lg.LogIt("Checking offset position with a plate solve"); imagePA = PlateSolve(); //Reset the chart size for something pleasant around the FOVI's guiderFOV.SetStarChartSize(); //center the star chart on the pointing location == once again, for esthetic purposes lg.LogIt("Recentering chart"); sky6StarChart tsxsc = new sky6StarChart { RightAscension = tgtPosition.StarRA, Declination = tgtPosition.StarDec }; //Take a guider image and adjust the exposure to an optimal level lg.LogIt("Adjusting guider exposure to achieve ADU of " + OptGuiderADU.ToString()); double optExposure = OptimizeExposure(InitialGuiderExposure, OptGuiderADU); lg.LogIt("Best guider exposure determined to be " + optExposure.ToString("0.00") + " secs"); //Calibrate the guider lg.LogIt("Starting direct guide calibration"); string calDone = CalibrateGuideCam(optExposure, false); //No AO lg.LogIt("Direct guide " + calDone); //Calibrate the AO, if enabled TargetPlan tPlan = new TargetPlan(openSession.CurrentTargetName); lg.LogIt("Starting AO guide calibration"); calDone = CalibrateGuideCam(optExposure, true); // AO lg.LogIt("AO guide " + calDone); } }