Ejemplo n.º 1
0
 public void Refresh(AscomTools tools, DateTime syncTime)
 {
     SyncTime = syncTime;
     LocalApparentSiderialTime = new HourAngle(AstroConvert.LocalApparentSiderealTime(tools.Transform.SiteLongitude, syncTime));
     Equatorial = new EquatorialCoordinate(GetRA(ObservedAxes), GetDec(ObservedAxes));
     UpdateAltAzimuth(tools, syncTime);
 }
Ejemplo n.º 2
0
            private static MPEphEntry ParseLine(string line)
            {
                // 00055
                // Date       UT      R.A. (J2000) Decl.    Delta     r     El.    Ph.   V      Sky Motion        Object    Sun   Moon                Uncertainty info
                //            h m s                                                            "/min    P.A.    Azi. Alt.  Alt.  Phase Dist. Alt.    3-sig/" P.A.
                //                                                                                                     1         1         1         1         1
                //           1         2         3         4         5         6         7         8         9         0         1         2         3         4
                // 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
                // 2009 07 27 124800 22 18 36.1 -20 15 18   1.545   2.497  153.8  10.3  11.4    0.40    249.0    264  +47   -68   0.36   130  +03         0 318.1
                // 2010 12 11 130549 07 34 48.3 -17 52 01   0.342   1.220  126.5  40.5   7.9    0.54    235.0    261  +46   -32   0.31   137  -03

                try
                {
                    MPEphEntry retVal = new MPEphEntry();

                    int year  = int.Parse(line.Substring(0, 4).Trim());
                    int month = int.Parse(line.Substring(5, 2).Trim());
                    int day   = int.Parse(line.Substring(8, 2).Trim());
                    int hr    = int.Parse(line.Substring(11, 2).Trim());
                    int min   = int.Parse(line.Substring(13, 2).Trim());
                    int sec   = int.Parse(line.Substring(15, 2).Trim());

                    retVal.UtcDate   = new DateTime(year, month, day, hr, min, sec);
                    retVal.RAHours   = AstroConvert.ToRightAcsension(line.Substring(18, 10).Trim());
                    retVal.DEDeg     = AstroConvert.ToDeclination(line.Substring(29, 9).Trim());
                    retVal.Mag       = double.Parse(line.Substring(69, 4).Trim(), CultureInfo.InvariantCulture);
                    retVal.SkyMotion = double.Parse(line.Substring(74, 7).Trim(), CultureInfo.InvariantCulture);

                    return(retVal);
                }
                catch
                {
                    return(null);
                }
            }
Ejemplo n.º 3
0
        private static MPCheckEntry ParseLine(string line)
        {
            // Object designation         R.A.      Decl.     V       Offsets     Motion/hr   Orbit  <a href="http://www.cfa.harvard.edu/iau/info/FurtherObs.html">Further observations?</a>
            //                           h  m  s     &#176;  '  "        R.A.   Decl.  R.A.  Decl.        Comment (Elong/Decl/V at date 1)
            //
            //                                                                                                     1         1         1         1         1
            //          1         2         3         4         5         6         7         8         9         0         1         2         3         4
            //012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
            //    (55) Pandora         22 18 26.2 -20 16 13  11.4   4.4W   7.2N    21-     8-   56o  None needed at this time.
            //(148989) 2001 YM73       22 18 35.1 -20 08 33  19.8   2.3W  14.9N    19-    17-    5o  None needed at this time.
            //         2008 HM2        22 17 34.4 -20 16 40  19.9  16.6W   6.8N    20-    12-    5o  Very desirable between 2009 Aug. 27-Sept. 26.  (166.0,-22.5,19.7)
            //  (1448) Lindbladia      22 18 04.5 -20 02 00  16.7   9.5W  21.5N    25-    13-   24o  None needed at this time.

            try
            {
                MPCheckEntry entry = new MPCheckEntry();
                entry.ObjectName = line.Substring(0, 22).Trim();
                entry.RAHours    = AstroConvert.ToRightAcsension(line.Substring(25, 10).Trim());
                entry.DEDeg      = AstroConvert.ToDeclination(line.Substring(36, 9).Trim());

                string magStr = line.Substring(47, 4).Trim();
                entry.Mag = string.IsNullOrEmpty(magStr)
                    ? 30
                    : double.Parse(magStr, CultureInfo.InvariantCulture);

                return(entry);
            }
            catch
            {
                return(null);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Decodes an AzAlt Coordinate from it's cartesean equivalent
        /// Note: This method should ONLY be used to decode cartesean coordinates
        /// that were originally generated from an AzAltCoordinate of from values
        /// interpolated from those originally generated from AzAltCoordinates.
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        public static AltAzCoordinate FromCartesean(double x, double y)
        {
            double az  = 0.0;
            double alt = Math.Sqrt((x * x) + (y * y));

            if (x > 0)
            {
                az = Math.Atan(y / x);
            }

            if (x < 0)
            {
                if (y >= 0)
                {
                    az = Math.Atan(y / x) + Math.PI;
                }
                else
                {
                    az = Math.Atan(y / x) - Math.PI;
                }
            }
            if (x == 0)
            {
                if (y > 0)
                {
                    az = Math.PI / 2.0;
                }
                else
                {
                    az = -1 * (Math.PI / 2.0);
                }
            }
            return(new AltAzCoordinate((alt - ALT_OFFSET), AstroConvert.RangeAzimuth(AstroConvert.RadToDeg(az))));
        }
Ejemplo n.º 5
0
        private bool ValidateParameters()
        {
            try
            {
                m_RA = AstroConvert.ToRightAcsension(tbxRA.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Tangra", MessageBoxButtons.OK, MessageBoxIcon.Error);
                tbxRA.Focus();
                return(false);
            }

            try
            {
                m_DE = AstroConvert.ToDeclination(tbxDE.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Tangra", MessageBoxButtons.OK, MessageBoxIcon.Error);
                tbxDE.Focus();
                return(false);
            }

            return(true);
        }
Ejemplo n.º 6
0
 public void RawTransformTest()
 {
     using (AscomTools _AscomTools = new AscomTools())
     {
         double siteLongitude = -1.333333;
         double siteLatitude  = 52.666667;
         _AscomTools.Transform.SiteLatitude  = siteLatitude;
         _AscomTools.Transform.SiteLongitude = siteLongitude;
         _AscomTools.Transform.SiteElevation = 192;
         DateTime testTime = new DateTime(2019, 1, 18, 21, 11, 00);
         double   lst      = AstroConvert.LocalApparentSiderealTime(siteLongitude, testTime);
         _AscomTools.Transform.SetAzimuthElevation(0.0, siteLatitude);
         _AscomTools.Transform.JulianDateTT = _AscomTools.Util.DateLocalToJulian(testTime);
         double ra          = _AscomTools.Transform.RATopocentric;
         double dec         = _AscomTools.Transform.DECTopocentric;
         double alt         = _AscomTools.Transform.ElevationTopocentric;
         double az          = _AscomTools.Transform.AzimuthTopocentric;
         double lstExpected = 4.95996448153762;
         double raExpected  = 10.9439120745406;
         double decExpected = 89.9999999983757;
         double azExpected  = 8.03515690758855E-09;
         double altExpected = 52.6666669999972;
         Assert.AreEqual(lstExpected, lst, 0.001, "LST test failed");
         Assert.AreEqual(raExpected, ra, 0.0001, "RA test failed");
         Assert.AreEqual(decExpected, dec, 0.0001, "Dec test failed");
         Assert.AreEqual(azExpected, az, 0.0001, "Az test failed");
         Assert.AreEqual(altExpected, alt, 0.0001, "Alt test failed");
     }
 }
Ejemplo n.º 7
0
        public void ShowImageHeader(AstroImage currentImage)
        {
            try
            {
                var hdr = new QHYImageHeader(currentImage);

                lblSeqNo.Text  = hdr.SeqNumber.ToString();
                lblTempNo.Text = hdr.TempNumber.ToString();

                lblGpsState.Text = hdr.GPSStatus.ToString();
                lblMaxClock.Text = hdr.MaxClock.ToString();
                try
                {
                    lblStartTime.Text = hdr.StartTime.ToString("yyyy-MM-dd  HH:mm:ss.fffffff");
                    lblEndTime.Text   = hdr.EndTime.ToString("yyyy-MM-dd  HH:mm:ss.fffffff");
                }
                catch { }

                lblStartFlag.Text = "0x" + Convert.ToString(hdr.StartFlag, 16).PadLeft(2, '0');
                lblEndFlag.Text   = "0x" + Convert.ToString(hdr.EndFlag, 16).PadLeft(2, '0');
                lblNowFlag.Text   = "0x" + Convert.ToString(hdr.NowFlag, 16).PadLeft(2, '0');

                lblLongitude.Text = AstroConvert.ToStringValue(hdr.ParseLongitude, "+DD°MM'SS.TT\"");
                lblLatitude.Text  = AstroConvert.ToStringValue(hdr.ParseLatitude, "+DD°MM'SS.TT\"");
                lblImageSize.Text = string.Format("{0} x {1}", hdr.Width, hdr.Height);
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex);
            }
        }
Ejemplo n.º 8
0
        public void SetPosition(double raHours, double deDeg, DateTime utcTime, bool isVideoNormalPosition, bool highPrecision = false)
        {
            double roundedTime = (utcTime.Hour + utcTime.Minute / 60.0 + (utcTime.Second + (utcTime.Millisecond / 1000.0)) / 3600.0) / 24;
            string format      = "00.000000";

            if (isVideoNormalPosition)
            {
                roundedTime = Math.Truncate(Math.Round(roundedTime * 1000000)) / 1000000;
                format      = "00.000000";
            }
            else
            {
                roundedTime = Math.Truncate(Math.Round(roundedTime * 100000)) / 100000;
                format      = "00.00000";
            }

            m_TimeString_16_32 = (utcTime.ToString("yyyy MM ") + (utcTime.Day + roundedTime).ToString(format, CultureInfo.InvariantCulture)).PadRight(17).Substring(0, 17);

            if (highPrecision)
            {
                m_RAString_33_44 = AstroConvert.ToStringValue(raHours, "HH MM SS.TTT").PadRight(13).Substring(0, 13);
                m_DEString_45_56 = AstroConvert.ToStringValue(deDeg, "+HH MM SS.TT").PadRight(13).Substring(0, 13);
            }
            else
            {
                m_RAString_33_44 = AstroConvert.ToStringValue(raHours, "HH MM SS.TT").PadRight(12).Substring(0, 12);
                m_DEString_45_56 = AstroConvert.ToStringValue(deDeg, "+HH MM SS.T").PadRight(12).Substring(0, 12);
            }

            SetVideoNormalPosition(isVideoNormalPosition);
        }
Ejemplo n.º 9
0
        public HourAngle GetRA(AxisPosition axes)
        {
            double tempRA_hours = GetHourAngleFromAngle(axes.RAAxis.Value);
            double tRa          = LocalApparentSiderialTime + tempRA_hours;
            double tHa          = AstroConvert.RangeHA(tRa);
            double dec          = GetDec(axes);

            // System.Diagnostics.Debug.Write($"{axes.RAAxis.Value}/{axes.DecAxis.Value}\t{dec}\t{tHa}\t{tRa}");
            if (Hemisphere == HemisphereOption.Northern)
            {
                if (axes.DecFlipped)
                {
                    tRa = tRa - 12.0;
                    // System.Diagnostics.Debug.Write("\t tRa - tRa - 12");
                }
            }
            else
            {
                System.Diagnostics.Debug.Assert(false, "GetRA is not tested for Southern Hemisphere");
                if (axes.DecAxis.Value > 180)
                {
                    tRa = tRa + 12.0;
                }
            }
            return(new HourAngle(AstroConvert.RangeRA(tRa)));
        }
Ejemplo n.º 10
0
        public void RADecAltAxRADecTest(double ra, double dec)
        {
            double lst = TimeUtils.GetLocalSiderealTime(timeRecord.UtcTime, new TimeSpan(), longitude);

            double[] altAz = AstroConvert.RaDec2AltAz(ra, dec, lst, latitude);
            double[] raDec = AstroConvert.AltAz2RaDec(altAz[0], altAz[1], latitude, lst);
            Assert.AreEqual(ra, raDec[0], tolerance);
            Assert.AreEqual(dec, raDec[1], tolerance);
        }
Ejemplo n.º 11
0
 public EquatorialCoordinate(HourAngle rightAscension, Angle declination) : this() // , Angle longitude, DateTime observedTime)
 {
     if (declination > 90.0 || declination < -90.0)
     {
         throw new ArgumentOutOfRangeException("Declination");
     }
     _RA.Value = AstroConvert.RangeRA(rightAscension.Value);
     _Dec      = declination.Value;
 }
Ejemplo n.º 12
0
        /// <summary>
        ///  Obtains a vector in polar notation from the equatorial coordinates and the observation time.
        /// </summary>
        /// <param name="coord"></param>
        /// <param name="time"></param>
        /// <returns></returns>
        private Vector GetEVC(EquatorialCoordinate coord, double localSiderealTime)
        {
            double deltaTime = AstroConvert.HrsToRad((localSiderealTime - _timeZero));
            Vector evc       = new Vector(0.0, 0.0, 0.0);

            evc[0] = Math.Cos(coord.Declination.Radians) * Math.Cos(coord.RightAscension.Radians - (_k * deltaTime));
            evc[1] = Math.Cos(coord.Declination.Radians) * Math.Sin(coord.RightAscension.Radians - (_k * deltaTime));
            evc[2] = Math.Sin(coord.Declination.Radians);
            return(evc);
        }
Ejemplo n.º 13
0
 public void MoveRADec(AxisPosition newAxisPosition, AscomTools tools, DateTime syncTime)
 {
     // double[] delta = ObservedAxes.GetDeltaTo(newAxisPosition);
     SyncTime = syncTime;
     LocalApparentSiderialTime = new HourAngle(AstroConvert.LocalApparentSiderealTime(tools.Transform.SiteLongitude, syncTime));
     // Apply the axis rotation to the new position.
     ObservedAxes = newAxisPosition;
     Equatorial   = new EquatorialCoordinate(GetRA(ObservedAxes), GetDec(ObservedAxes));
     UpdateAltAzimuth(tools, syncTime);
 }
Ejemplo n.º 14
0
        public double GetObservationRAHours()
        {
            try
            {
                return(AstroConvert.ToRightAcsension(m_RAString_33_44.Trim()));
            }
            catch (Exception)
            { }

            return(double.NaN);
        }
Ejemplo n.º 15
0
        public double GetObservationDEDeg()
        {
            try
            {
                return(AstroConvert.ToDeclination(m_DEString_45_56.Trim()));
            }
            catch (Exception)
            { }

            return(double.NaN);
        }
Ejemplo n.º 16
0
 public MountCoordinate(EquatorialCoordinate equatorial, AxisPosition axisPosition, AscomTools tools, DateTime syncTime)
 {
     ObservedAxes = axisPosition;
     SyncTime     = syncTime;
     LocalApparentSiderialTime = new HourAngle(AstroConvert.LocalApparentSiderealTime(tools.Transform.SiteLongitude, syncTime));
     if (tools.Transform.SiteLatitude < 0.0)
     {
         Hemisphere = HemisphereOption.Southern;
     }
     Equatorial = equatorial;
     this.UpdateAltAzimuth(tools, syncTime);
 }
Ejemplo n.º 17
0
        public void SlewRA(double slewAngle, double expectedRA)
        {
            MountCoordinate currentPosition = new MountCoordinate(new AxisPosition(0.0, 0.0), _Tools, _Now);
            double          targetRA        = AstroConvert.RangeRA(currentPosition.Equatorial.RightAscension.Value + expectedRA);
            double          targetDec       = currentPosition.Equatorial.Declination.Value;

            currentPosition.MoveRADec(new AxisPosition(slewAngle, 0.0), _Tools, _Now);
            EquatorialCoordinate expected = new EquatorialCoordinate(targetRA, targetDec);

            Assert.AreEqual(expected.RightAscension, currentPosition.Equatorial.RightAscension, 0.000001, "RA test");
            Assert.AreEqual(expected.Declination, currentPosition.Equatorial.Declination, 0.000001, "DEc test");
        }
Ejemplo n.º 18
0
        private double GetHourAngleFromAngle(Angle raAxisAngle)
        {
            double hours = HourAngle.DegreesToHours(AstroConvert.Range360Degrees(360.0 - raAxisAngle.Value));

            if (Hemisphere == HemisphereOption.Northern)
            {
                return(AstroConvert.RangeRA(hours + 6.0));
            }
            else
            {
                return(AstroConvert.RangeRA((24.0 - hours) + 6.0));
            }
        }
Ejemplo n.º 19
0
        public frmRovingObsLocation()
        {
            InitializeComponent();

            if (TangraConfig.Settings.LastUsed.RovingLongitude == null)
            {
                cbxLongitude.SelectedIndex = -1;
                tbxLongitude.Text          = string.Empty;
            }
            else
            {
                double longNoSign = Math.Abs(TangraConfig.Settings.LastUsed.RovingLongitude.Value);
                tbxLongitude.Text = AstroConvert.ToStringValue(longNoSign, "DD MM SS");
                if (TangraConfig.Settings.LastUsed.RovingLongitude.Value < 0)
                {
                    cbxLongitude.SelectedIndex = 1;
                }
                else
                {
                    cbxLongitude.SelectedIndex = 0;
                }
            }

            if (TangraConfig.Settings.LastUsed.RovingLatitude == null)
            {
                cbxLatitude.SelectedIndex = -1;
                tbxLatitude.Text          = string.Empty;
            }
            else
            {
                double latNoSign = Math.Abs(TangraConfig.Settings.LastUsed.RovingLatitude.Value);
                tbxLatitude.Text = AstroConvert.ToStringValue(latNoSign, "DD MM SS");
                if (TangraConfig.Settings.LastUsed.RovingLatitude.Value < 0)
                {
                    cbxLatitude.SelectedIndex = 1;
                }
                else
                {
                    cbxLatitude.SelectedIndex = 0;
                }
            }

            if (TangraConfig.Settings.LastUsed.RovingAltitude != null)
            {
                tbxAltitude.Text = string.Format("{0:0}", TangraConfig.Settings.LastUsed.RovingAltitude.Value);
            }
            else
            {
                tbxAltitude.Text = string.Empty;
            }
        }
Ejemplo n.º 20
0
        public static List <MPCheckEntry> CheckRegion(
            DateTime utcDate, double raDeg, double deDeg, double radiusArcMin, double magLimit, string observatoryCode)
        {
            Trace.WriteLine(String.Format("Checking potential objects around RA:{0:0.0000}, DEC:{1:0.0000} at {2} UTC for observatory code {3})", raDeg / 15, deDeg, utcDate.ToString("yyyy-MMM-dd HH:mm:ss"), observatoryCode));

            double dayPart = utcDate.Day + (utcDate.Hour + utcDate.Minute / 60.0 + (utcDate.Second + (utcDate.Millisecond / 1000.0)) / 3600.0) / 24.0;

            string requestUrl =
                string.Format(
                    TangraConfig.Settings.Urls.MPCheckHttpsServiceUrl + "?year={0}&month={1}&day={2}&which=pos&ra={3}&decl={4}&TextArea=&radius={5}&limit={6}&oc={7}&sort=d&mot=h&tmot=s&pdes=u&needed=f&ps=n&type=p",
                    utcDate.Year, utcDate.Month, dayPart.ToString("0.000"),
                    AstroConvert.ToStringValue(raDeg / 15.0, "HH MM SS"),
                    AstroConvert.ToStringValue(deDeg, "+DD MM SS"),
                    radiusArcMin.ToString("0"),
                    magLimit.ToString("0.0"),
                    observatoryCode);

            ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

            try
            {
                HttpWebRequest req = (HttpWebRequest)WebRequest.Create(requestUrl);

                Version ver = Assembly.GetExecutingAssembly().GetName().Version;
                req.UserAgent = "Tangra, ver " + ver.ToString();

                HttpWebResponse response       = (HttpWebResponse)req.GetResponse();
                Stream          responseStream = response.GetResponseStream();
                string          responseString = null;
                using (StreamReader reader = new StreamReader(responseStream, Encoding.UTF8))
                {
                    responseString = reader.ReadToEnd();
                }

                int startIdx = responseString.IndexOf("<pre>");
                int endIdx   = responseString.IndexOf("</pre>");

                if (startIdx > -1)
                {
                    List <MPCheckEntry> parsedData = ParseMPCheckResponse(responseString.Substring(startIdx + 5, endIdx - startIdx - 5));

                    return(parsedData);
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.ToString());
            }

            return(new List <MPCheckEntry>());
        }
Ejemplo n.º 21
0
        private void SaveHeader()
        {
            Header.AddValue("HISTORY", "Fits header populated by Tangra v0.1", string.Empty);

            if (!string.IsNullOrEmpty(tbxObject.Text))
            {
                Header.AddValue("OBJECT", tbxObject.Text, null);
            }

            if (!string.IsNullOrEmpty(tbxScope.Text))
            {
                Header.AddValue("TELESCO", tbxScope.Text, null);
            }

            if (!string.IsNullOrEmpty(tbxCamera.Text))
            {
                Header.AddValue("INSTRUME", tbxCamera.Text, null);
            }

            if (!string.IsNullOrEmpty(tbxObserver.Text))
            {
                Header.AddValue("OBSERVER", tbxObserver.Text, null);
            }

            if (!string.IsNullOrEmpty(tbxNotes.Text))
            {
                Header.AddValue("NOTES", tbxNotes.Text, null);
            }

            if (!string.IsNullOrEmpty(tbxRA.Text))
            {
                Header.AddValue("OBJCTRA", AstroConvert.ToStringValue(m_RA, "HH MM SS.TT"), string.Empty);
                Header.AddValue("RA", AstroConvert.ToStringValue(m_RA, "HH MM SS.TT"), string.Empty);
            }

            if (!string.IsNullOrEmpty(tbxDE.Text))
            {
                Header.AddValue("OBJCTDEC", AstroConvert.ToStringValue(m_DEC, "DD MM SS.T"), string.Empty);
                Header.AddValue("DEC", AstroConvert.ToStringValue(m_DEC, "DD MM SS.T"), string.Empty);
            }

            if (cbxDateTime.Checked)
            {
                Header.AddValue("DATE-OBS", m_ExposureTime, string.Empty);
                Header.AddValue("TIMESYS", "UTC", "Default time system");
            }

            Header.AddValue("CLRBAND", "R", string.Empty);
        }
Ejemplo n.º 22
0
        public AxisPosition GetAxisPosition(EquatorialCoordinate eq, double targetSiderealTime)
        {
            Vector EVC = GetEVC(eq, targetSiderealTime);
            Vector HVC = new Vector(0.0, 0.0, 0.0);

            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    HVC[i] += _T[i, j] * EVC[j];
                }
            }

            return(new AxisPosition(AstroConvert.Range2Pi(Math.Atan2(HVC[1], HVC[0])), AstroConvert.Range2Pi(Math.Asin(HVC[2]))));
        }
Ejemplo n.º 23
0
        public EquatorialCoordinate GetEquatorialCoords(AxisPosition axes, double localSiderealTime)
        {
            Vector EVC       = new Vector(0.0, 0.0, 0.0);
            Vector HVC       = GetHVC(axes);
            double deltaTime = AstroConvert.HrsToRad((localSiderealTime - _timeZero));

            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    EVC[i] += _iT[i, j] * HVC[j];
                }
            }
            return(new EquatorialCoordinate(Math.Atan2(EVC[1], EVC[0]) + (_k * deltaTime), Math.Asin(EVC[2])));
        }
Ejemplo n.º 24
0
        public CarteseanCoordinate ToCartesean(Angle latitude, bool affineTaki = true)
        {
            CarteseanCoordinate cartCoord;

            if (affineTaki)
            {
                // Get Polar (or should than be get AltAzimuth) from Equatorial coordinate (formerly call to EQ_SphericalPolar)
                AltAzCoordinate polar = AstroConvert.GetAltAz(this, latitude);
                // Get  Cartesean from Polar (formerly call to EQ_Polar2Cartes)
                cartCoord = polar.ToCartesean();
            }
            else
            {
                cartCoord = new CarteseanCoordinate(this.RightAscension.Radians, this.Declination.Radians, 1.0);
            }
            return(cartCoord);
        }
Ejemplo n.º 25
0
        public override void LoadSettings()
        {
            m_CatalogValidator = new StarCatalogueFacade(TangraConfig.Settings.StarCatalogue);

            if (double.IsNaN(TangraConfig.Settings.Generic.Longitude))
            {
                cbxLongitude.SelectedIndex = -1;
                tbxLongitude.Text          = string.Empty;
            }
            else
            {
                double longNoSign = Math.Abs(TangraConfig.Settings.Generic.Longitude);
                tbxLongitude.Text = AstroConvert.ToStringValue(longNoSign, "DD MM SS");
                if (TangraConfig.Settings.Generic.Longitude < 0)
                {
                    cbxLongitude.SelectedIndex = 1;
                }
                else
                {
                    cbxLongitude.SelectedIndex = 0;
                }
            }

            rbMPCCode.Checked = TangraConfig.Settings.Astrometry.UseMPCCode;
            tbxMPCCode.Text   = TangraConfig.Settings.Astrometry.MPCObservatoryCode;

            if (double.IsNaN(TangraConfig.Settings.Generic.Latitude))
            {
                cbxLatitude.SelectedIndex = -1;
                tbxLatitude.Text          = string.Empty;
            }
            else
            {
                double latNoSign = Math.Abs(TangraConfig.Settings.Generic.Latitude);
                tbxLatitude.Text = AstroConvert.ToStringValue(latNoSign, "DD MM SS");
                if (TangraConfig.Settings.Generic.Latitude < 0)
                {
                    cbxLatitude.SelectedIndex = 1;
                }
                else
                {
                    cbxLatitude.SelectedIndex = 0;
                }
            }
        }
Ejemplo n.º 26
0
        private Angle GetAngleFromHourAngle(double hourAngle)
        {
            double ha = 0.0;
            double degrees;

            if (Hemisphere == HemisphereOption.Northern)
            {
                ha      = AstroConvert.RangeRA(hourAngle - 6.0); // Renormalise from a perpendicular position
                degrees = HourAngle.HoursToDegrees(ha);
            }
            else
            {
                System.Diagnostics.Debug.Assert(false, "GetAngleFromHours not tested for Southern Hemisphere");
                ha      = AstroConvert.RangeRA((24 - hourAngle) - 6.0); // Renormalise from a perpendicular position
                degrees = HourAngle.HoursToDegrees(ha);
            }
            return(AstroConvert.Range360Degrees(360.0 - degrees));
        }
Ejemplo n.º 27
0
        public void TestingHA()
        {
            double    ra  = 0.0;
            double    ha  = 0.0;
            HourAngle lst = new HourAngle(AstroConvert.LocalApparentSiderealTime(_Tools.Transform.SiteLongitude, _Now));

            System.Diagnostics.Debug.WriteLine($"LST = {lst.Value}");
            System.Diagnostics.Debug.WriteLine("\tRA\t\t\tHA");
            System.Diagnostics.Debug.WriteLine("\t==\t\t\t==");

            for (int i = 0; i < 24; i++)
            {
                ra = i * 1.0;
                ha = AstroConvert.RangeHA(ra - lst);
                System.Diagnostics.Debug.WriteLine($"\t{ra}\t\t{ha}");
            }

            Assert.IsTrue(true);
        }
Ejemplo n.º 28
0
        public void CalculateSlewAngles()
        {
            MountCoordinate currentPosition = new MountCoordinate(new AxisPosition(0.0, 0.0), _Tools, _Now);
            double          ha = currentPosition.LocalApparentSiderialTime;

            System.Diagnostics.Debug.WriteLine("\nPoint A (SE)");
            System.Diagnostics.Debug.WriteLine("============");
            AxisPosition targetAxes = currentPosition.GetAxisPositionForRADec(AstroConvert.RangeRA(ha - 3.0), 10.0, _Tools);

            Angle[] deltaAngles = currentPosition.ObservedAxes.GetSlewAnglesTo(targetAxes);
            System.Diagnostics.Debug.WriteLine($"Slewing through: {deltaAngles[0]} / {deltaAngles[1]}");
            currentPosition.MoveRADec(targetAxes, _Tools, _Now);
            currentPosition.DumpDebugInfo();
            Assert.AreEqual(PierSide.pierWest, currentPosition.GetPointingSideOfPier(false), "Point A");

            System.Diagnostics.Debug.WriteLine("\nPoint B (NW)");
            System.Diagnostics.Debug.WriteLine("============");
            targetAxes  = currentPosition.GetAxisPositionForRADec(AstroConvert.RangeRA(ha + 9.0), 60.0, _Tools);
            deltaAngles = currentPosition.ObservedAxes.GetSlewAnglesTo(targetAxes);
            System.Diagnostics.Debug.WriteLine($"Slewing through: {deltaAngles[0]} / {deltaAngles[1]}");
            currentPosition.MoveRADec(targetAxes, _Tools, _Now);
            currentPosition.DumpDebugInfo();
            Assert.AreEqual(PierSide.pierEast, currentPosition.GetPointingSideOfPier(false), "Point B");

            System.Diagnostics.Debug.WriteLine("\nPoint C (NE)");
            System.Diagnostics.Debug.WriteLine("============");
            targetAxes  = currentPosition.GetAxisPositionForRADec(AstroConvert.RangeRA(ha - 9.0), 60.0, _Tools);
            deltaAngles = currentPosition.ObservedAxes.GetSlewAnglesTo(targetAxes);
            System.Diagnostics.Debug.WriteLine($"Slewing through: {deltaAngles[0]} / {deltaAngles[1]}");
            currentPosition.MoveRADec(targetAxes, _Tools, _Now);
            currentPosition.DumpDebugInfo();
            Assert.AreEqual(PierSide.pierWest, currentPosition.GetPointingSideOfPier(false), "Point C");

            System.Diagnostics.Debug.WriteLine("\nPoint D (SW)");
            System.Diagnostics.Debug.WriteLine("============");
            targetAxes  = currentPosition.GetAxisPositionForRADec(AstroConvert.RangeRA(ha + 3.0), 10.0, _Tools);
            deltaAngles = currentPosition.ObservedAxes.GetSlewAnglesTo(targetAxes);
            System.Diagnostics.Debug.WriteLine($"Slewing through: {deltaAngles[0]} / {deltaAngles[1]}");
            currentPosition.MoveRADec(targetAxes, _Tools, _Now);
            currentPosition.DumpDebugInfo();
            Assert.AreEqual(PierSide.pierEast, currentPosition.GetPointingSideOfPier(false), "Point D");
        }
Ejemplo n.º 29
0
        internal void SelectStar(PlateConstStarPair selectedPair, PSFFit psfFit)
        {
            if (selectedPair != null)
            {
                lblStarNo.Text = selectedPair.StarNo.ToString();
                lblRA.Text     = AstroConvert.ToStringValue(selectedPair.RADeg / 15.0, "HH MM SS.TT");
                lblDE.Text     = AstroConvert.ToStringValue(selectedPair.DEDeg, "+DD MM SS.T");
                lblX.Text      = selectedPair.x.ToString("0.00");
                lblY.Text      = selectedPair.y.ToString("0.00");
                lblResRA.Text  = string.Format("{0}\"", selectedPair.FitInfo.ResidualRAArcSec.ToString("0.00"));
                lblResDE.Text  = string.Format("{0}\"", selectedPair.FitInfo.ResidualDEArcSec.ToString("0.00"));

                m_SelectedPSF = psfFit;
            }
            else
            {
                m_SelectedPSF = null;
            }

            pnlSelectedStar.Visible = selectedPair != null;
        }
Ejemplo n.º 30
0
        private Angle GetAngleFromDecDegrees(double angle, bool flipDEC)
        {
            double offset = -90.0; // This may vary in the future if zero degrees is no longer at 12-0-clock
            double result = 0.0;

            if (Hemisphere == HemisphereOption.Southern)
            {
                angle = 360.0 - angle;
            }
            if (angle > 180.0 && !flipDEC)
            {
                result = offset - angle;
            }
            else
            {
                result = angle + offset;
            }
            // This routine works clockwise so need to convert to Anti-clockwise
            result = AstroConvert.Range360Degrees(360 + result);
            return(result);
        }