public void Test_swe_fixstar_ut() { using (var swe = new SwissEph()) { string name = "aldebaran"; double tjd = swe.swe_julday(1974, 8, 16, 0.5, SwissEph.SE_GREG_CAL); double[] geopos = new double[] { 47.853333, 5.333889, 468 }; double[] xx = new double[6]; String serr = null; swe.OnLoadFile += (s, e) => { if (string.Equals(e.FileName, "[ephe]\\sefstars.txt", StringComparison.OrdinalIgnoreCase)) { e.File = ResourceFileHelpers.OpenResourceFile("sefstars.txt"); } }; int iflag = swe.swe_fixstar_ut(ref name, tjd, SwissEph.SEFLG_MOSEPH, xx, ref serr); Assert.NotEqual(SwissEph.ERR, iflag); Assert.Null(serr); Assert.Equal("Aldebaran,alTau", name); Assert.Equal(69.43785475383, xx[0], 11); Assert.Equal(-5.46862068520, xx[1], 11); Assert.Equal(4214356.43827158, xx[2], 7); Assert.Equal(0.000151, xx[3], 6); Assert.Equal(1.7E-05, xx[4], 6); #if DEBUG Assert.Equal(0.015532, xx[5], 6); #else Assert.Equal(0.01536, xx[5], 6); #endif } }
public void Test() { string jplfolder = @"C:\Temp\ephe\jplfiles"; string file = "de430.eph"; string eop_today = "eop_1962_today.txt"; string eop_finals = "eop_finals.txt"; // Skip test if the file not exists if (!File.Exists(Path.Combine(jplfolder, file))) { return; } using (var swe = new SwissEph()) { swe.OnLoadFile += (s, e) => { string f = e.FileName; string fn = Path.GetFileName(f); if (File.Exists(f)) { e.File = new FileStream(f, FileMode.Open, FileAccess.Read); } else if (fn == eop_today || fn == eop_finals) { e.File = ResourceFileHelpers.OpenResourceFile(fn); } }; swe.swe_set_ephe_path(jplfolder); // The issue raise a FormatException on this instruction swe.swe_set_jpl_file(file); } }
public void Test_swe_fixstar_ut() { using (var swe = new SwissEph()) { string name = "aldebaran"; double tjd = swe.swe_julday(1974, 8, 16, 0.5, SwissEph.SE_GREG_CAL); double[] geopos = new double[] { 47.853333, 5.333889, 468 }; double[] xx = new double[6]; String serr = null; swe.OnLoadFile += (s, e) => { if (string.Equals(e.FileName, "[ephe]\\sefstars.txt", StringComparison.OrdinalIgnoreCase)) { e.File = ResourceFileHelpers.OpenResourceFile("sefstars.txt"); } }; int iflag = swe.swe_fixstar_ut(ref name, tjd, SwissEph.SEFLG_MOSEPH, xx, ref serr); Assert.NotEqual(SwissEph.ERR, iflag); Assert.Null(serr); Assert.Equal("Aldebaran,alTau", name); Assert.Equal(69.439402029787, xx[0], 12); Assert.Equal(-5.469136284371, xx[1], 12); Assert.Equal(1.0, xx[2], 12); Assert.Equal(0, xx[3], 12); Assert.Equal(0, xx[4], 12); Assert.Equal(0, xx[5], 12); } }
public void Test_swe_fixstar() { using (var swe = new SwissEph()) { string name = "aldebaran"; double tjd = swe.swe_julday(1974, 8, 16, 0.5, SwissEph.SE_GREG_CAL); double[] geopos = new double[] { 47.853333, 5.333889, 468 }; double[] xx = new double[6]; String serr = null; int iflag = swe.swe_fixstar(ref name, tjd, SwissEph.SEFLG_MOSEPH, xx, ref serr); Assert.Equal(SwissEph.ERR, iflag); Assert.Equal("SwissEph file 'sefstars.txt' not found in PATH '[ephe]'", serr); swe.OnLoadFile += (s, e) => { if (string.Equals(e.FileName, "[ephe]\\sefstars.txt", StringComparison.OrdinalIgnoreCase)) { e.File = ResourceFileHelpers.OpenResourceFile("sefstars.txt"); } }; iflag = swe.swe_fixstar(ref name, tjd, SwissEph.SEFLG_MOSEPH, xx, ref serr); Assert.NotEqual(SwissEph.ERR, iflag); Assert.Null(serr); Assert.Equal("Aldebaran,alTau", name); Assert.Equal(69.43785467706, xx[0], 11); Assert.Equal(-5.46862068665, xx[1], 11); Assert.Equal(4214356.43826371, xx[2], 8); #if DEBUG Assert.Equal(0.00014896, xx[3], 8); Assert.Equal(1.723E-05, xx[4], 8); Assert.Equal(0.01522108, xx[5], 8); #else Assert.Equal(0.00014887, xx[3], 8); Assert.Equal(1.724E-05, xx[4], 8); Assert.Equal(0.01536112, xx[5], 8); #endif name = "unknown"; iflag = swe.swe_fixstar(ref name, tjd, SwissEph.SEFLG_MOSEPH, xx, ref serr); Assert.Equal(SwissEph.ERR, iflag); Assert.Equal("star unknown not found", serr); } }
public void Test_swe_fixstar_mag() { using (var swe = new SwissEph()) { string name = "aldebaran"; double mag = 0; String serr = null; swe.OnLoadFile += (s, e) => { if (string.Equals(e.FileName, "[ephe]\\sefstars.txt", StringComparison.OrdinalIgnoreCase)) { e.File = ResourceFileHelpers.OpenResourceFile("sefstars.txt"); } }; int iflag = swe.swe_fixstar_mag(ref name, ref mag, ref serr); Assert.NotEqual(SwissEph.ERR, iflag); Assert.Equal("Aldebaran,alTau", name); Assert.Equal(0.86, mag, 12); } }
public void TestFixstar(string search, int eres, string estar, string error) { int day = 16, month = 8, year = 1974; double time = 0.05; using (var swe = new SwissEph()) { swe.OnLoadFile += (s, e) => { string f = e.FileName; string fn = Path.GetFileName(f); if (File.Exists(f)) { e.File = new FileStream(f, FileMode.Open, FileAccess.Read); } else { e.File = ResourceFileHelpers.OpenResourceFile(fn); } }; double[] xx = new double[6]; double tjd = swe.swe_julday(year, month, day, time, SwissEph.SE_GREG_CAL); double te = tjd + swe.swe_deltat(tjd); string star = search, serr = null; int res = swe.swe_fixstar(ref star, te, SwissEph.SEFLG_MOSEPH, xx, ref serr); Assert.Equal(eres, res); if (res == SwissEph.ERR) { Assert.Equal(error, serr); } else { Assert.Equal(estar, star); } } }