|
Astro::Coord::ECI::Utils - Utility routines for astronomical calculations |
Astro::Coord::ECI::Utils - Utility routines for astronomical calculations
use Astro::Coord::ECI::Utils qw{:all};
my $now = time ();
print "The current Julian day is ", julianday ($now);
This module was written to provide a home for all the constants and utility subroutines used by Astro::Coord::ECI and its descendents. What ended up here was anything that was essentially a subroutine, not a method.
This package exports nothing by default. But all the constants, variables, and subroutines documented below are exportable, and the :all tag gets you all of them.
AU = number of kilometers in an astronomical unit JD_OF_EPOCH = the Julian Day of Perl epoch 0 LIGHTYEAR = number of kilometers in a light year PARSEC = number of kilometers in a parsec PERL2000 = January 1 2000, 12 noon universal, in Perl time PI = the circle ratio, computed as atan2 (0, -1) PIOVER2 = half the circle ratio SECSPERDAY = the number of seconds in a day TWOPI = twice the circle ratio
This variable represents the POSIX::strftime format used to convert times to strings. The default value is '%a %b %d %Y %H:%M:%S' to be consistent with the behavior of gmtime (or, to be precise, the behavior of ctime as documented on my system).
This variable represents the Julian Day of the switch from Julian to Gregorian calendars. This is used by date2jd(), jd2date(), and the routines which depend on them, for deciding whether the date is to be interpreted as in the Julian or Gregorian calendar. Its initial setting is 2299160.5, which represents midnight October 15 1582 in the Gregorian calendar, which is the date that calendar was first adopted. This is slightly different than the value of 2299161 (noon of the same day) used by Jean Meeus.
If you are interested in historical calculations, you may wish to reset this appropriately. If you use date2jd to calculate the new value, be aware of the effect the current setting of $JD_GREGORIAN has on the interpretation of the date you give.
The algorithm comes from Daniel W. E. Green's article ``Magnitude Corrections for Atmospheric Extinction'', which was published in the July 1992 issue of ``International Comet Quarterly'', and is available online at http://www.cfa.harvard.edu/icq/ICQExtinct.html. The text of this article makes it clear that the actual value of the atmospheric extinction can vary greatly from the typical values given even in the absence of cloud cover.
If less than 6 arguments are provided, zeroes will be prepended to the argument list as needed.
The date is presumed to be in the Gregorian calendar. If the resultant Julian Day is before $JD_GREGORIAN, the date is reinterpreted as being from the Julian calendar.
The only validation is that the month be between 0 and 11 inclusive, and that the year be not less than -6612 (4713 BC). Fractional days are accepted.
The algorithm is from Jean Meeus' ``Astronomical Algorithms'', second edition, chapter 7 (``Julian Day''), pages 60ff, but the month is zero-based, not 1-based, and years are 1900-based.
date2jd() to do so. The arguments are the
same as those of date2jd().
If less than 6 arguments are provided, zeroes will be prepended to the argument list as needed.
The functionality is the same as Time::Local::timegm, but this function lacks timegm's limited date range.
$dynamical = $time + dynamical_delta ($time)
if $time is universal time.
The algorithm is from Jean Meeus' ``Astronomical Algorithms'', 2nd Edition, Chapter 10, page 78.
If called in scalar context, it returns the date formatted by POSIX::strftime, using the format string in $DATETIMEFORMAT.
The functionality is similar to gmtime, but lacks gmtime's limited date range.
The input must convert to a non-negative Julian date. The exact lower limit depends on the system, but is computed by -(JD_OF_EPOCH * 86400). For Unix systems with an epoch of January 1 1970, this is -210866760000.
Additional algorithms for day of week and day of year come from Jean Meeus' ``Astronomical Algorithms'', 2nd Edition, Chapter 7 (Julian Day), page 65.
The algorithm is from W. S. Smart's ``Text-Book on Spherical Astronomy'', as reported in Jean Meeus' ``Astronomical Algorithms'', 2nd Edition, Chapter 28, page 185.
The test () function is assumed to be false for the first part of the interval, and true for the rest. If this assumption is violated, the result of this subroutine should be considered meaningless.
The calculation is done by, essentially, a binary search; the interval is repeatedly split, the function is evaluated at the midpoint, and a new interval selected based on whether the result is true or false.
Actually, nothing in this function says the independent variable has to be time.
Note that, because of the way magnitudes work (a more negative number represents a brighter star) you get back a positive result for an intensity ratio less than 1, and a negative result for an intensity ratio greater than 1.
If the $jd is before $JD_GREGORIAN, the date will be in the Julian calendar; otherwise it will be in the Gregorian calendar.
The input may not be less than 0.
The algorithm is from Jean Meeus' ``Astronomical Algorithms'', second edition, chapter 7 (``Julian Day''), pages 63ff, but the month is zero-based, not 1-based, and the year is 1900-based.
The input may not be less than 0.
The computation makes use of information from Jean Meeus' ``Astronomical Algorithms'', 2nd Edition, Chapter 7, page 62.
The computation makes use of information from Jean Meeus' ``Astronomical Algorithms'', 2nd Edition, Chapter 7, page 62.
The algorithm comes from Jean Meeus' ``Astronomical Algorithms'', 2nd Edition, Chapter 22, pages 143ff. Meeus states that it is good to 0.5 seconds of arc.
The algorithm comes from Jean Meeus' ``Astronomical Algorithms'', 2nd Edition, Chapter 22, pages 143ff. Meeus states that it is good to 0.1 seconds of arc.
The algorithm comes from Jean Meeus' ``Astronomical Algorithms'', 2nd Edition, Chapter 22, pages 143ff. The conversion from universal to dynamical time comes from chapter 10, equation 10.2 on page 78.
The algorithm comes from Jean Meeus' ``Astronomical Algorithms'', 2nd Edition, Chapter 22, pages 143ff.
The algorithm comes from Jean Meeus' ``Astronomical Algorithms'', 2nd Edition, equation 12.4, page 88.
The author wishes to acknowledge Jean Meeus, whose book ``Astronomical Algorithms'' (second edition) published by Willmann-Bell Inc (http://www.willbell.com/) provided several of the algorithms implemented herein.
Bugs can be reported to the author by mail, or through http://rt.cpan.org/.
Thomas R. Wyant, III (wyant at cpan dot org)
Copyright 2005, 2006, 2007 by Thomas R. Wyant, III (wyant at cpan dot org). All rights reserved.
This module is free software; you can use it, redistribute it and/or modify it under the same terms as Perl itself. Please see http://perldoc.perl.org/index-licence.html for the current licenses.
This software is provided without any warranty of any kind, express or implied. The author will not be liable for any damages of any sort relating in any way to this software.
|
Astro::Coord::ECI::Utils - Utility routines for astronomical calculations |