コード例 #1
0
ファイル: Geo.php プロジェクト: marando/astrocoord
 /**
  * Represents this instance as a string
  *
  * @return string
  */
 public function __toString()
 {
     // Figure out cardinal directions
     $latDir = $this->isN() ? 'N' : 'S';
     $lonDir = $this->isW() ? 'W' : 'E';
     // Get the lat/lon as positive values
     $lat = $this->lat->deg >= 0 ? $this->lat : $this->lat->copy()->negate();
     $lon = $this->lon->deg >= 0 ? $this->lon : $this->lon->copy()->negate();
     return "{$lat} {$latDir}, {$lon} {$lonDir}";
 }
コード例 #2
0
ファイル: EquatTest.php プロジェクト: gavinkou/AstroCoord
 public function testToEclip()
 {
     // Earth -> Venus @ 2015-Nov-08 23:20:34.000 UT
     $dt = AstroDate::jd(2457335.47261574);
     $x = Distance::au(-0.7956853147170494);
     $y = Distance::au(-0.00807301690301796);
     $z = Distance::au(0.01392567642390632);
     $c = new Cartesian(Frame::ICRF(), $dt->toEpoch(), $x, $y, $z);
     $equat = $c->toEquat();
     $eclip = $equat->toEclip();
     $prec = Angle::arcmin(13)->deg;
     $this->assertEquals(180.3510658, $eclip->lon->deg, 'λ', $prec);
     $this->assertEquals(1.1487465, $eclip->lat->deg, 'β', $prec);
 }
コード例 #3
0
 /**
  * @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);
 }
コード例 #4
0
ファイル: Nutation.php プロジェクト: marando/meeus-nutation
 /**
  * Calculates the nutations in longitude (Δψ) and latitude (Δε) for a date
  *
  * @param  AstroDate $date
  * @return static
  *
  * @see Meeus, Jean. Astronomical Algorithms. Richmond, Virg.: Willmann-Bell,
  *          2009. 143-147. Print.
  */
 public static function find(AstroDate $date)
 {
     // Time factor
     $t = ($date->copy()->toUTC()->jd - 2451545.0) / 36525;
     /*
      * Required terms
      * ----------------
      * D  = mean elongation of the Moon from the Sun
      * M  = mean anomaly of the Earth
      * M´ = mean anomaly of the Moon
      * F  = argument of latitude for Moon
      * Ω  = long. of asc. node for Moon's mean ecl. orbit (mean equi. of date)
      */
     $coeffD = [297.85036, 445267.1148, -0.0019142, 1 / 189474];
     $coeffM = [357.52772, 35999.05034, -0.0001603, -1 / 300000];
     $coeffM´ = [134.96298, 477198.867398, 0.0086972, 1 / 5620];
     $coeffF = [93.27191000000001, 483202.017538, -0.0036825, 1 / 327270];
     $coeffΩ = [125.04452, -1934.136261, 0.0020708, 1.0 / 450000];
     // Calculate the terms
     $D = Angle::deg(static::Horner($t, $coeffD))->norm();
     $M = Angle::deg(static::Horner($t, $coeffM))->norm();
     $M´ = Angle::deg(static::Horner($t, $coeffM´))->norm();
     $F = Angle::deg(static::Horner($t, $coeffF))->norm();
     $Ω = Angle::deg(static::Horner($t, $coeffΩ))->norm();
     // Nutation coefficient terms
     $nutationTerms = static::NutationTerms();
     // Evaluate the nutation terms
     $Δψ = 0;
     $Δε = 0;
     for ($i = 0; $i < count($nutationTerms); $i++) {
         $row = $nutationTerms[$i];
         $arg = 0 + $row[0] * $D->rad + $row[1] * $M->rad + $row[2] * $M´->rad + $row[3] * $F->rad + $row[4] * $Ω->rad;
         $Δψ += ($row[5] + $row[6] * $t) * sin($arg) / 10000.0 / Time::SEC_IN_HOUR;
         $Δε += ($row[7] + $row[8] * $t) * cos($arg) / 10000.0 / Time::SEC_IN_HOUR;
     }
     // Store as angles
     $Δψ = Angle::deg($Δψ);
     $Δε = Angle::deg($Δε);
     // Return the nutation
     return new Nutation($Δψ, $Δε);
 }
コード例 #5
0
ファイル: AstroDateTest.php プロジェクト: marando/astrodate
 /**
  * @covers Marando\AstroDate\AstroDate::sidereal
  */
 public function testSidereal()
 {
     $tests = [[1.7541749718700912, AstroDate::mjd(53736.0, TimeScale::UT1())->sidereal('m'), 1.0E-9], [1.754166137675019, AstroDate::mjd(53736.0, TimeScale::UT1())->sidereal('a'), 1.0E-8], [1.7541749718700912 + deg2rad(-20), AstroDate::mjd(53736.0, TimeScale::UT1())->sidereal('m', Angle::deg(-20)), 1.0E-9], [1.754166137675019 + deg2rad(-20), AstroDate::mjd(53736.0, TimeScale::UT1())->sidereal('a', Angle::deg(-20)), 1.0E-8]];
     foreach ($tests as $t) {
         $expt = $t[0];
         $st = $t[1];
         $this->assertEquals($expt, Angle::time($st)->rad, null, $t[2]);
     }
 }
コード例 #6
0
ファイル: GenericTest.php プロジェクト: marando/astrocoord
 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";
 }
コード例 #7
0
ファイル: Cartesian.php プロジェクト: marando/astrocoord
 /**
  * Converts this instance to an equatorial coordinate
  *
  * @return Equat
  */
 public function toEquat()
 {
     // Cartesian -> spherical
     IAU::C2s([$this->x->au, $this->y->au, $this->z->au], $theta, $phi);
     // Create RA and Declination components from radians
     $ra = Angle::rad($theta)->norm()->toTime();
     $dec = Angle::rad($phi);
     // Return new equatorial instance using same frame and epoch
     return new Equat($this->frame, $this->epoch, $ra, $dec, $this->r);
 }
コード例 #8
0
ファイル: Equat.php プロジェクト: gavinkou/AstroCoord
 /**
  * Performs a [IRCS -> observed] coordinate transformation for the parameters
  * of this instance
  * @param  string       $type Coordintate type, 'e' for equat 'h' for horiz
  * @return static|Horiz
  */
 protected function ICRStoObserved($type = 'e', Pressure $pressure = null, Temperature $temp = null, $humidity = null)
 {
     // Instance initial properties
     $rc = $this->ra->toAngle()->rad;
     $dc = $this->dec->rad;
     $date1 = $this->epoch->toDate()->toTDB()->toJD();
     $pr = 0;
     $pd = 0;
     $rv = 0;
     $px = $this->dist->au > 0 ? 8.794 / 3600 / $this->dist->au : 0;
     $utc1 = $this->epoch->toDate()->toUTC()->toJD();
     $dut1 = IERS::jd($utc1)->dut1();
     $elong = $this->topo ? $this->topo->lon->rad : 0;
     $phi = $this->topo ? $this->topo->lat->rad : 0;
     $hm = 0;
     //$this->obsrv->height->m;
     $xp = IERS::jd($utc1)->x() / 3600 * pi() / 180;
     $yp = IERS::jd($utc1)->y() / 3600 * pi() / 180;
     $phpa = $pressure ? $pressure->mbar : 0;
     $tc = $temp ? $temp->c : 0;
     $rh = $humidity ? $humidity : 0;
     $wl = 0.55;
     // ICRS -> CIRS (geocentric observer)
     IAU::Atci13($rc, $dc, $pr, $pd, $px, $rv, $date1, 0, $ri, $di, $eo);
     // CIRS -> ICRS (astrometric)
     //IAU::Atic13($ri, $di, $date1, 0, $rca, $dca, $eo);
     // ICRS (astrometric) -> CIRS (geocentric observer)
     //IAU::Atci13($rca, $dca, $pr, $pd, $px, $rv, $date1, 0, $ri, $di, $eo);
     // Apparent place ?
     //$ri = $ri - $eo;
     //$di = $di;
     //
     // CIRS -> topocentric
     IAU::Atio13($ri, $di, $utc1, 0, $dut1, $elong, $phi, $hm, $xp, $yp, $phpa, $tc, $rh, $wl, $aob, $zob, $hob, $dob, $rob);
     if ($type == 'e') {
         // Copy this instance, and override the apparent RA and Decl
         $topocentric = $this->copy();
         $topocentric->ra = Angle::rad($rob)->toTime();
         $topocentric->dec = Angle::rad($dob);
         $topocentric->apparent = true;
         // Return apparent coordinates
         return $topocentric;
     } else {
         // Prepare new horizontal instance
         $horiz = new Horiz(Angle::rad(deg2rad(90) - $zob), Angle::rad($aob), $this->dist);
         return $horiz;
     }
 }
コード例 #9
0
ファイル: GenericTest.php プロジェクト: gavinkou/AstroDate
 public function test()
 {
     return;
     // Converts to J2000.0
     echo "\n" . AstroDate::parse('2000-Jan-1 12:00:00 TT')->toEpoch();
     // Isn't J2000.0 so represented as date
     echo "\n" . ($e = AstroDate::parse('2000-Jan-1 14:00:00 TT')->toEpoch());
     echo "\n\n" . AstroDate::now()->toEpoch();
     $d = AstroDate::now()->setTimezone('est');
     echo "\n\n" . $d->sinceMidnight();
     echo "\n\n";
     return;
     echo "\n" . ($d = AstroDate::now()->setTimezone(TimeZone::UT(-7)));
     echo "\n" . TimeScale::TT()->abr;
     echo "\n" . TimeScale::TT()->name;
     echo "\n" . Epoch::J2000();
     echo "\n" . Epoch::J1900();
     echo "\n" . Epoch::B1950();
     echo "\n" . Epoch::B1900();
     echo "\n" . Epoch::B(1954.4423);
     echo "\n" . Epoch::jd(2455200.5);
     echo "\n\n" . Epoch::J2000()->toDate();
     echo "\n" . Epoch::J1900()->toDate();
     echo "\n" . Epoch::B1950()->toDate();
     echo "\n" . Epoch::B1900()->toDate();
     echo "\n" . Epoch::B(1954.4423)->toDate();
     echo "\n\n" . AstroDate::now();
     echo "\n" . ($d = AstroDate::now()->setTimezone(TimeZone::parse('EST')));
     echo "\n" . $d->toTDB();
     echo "\n" . $d->toUTC();
     echo "\n" . ($d = AstroDate::now()->setTimezone('MST'));
     echo "\n" . ($d = AstroDate::now()->setTimezone('PST'));
     return;
     echo "\n" . AstroDate::parse('2015-Dec-10 6:00');
     echo "\n" . AstroDate::parse('2015-Dec-10 6:00')->setTimezone(TimeZone::parse('EST'));
     echo "\n" . AstroDate::now();
     echo "\n" . AstroDate::now()->setTimezone(TimeZone::parse('EST'));
     echo "\n" . AstroDate::now()->setTimezone(TimeZone::parse('PST'));
     echo "\n" . AstroDate::now()->setTimezone(TimeZone::UT(6));
     echo "\n" . TimeZone::parse('est')->offset;
     echo "\n" . TimeZone::parse('est')->offset(2451545.5);
     echo "\n" . TimeZone::parse('est')->offset(2451589.5);
     return;
     echo "\n" . TimeZone::UT(-2);
     echo "\n" . TimeZone::parse('EST');
     echo "\n" . AstroDate::now()->setTimezone(TimeZone::EST())->format(AstroDate::FORMAT_GOOGLE);
     echo "\n" . AstroDate::now()->setTimezone(TimeZone::UT(-10.5))->format(AstroDate::FORMAT_GOOGLE);
     echo "\n" . AstroDate::now()->setTimezone(TimeZone::UT(-10))->format(AstroDate::FORMAT_GOOGLE);
     return;
     $t = timezone_abbreviations_list();
     $s = timezone_identifiers_list();
     $e = timezone_name_from_abbr('est');
     var_dump($t);
     return;
     $d = AstroDate::now()->setTimezone(TimeZone::EST());
     echo "\n" . $d->format('r Y-M-c h:i:s.u A T');
     echo "\n" . $d->sub(Time::days(15))->format(AstroDate::FORMAT_GENERIC);
     echo "\n" . $d->sidereal('a');
     echo "\n" . $d->sidereal('m');
     echo "\n" . $d->format(AstroDate::FORMAT_JPL_FRAC);
     echo "\n" . $d->sidereal('a', Angle::deg(-82.47));
     echo "\n" . $d->sidereal('m', Angle::deg(-82.47));
     echo "\n" . $d->sinceMidnight();
     echo "\n" . $d->untilMidnight();
     /**
      * TODO:
      *
      *    - Figure out formula for DST start and end
      *    - Figure out formula for Week # of year
      *
      *
      */
     return;
     echo "\n" . $d->format(DateTime::RSS);
     echo "\n" . $d;
     echo "\n" . $d->format(AstroDate::FORMAT_GENERIC);
     echo "\n" . $d->format(DateTime::ISO8601);
     return;
     $str = '2016-Nov-14 17:07:07.120';
     echo "\n" . ($d = AstroDate::parse($str));
     echo "\n" . ($d = AstroDate::parse($str)->setTimezone(TimeZone::EST()));
     echo "\n" . $d->format('Z T P O e u s i h H G g a A y Y n M m F W z D Y-m-d j');
     $str = '2016-Nov-14 17:07:07.120 TAI';
     echo "\n" . ($d = AstroDate::parse($str));
     echo "\n" . $d->format('O e u s i h H G g a A y Y n M m F W z D Y-m-d j');
     $str = '2015-Nov-1 17:07:07.120 UTC';
     $d = AstroDate::parse($str);
     echo "\n" . $d->format('z w S N l L D Y-m-d j');
     return;
     echo "\n\n" . ($str = '2015-Nov-16 17:07:07.120 TT');
     echo "\n" . AstroDate::parse($str);
     echo "\n\n" . ($str = '-1950-1-16 17:07:07 UTC');
     echo "\n" . ($d = AstroDate::parse($str));
     echo "\n" . $d->format('Y-m-d');
     return;
     echo "\n" . ($d = AstroDate::now());
     echo "\n" . $d->toUT1();
     echo "\n" . $d->toTAI();
     echo "\n\n" . ($d = AstroDate::now(TimeZone::EST()));
     echo "\n" . $d->toUT1();
     echo "\n" . $d->toTAI();
     return;
     $d = new AstroDate(2017, 11, 15, 7, 0, 0);
     echo "\n" . $d;
     echo "\n" . $d->setTimezone(TimeZone::EST());
     //var_dump($d);
     $d = new AstroDate(2017, 6, 15, 7, 0, 0);
     echo "\n\n" . $d;
     echo "\n" . $d->setTimezone(TimeZone::EST());
     //var_dump($d);
     $d = new AstroDate(2017, 11, 15, 7, 0, 0);
     echo "\n\n" . $d;
     echo "\n" . $d->setTimezone(TimeZone::EST());
     //var_dump($d);
     $d = new AstroDate(2017, 6, 15, 6, 0, 0);
     echo "\n\n" . $d;
     echo "\n" . $d->setTimezone(TimeZone::EST());
     //var_dump($d);
     return;
     $d = new AstroDate(2017, 11, 15, 0, 0, 0);
     echo "\n" . $d;
     echo "\n" . $d->jd();
     echo "\n" . $d->jd(12);
     echo "\n" . $d->toTT();
     echo "\n" . $d->toJD();
     echo "\n" . $d->jd(12);
     echo "\n";
     $d = new AstroDate(2015, 11, 15, 20, 23, 18, TimeZone::EST(), TimeScale::TT());
     echo "\n" . $d;
     echo "\n" . $d->setTimezone(TimeZone::UTC());
     echo "\n" . $d->toUT1();
     echo "\n" . $d->setTimezone(TimeZone::EST());
     echo "\n" . $d->jd();
     echo "\n" . $d->jd(12);
     echo "\n" . $d->mjd();
     echo "\n" . $d->mjd(12);
     echo "\n" . $d->monthName();
     echo "\n" . $d->mjd();
     echo "\n\n" . $d->toTAI();
     echo "\n" . $d->year;
     echo "\n" . $d->month;
     echo "\n" . $d->day;
     echo "\n" . $d->hour;
     echo "\n" . $d->min;
     echo "\n" . $d->sec;
     echo "\n" . $d->micro;
     echo "\n" . $d->timezone;
     echo "\n" . $d->timescale;
     $d->year = 2020;
     echo "\n" . $d;
     $d->month = 12.13432;
     echo "\n" . $d;
     $d->sec = 12;
     echo "\n" . $d;
     echo "\n" . $d->add(Time::sec(0.5));
     echo "\n" . $d->setDateTime(2017, 9, 4, 18, 34, 34.234);
     var_dump($d->isLeapYear());
     echo "\n" . $d->setDateTime(2016, 9, 4, 18, 34, 34.234);
     var_dump($d->isLeapYear());
     echo "\n" . $d->dayName();
     $a = new AstroDate(2016, 12, 25, 19, 10, 2);
     $b = new AstroDate(2015, 12, 25, 19, 10, 2);
     echo "\n" . $a->diff($b);
     echo "\n" . ($a = new AstroDate(2016, 12, 31, 19, 10, 2));
     echo "\n" . ($b = new AstroDate(2015, 12, 31, 19, 10, 2));
     echo "\n" . $a->dayOfYear();
     echo "\n" . $b->dayOfYear();
     echo "\n\n" . $b;
     echo "\n" . $b->toTDB();
     echo "\n" . $b->setTimezone(TimeZone::UTC());
     echo "\n" . $b->toTDB();
     echo "\n" . $b->setTimezone(TimeZone::EST());
     echo "\n" . $b->toTDB();
     echo "\n\n\n";
     $d = new AstroDate(2015, 11, 15, 20, 23, 18.454334);
     echo "\n" . $d;
     echo "\n" . $d->setTimezone(TimeZone::EST());
     echo "\n" . $d->toUTC();
     echo "\n" . $d->toTAI();
     echo "\n" . $d->setTimezone(TimeZone::EST());
     echo "\n" . $d->toTT();
     return;
     $d = new AstroDate(2015, 11, 15, 20, 23, 18.454334);
     echo "\n" . $d;
     $d = new AstroDate(2015, 11, 15, 20, 23, 18.454334, TimeZone::EST());
     echo "\n" . $d;
     echo "\n" . $d->setDate(2020, 10, 2);
     echo "\n" . $d->setTime(23, 59, 1);
     echo "\n" . $d->setTimezone(TimeZone::UTC());
     echo "\n" . $d->setTimezone(TimeZone::EST());
 }
コード例 #10
0
ファイル: AstroDate.php プロジェクト: gavinkou/AstroDate
 /**
  * Finds the sidereal time of this intsance
  *
  * @param type  $mode Type of sidereal time... (a = apparent, m = mean)
  * @param Angle $lon  If a longitude is supplied, finds local sidereal time,
  *                    otherwise returns sidereal time at Greenwich
  */
 public function sidereal($mode = 'a', Angle $lon = null)
 {
     // Get UT1 time
     $ut = $this->copy()->toUT1();
     $uta = $ut->jd;
     $utb = $ut->dayFrac;
     $ut = null;
     // Get TT time
     $tt = $this->copy()->toTT();
     $tta = $tt->jd;
     $ttb = $tt->dayFrac;
     $tt = null;
     // Compute either GMST or GAST
     $st;
     if ($mode == 'a') {
         $strad = IAU::Gst06a($uta, $utb, $tta, $ttb);
     } else {
         $strad = IAU::Gmst06($uta, $utb, $tta, $ttb);
     }
     // Add longitude if relevant
     if ($lon) {
         $st = Angle::rad($strad)->add($lon)->norm()->toTime();
     } else {
         $st = Angle::rad($strad)->toTime();
     }
     // Return as hours
     return $st->setUnit('hours');
 }
コード例 #11
0
ファイル: AngleTest.php プロジェクト: marando/units
 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'));
     }
 }
コード例 #12
0
ファイル: Distance.php プロジェクト: marando/units
 /**
  * Converts this distance to a parallax measurement of astronomical
  * parallax.
  *
  * @return Angle
  */
 private function toParallax()
 {
     return Angle::asec(1 / $this->pc);
 }