Exemple #1
0
        public void Transform_CelestialToApparentTest(double ra, double dec)
        {
            //Arrange
            var coordinates = new Coordinates(ra, dec, Epoch.J2000, Coordinates.RAType.Hours);

            //Act
            coordinates = coordinates.Transform(Epoch.JNOW);

            var transform = new ASCOM.Astrometry.Transform.Transform();

            transform.SetJ2000(ra, dec);

            //Check with ascom transformation that the transformation logic matches
            Assert.AreEqual(transform.RAApparent, coordinates.RA, 0.0001);
            Assert.AreEqual(transform.DECApparent, coordinates.Dec, 0.0001);
        }
Exemple #2
0
        static public AltAz RaDec2AltAz(RaDec coord, LatLon location, DateTime time, double elevation)
        {
            var utils   = new ASCOM.Astrometry.AstroUtils.AstroUtils();
            var MJDdate = utils.CalendarToMJD(time.Day, time.Month, time.Year);

            MJDdate += time.TimeOfDay.TotalDays;

            var tfm = new ASCOM.Astrometry.Transform.Transform();

            tfm.JulianDateTT    = MJDdate;
            tfm.SiteElevation   = elevation * 1000;
            tfm.SiteLatitude    = location.Lat;
            tfm.SiteLongitude   = location.Lon;
            tfm.SiteTemperature = 0;
            tfm.SetJ2000(coord.Ra, coord.Dec);
            tfm.Refresh();

            var res = new AltAz(tfm.ElevationTopocentric, tfm.AzimuthTopocentric);

            return(res);
        }
Exemple #3
0
        public (double Alt, double Az) ConvertAltAz(double RaHours, double DecHours, double JuliuanDate)
        {
            transform.SiteLatitude    = Convert.ToDouble(Lat.Text);
            transform.SiteLongitude   = Convert.ToDouble(Long.Text);
            transform.SiteElevation   = Convert.ToDouble(Elevation.Text);
            transform.SiteTemperature = 20.0;
            transform.JulianDateTT    = JuliuanDate;


            //T.SetJ2000(U.HMSToHours("14:15:38.951"), U.DMSToDegrees("19:10:38.06"));
            transform.SetJ2000(RaHours, DecHours);
            //Console.WriteLine("RA: " + RaHours.ToString() + " DEC: " + DecHours.ToString());

            //MsgBox("RA Topo: " & U.HoursToHMS(T.RATopocentric, ":", ":", "", 3) & " DEC Topo: " & U.DegreesToDMS(T.DECTopocentric, ":", ":", "", 3))
            Console.WriteLine("Azimuth: " + transform.AzimuthTopocentric.ToString() + " Elevation: " + transform.ElevationTopocentric.ToString());

            return(transform.ElevationTopocentric, transform.AzimuthTopocentric);

            //'Set arbitary topocentric co-ordinates and read off the corresponding J2000 co-ordinates (site parameters remain the same)
            //T.SetTopocentric(11.0, 25.0);
            //MsgBox("RA J2000: " & U.HoursToHMS(T.RAJ2000, ":", ":", "", 3) & " DEC J2000: " & U.DegreesToDMS(T.DecJ2000, ":", ":", "", 3))

            //'Clean up components
        }
        public static AltAzm RaDec2AltAzm(Coordinates coord, LatLon location, DateTime time, double elevation)
        {
            var utils = new ASCOM.Astrometry.AstroUtils.AstroUtils();
            var MJDdate = utils.CalendarToMJD(time.Day, time.Month, time.Year);
            MJDdate += time.TimeOfDay.TotalDays;

            var tfm = new ASCOM.Astrometry.Transform.Transform();
            tfm.JulianDateTT = MJDdate;
            tfm.SiteElevation = elevation * 1000;
            tfm.SiteLatitude = location.Lat;
            tfm.SiteLongitude = location.Lon;
            tfm.SiteTemperature = 0;
            tfm.SetJ2000(coord.Ra, coord.Dec);
            tfm.Refresh();

            var res = new AltAzm(tfm.ElevationTopocentric, tfm.AzimuthTopocentric);
            return res;
        }