public void Transform_ApparentToCelestialTest(double ra, double dec) { //Arrange var coordinates = new Coordinates(ra, dec, Epoch.JNOW, Coordinates.RAType.Hours); //Act coordinates = coordinates.Transform(Epoch.J2000); var transform = new ASCOM.Astrometry.Transform.Transform(); transform.SetApparent(ra, dec); //Assert //Check with ascom transformation that the transformation logic matches Assert.AreEqual(transform.RAJ2000, coordinates.RA, 0.0001); Assert.AreEqual(transform.DecJ2000, coordinates.Dec, 0.0001); }
static public 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.SetApparent(coord.Ra, coord.Dec); tfm.Refresh(); var res = new AltAzm(tfm.ElevationTopocentric, tfm.AzimuthTopocentric); return(res); }
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.SetApparent(coord.Ra, coord.Dec); tfm.Refresh(); var res = new AltAzm(tfm.ElevationTopocentric, tfm.AzimuthTopocentric); return res; }