/**
  * @covers Marando\Meeus\Nutation\Nutation::meanObliquity
  * @see p.148, ex. 22.a
  */
 public function testMeanObliquity()
 {
     $ε0 = Nutation::meanObliquity(AstroDate::parse('1987-Apr-10'));
     $this->assertEquals(Angle::dms(23, 26, 27.407), $ε0, 'ε0', 0.001);
 }
Exemple #2
0
 public function test()
 {
     return;
     $frame = Frame::ICRF();
     $epoch = Epoch::J(2000);
     echo $epoch->toDate()->toTDB();
     echo "\n";
     echo "\n";
     exit;
     $ra = \Marando\Units\Time::hms(11, 16, 46.6);
     $dec = \Marando\Units\Angle::dms(5, 45, 32.5);
     $dist = Distance::au(5.8);
     echo "\n" . ($eq = new Equat($frame, $epoch, $ra, $dec, $dist));
     echo "\n" . ($eq = (new Equat($frame, $epoch, $ra, $dec, $dist))->apparent());
     echo "\n";
     return;
     $frame = Frame::ICRF();
     $epoch = AstroDate::jd(2457335.472615741)->toEpoch();
     $ra = \Marando\Units\Time::hms(11, 16, 46.6);
     $dec = \Marando\Units\Angle::dms(5, 45, 32.5);
     $dist = Distance::au(5.8);
     echo "\n" . ($eq = new Equat($frame, $epoch, $ra, $dec, $dist));
     echo "\n" . ($eq = (new Equat($frame, $epoch, $ra, $dec, $dist))->apparent());
     $eq = new Equat($frame, $epoch, $ra, $dec, $dist);
     $eq->topo = Geo::deg(27, -82);
     echo "\n" . $eq->toHoriz();
     echo "\n" . $eq->apparent();
     echo "\n" . ($h = $eq->toHoriz());
     echo "\n" . $h->az->deg . "\t" . $h->alt->deg;
     echo "\n" . $eq->apparent(\Marando\Units\Pressure::mbar(100), \Marando\Units\Temperature::F(90), 0.85);
     echo "\n" . $eq->toHoriz();
     return;
     $ra = \Marando\Units\Time::hours(14.424354);
     $dec = \Marando\Units\Angle::deg(33.54366);
     $dist = Distance::au(1.5);
     $geo = Geo::deg(27, -82);
     $e = new Equat(Frame::ICRF(), Epoch::jd(2455586), $ra, $dec, $dist);
     $e->topo = $geo;
     echo "\n\n" . $e;
     echo "\n" . $e->apparent();
     $e = new Equat(Frame::ICRF(), Epoch::jd(2455586), $ra, $dec, $dist);
     $e->topo = $geo;
     echo "\n" . $e->apparent();
     $e = new Equat(Frame::ICRF(), Epoch::jd(2455586), $ra, $dec, $dist);
     $e->topo = $geo;
     echo "\n" . $e->toHoriz();
     return;
     $e = new Equat(Frame::ICRF(), Epoch::jd(2455586), $ra, $dec, $dist);
     echo "\n\n" . $e;
     echo "\n" . $e->apparent($geo);
     echo "\n" . $e->apparent()->toHoriz($geo);
     $e = new Equat(Frame::ICRF(), Epoch::jd(2455586), $ra, $dec, $dist);
     echo "\n\n" . $e;
     echo "\n" . $e->apparent();
     echo "\n" . $e->apparent()->toHoriz();
     $e = new Equat(Frame::ICRF(), Epoch::jd(2451586), $ra, $dec, $dist);
     $e->topo = $geo;
     echo "\n\n" . $e;
     echo "\n" . $e->apparent();
     echo "\n" . $e->apparent()->toHoriz();
     return;
     // Position of Mercury
     $x = Distance::au(+1.18052679326447);
     $y = Distance::au(-0.3650485652522116);
     $z = Distance::au(-0.2123422968928603);
     // Velocity of Mercury
     $vx = Velocity::aud(0.02052320553396918);
     $vy = Velocity::aud(0.02828864020900079);
     $vz = Velocity::aud(0.01145246106968459);
     // Frame & epoch
     $frame = Frame::ICRF();
     $epoch = AstroDate::parse('2015-Mar-20')->toEpoch();
     $c = new Cartesian($frame, $epoch, $x, $y, $z, $vx, $vy, $vz);
     echo "\n\n";
     echo $c;
     echo "\n\n";
     echo $c->setUnit('km km/d');
     echo "\n\n";
     echo $c->setUnit('km km/s');
     echo "\n\n";
     echo $c->toEquat();
     echo "\n\n";
     echo $c->toEquat()->apparent();
     echo "\n\n";
     echo $c->toEquat()->apparent(Geo::deg(27, 278));
     echo "\n\n";
     echo $c->toEquat()->toHoriz(Geo::deg(27, 278));
     echo "\n\n";
 }
Exemple #3
0
 /**
  * Finds the mean obliquity of the ecliptic (ε0) for a given date by using the
  * coefficients provided by Laskar.
  *
  * By using this method the accuracy is estimated to be at 0".01 after 1000
  * years and a few arc seconds after 10,000 years on either side of the
  * epoch J2000. Also, this method is only valid over a period of 10,000 years
  * on either side of J2000 and will throe an exception if attempted on out
  * of range dates
  *
  * @param  AstroDate $date Date to find ε0 for
  * @return Angle           Mean obliquity (ε0)
  * @throws Exception       Occurs with an out of range date, |year| > 10,000
  *
  * @see Meeus, Jean. Astronomical Algorithms. Richmond, Virg.: Willmann-Bell,
  *          2009. 147. Print.
  */
 public static function meanObliquityLaskar(AstroDate $date)
 {
     // Time factor
     $t = ($date->copy()->toUTC()->jd - 2451545.0) / 36525;
     // Check for out of range date
     if (abs($t) >= 1) {
         $msg = "The Laskar method is not valid for the year {$date->year}.";
         throw new Exception($msg);
     }
     $ε0TermsLaskar = [Angle::dms(23, 26, 21.448)->rad, Angle::dms(0, 0, -4680.93)->rad, Angle::dms(0, 0, -1.55)->rad, Angle::dms(0, 0, 1999.25)->rad, Angle::dms(0, 0, -51.38)->rad, Angle::dms(0, 0, -249.67)->rad, Angle::dms(0, 0, -39.05)->rad, Angle::dms(0, 0, 7.12)->rad, Angle::dms(0, 0, 27.87)->rad, Angle::dms(0, 0, 5.79)->rad, Angle::dms(0, 0, 2.45)->rad];
     $ε0 = static::Horner($t, $ε0TermsLaskar);
     return Angle::rad($ε0);
 }
Exemple #4
0
 public function testString()
 {
     $tests = ['0 0 1' => Angle::dms(0, 0, 1), '0 0 0.1' => Angle::dms(0, 0, 0, 1), '0 0 0.1' => Angle::dms(0, 0, 0, 0.1), '0 0 0.01' => Angle::dms(0, 0, 0, 0.01), '0 0 0.001' => Angle::dms(0, 0, 0, 0.001), '0 0 0.0001' => Angle::dms(0, 0, 0, 0.0001), '0 0 0.00001' => Angle::dms(0, 0, 0, 1.0E-5), '0 0 0.000001' => Angle::dms(0, 0, 0, 1.0E-6), '0 0 0.0000001' => Angle::dms(0, 0, 0, 1.0E-7), '0 0 0.00000001' => Angle::dms(0, 0, 0, 1.0E-8), '0 0 0.000000001' => Angle::dms(0, 0, 0, 1.0E-9), '-0 0 1' => Angle::dms(0, 0, -1), '-0 0 0.1' => Angle::dms(0, 0, 0, -1), '-0 0 0.1' => Angle::dms(0, 0, 0, -0.1), '-0 0 0.01' => Angle::dms(0, 0, 0, -0.01), '-0 0 0.001' => Angle::dms(0, 0, 0, -0.001), '-0 0 0.0001' => Angle::dms(0, 0, 0, -0.0001), '-0 0 0.00001' => Angle::dms(0, 0, 0, -1.0E-5), '-0 0 0.000001' => Angle::dms(0, 0, 0, -1.0E-6), '-0 0 0.0000001' => Angle::dms(0, 0, 0, -1.0E-7), '-0 0 0.00000001' => Angle::dms(0, 0, 0, -1.0E-8), '-0 0 0.000000001' => Angle::dms(0, 0, 0, -1.0E-9)];
     foreach ($tests as $string => $angle) {
         $this->assertEquals($string, $angle->format('d m s.9f'));
     }
 }