Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
    /// 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;
    }
Ejemplo n.º 3
0
    /// 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;
    }
Ejemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static double GetLocationLatitude()
        {
            //Get and return the latitude of the current TSX star chart (as set by location)
            sky6StarChart tsxsc = new sky6StarChart();

            tsxsc.DocumentProperty(Sk6DocumentProperty.sk6DocProp_Latitude);
            double lat = Convert.ToDouble(tsxsc.DocPropOut);

            return(lat);
        }
Ejemplo n.º 5
0
        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;
        }
Ejemplo n.º 6
0
        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;
        }
Ejemplo n.º 7
0
        private Point LocateCenter(double ra, double dec)
        {
            //Center the star chart on
            sky6StarChart tsxsc = new sky6StarChart();
            sky6Utils     tsxut = new sky6Utils();

            //Ultimately, we want to center the star chart on the FOV of the image,
            //  but not resize the chart

            tsxsc.RightAscension = ra;
            tsxsc.Declination    = dec;
            return(new Point(tsxsc.WidthInPixels / 2, tsxsc.HeightInPixels / 2));
        }
Ejemplo n.º 8
0
        private void GetSiteLocation()
        {
            //Import scout text query and parse out tracking parameters
            sky6StarChart tsxsc = new sky6StarChart();

            tsxsc.DocumentProperty(Sk6DocumentProperty.sk6DocProp_Latitude);
            BestObservatory.MySiteLat = tsxsc.DocPropOut;
            tsxsc.DocumentProperty(Sk6DocumentProperty.sk6DocProp_Longitude);
            BestObservatory.MySiteLong = tsxsc.DocPropOut;
            tsxsc.DocumentProperty(Sk6DocumentProperty.sk6DocProp_ElevationInMeters);
            BestObservatory.MySiteElev = tsxsc.DocPropOut / 1000;
            return;
        }
Ejemplo n.º 9
0
        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;
        }
Ejemplo n.º 10
0
        public void SetStarChartSize()
        {
            // Changes the StarChart width to four times the center-to-center distance
            //  between image FOV and guider FOV for esthetic purposes
            sky6StarChart tsxsc           = new sky6StarChart();
            double        widthViaCenters = (SumOfSquares(gfov.CenterX, gfov.CenterY) * 4) / 60.0;
            double        widthViaSize    = (SumOfSquares(gfov.ArcMinSizeX, gfov.ArcMinSizeY) * 4) / 60.0;

            if (widthViaCenters < widthViaSize)
            {
                tsxsc.FieldOfView = widthViaSize;
            }
            else
            {
                tsxsc.FieldOfView = widthViaCenters;
            }
        }
Ejemplo n.º 11
0
        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);
        }
Ejemplo n.º 12
0
        private static InfoObj[] GetNearbyStars(sky6StarChart tsxsc, int xC, int yC)
        {
            sky6ObjectInformation tsxod = new sky6ObjectInformation();

            tsxsc.ClickFind(xC, yC);
            int objcnt = tsxod.Count;

            InfoObj[] infoObj = new InfoObj[objcnt];
            for (int i = 0; i < objcnt; i++)
            {
                tsxod.Index = i;
                tsxod.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_NAME1);
                infoObj[i].CatalogedName = tsxod.ObjInfoPropOut;
                tsxod.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_MAG);
                infoObj[i].CatalogMag = tsxod.ObjInfoPropOut;
                tsxod.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_RA_2000);
                infoObj[i].CatalogRA = tsxod.ObjInfoPropOut;
                tsxod.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_DEC_2000);
                infoObj[i].CatalogDec = tsxod.ObjInfoPropOut;
                if (infoObj[i].CatalogedName.Contains("Gaia"))
                {
                    tsxod.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_DB_FIELD_1); //FIlter G
                    infoObj[i].CatalogMagG = Convert.ToDouble(tsxod.ObjInfoPropOut);
                    tsxod.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_DB_FIELD_2); //Filter PB
                    infoObj[i].CatalogMagB = Convert.ToDouble(tsxod.ObjInfoPropOut);
                    tsxod.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_DB_FIELD_3); //Filter PR
                    infoObj[i].CatalogMagR = Convert.ToDouble(tsxod.ObjInfoPropOut);
                }
                else if (infoObj[i].CatalogedName.Contains("APASS"))
                {
                    tsxod.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_STAR_MAGB);
                    infoObj[i].CatalogMagB = tsxod.ObjInfoPropOut;
                    tsxod.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_STAR_MAGV);
                    infoObj[i].CatalogMagV = tsxod.ObjInfoPropOut;
                    tsxod.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_STAR_MAGR);
                    infoObj[i].CatalogMagR = tsxod.ObjInfoPropOut;
                    tsxod.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_DB_FIELD_4);
                    char[] s = new char[] { ' ' };
                    infoObj[i].CatalogMagG = Convert.ToDouble(tsxod.ObjInfoPropOut.Split(s, StringSplitOptions.RemoveEmptyEntries)[0]);
                }
            }
            return(infoObj);
        }
Ejemplo n.º 13
0
    /// Windows C# Sample Console Application: MyFOV
    ///
    /// ------------------------------------------------------------------------
    ///
    ///               Author: R.McAlister (2017)
    ///
    /// ------------------------------------------------------------------------
    ///
    /// This application demonstrates some of the functionality of the MyFOV class
    ///
    ///
    ///Globals

    public void MyFOVSample()
    {
        ///Which FOV definition by index
        int iFOV = 0;            ///First FOV definition

        ///Create FOV object
        sky6MyFOVs    tsx_fov = new sky6MyFOVs();
        sky6StarChart tsx_sc  = new sky6StarChart();

        ///First FOV definition, additional definitions at successive indicies
        ///Get FOV name and Postition Angle
        tsx_fov.Name(iFOV);
        string fovname = tsx_fov.OutString;

        tsx_fov.Property(fovname, 0, sk6MyFOVProperty.sk6MyFOVProp_PositionAngleDegrees);
        double fovPA = tsx_fov.OutVar;

        MessageBox.Show("FOV Name: " + fovname + "  FOV PA: " + fovPA.ToString());

        return;
    }
Ejemplo n.º 14
0
    /// Windows C# Sample Console Application: StarChartSetWW
    ///
    /// ------------------------------------------------------------------------
    ///               Adapted from TheSkySetWW.vbs  (Visual Basic Script)
    ///               Copyright (C) Software Bisque (2009?)
    ///
    ///				Converted 2014, R.McAlister
    ///
    /// ------------------------------------------------------------------------
    ///
    /// This C# console application exercises the Star Chart class functions for setting
    ///   Timne, Time Zone, Location, etc.
    ///

    public void StarChartSetWWSample()
    {
        double dJD   = 2452066.0; ///=06/05/2001, ignored if UseCompterClock=1
        double dTZ   = 7;         ///MST
        double dElev = 1000;      ///meters
        double dLat  = 39.5;
        double dLong = 105.5;
        string szLoc = "Location from script";

        ///Create Telescope Object and disconnect telescope -- time changes are not enabled with scope connected
        sky6RASCOMTele tsx_ts = new sky6RASCOMTele();

        tsx_ts.Disconnect();

        ///Create the Star Chart object
        sky6StarChart tsx_sc = new sky6StarChart();

        ///Turn off the Computer Clock
        tsx_sc.SetDocumentProperty(Sk6DocumentProperty.sk6DocProp_UseComputerClock, 0);

        ///Change the julian date
        tsx_sc.SetDocumentProperty(Sk6DocumentProperty.sk6DocProp_JulianDateNow, dJD);

        ///Change the time zone
        tsx_sc.SetDocumentProperty(Sk6DocumentProperty.sk6DocProp_Time_Zone, dTZ);

        ///Change the elevation
        tsx_sc.SetDocumentProperty(Sk6DocumentProperty.sk6DocProp_ElevationInMeters, dElev);

        ///Change the latitude
        tsx_sc.SetDocumentProperty(Sk6DocumentProperty.sk6DocProp_Latitude, dLat);

        ///Change the longitude
        tsx_sc.SetDocumentProperty(Sk6DocumentProperty.sk6DocProp_Longitude, dLong);

        ///Change the location description
        tsx_sc.SetDocumentProperty(Sk6DocumentProperty.sk6DocProp_LocationDescription, szLoc);

        return;
    }
Ejemplo n.º 15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="lightSource"></param>
        /// <returns>TargetData[0] => APASS star
        /// TargetData[1] => GAIA star</returns>
        public static TargetData AcquireNearestQualifiedStar(TargetData lightSource)
        {
            //Find the nearest APASS star and the nearest GAIA star
            //
            const string GAIACatalogName   = "Gaia";
            const string APASSCatalogName  = "APASS";
            const string GCVSCatalogPrefix = "GCVS";

            InfoObj gaiaCatData  = new InfoObj();
            InfoObj apassCatData = new InfoObj();

            //Populate target data with catalog data, if found
            sky6StarChart tsxsc = new sky6StarChart();
            sky6Utils     tsxut = new sky6Utils();

            //Ultimately, we want to center the star chart on the FOV of the image,
            //  but not resize the chart
            tsxsc.EquatorialToStarChartXY(lightSource.SourceRA, lightSource.SourceDec);
            int xC = (int)tsxsc.dOut0;
            int yC = (int)tsxsc.dOut1;

            InfoObj[] catStarList = GetNearbyStars(tsxsc, xC, yC);
            //First, find the nearest star to the light source in the list from the catalog
            //Initialize a catalog info object with the first found star from a catalog
            gaiaCatData.CatalogSeparation  = 1000;
            apassCatData.CatalogSeparation = 1000;
            double separation;

            //Now find an APASS star that is closest, or default to the initial one
            // go through the catalog list of stars.
            foreach (InfoObj iob in catStarList)
            {
                //Disqualify any light source with a GCVS star nearby
                if (iob.CatalogedName.Contains(GCVSCatalogPrefix))
                {
                    lightSource.IsGCVSCataloged = true;
                }

                tsxut.ComputeAngularSeparation(lightSource.SourceRA, lightSource.SourceDec, iob.CatalogRA, iob.CatalogDec);
                separation = (double)tsxut.dOut0 * 3600.0;
                if (separation < apassCatData.CatalogSeparation & iob.CatalogedName.Contains(APASSCatalogName))
                {
                    apassCatData.CatalogedName     = iob.CatalogedName;
                    apassCatData.CatalogRA         = iob.CatalogRA;
                    apassCatData.CatalogDec        = iob.CatalogDec;
                    apassCatData.CatalogMag        = iob.CatalogMag;
                    apassCatData.CatalogMagB       = iob.CatalogMagB;
                    apassCatData.CatalogMagV       = iob.CatalogMagV;
                    apassCatData.CatalogMagR       = iob.CatalogMagR;
                    apassCatData.CatalogMagG       = iob.CatalogMagG;
                    apassCatData.CatalogSeparation = separation;
                }
                if (separation < gaiaCatData.CatalogSeparation & iob.CatalogedName.Contains(GAIACatalogName))
                {
                    gaiaCatData.CatalogedName     = iob.CatalogedName;
                    gaiaCatData.CatalogRA         = iob.CatalogRA;
                    gaiaCatData.CatalogDec        = iob.CatalogDec;
                    gaiaCatData.CatalogMag        = iob.CatalogMag;
                    gaiaCatData.CatalogMagB       = iob.CatalogMagB;
                    gaiaCatData.CatalogMagG       = iob.CatalogMagG;
                    gaiaCatData.CatalogMagR       = iob.CatalogMagR;
                    gaiaCatData.CatalogSeparation = separation;
                }
                //check for APASS entry and hold again if so and separation is smaller than thelast
            }
            lightSource.APASSCatalogName                  = apassCatData.CatalogedName;
            lightSource.APASSCatalogMagnitude             = apassCatData.CatalogMag;
            lightSource.APASSCatalogMagnitudeB            = apassCatData.CatalogMagB;
            lightSource.APASSCatalogMagnitudeV            = apassCatData.CatalogMagV;
            lightSource.APASSCatalogMagnitudeR            = apassCatData.CatalogMagR;
            lightSource.APASSCatalogMagnitudeG            = apassCatData.CatalogMagG;
            lightSource.APASSCatalogRA                    = apassCatData.CatalogRA;
            lightSource.APASSCatalogDec                   = apassCatData.CatalogDec;
            lightSource.SourceToAPASSCatalogPositionError = apassCatData.CatalogSeparation;
            tsxut.ComputeAngularSeparation(lightSource.TargetRA, lightSource.TargetDec, lightSource.APASSCatalogRA, lightSource.APASSCatalogDec);
            lightSource.TargetToAPASSCatalogPositionError = (double)tsxut.dOut0 * 3600.0;

            lightSource.GAIACatalogName                  = gaiaCatData.CatalogedName;
            lightSource.GAIACatalogMagnitude             = gaiaCatData.CatalogMag;
            lightSource.GAIACatalogMagnitudeB            = gaiaCatData.CatalogMagB;
            lightSource.GAIACatalogMagnitudeG            = gaiaCatData.CatalogMagG;
            lightSource.GAIACatalogMagnitudeR            = gaiaCatData.CatalogMagR;
            lightSource.GAIACatalogRA                    = gaiaCatData.CatalogRA;
            lightSource.GAIACatalogDec                   = gaiaCatData.CatalogDec;
            lightSource.SourceToGAIACatalogPositionError = gaiaCatData.CatalogSeparation;
            tsxut.ComputeAngularSeparation(lightSource.TargetRA, lightSource.TargetDec, lightSource.GAIACatalogRA, lightSource.GAIACatalogDec);
            lightSource.TargetToGAIACatalogPositionError = (double)tsxut.dOut0 * 3600.0;

            if (lightSource.APASSCatalogName != null)
            {
                string catPrefix = lightSource.APASSCatalogName.Split(' ')[0];
                lightSource.APASSCatalogName = Utility.CreateStarLabel("APASS ", lightSource.APASSCatalogRA, lightSource.APASSCatalogDec);
                lightSource.IsAPASSCataloged = true;
            }
            else
            {
                lightSource.IsAPASSCataloged = false;
            }

            if (lightSource.GAIACatalogName != null)
            {
                lightSource.GAIACatalogName = Utility.CreateStarLabel("Gaia ", lightSource.GAIACatalogRA, lightSource.GAIACatalogDec);
                lightSource.IsGAIACataloged = true;
            }
            else
            {
                lightSource.IsGAIACataloged = false;
            }

            return(lightSource);
        }
Ejemplo n.º 16
0
        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);
                }
            }
        }
Ejemplo n.º 17
0
        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);
        }
Ejemplo n.º 18
0
        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);
        }
Ejemplo n.º 19
0
/// 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;
    }
Ejemplo n.º 20
0
        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;
        }
Ejemplo n.º 21
0
        //Autofocus manages the TSX functions to refocus the camera
        // every change of 1 degree in temperature.
        //The first fime autofocus is called, the telescope is slewed to
        // a position with Az = 90, Alt = 80.  Then @Focus2 is called with
        // TSX providing the star to use.  the temperature at that time is recorded.
        //Subsequent calls to autofocus check to see if the current focuser temperature
        //  is more than a degree celsius different from the last @autofocus2 time.
        //  if so, @autofocus2 is called again, although the telescope is not slewed.  And so on.

        /// <summary>
        /// Checks temp and runs autofocus 2 or 3 if exceeds one degree
        /// </summary>
        /// <param name="AtFocus2"></param>
        /// <returns></returns>
        public static string Check(bool AtFocus3)
        {
            //check to see if current temperature is a degree different from last temperature
            //  If so, then set up and run @focus2
            //AtFocus2 chooses to use a 15 degree x 15 degree field of view to choose a focus star
            //  If the current position is close to the meridian then a focus star on the other
            //  side of the meridian can be choosen and the mount will flip trying to get to it
            //  and, if using a dome, the slew does not wait for the dome slit to catch up (CLS flaw)
            //  so not only will an exception be thrown (Dome command in progress Error 125) the first image
            //   will be crap and the focus fail (as of DB 11360).  So, this method will point the mount to a
            //  altitude that is no more than 80 degrees at the same azimuth of the current position in order
            //  to avoid a flip and subsequent bullshit happening

            ccdsoftCamera tsxc = new ccdsoftCamera();

            tsxc.Connect();
            double currentTemp = tsxc.focTemperature;

            if (Math.Abs(currentTemp - afLastTemp) > 1)
            {
                //Going to have to refocus.

                ////Move to altitude away from meridian, if need be
                //sky6RASCOMTele tsxt = new sky6RASCOMTele();
                //tsxt.GetAzAlt();
                //double tAlt = tsxt.dAlt;
                //if (tAlt > 80)
                //{
                //    double tAz = tsxt.dAz;
                //    tAlt = 80.0;
                //    tsxt.SlewToAzAlt(tAz, tAlt, "AtFocus2ReadyPosition");
                //}

                //reset last temp
                afLastTemp = currentTemp;
                int syncSave = tsxc.Asynchronous;
                tsxc.Asynchronous = 0;
                if (AtFocus3)
                {
                    //Set the starchart size to 3 degrees so we minimize the chance of finding a star on
                    //  the wrong side of the meridian, if auto-selecting star
                    sky6StarChart tschrt = new sky6StarChart();
                    tschrt.FieldOfView = 3.0;
                    //run either of the focusing routings
                    try
                    {
                        int focStat = tsxc.AtFocus3(3, true);
                    }
                    catch (Exception e)
                    {
                        tsxc.Asynchronous = syncSave;
                        return("Focus Check: " + e.Message);
                    }
                }
                else
                {
                    try
                    {
                        int focStat = tsxc.AtFocus2();
                    }
                    catch (Exception e)
                    {
                        tsxc.Asynchronous = syncSave;
                        return("Focus Check: " + e.Message);
                    }
                    //Throw in a 5 sec wait to see if TSX can't set the telescope crosshairs back to original condition
                    System.Threading.Thread.Sleep(5000);
                }
                return("Focus Check: Focus successful");
            }
            return("Focus Check: Temperature change less than 1 degree");
        }
Ejemplo n.º 22
0
        //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;
        }
Ejemplo n.º 23
0
        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);
            }
        }
Ejemplo n.º 24
0
        private void PickButton_Click(object sender, EventArgs e)
        {
            PickButton.BackColor  = Color.LightSalmon;
            StartButton.BackColor = Color.LightSalmon;
            //Pick up the target star location as selected in TSX Star Chart
            MessageBox.Show("Select target star");
            WriteLog("Picking up coordinates of selected target star");
            sky6ObjectInformation tsxoi     = new sky6ObjectInformation();
            StarProspect          foundStar = new StarProspect();

            tsxoi.Index = 0;
            tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_NAME1);
            foundStar.StarName = (tsxoi.ObjInfoPropOut);
            tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_RA_2000);
            foundStar.StarRA = (tsxoi.ObjInfoPropOut);
            tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_DEC_2000);
            foundStar.StarDec = (tsxoi.ObjInfoPropOut);
            tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_MAG);
            foundStar.StarMag = (tsxoi.ObjInfoPropOut);

            WriteLog("Target star found: " + foundStar.StarName);
            //Closed Loop Slew (following standard slew -- see notes) to the target guide star
            WriteLog("Centering imaging camera on target star");
            bool slewDone1 = SlewToStar(foundStar.StarName, foundStar.StarRA, foundStar.StarDec);

            if (slewDone1)
            {
                WriteLog("Target star centered");
            }
            else
            {
                WriteLog("There was a problem centering the target star");
            }
            //Calculate a pointing position that would put the target star in the guider FOV
            WriteLog("Calculating offset for centering star in guider FOV");
            StarProspect tgtPosition = guiderFOV.OffsetCenter(foundStar, imagePA);

            WriteLog("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
            WriteLog("Centering target star in guider FOV");
            bool slewDone = SlewToPosition(tgtPosition.StarRA, tgtPosition.StarDec);

            if (slewDone1)
            {
                WriteLog("Target star centered in guider FOV");
            }
            else
            {
                WriteLog("Could not recenter the target 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
            WriteLog("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
            WriteLog("Recentering chart");
            sky6StarChart tsxsc = new sky6StarChart
            {
                RightAscension = tgtPosition.StarRA,
                Declination    = tgtPosition.StarDec
            };

            WriteLog("Target star centered in Guider FOV");
            PickButton.BackColor      = Color.LightGreen;
            StartButton.BackColor     = Color.LightGreen;
            OptimizeButton.Enabled    = true;
            CalibrateButton.Enabled   = true;
            OptimizeButton.BackColor  = Color.LightGreen;
            CalibrateButton.BackColor = Color.LightGreen;

            //all done
            return;
        }
Ejemplo n.º 25
0
    /// 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;
    }
Ejemplo n.º 26
0
        public ObjectList(DBQFileManagement.SearchType searchDB, DateTime duskDateLocal, DateTime dawnDateLocal)
        {
            //Determine if search database file exists, if not, create it
            if (!DBQFileManagement.DBQsInstalled())
            {
                DBQFileManagement.InstallDBQs();
            }

            //Load the path to the selected search database query
            sky6DataWizard tsxdw = new sky6DataWizard();

            tsxdw.Path = DBQFileManagement.GetDBQPath(searchDB);
            //Set the search date for the dusk query
            sky6StarChart tsxs = new sky6StarChart();

            tsxs.DocumentProperty(Sk6DocumentProperty.sk6DocProp_Latitude);
            oLat = tsxs.DocPropOut;
            tsxs.DocumentProperty(Sk6DocumentProperty.sk6DocProp_Longitude);
            oLong = tsxs.DocPropOut;
            double jdate = Celestial.DateToJulian(duskDateLocal.ToUniversalTime());

            tsxs.SetDocumentProperty(Sk6DocumentProperty.sk6DocProp_JulianDateNow, jdate);
            tsxdw.Open();
            //sky6ObjectInformation tsxoi = new sky6ObjectInformation();
            sky6ObjectInformation tsxoi = tsxdw.RunQuery;

            //Fill in data arrays (for speed purposes)
            int tgtcount = tsxoi.Count;

            for (int i = 0; i < tgtcount; i++)
            {
                tsxoi.Index = i;
                //tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_ALL_INFO);
                //var AllInfo = tsxoi.ObjInfoPropOut;

                tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_NAME1);
                oname = (tsxoi.ObjInfoPropOut);
                tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_OBJECTTYPE);
                otype = (tsxoi.ObjInfoPropOut);
                tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_MAJ_AXIS_MINS);
                osize = (tsxoi.ObjInfoPropOut);
                tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_RISE_TIME);
                orise = (duskDateLocal - duskDateLocal.TimeOfDay).AddHours(tsxoi.ObjInfoPropOut);
                tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_SET_TIME);
                oset = (duskDateLocal - duskDateLocal.TimeOfDay).AddHours(tsxoi.ObjInfoPropOut);
                tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_DEC_2000);
                oDec = (tsxoi.ObjInfoPropOut);
                tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_RA_2000);
                oRA = (tsxoi.ObjInfoPropOut);
                //compute the duration
                oduration = Celestial.IntervalOverlap(duskDateLocal, dawnDateLocal, orise, oset);
                //compute the maximum altitude
                omaxaltitude = ComputeMaxAltitude(duskDateLocal, dawnDateLocal, oRA, oDec, oLat, oLong);
                // if the duration is greater than zero, then add it
                if (oduration > 0)
                {
                    dbqList.Add(new DBQObject(oname, otype, osize, oset, orise, oDec, oRA, oLat, oLong, oduration, omaxaltitude));
                }
            }
            //Note that all these entries should have at least some duration
            //Set the search date for the dawn query
            jdate = Celestial.DateToJulian(dawnDateLocal.ToUniversalTime());
            tsxs.SetDocumentProperty(Sk6DocumentProperty.sk6DocProp_JulianDateNow, jdate);
            tsxdw.Open();
            tsxoi = tsxdw.RunQuery;

            //check each entry to see if it is already in the dusk list
            //  if so, just ignor, if not get the resf of the info and add it
            for (int i = 0; i < tsxoi.Count; i++)
            {
                tsxoi.Index = i;
                tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_NAME1);
                oname = (tsxoi.ObjInfoPropOut);
                bool newEntry = true;
                foreach (DBQObject tgt in dbqList)
                {
                    if (tgt.Name == oname)
                    {
                        newEntry = false;
                        break;
                    }
                }
                if (newEntry)
                {
                    tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_OBJECTTYPE);
                    otype = (tsxoi.ObjInfoPropOut);
                    tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_MAJ_AXIS_MINS);
                    osize = (tsxoi.ObjInfoPropOut);
                    tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_RISE_TIME);
                    orise = (duskDateLocal - duskDateLocal.TimeOfDay).AddHours(tsxoi.ObjInfoPropOut);
                    tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_SET_TIME);
                    oset = (duskDateLocal - duskDateLocal.TimeOfDay).AddHours(tsxoi.ObjInfoPropOut);
                    tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_DEC_2000);
                    oDec = (tsxoi.ObjInfoPropOut);
                    tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_RA_2000);
                    oRA = (tsxoi.ObjInfoPropOut);
                    //compute the duration
                    oduration = Celestial.IntervalOverlap(duskDateLocal, dawnDateLocal, orise, oset);
                    //compute the maximum altitude
                    omaxaltitude = ComputeMaxAltitude(duskDateLocal, dawnDateLocal, oRA, oDec, oLat, oLong);
                    // if the duration is greater than zero, then add it
                    if (oduration > 0)
                    {
                        dbqList.Add(new DBQObject(oname, otype, osize, oset, orise, oDec, oRA, oLat, oLong, oduration, omaxaltitude));
                    }
                }
            }

            //Now clear out all the entries that have no duration between
            //Reset tsx to computer clock
            tsxs.SetDocumentProperty(Sk6DocumentProperty.sk6DocProp_UseComputerClock, 1);
            tsxs  = null;
            tsxoi = null;
            return;
        }
Ejemplo n.º 27
0
        //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);
            }
        }
Ejemplo n.º 28
0
        public FormImagePlanner()
        {
            InitializeComponent();

            SelectionEnabled = false;
            ButtonGreen(DetailsButton);
            ButtonGreen(AltitudeButton);
            ButtonGreen(PreviewButton);
            ButtonGreen(AddTargetPlanButton);
            ButtonGreen(DeleteTargetPlanButton);
            ButtonGreen(PrintButton);
            ButtonGreen(DoneButton);
            ButtonGreen(InfoButton);
            ButtonGreen(ProspectButton);
            ButtonGreen(AssessButton);
            ButtonGreen(TrackButton);

            this.FontHeight        = 1;
            MonthCalendar.RowCount = 31;
            for (int i = 0; i <= 30; i++)
            {
                MonthCalendar.Rows[i].HeaderCell.Value = (i + 1).ToString();
            }

            //Compute current dates based on TSX star chart julian date
            //  this allows star charts to be in different locations and time zones
            //  as set up by user
            sky6StarChart tsxsc = new sky6StarChart();

            //Get the star chart julian date and convert to current date/time
            tsxsc.DocumentProperty(Sk6DocumentProperty.sk6DocProp_JulianDateNow);
            DateTime dateTSXutc = AstroMath.Celestial.JulianToDate(tsxsc.DocPropOut);

            tsxsc.DocumentProperty(Sk6DocumentProperty.sk6DocProp_Time_Zone);
            double tzTSX = tsxsc.DocPropOut;

            tsxsc.DocumentProperty(Sk6DocumentProperty.sk6DocProp_DaylightSavingTimeIndex);
            double   tzIndexTSX = tsxsc.DocPropOut;
            DateTime dateTSX    = dateTSXutc.AddHours(tzTSX + tzIndexTSX);

            CurrentYearPick.Value = dateTSX.Year;
            GenerateCalendar();
            Show();
            System.Windows.Forms.Application.DoEvents();
            SelectionEnabled = true;
            //Figure out the year and load it into the year box
            string thisyear = dateTSX.ToString("yyyy");

            CurrentYearPick.Value = Convert.ToInt16(thisyear);
            //Pick the current date as the selected cell
            SelectedDate = dateTSX;
            int jCol = dateTSX.Month - 1;
            int iRow = dateTSX.Day - 1;

            MonthCalendar.Rows[iRow].Cells[jCol].Selected = true;

            //Fill in Humason target plans
            XFiles xf = new XFiles();

            if (xf != null)
            {
                List <string> tgtList = xf.GetTargetFiles();
                foreach (string tgt in tgtList)
                {
                    if (!(tgt.Contains("Default")))
                    {
                        ImagePlannerTargetList.Items.Add(tgt);
                    }
                }
                if (ImagePlannerTargetList.Items.Count > 0)
                {
                    ImagePlannerTargetList.SelectedItem = ImagePlannerTargetList.Items[0];
                }
            }
            QPUpdate.WazzupEventHandler += WazzupEvent_Handler;

            return;
        }
Ejemplo n.º 29
0
        static DBQStar FindStar(double gIsolation)
        {
            /* Locates a nearby star for running a guider calibration
             *
             * Generate and observing list from the AtFocus database search near the current location
             *   (sometime in the future, cull this list for stars on the wrong side of the meridian.
             * Get the calibration distances (arc min for now) to use for framing
             * Look through the observing list array for a star isolated from it's neighbors by at least
             *   twice the calibration distance.  This means that once the FOV is centered on this ster,
             *   you can move the mount at least the calibration distance without the other star coming into
             *   the FOV.
             */

            //Find the first star that is isolated from all the other stars on the list
            //  and from the edge of the search area.  Note that the search area is in degrees and
            //  centered on the star chart center.
            //  The star position <-> center position <= search radius - isolation radius.
            //
            sky6StarChart tsxsc      = new sky6StarChart();
            double        gMaxRadius = (searchAreaDeg * 60) - gIsolation; //arc mins
            double        scRA       = tsxsc.RightAscension;
            double        scDec      = tsxsc.Declination;
            sky6Utils     tsxut      = new sky6Utils();

            //Loop through all the stars in the prospect list
            //  For each star, loop through from that star forward to see if any other star is
            //  within gMinRadius of the center of the star chart
            //  if so, then look through the rest of the list for any star within the gisolation
            //    distance.
            //
            //  Eventually, need to check for meridian side as well
            //
            //  if not, then that's our star
            int           gStarIdx = 0;
            double        gStarRadius;
            double        gRA;
            double        gDec;
            StarProspects starList = new StarProspects(searchAreaDeg);

            for (int i = 0; i < starList.Count; i++)
            {
                gStarIdx = i;
                gRA      = starList.StarRA(i);
                gDec     = starList.StarDec(i);
                tsxut.ComputeAngularSeparation(scRA, scDec, gRA, gDec);
                gStarRadius = tsxut.dOut0 * 60;
                if (gStarRadius < gMaxRadius)
                {
                    for (int j = i + 1; j < starList.Count; j++)
                    {
                        tsxut.ComputeAngularSeparation(starList.StarRA(j), starList.StarDec(j), gRA, gDec);
                        if ((tsxut.dOut0 * 60) < gIsolation)
                        {
                            break;
                        }
                        if (j == starList.Count - 1)
                        {
                            return(starList.Star(gStarIdx));
                        }
                    }
                }
            }
            return(null);
        }
Ejemplo n.º 30
0
        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;
        }