public FormTargetTrack(DailyPosition dp, DailyPosition mp, string targetNameS) { InitializeComponent(); targetName = targetNameS; tgtDateUTC = dp.UTCdate; moonDateUTC = mp.iRise; tgtUpH = dp.Rising.ToLocalTime().Hour + (dp.Rising.ToLocalTime().Minute / 60.0); tgtDownH = dp.Setting.ToLocalTime().Hour + (dp.Setting.ToLocalTime().Minute / 60.0); tgtDecD = 90.0 - Transform.RadiansToDegrees(dp.Position.Dec); tgtPosition = dp.Position; MoonPosition = mp.Position; obsLocation = dp.Location; //Set lat obsLatD = Transform.RadiansToDegrees(dp.Location.Lat); //Moon look up stuff Celestial.RADec moonRADec = DailyPosition.MoonRaDec(Celestial.DateToJ2kC(dp.UTCdate)); moonDecD = 90 - Transform.RadiansToDegrees(mp.Position.Dec); //Get the rise/set times from TSX sky6StarChart tsxs = new sky6StarChart(); sky6ObjectInformation tsxo = new sky6ObjectInformation(); //Set the date/time to the local date for the target tsxs.SetDocumentProperty(Sk6DocumentProperty.sk6DocProp_JulianDateNow, Celestial.DateToJulian(tgtDateUTC)); //Get some target stuff that's hard to calculate tsxs.Find(targetName); //wait a second System.Threading.Thread.Sleep(500); tsxo.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_TRANSIT_TIME); tgtTransitH = tsxo.ObjInfoPropOut; //Test stuff //double testmoontransitH = MoonPosition.TransitTime(tgtDateUTC, obsLocation); //Get some moon stuff now tsxs.SetDocumentProperty(Sk6DocumentProperty.sk6DocProp_JulianDateNow, Celestial.DateToJulian(moonDateUTC)); tsxs.Find("Moon"); //wait a second System.Threading.Thread.Sleep(500); tsxo.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_RISE_TIME); moonRiseH = tsxo.ObjInfoPropOut; tsxo.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_SET_TIME); moonSetH = tsxo.ObjInfoPropOut; //put the target back in tsxs.Find(targetName); tsxs = null; tsxo = null; return; }
/// Windows C# Sample Console Application: ClosedLoopSlew /// /// ------------------------------------------------------------------------ /// /// Author: R.McAlister (2017) /// /// ------------------------------------------------------------------------ /// /// ClosedLoopSlew: Find a target (M39 in this case), then execute a closed loop slew to it /// /// public void CLSSample() { ///Set connection to star chart and perform a find on M39 sky6StarChart tsx_sc = new sky6StarChart(); tsx_sc.Find("M39"); ///Create connection to camera and connect ccdsoftCamera tsx_cc = new ccdsoftCamera(); tsx_cc.Connect(); ///Create closed loop slew object ClosedLoopSlew tsx_cls = new ClosedLoopSlew(); ///Set the exposure, filter to luminance and reduction, set the camera delay to 0 -- backlash /// should be picked up in the mount driver tsx_cc.ImageReduction = ccdsoftImageReduction.cdAutoDark; tsx_cc.FilterIndexZeroBased = 3; ///Luminance tsx_cc.ExposureTime = 10; tsx_cc.Delay = 0; ///Execute try { int clsstat = tsx_cls.exec(); } catch { ///Just close up: TSX will spawn error window MessageBox.Show("Closed Loop Slew failure"); }; return; }
static bool SlewToPosition(double starRA, double starDec) { //Moves the mount to center the calibration star in the guider FOV //Async slew to target (letting dome catch up), then CLS to align (does not coordinate with dome) // sky6RASCOMTele tsxm = new sky6RASCOMTele { Asynchronous = 0 }; if (tsxm.IsConnected == 0) { tsxm.Connect(); } tsxm.SlewToRaDec(starRA, starDec, "Target Position"); sky6StarChart tsxsc = new sky6StarChart(); string RADecname = starRA.ToString() + "," + starDec.ToString(); ClosedLoopSlew tsxcls = new ClosedLoopSlew(); tsxsc.Find(RADecname); try { tsxcls.exec(); } catch (Exception ex) { return(false); } return(true); }
/// Windows C# Sample Console Application: Solar /// /// ------------------------------------------------------------------------ /// Vaguely adapted from Solar.vbs /// Copyright Software Bisque /// /// Converted by: R.McAlister 2017 /// /// ------------------------------------------------------------------------ /// ///Very simple demonstration application that targets the telescope on the Sun -- careful now. /// /// Note: this is basically simplification of "ListSearch.vb" where the only target is the Sun. /// /// public void SolarSample() { ///Target Sun string target = "Sun"; ///Create Objects sky6StarChart tsx_sc = new sky6StarChart(); sky6RASCOMTele tsx_ts = new sky6RASCOMTele(); sky6ObjectInformation tsx_oi = new sky6ObjectInformation(); ///Connect telescope tsx_ts.Connect(); tsx_sc.Find(target); tsx_oi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_ALT); double dAlt = tsx_oi.ObjInfoPropOut; tsx_oi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_AZM); double dAz = tsx_oi.ObjInfoPropOut; try { tsx_ts.SlewToAzAlt(dAz, dAlt, target); } catch { MessageBox.Show("An error has occurred running slew"); return; }; MessageBox.Show("The Sun's location is at: Altitude: " + dAlt.ToString() + " Azimuth: " + dAz.ToString()); ///Disconnect telesope tsx_ts.Disconnect(); return; }
public bool CLSToTarget(SpeedVector sv) { int clsStatus = 123; sky6RASCOMTele tsxmt = new sky6RASCOMTele(); ClosedLoopSlew tsx_cl = new ClosedLoopSlew(); sky6StarChart tsxsc = new sky6StarChart(); //Clear any image reduction, otherwise full reduction might cause a problem ccdsoftCamera tsxcam = new ccdsoftCamera() { ImageReduction = ccdsoftImageReduction.cdNone, Asynchronous = 1 //make sure nothing else happens while setting this up }; //Abort any ongoing imaging tsxcam.Abort(); double tgtRAH = Transform.DegreesToHours(sv.RA_Degrees - RA_CorrectionD); double tgtDecD = sv.Dec_Degrees - Dec_CorrectionD; tsxsc.Find(tgtRAH.ToString() + ", " + tgtDecD.ToString()); tsxmt.Connect(); try { tsxmt.SlewToRaDec(tgtRAH, tgtDecD, TgtName); } catch (Exception ex) { MessageBox.Show("Slew to target failed: " + ex.Message); return(false); } //********** CLS AVOIDANCE CODE FOR SIMULATOR DEBUGGING PURPOSES //tsxsc.Find(TgtName); //return true; //********************* try { clsStatus = tsx_cl.exec(); } catch (Exception ex) { tsxsc.Find(TgtName); return(false); } tsxsc.Find(TgtName); return(true); }
private void NGCList_SelectedIndexChanged(Object sender, EventArgs e) { //Upon selection of an object, center the star chart on the RA/Dec and run a Find on the name. sky6StarChart tsxsc = new sky6StarChart(); int oi = olist.TgtFind(NGCList.SelectedItem.ToString()); tsxsc.Declination = olist.TgtDec(oi); tsxsc.RightAscension = olist.TgtRA(oi); tsxsc.Find(NGCList.SelectedItem.ToString()); tsxsc = null; return; }
private void FillInTargetDetails(string tName) { //Retrieves details from TSX about the target object sky6StarChart tsxs = new sky6StarChart(); sky6ObjectInformation tsxo = new sky6ObjectInformation(); try { tsxs.Find(tName); } catch { return; } tsxo.Index = 0; tsxo.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_ALL_INFO); string sAllInfo = tsxo.ObjInfoPropOut; sAllInfo = sAllInfo.Replace("/", "-"); string[] sInfoDB = sAllInfo.Split('\n'); XElement infoX = new XElement("All_Properties"); foreach (string ipair in sInfoDB) { string[] infoPair = ipair.Split(':'); infoPair[0] = infoPair[0].Replace(" ", "_"); string[] firstSpace = infoPair[0].Split('('); if (firstSpace[0] != "") { firstSpace[0] = firstSpace[0].Trim('_'); firstSpace[0] = System.Text.RegularExpressions.Regex.Replace(firstSpace[0], "//", ""); infoPair[1] = infoPair[1].Trim(' '); infoX.Add(new XElement(firstSpace[0], infoPair[1])); } } //Get rid of multiple constellations. Got to do it twice for (some reason foreach (XElement xmv in infoX.Elements("Constellation")) { if (xmv.Value.Length < 4) { xmv.Remove(); } } foreach (XElement xmv in infoX.Elements("Constellation")) { if (xmv.Value.Length < 4) { xmv.Remove(); } } //Get rid of the first RA (that//s the current, not J2000) XElement xra = infoX.Element("RA"); xra.Remove(); XElement xdec = infoX.Element("Dec"); xdec.Remove(); //read out interesting data string details = ""; details += "Object: " + EntryCheck(infoX, "Object_Name"); details += "Catalog Id: " + EntryCheck(infoX, "Catalog_Identifier"); details += "Object Type: " + EntryCheck(infoX, "Object_Type"); details += "Constellation: " + EntryCheck(infoX, "Constellation"); details += "Magnitude: " + EntryCheck(infoX, "Magnitude"); details += "Major Axis: " + EntryCheck(infoX, "Major_Axis"); details += "Minor Axis: " + EntryCheck(infoX, "Minor_Axis"); details += "Axis PA: " + EntryCheck(infoX, "Axis_Position_Angle"); details += "RA (J2000): " + EntryCheck(infoX, "RA"); details += "Dec (J2000): " + EntryCheck(infoX, "Dec"); TargetDetailsTip.SetToolTip(TargetNameBox, details); return; }
public static bool CLSToTarget(string tgtName, SpeedVector sv, bool IsPrecision = false) { //first, couple dome to telescope, if there is one sky6Dome tsxd = new sky6Dome(); try { tsxd.Connect(); tsxd.IsCoupled = 1; } catch (Exception ex) { //do nothing } int clsStatus = 123; sky6RASCOMTele tsxmt = new sky6RASCOMTele(); ClosedLoopSlew tsx_cl = new ClosedLoopSlew(); sky6StarChart tsxsc = new sky6StarChart(); sky6Utils tsxu = new sky6Utils(); //Check to see if target is above horizon double tgtRAH = Transform.DegreesToHours(sv.RA_Degrees); double tgtDecD = sv.Dec_Degrees; tsxu.ConvertRADecToAzAlt(tgtRAH, tgtDecD); double tgtAzmD = tsxu.dOut0; double tgtAltD = tsxu.dOut1; if (tgtAltD <= 0) { MessageBox.Show("Slew failure: Target is below the horizon"); return(false); } //Clear any image reduction, otherwise full reduction might cause a problem ccdsoftCamera tsxcam = new ccdsoftCamera() { ImageReduction = ccdsoftImageReduction.cdNone, Asynchronous = 1 //make sure nothing else happens while setting this up }; //Abort any ongoing imaging tsxcam.Abort(); bool returnStatus = true; // diagnostic string strRA = Utils.HourString(tgtRAH, false); string strDec = Utils.DegreeString(tgtDecD, false); // tsxsc.Find(tgtRAH.ToString() + ", " + tgtDecD.ToString()); tsxmt.Connect(); tsxu.Precess2000ToNow(tgtRAH, tgtDecD); double jnRAH = tsxu.dOut0; double jnDecD = tsxu.dOut1; //tsxmt.Asynchronous = 0; try { tsxmt.SlewToRaDec(jnRAH, jnDecD, tgtName); } catch (Exception ex) { MessageBox.Show("Slew Failure: " + ex.Message); returnStatus = false; } if (IsPrecision && returnStatus) { //*** precision slew try { clsStatus = tsx_cl.exec(); } catch (Exception ex) { returnStatus = false; } } try { tsxsc.Find(tgtName); } catch (Exception ex) { returnStatus = true; } return(returnStatus); }
public static string TargetStarSearch() { //Upon instantiation... //Open empty working XML file for Star list //Create connection to TSX DataWizard //Get the path to the query files, then set the path to SuperScanQuery.sdb //Run the DataWizard //Create an XML datastructure for the Observing List and load it with Observing LIst entries //Replace the current working Star List file with the new XML data list //Close the file string gName; double gRA; double gDec; //Locate current position on star chart and set FOV to 3 degrees sky6StarChart tsxsc = new sky6StarChart(); double centerRA = tsxsc.RightAscension; double centerDec = tsxsc.Declination; tsxsc.FieldOfView = 3.0; //Look for closest member of list //Note the Hour Angle should always be greater than zero // and the search area witin 3 degrees of the center of the chart // Also only uses HIP stars because "Find" doesn't work on all names, like Tycho double bestSeparation = 100.0; double tSeparation; TargetRA = centerRA; TargetDec = centerDec; sky6ObjectInformation tsx_oi = new sky6ObjectInformation(); do { //tsx_oi = GetStars(); // will return null if null tsx_oi (including exception thrown) or count = 0; //Runs the database query and checks results. objecty information false // else returns null sky6DataWizard tsx_dw = new sky6DataWizard(); ///Set query path tsx_dw.Path = StarSearchDBQPath; tsx_dw.Open(); string tst = tsx_dw.Path; try { tsx_oi = tsx_dw.RunQuery; } catch (Exception ex) { MessageBox.Show(ex.Message); return(null); } if (tsx_oi.Count == 0) { return(null); } // // if (tsx_oi == null) { MessageBox.Show("Waiting half a minute for a better target star"); System.Threading.Thread.Sleep(30000); //sleep for thirty seconds then try again } } while (tsx_oi == null); int oiCount = tsx_oi.Count; for (int i = 0; i < oiCount; i++) { tsx_oi.Index = i; tsx_oi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_NAME1); gName = (string)tsx_oi.ObjInfoPropOut; tsx_oi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_RA_2000); gRA = (double)tsx_oi.ObjInfoPropOut; tsx_oi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_DEC_2000); gDec = (double)tsx_oi.ObjInfoPropOut; if (gName.Contains("HIP")) { tSeparation = ComputeDistance(centerRA, centerDec, gRA, gDec); if (tSeparation < bestSeparation) { bestSeparation = tSeparation; TargetName = gName; TargetRA = gRA; TargetDec = gDec; } } } tsxsc.Find(TargetName); return(TargetName); }
/// Windows C# Sample Console Application: AutoGuide /// /// ------------------------------------------------------------------------ /// /// Author: R.McAlister (2017) /// /// ------------------------------------------------------------------------ /// /// This application performs the following steps: /// Finds a target, M39 in this case /// Turns off Autoguiding (if on) /// Performs a Closed Loop Slew to the target /// Takes an image with the Autoguide camera /// Turns on Autoguiding /// /// public void AutoGuideSample() { ///Set connection to star chart and perform a find on M39 -- this will set the target for a CLS sky6StarChart tsx_sc = new sky6StarChart(); tsx_sc.Find("M39"); ///Create connection to autoguide camera and connect ccdsoftCamera tsx_ag = new ccdsoftCamera(); ///Attach this object to the guider camera tsx_ag.Autoguider = 1; ///Find out with the guide camera is up to. Abort if autoguiding or calibrating if (tsx_ag.Connect() == 0) { if ((tsx_ag.State == ccdsoftCameraState.cdStateAutoGuide) | (tsx_ag.State == ccdsoftCameraState.cdStateCalibrate)) { tsx_ag.Abort(); } ; } ; ///Create closed loop slew object ClosedLoopSlew tsx_cls = new ClosedLoopSlew(); ///Set the exposure, filter to luminance and reduction, set the camera delay to 0 -- backlash /// should be picked up in the mount driver ccdsoftCamera tsx_cc = new ccdsoftCamera(); tsx_cc.ImageReduction = ccdsoftImageReduction.cdAutoDark; tsx_cc.FilterIndexZeroBased = 3; ///Luminance tsx_cc.ExposureTime = 10; tsx_cc.Delay = 0; ///run CLS synchronously ///tsx_cls.Asynchronous = False ///-- this setting doesn///t appear to work (member not found) as of DB8458 ///Execute try { int clsstat = tsx_cls.exec(); } catch { ///Just close up: TSX will spawn error window MessageBox.Show("Closed Loop Slew error"); return; ///Let it go for demo purposes }; ///Connect AutoGuide camera in case it isn///t try { tsx_ag.Connect(); } catch { MessageBox.Show("Guide camera connect error"); return; }; ///Take an image to use for Autoguiding, run the function synchronously tsx_ag.ExposureTime = 2; tsx_ag.Asynchronous = 0; tsx_ag.Subframe = 0; var tstat = tsx_ag.TakeImage(); ///Just assume it works ///Turn asynchronous back on to get out of this tsx_ag.Asynchronous = 1; ///Fire off Autoguiding tsx_ag.Autoguide(); return; }
/// Windows C# Sample Console Application: AutoFocus /// /// ------------------------------------------------------------------------ /// /// Author: R.McAlister (2017) /// /// ------------------------------------------------------------------------ /// /// This application performs the following steps: /// Saves the current target and imaging parameters /// Turns off Autoguiding (if on) /// Turns on AutoFocus /// Returns to the current target /// Note that "Automatically slew telescope to nearest appropriate focus star" must be checked in the @Focus2 start-up window. /// public void AutoFocusSample() { int iFilter = 3; ///Luminescent, I hope ///Connect the telescope for some slewing sky6RASCOMTele tsx_tt = new sky6RASCOMTele(); tsx_tt.Connect(); ///Work around and Run @Focus2 /// Save current target name so it can be found again /// Run @Focus2 (which preempts the observating list and object) /// Restore current target, using Name with Find method /// ClosedLoopSlew back to target ccdsoftCamera tsx_cc = new ccdsoftCamera(); tsx_cc.Connect(); tsx_cc.focConnect(); ///Get current target name so we can return after running @focus2 sky6ObjectInformation tsx_oi = new sky6ObjectInformation(); tsx_oi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_NAME1); string sTargetName = tsx_oi.ObjInfoPropOut; ///TBD: Set up parameters for @Focus2, if necessary /// ///Run Autofocus /// Create a camera object /// Launch the autofocus watching out for an exception -- which will be posted in TSX ///Save current camera delay, exposure and filter /// then set the camera delay = 0 /// set the delay back when done with focusing tsx_cc.AutoSaveFocusImages = 0; var dCamDelay = tsx_cc.Delay; var iCamReduction = tsx_cc.ImageReduction; var iCamFilter = tsx_cc.FilterIndexZeroBased; var dCamExp = tsx_cc.ExposureTime; var iFocStatus = 0; tsx_cc.ImageReduction = ccdsoftImageReduction.cdAutoDark; tsx_cc.FilterIndexZeroBased = 3; ///Luminance tsx_cc.ExposureTime = 10; tsx_cc.Delay = 0; tsx_cc.FilterIndexZeroBased = iFilter; iFocStatus = tsx_cc.AtFocus2(); ///Restore the current target and slew back to it /// Run a Find on the target -- which makes it the "observation" /// Perform Closed Loop Slew to the target sky6StarChart tsx_sc = new sky6StarChart(); tsx_sc.Find(sTargetName); ///Run a Closed Loop Slew to return ClosedLoopSlew tsx_cls = new ClosedLoopSlew(); ///Set the exposure, filter to luminance and reduction, set the camera delay to 0 -- any backlash /// should be picked up in the mount driver tsx_cc.ImageReduction = ccdsoftImageReduction.cdAutoDark; tsx_cc.FilterIndexZeroBased = iFilter; ///Luminance, probably tsx_cc.ExposureTime = 10; tsx_cc.Delay = 0; try { var clsstat = tsx_cls.exec(); } catch { ///Just close up: TSX will spawn error window ///System.Windows.Forms.Show("AutoFocus return failure") }; ///Put back the orginal settings tsx_cc.ImageReduction = iCamReduction; tsx_cc.FilterIndexZeroBased = iCamFilter; tsx_cc.ExposureTime = dCamExp; tsx_cc.Delay = dCamDelay; return; }
//Find the coordinates of the object galaxyName and perform a slew, then CLS to it. private bool SeekGalaxy() { sky6StarChart tsx_sc = new sky6StarChart(); ClosedLoopSlew tsx_cl = new ClosedLoopSlew(); sky6RASCOMTele tsx_mt = new sky6RASCOMTele(); sky6Raven tsx_rv = new sky6Raven(); sky6ObjectInformation tsx_obj = new sky6ObjectInformation(); //Clear any camera set up stuff that might be hanging around // and there has been some on occasion //Removed subframe on request for cameras with long download times ccdsoftCamera tsx_cc = new ccdsoftCamera() { //Subframe = 0, Delay = 0 }; LogEntry("Finding coordinates for " + freshImageName); tsx_sc.Find(freshImageName); // Perform slew to new location before starting CLS -- TSX does not wait for dome rotation. tsx_obj.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_RA_2000); double tRA = tsx_obj.ObjInfoPropOut; tsx_obj.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_DEC_2000); double tDec = tsx_obj.ObjInfoPropOut;; //Make sure that the mount commands are synchronous tsx_mt.Asynchronous = 0; //LogEntry("Initial slew to target"); ////Slew the mount and dome should follow before completion... // try { tsx_mt.SlewToRaDec(tRA, tDec, freshImageName); } //catch (Exception ex) { LogEntry("Slew error: " + ex.Message); } //Test to see if a dome tracking operation is underway. // If so, doing a IsGotoComplete will throw an Error 212. // Ignore it a wait a few seconds for stuff to clear //If using dome, toggle dome coupling: this appears to clear most Error 123 problems Configuration ss_cfg = new Configuration(); bool hasDome = Convert.ToBoolean(ss_cfg.UsesDome); if (hasDome) { sky6Dome tsx_dm = new sky6Dome(); tsx_dm.IsCoupled = 0; System.Threading.Thread.Sleep(1000); tsx_dm.IsCoupled = 1; } //Wait for any Error 123//s to clear LogEntry("Precision slew (CLS) to target"); //Now try the CLS, but if an Error 123 is thrown, keep trying // every five seconds until the dome slew catches up. //int clsStatus = 123; //while (clsStatus == 123) //{ // try { clsStatus = tsx_cl.exec(); } // catch (Exception ex) // { // clsStatus = ex.HResult - 1000; // LogEntry("CLS Error: " + ex.Message); // }; //} DeviceControl dctl = new DeviceControl(); int clsStatus = dctl.ReliableClosedLoopSlew(tRA, tDec, freshImageName, hasDome); LogEntry("Precision Slew Complete: "); if (clsStatus == 0) { LogEntry(" CLS successful"); return(true); } else { LogEntry(" CLS unsucessful: Error: " + clsStatus.ToString()); return(false); } }
double MinGalAlt = 30; //Minimum altitude will default to 30 degrees if not set public GalaxyList() //Upon instantiation... //Open empty working XML file for galaxy list //Create connection to TSX DataWizard //Get the path to the query files, then set the path to SuperScanQuery.sdb //Run the DataWizard //Create an XML datastructure for the Observing List and load it with Observing LIst entries //Replace the current working Galaxy List file with the new XML data list //Close the file { string gname = ""; string gRA; string gDec; string gMag; string gMajorAxis; string gMinorAxis; string gAltitude; string gHA; string gSide; XElement gXgalaxies = new XElement("TargetGalaxies"); XElement gXrec; Configuration ss_cfg = new Configuration(); //if targets are to be refreshed, then run a new observing list query and save the results in the gXgalaxies XML list if (Convert.ToBoolean(ss_cfg.RefreshTargets)) { ///Create object information and datawizard objects sky6DataWizard tsx_dw = new sky6DataWizard(); ///Set query path tsx_dw.Path = ss_cfg.QueryPath; tsx_dw.Open(); string tst = tsx_dw.Path; sky6ObjectInformation tsx_oi = new sky6ObjectInformation(); tsx_oi = tsx_dw.RunQuery; /// ///tsx_oi is an array (tsx_oi.Count) of object information indexed by the tsx_oi.Index property /// ///For each object information in the list, get the name, perform a "Find" and look for the catalog ID. If there is one, print it. for (int i = 0; i <= (tsx_oi.Count - 1); i++) { tsx_oi.Index = i; tsx_oi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_NAME1); gname = tsx_oi.ObjInfoPropOut.ToString(); tsx_oi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_RA_2000); gRA = tsx_oi.ObjInfoPropOut.ToString(); tsx_oi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_DEC_2000); gDec = tsx_oi.ObjInfoPropOut.ToString(); tsx_oi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_MAG); gMag = tsx_oi.ObjInfoPropOut.ToString(); tsx_oi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_MAJ_AXIS_MINS); gMajorAxis = tsx_oi.ObjInfoPropOut.ToString(); tsx_oi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_MIN_AXIS_MINS); gMinorAxis = tsx_oi.ObjInfoPropOut.ToString(); tsx_oi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_ALT); gAltitude = tsx_oi.ObjInfoPropOut.ToString(); tsx_oi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_HA_HOURS); gHA = tsx_oi.ObjInfoPropOut.ToString(); if (System.Convert.ToDouble(gHA) < 0) { gSide = "East"; } else { gSide = "West"; }; gXrec = new XElement("Galaxy", new XElement("Name", gname), new XElement("RA", gRA), new XElement("Dec", gDec), new XElement("Magnitude", gMag), new XElement("MajorAxis", gMajorAxis), new XElement("MinorAxis", gMinorAxis), new XElement("Altitude", gAltitude), new XElement("HA", gHA), new XElement("Side", gSide)); //check for galaxy size, if less than the configured minimum, then discard if (Convert.ToDouble(gMajorAxis) >= Convert.ToDouble(ss_cfg.MinGalaxySize)) { gXgalaxies.Add(gXrec); } } gXgalaxies.Save(ss_cfg.GalaxyListPath); return; } else { //List is not to be refreshed. Look for the "SuperScanObservingList" in the SuperScan directory. // if one, then parse it into an XML tree if (File.Exists(ss_cfg.ObservingListPath)) { ObservingListLoader oLoad = new ObservingListLoader(ss_cfg.ObservingListPath); XElement oListX = oLoad.TSXtoXML(); //The XML doc may or may not have all the galaxy information that we need, so use the Find function to go through the //targets and capture all the information TheSky64Lib.sky6StarChart tsxsc = new sky6StarChart(); sky6ObjectInformation tsx_oi = new sky6ObjectInformation(); foreach (XElement galaxyXList in oListX.Elements("target")) { string gName = galaxyXList.Element("name").Value; tsxsc.Find(gName); tsx_oi.Index = 0; tsx_oi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_NAME1); gname = tsx_oi.ObjInfoPropOut.ToString(); tsx_oi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_RA_2000); gRA = tsx_oi.ObjInfoPropOut.ToString(); tsx_oi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_DEC_2000); gDec = tsx_oi.ObjInfoPropOut.ToString(); tsx_oi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_MAG); gMag = tsx_oi.ObjInfoPropOut.ToString(); tsx_oi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_MAJ_AXIS_MINS); gMajorAxis = tsx_oi.ObjInfoPropOut.ToString(); tsx_oi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_MIN_AXIS_MINS); gMinorAxis = tsx_oi.ObjInfoPropOut.ToString(); tsx_oi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_ALT); gAltitude = tsx_oi.ObjInfoPropOut.ToString(); tsx_oi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_HA_HOURS); gHA = tsx_oi.ObjInfoPropOut.ToString(); if (System.Convert.ToDouble(gHA) < 0) { gSide = "East"; } else { gSide = "West"; }; gXrec = new XElement("Galaxy", new XElement("Name", gname), new XElement("RA", gRA), new XElement("Dec", gDec), new XElement("Magnitude", gMag), new XElement("MajorAxis", gMajorAxis), new XElement("MinorAxis", gMinorAxis), new XElement("Altitude", gAltitude), new XElement("HA", gHA), new XElement("Side", gSide)); //check for galaxy size, if less than the configured minimum, then discard if (Convert.ToDouble(gMajorAxis) >= Convert.ToDouble(ss_cfg.MinGalaxySize)) { gXgalaxies.Add(gXrec); } } gXgalaxies.Save(ss_cfg.GalaxyListPath); } } }
//When a suspect is chosen from the textbox list, parse the line for galaxy name and date // then have TSX open the difference image, the reference image and the current image // then have TSX set the FOV to the size of the galaxy, set the center of the chart to the // coordinates of the suspect and place the target circle over the coordinates. // //Then... // private void SuspectListbox_SelectedIndexChanged(object sender, EventArgs e) { ///If nothing selected then exit /// ///Parse the selected line for the galaxy name and image time. ///Load up the suspect data ///Lay in the clearer follow up image and prep to blink the two latest images /// //Set the cursor to wait UseWaitCursor = true; Show(); FormCrunchingNotice cForm = new FormCrunchingNotice(); cForm.Show(); BlinkButton.BackColor = Color.LightSalmon; //pull the selected suspect entry from the suspect list box string susitem; try { susitem = SuspectListbox.Items[SuspectListbox.SelectedIndex].ToString(); } catch (Exception ex) { return; } //Clear the blink list BlinkList = null; //Parse the selected entry for relavent info and create a suspect object to work with int galLen = susitem.IndexOf("\t"); string galname = susitem.Substring(0, galLen - 1); galname = galname.TrimEnd(); int dateLen = susitem.IndexOf(":") - galLen + 2; string galevent = susitem.Substring(galLen + 1, dateLen); DateTime galdate = Convert.ToDateTime(galevent); CurrentSuspect = new Suspect(); //Check to see if the stored suspect info loads ok, if so then // have TSX upload the image files and target the RA/Dec bool susLoad = CurrentSuspect.Load(galname, galdate); if (susLoad) { CurrentDrillDown = new DrillDown(CurrentSuspect.Event); CurrentDrillDown.Display(galname, CurrentSuspect.SuspectRA, CurrentSuspect.SuspectDec); sky6StarChart tsx_sc = new sky6StarChart(); sky6ObjectInformation tsx_oi = new sky6ObjectInformation(); //Get the galaxy major axis tsx_sc.Find(galname); tsx_oi.Index = 0; tsx_oi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_MAJ_AXIS_MINS); double galaxis = tsx_oi.ObjInfoPropOut; //Set the FOV size to the galaxy size tsx_sc.FieldOfView = galaxis / 60; //Set the center of view to the suspect//s RA/Dec and light up the target icon //tsx_sc.Find(suspect.SuspectRA.ToString() + ", " + suspect.SuspectDec.ToString()); tsx_sc.RightAscension = CurrentSuspect.SuspectRA; tsx_sc.Declination = CurrentSuspect.SuspectDec; //Check TNS for supernova reports for 60 arc seconds around this location for the last 10 days TNSReader tnsReport = new TNSReader(); List <string> snList = tnsReport.RunLocaleQuery(CurrentSuspect.SuspectRA, CurrentSuspect.SuspectDec, 60, 10); if (snList != null) { NotesTextBox.AppendText("Supernova reported for " + snList[0] + " at this location\r\n"); } else { NotesTextBox.AppendText("No supernova report for this location\r\n"); } //Give the user an opportunity to clear the suspect by updating its status to cleared -- or not. Clipboard.Clear(); try { Clipboard.SetText(CurrentSuspect.SuspectRA.ToString() + ", " + CurrentSuspect.SuspectDec.ToString()); } catch (Exception ex) { NotesTextBox.AppendText(ex.Message); return; } //Display the suspect position information NotesTextBox.AppendText("Suspect RA and Dec written to clipboard\r\n"); LocationTextBox.Text = CurrentSuspect.SuspectRA.ToString() + ", " + CurrentSuspect.SuspectDec.ToString(); Show(); System.Windows.Forms.Application.DoEvents(); //Show followup Image in picture box CurrentFollowUpImage = CurrentDrillDown.GetFollowUpImage(ImageZoom); ImagePictureBox.SizeMode = PictureBoxSizeMode.CenterImage; ImagePictureBox.Image = CurrentFollowUpImage; BlinkButton.BackColor = Color.LightGreen; ClearButton.BackColor = Color.LightGreen; UseWaitCursor = false; } cForm.Close(); Show(); return; }
public FormPreview(string targetName) { InitializeComponent(); // //private string isource1 = "http://server1.sky-map.org/skywindow?img_source=DSS2&object=ic2177&zoom=8"; string isource1 = "http://server1.sky-map.org/skywindow?img_source=DSS2"; string izoom = "zoom="; string ira = "ra="; string idec = "de="; string ishowbox = "show_box=1"; string ishowboxwidth = "box_width="; string ishowboxheight = "box_height="; string ishowgrids = "show_grid=0"; string ishowconstellationlines = "show_constellation_lines=0"; string ishowconstellationboundaries = "show_constellation_boundaries=0"; int angularFrameWidth = 0; double iWidthD = 60; //default width of 1 degree double iHeightD = 45; //default height of 2/3 degree FOVX fovXML = new FOVX(); //Check for valid content in converted My Equipment List XML file string FOVName = fovXML.GetActiveFOVHead(fovXML.Description1FieldXName); if (FOVName != null) { //get image fov center, convert to degreess (sky6MyFOV returns arc minutes) iWidthD = Convert.ToDouble(fovXML.GetActiveFOVElementEntry(0, fovXML.SizeXFieldXName)); //arc min iHeightD = Convert.ToDouble(fovXML.GetActiveFOVElementEntry(0, fovXML.SizeYFieldXName)); //arc min //get overall image width at 4 times FOV, convert to degrees angularFrameWidth = (int)(4 * iWidthD / 60); //Get RA/Dec coordinates for target in box //string targetName = parentForm.TargetNameBox.Text; this.Text = targetName + ": " + FOVName; } else { this.Text = targetName + ": Default FOV"; } if (iWidthD == 0) { MessageBox.Show("Zero width FOV is active", "Preview Error", MessageBoxButtons.OK); iWidthD = 60; } angularFrameWidth = (int)(4 * iWidthD / 60); sky6StarChart tsxs = new sky6StarChart(); sky6ObjectInformation tsxo = new sky6ObjectInformation(); //if the object is not found, just return try { tsxs.Find(targetName); } catch { fovXML = null; tsxs = null; tsxo = null; return; } int cnt = tsxo.Count; tsxo.Index = 0; tsxo.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_RA_2000); double dRA = tsxo.ObjInfoPropOut; tsxo.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_DEC_2000); double dDec = tsxo.ObjInfoPropOut; tsxs.RightAscension = dRA; tsxs.Declination = dDec; tsxs.FieldOfView = angularFrameWidth; double fullpixDeg0 = (2000.0 / 360.0); //pixels per degree at zoom = 0 (maximum pixel width = 2000, at frame width = 360 degrees) double fullpixDegN = (2000.0 / angularFrameWidth); //pixels per degree where the frame width == maximum width in pixels, scaled double fullzoomX = Math.Log((fullpixDegN / fullpixDeg0), 2); //zoom level N that produces a pixel per degree of pixDegN int fullzoom = Convert.ToInt32(fullzoomX) - 1; //convert zoom to integer int fullpixDegAtZoomN = (int)(Math.Pow(2, fullzoom) * fullpixDeg0); //pixels per degree at integer zoom N (integerized) int showboxWidth = Convert.ToInt32((iWidthD / 60) * fullpixDegAtZoomN); //width of showbox in frame which is zoomed to N int showboxHeight = Convert.ToInt32((iHeightD / 60) * fullpixDegAtZoomN); //width of showbox in frame which is zoomed to N string iframer = "<IFRAME SRC=" + isource1 + "&" + izoom + fullzoom.ToString() + "&" + ira + dRA.ToString("0.0000") + "&" + idec + dDec.ToString("0.0000") + "&" + ishowbox + "&" + ishowboxwidth + showboxWidth.ToString("00") + "&" + ishowboxheight + showboxHeight.ToString("00") + "&" + ishowgrids + "&" + ishowconstellationlines + "&" + ishowconstellationboundaries + "&" + " WIDTH=400 HEIGHT=400></IFRAME"; //set the preview window so that it always shows in front of imageforecast window, if active //this.Owner = FormImagePlanner; //We had some fatal errors here with loading the iframe, i think, so try to catch and ignor try { WebBrowserFrame.DocumentText = iframer; } catch { // Do nothing } System.Threading.Thread.Sleep(1000); this.Show(); fovXML = null; tsxo = null; tsxs = null; return; }
private void ReScan() { string curFilePath = ""; string refFilePath = ""; string singleTargetName = ""; bool scanAll = true; //Open up the configuration parameteters, update with current form inputs Configuration ss_cfg = new Configuration(); LogEventHandler("Starting ReScan"); string ibdir = ss_cfg.ImageBankFolder; string[] imageBankDirs = System.IO.Directory.GetDirectories(ibdir); GalaxyCount.Text = imageBankDirs.Length.ToString(); if (imageBankDirs.Length == 0) { LogEventHandler("Empty Image Bank"); return; } //Determine if all or just one target is to be tested DialogResult testDR = MessageBox.Show("Test All?", "Detection Scope", MessageBoxButtons.YesNo); if (testDR == DialogResult.No) { scanAll = false; FormEnterGalaxyNumber ngd = new FormEnterGalaxyNumber(); ngd.ShowDialog(this); singleTargetName = "NGC " + ngd.NGCnumberTextBox.Text; ngd.Dispose(); if (singleTargetName == "NGC") { return; } } foreach (string galdir in imageBankDirs) { System.IO.DirectoryInfo sys_imd = new System.IO.DirectoryInfo(galdir); if (!scanAll && sys_imd.Name == singleTargetName) { string targetName = sys_imd.Name; LogEventHandler("Running " + targetName); System.IO.DirectoryInfo sys_gal = new System.IO.DirectoryInfo(galdir); if (sys_gal.GetFiles("NGC*.fit").Length >= 2) { curFilePath = FindCurrentFile(galdir); refFilePath = FindReferenceFile(galdir); CurrentGalaxyName.Text = targetName; sky6StarChart tsx_sc = new sky6StarChart(); sky6ObjectInformation tsx_oi = new sky6ObjectInformation(); tsx_sc.Find(targetName); tsx_oi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_RA_2000); double gRA = Convert.ToDouble(tsx_oi.ObjInfoPropOut); tsx_oi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_DEC_2000); double gDec = Convert.ToDouble(tsx_oi.ObjInfoPropOut); tsx_oi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_MAJ_AXIS_MINS); double gMaxArcMin = Convert.ToDouble(tsx_oi.ObjInfoPropOut); CurrentGalaxySizeArcmin.Text = gMaxArcMin.ToString(); int subFrameSize = Convert.ToInt32(60 * gMaxArcMin); NovaDetection ss_ndo = new NovaDetection(); ss_ndo.LogUpdate += LogEventHandler; ss_ndo.Detect(targetName, subFrameSize, gRA, gDec, curFilePath, refFilePath, galdir); } else { LogEventHandler("Insufficient Images"); } } GalaxyCount.Text = (Convert.ToInt16(GalaxyCount.Text) - 1).ToString(); } LogEventHandler("ReScan Done"); return; }
//Find the coordinates of the object targetName and perform a slew, then CLS to it. private bool SeekTarget() { sky6StarChart tsx_sc = new sky6StarChart(); ClosedLoopSlew tsx_cl = new ClosedLoopSlew(); sky6RASCOMTele tsx_mt = new sky6RASCOMTele(); sky6Raven tsx_rv = new sky6Raven(); sky6ObjectInformation tsx_obj = new sky6ObjectInformation(); //Clear any camera set up stuff that might be hanging around // and there has been some on occasion //Removed subframe on request for cameras with long download times ccdsoftCamera tsx_cc = new ccdsoftCamera() { Subframe = 0, Delay = 0 }; LogEntry("Finding coordinates for " + freshImageName); tsx_sc.Find(this.freshImageRA.ToString() + "," + this.freshImageDec.ToString()); //Make sure that the mount commands are synchronous tsx_mt.Asynchronous = 0; //LogEntry("Initial slew to target"); ////Slew the mount and dome should follow before completion... // try { tsx_mt.SlewToRaDec(tRA, tDec, freshImageName); } //catch (Exception ex) { LogEntry("Slew error: " + ex.Message); } //Test to see if a dome tracking operation is underway. // If so, doing a IsGotoComplete will throw an Error 212. // Ignore it a wait a few seconds for stuff to clear //If using dome, toggle dome coupling: this appears to clear most Error 123 problems Configuration cfg = new Configuration(); bool hasDome = Convert.ToBoolean(cfg.UsesDome); if (hasDome) { sky6Dome tsx_dm = new sky6Dome(); tsx_dm.IsCoupled = 0; System.Threading.Thread.Sleep(1000); tsx_dm.IsCoupled = 1; } //Wait for any Error 123//s to clear LogEntry("Precision slew (CLS) to target"); DeviceControl dctl = new DeviceControl(); int clsStatus = dctl.ReliableClosedLoopSlew(freshImageRA, freshImageDec, freshImageName, hasDome); LogEntry("Precision Slew Complete: "); if (clsStatus == 0) { LogEntry(" CLS successful"); return(true); } else { LogEntry(" CLS unsucessful: Error: " + clsStatus.ToString()); return(false); } }
/// Windows C# Sample Console Application: ListSearch /// /// ------------------------------------------------------------------------ /// Vaguely adapted from ErrorHandling.vbs (Visual Basic Script) /// Copyright (C) Software Bisque (2013) /// /// Converted 2015, R.McAlister /// /// ------------------------------------------------------------------------ /// /// This C# console application demonstrates how to run the telescope through a list of targets as defined /// by a list of names. /// /// Note: The gist of the orginal VBS script was entitled "ErrorHandling.vbs". However, that /// script, however labeled, performed the functions as adapted to VB herein. /// public void ListSearchSample() { ///Set the exposure time for the image double dExposure = 1.0; ///Target List string[] targetlist = new string[] { "NGC1348", "NGC1491", "NGC1708", "NGC179", "NGC1798", "NGC2165", "NGC2334", "NGC2436", "NGC2519", "NGC2605", "NGC2689", "NGC2666", "NGC4381", "NGC5785", "NGC5804", "NGC6895", "NGC6991", "NGC7011", "NGC7058", "M39", "NGC7071", "NGC7150", "NGC7295", "NGC7394", "NGC7686", "NGC7801" }; ///Create objects sky6StarChart objChrt = new sky6StarChart(); sky6RASCOMTele objTele = new sky6RASCOMTele(); ccdsoftCamera objCam = new ccdsoftCamera(); sky6Utils objUtil = new sky6Utils(); sky6ObjectInformation objInfo = new sky6ObjectInformation(); ///Connect Objects objTele.Connect(); objCam.Connect(); ///Run loop over array of target names double dAlt; double dAz; bool iError; foreach (string target in targetlist) { objChrt.Find(target); objInfo.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_ALT); dAlt = objInfo.ObjInfoPropOut; objInfo.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_AZM); dAz = objInfo.ObjInfoPropOut; try { objTele.SlewToAzAlt(dAz, dAlt, target); } catch { MessageBox.Show("An error has occurred running slew"); return; }; ///Set exposure time and try for image, exit if error objCam.ExposureTime = dExposure; try { objCam.TakeImage(); } catch { MessageBox.Show("An error has occurred running image"); }; } ///Disconnect telescope and camera objTele.Disconnect(); objCam.Disconnect(); return; }
private void AddTargetPlanButton_Click(Object sender, EventArgs e) // Handles AddTargetPlanButton.Click { ButtonRed(AddTargetPlanButton); //Save a new Humason configuration file with this target name, RA and Dec and about nothing else string tgtName = TargetNameBox.Text; sky6StarChart tsxs = new sky6StarChart(); sky6ObjectInformation tsxo = new sky6ObjectInformation(); //if (the object is not found, just return try { tsxs.Find(tgtName); } catch { ButtonGreen(AddTargetPlanButton); return; } int cnt = tsxo.Count; tsxo.Index = 0; tsxo.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_RA_2000); double dRA = tsxo.ObjInfoPropOut; tsxo.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_DEC_2000); double dDec = tsxo.ObjInfoPropOut; XFiles xfn = new XFiles(tgtName); if (xfn != null) { xfn.ReplaceItem(XFiles.sbTargetNameName, tgtName); xfn.ReplaceItem(XFiles.sbTargetAdjustCheckedName, false); xfn.ReplaceItem(XFiles.sbTargetRAName, dRA); xfn.ReplaceItem(XFiles.sbTargetDecName, dDec); xfn.SavePlan(tgtName); } //clear current target list box and reload ImagePlannerTargetList.Items.Clear(); //Fill in Humason target plans XFiles xf = new XFiles(); List <string> tgtList = xf.GetTargetFiles(); foreach (string tgt in tgtList) { if (!(tgt.Contains("Default"))) { ImagePlannerTargetList.Items.Add(tgt); } } foreach (string tgt in ImagePlannerTargetList.Items) { if (tgt == tgtName) { ImagePlannerTargetList.SelectedItem = tgt; } } ButtonGreen(AddTargetPlanButton); return; }
//Calendar generation methods private void GenerateCalendar() { sky6StarChart tdoc = new sky6StarChart(); sky6Utils tute = new sky6Utils(); sky6ObjectInformation tobj = new sky6ObjectInformation(); double traH; //target RA in hours double tdecD; //target Dec in degrees double tlatD; //Observer Latitude in degrees double tlongD; //Observer Longitude in degrees try { tdoc.Find(TargetNameBox.Text); } catch (Exception ex) { //! found System.Windows.Forms.MessageBox.Show("Target not Found: " + TargetNameBox.Text + " " + ex.Message); TargetNameBox.Text = ""; return; } //Reset the target name to whatever TSX found tobj.Index = 0; //tobj.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_NAME1); //TargetNameBox.Text = tobj.ObjInfoPropOut; enteringTargetState = false; //TargetNameBox.Text = TargetNameBox.Text.Replace(" ", ""); int vj = tobj.Count; tobj.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_RA_2000); traH = tobj.ObjInfoPropOut; tobj.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_DEC_2000); tdecD = tobj.ObjInfoPropOut; tdoc.DocumentProperty(TheSky64Lib.Sk6DocumentProperty.sk6DocProp_Latitude); tlatD = tdoc.DocPropOut; tdoc.DocumentProperty(TheSky64Lib.Sk6DocumentProperty.sk6DocProp_Longitude); tlongD = tdoc.DocPropOut; tdoc.DocumentProperty(TheSky64Lib.Sk6DocumentProperty.sk6DocProp_Time_Zone); Celestial.RADec tgtRADec = new Celestial.RADec(Transform.HoursToRadians(traH), Transform.DegreesToRadians(tdecD)); Celestial.LatLon obsLocation = new Celestial.LatLon(Transform.DegreesToRadians(tlatD), Transform.DegreesToRadians(-tlongD)); sundata = TargetControl.SunCycle((int)CurrentYearPick.Value, obsLocation); tgtdata = TargetControl.TargetCycle(tgtRADec, sundata, obsLocation, (double)MinAltitudeBox.Value); tgtdata = TargetControl.MoonPhase(tgtdata); moondata = TargetControl.MoonCycle(tgtdata, obsLocation); //Update the target positions with the moonfree properties tgtdata = TargetControl.MoonClear(tgtdata, moondata); WriteTitle(TargetNameBox.Text, CurrentYearPick.Value.ToString()); SpawnCalendar(tgtdata); if ((CurrentYearPick.Value % 4) != 0) { ClearLeapDay(); } WriteMoonTip(moondata); Show(); System.Windows.Forms.Application.DoEvents(); return; }
public TargetSpecs(string targetName) { //Use TSX find to load information about the given target //Open TSX starchart object TargetName = targetName; sky6StarChart tsxsc = new sky6StarChart(); try { tsxsc.Find(targetName); } catch (Exception ex) { return; } sky6ObjectInformation tsxoi = new sky6ObjectInformation(); int objIndex = 0; // int oCount = tsxoi.Count; tsxoi.Index = objIndex; int pExists; tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_RISE_TIME); RiseTime = TimeSpan.FromHours(tsxoi.ObjInfoPropOut); tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_SET_TIME); SetTime = TimeSpan.FromHours(tsxoi.ObjInfoPropOut); tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_TRANSIT_TIME); TransitTime = TimeSpan.FromHours(tsxoi.ObjInfoPropOut); tsxoi.PropertyApplies(Sk6ObjectInformationProperty.sk6ObjInfoProp_PHASE_PERC); pExists = tsxoi.ObjInfoPropOut; if (pExists != 0) { tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_PHASE_PERC); PhasePercent = tsxoi.ObjInfoPropOut; } tsxoi.PropertyApplies(Sk6ObjectInformationProperty.sk6ObjInfoProp_TWIL_ASTRON_START); pExists = tsxoi.ObjInfoPropOut; if (pExists != 0) { tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_TWIL_ASTRON_START); TwilightSODTime = TimeSpan.FromHours(tsxoi.ObjInfoPropOut); } tsxoi.PropertyApplies(Sk6ObjectInformationProperty.sk6ObjInfoProp_TWIL_ASTRON_END); pExists = tsxoi.ObjInfoPropOut; if (pExists != 0) { tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_TWIL_ASTRON_END); TwilightEODTime = TimeSpan.FromHours(tsxoi.ObjInfoPropOut); } //TSX always returns 0 (false) on PropertyApplies for ALL_INFO, so ignor it tsxoi.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_ALL_INFO); string sAllInfo = tsxoi.ObjInfoPropOut; sAllInfo = sAllInfo.Replace("/", "-"); string[] sInfoDB = sAllInfo.Split('\n'); foreach (string s in sInfoDB) { if (s.Contains("Constellation:") && (s.Count() > 18)) { Constellation = s.Remove(0, 15); break; } } foreach (string s in sInfoDB) { if (s.Contains("Object Type:")) { TargetType = s.Remove(0, 13); break; } } return; }