Astro-satpass
view release on metacpan or search on metacpan
lib/Astro/Coord/ECI/Star.pm view on Meta::CPAN
name => 'Spica')->position(
3.51331869544372, # Right ascension, radians
-0.194802985206623, # Declination, radians
);
my $sta = Astro::Coord::ECI->
universal (time ())->
geodetic ($lat, $long, $alt);
my ($time, $rise) = $sta->next_elevation ($star);
print "Star @{[$rise ? 'rise' : 'set']} is ",
scalar localtime $time, "\n";
=head1 DESCRIPTION
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 L<Astro::Coord::ECI|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.
=head2 Methods
The following methods should be considered public:
=over
=cut
package Astro::Coord::ECI::Star;
use strict;
use warnings;
our $VERSION = '0.135';
use base qw{Astro::Coord::ECI};
use Astro::Coord::ECI::Utils qw{ @CARP_NOT :mainstream };
use Carp;
=item $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 B<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.
=cut
sub new {
my ($class, @args) = @_;
ref $class and $class = ref $class;
return $class->SUPER::new (angularvelocity => 0,
@args);
}
=item @almanac = $star->almanac($station, $start, $end);
This method produces almanac data for the star for the given observing
station, between the given start and end times. The station is assumed
to be Earth-Fixed - that is, you can not do this for something in orbit.
The C<$station> argument may be omitted if the C<station> attribute has
been set. That is, this method can also be called as
@almanac = $star->almanac( $start, $end )
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;
=cut
sub __almanac_event_type_iterator {
my ( $self, $station ) = @_;
my $inx = 0;
my $horizon = $station->__get_almanac_horizon();
my @events = (
[ $station, next_elevation => [ $self, $horizon, 1 ],
horizon => '__horizon_name' ],
[ $station, next_meridian => [ $self ],
transit => '__transit_name' ],
);
return sub {
$inx < @events
and return @{ $events[$inx++] };
return;
};
}
use Astro::Coord::ECI::Mixin qw{ almanac };
=item @almanac = $star->almanac_hash($station, $start, $end);
( run in 0.655 second using v1.01-cache-2.11-cpan-5fbc6bb55f2 )