++ed by:

3 PAUSE users

Tom Wyant
and 1 contributors


Astro::Coord::ECI::Star - Compute the position of a star.


 my $star = Astro::Coord::ECI::Star->star ();
 my $sta = Astro::Coord::ECI->new (name => 'Spica')->
     position (3.51331869544372, -0.194802985206623);
 my ($time, $rise) = $sta->next_elevation ($star);
 print "Spica's @{[$rise ? 'rise' : 'set']} is ",
     scalar localtime $time;


This module implements the position of a star (or any other object which can be regarded as fixed on the celestial sphere) as a function of time, as described in Jean Meeus' "Astronomical Algorithms," second edition. It is a subclass of Astro::Coord::ECI, with a position() method to set the catalog position (and optionally proper motion as well), and the time_set() method overridden to compute the position of the star at the given time.


The following methods should be considered public:

$star = Astro::Coord::ECI::Star->new();

This method instantiates an object to represent the coordinates of a star, or some other object which may be regarded as fixed on the celestial sphere. This is a subclass of Astro::Coord::ECI, with the angularvelocity attribute initialized to zero.

Truth in advertising: The positions produced by this model are about four arc seconds off Dr. Meeus' worked example for the position of Theta Persei for Dynamical time November 13.19, 2028. This seems excessive, but it's difficult to check intermediate results because this calculation goes through ecliptic coordinates, whereas Dr. Meeus' worked example is in equatorial coordinates.

@almanac = $star->almanac($location, $start, $end);

This method produces almanac data for the star for the given location, between the given start and end times. The location is assumed to be Earth-Fixed - that is, you can not do this for something in orbit.

The start time defaults to the current time setting of the $star object, and the end time defaults to a day after the start time.

The almanac data consists of a list of list references. Each list reference points to a list containing the following elements:

 [0] => time
 [1] => event (string)
 [2] => detail (integer)
 [3] => description (string)

The @almanac list is returned sorted by time.

The following events, details, and descriptions are at least potentially returned:

 horizon: 0 = star sets, 1 = star rises;
 transit: 1 = star transits meridian;
$star = $star->position($ra, $dec, $range, $mra, $mdc, $mrg, $time);

This method sets the position and proper motion of the star in equatorial coordinates. Right ascension and declination are specified in radians, and range in kilometers. Proper motion in range and declination is specified in radians per second (an extremely small number!), and the proper motion in recession in kilometers per second.

The range defaults to 1 parsec, which is too close but probably good enough since we do not take parallax into account when computing position, and since you can override it with a range (in km!) if you so desire. The proper motions default to 0. The time defaults to J2000.0, and is used to set not only the current time of the object but also the equinox_dynamical. If you are not interested in proper motion but are interested in time, omit the proper motion arguments completely and specify time as the fourth argument.

If you call this as a class method, a new Astro::Coord::ECI::Star object will be constructed. If you call it without arguments, the position of the star is returned.

Note that this is not simply a synonym for the equatorial() method. The equatorial() method returns the position of the star corrected for precession and nutation. This method is used to set the catalog position of the star in question.


This method sets coordinates of the object to the coordinates of the star at the object's currently-set universal time. Proper motion is taken into account if this was specified.

Although there's no reason this method can't be called directly, it exists to take advantage of the hook in the Astro::Coord::ECI object, to allow the position of the star to be computed when the time is set.

The computation comes from Jean Meeus' "Astronomical Algorithms", 2nd Edition, Chapter 23, pages 149ff.

Note, however, that for consistency with the Astro::Coord::ECI::Sun and ::Moon classes, the position is precessed to the current time setting.


The author wishes to acknowledge Jean Meeus, whose book "Astronomical Algorithms" (second edition) formed the basis for this module.


The Astro-Catalog package by Alasdair Allan, which accommodates a much more fulsome description of a star. The star's coordinates are represented by an Astro::Coords object.

The Astro-Coords package by Tim Jenness can also be used to find the position of a star at a given time given a catalog entry for the star. A wide variety of coordinate representations is accommodated. This package requires Astro::SLA, which in its turn requires the SLALIB library.


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.