Astro-satpass

 view release on metacpan or  search on metacpan

inc/Astro/Coord/ECI/TLE/Period.pm  view on Meta::CPAN

use Astro::Coord::ECI::TLE;
use Carp;

our @ISA = qw{ Astro::Coord::ECI::TLE };
our $VERSION = '0.133';

my $pkg = __PACKAGE__;

sub new {
    my ( $class, %args ) = @_;
    my $self = $class->SUPER::new();
    $self->{$pkg}{period} = delete $args{period};
    $self->set( %args );
    return $self;
}

sub period {
    my ( $self ) = @_;
    return $self->{$pkg}{period};
}

inc/My/Module/Build.pm  view on Meta::CPAN

	or push @depends_on, 'build';
    -e 'META.json'
	or push @depends_on, 'distmeta';
    @depends_on
	and $self->depends_on( @depends_on );
    return;
}

sub harness_switches {
    my ( $self ) = @_;
    my @res = $self->SUPER::harness_switches();
    foreach ( @res ) {
	'-MDevel::Cover' eq $_
	    or next;
	$_ .= '=-db,cover_db,-ignore,inc/';
    }
    return @res;
}

1;

inc/My/Module/SetDelegate.pm  view on Meta::CPAN


use strict;
use warnings;

use Astro::Coord::ECI::TLE;
our @ISA = qw{ Astro::Coord::ECI::TLE };

sub new {
    my ($class, @args) = @_;
    $class = ref $class if ref $class;
    my $self = $class->SUPER::new ();
    $self->set (model => 'null', @args);
    return $self;
}

*_nodelegate_nodelegate = \&nodelegate;
sub nodelegate {return $_[0]}

sub delegate {return $_[0]}

sub rebless {}	# No-op rebless() to defeat class changes.

lib/Astro/Coord/ECI.pm  view on Meta::CPAN

}

=item $coord = $coord->equinox_dynamical ($value);

This method sets the value of the equinox_dynamical attribute, and
returns the modified object. If called without an argument, it returns
the current value of the equinox_dynamical attribute.

Yes, it is equivalent to $coord->set (equinox_dynamical => $value) and
$coord->get ('equinox_dynamical'). But there seems to be a significant
performance penalty in the $self->SUPER::set () needed to get this
attribute set from a subclass. It is possible that more methods like
this will be added, but I do not plan to eliminate the set() interface.

=cut

sub equinox_dynamical {
    if (@_ > 1) {
	$_[0]{equinox_dynamical} = $_[1];
	return $_[0];
    } else {

lib/Astro/Coord/ECI.pm  view on Meta::CPAN

 sub subclass_method {
     my ( $self ) = @_;
     my $attr = $self->{ ref $self };
     ...
 }

From outside the subclass, these attributes can be made accessible by
overriding C<get()> and C<set()>.

Subclasses B<must> initialize themselves by overriding the C<new()>
method.  The override B<must> call C<< $class->SUPER::new() >>, passing
it any arguments that were passed to the override.

=head1 A NOTE ON VELOCITIES

The velocities returned by the methods in this class are a work in
progress. Velocities set are always returned. But conversions are more
problematic. For one thing, I have not come across decent worked
examples, so I am limited to sanity checking.

I consider a velocity to be sane if the difference between the position

lib/Astro/Coord/ECI/Moon.pm  view on Meta::CPAN


sub new {
    my ($class, @args) = @_;
    ref $class and $class = ref $class;
    if ( $Singleton && $weaken && __classisa( $class, __PACKAGE__ ) ) {
	my $self;
	if ( $self = $object{$class} ) {
	    $self->set( @args ) if @args;
	    return $self;
	} else {
	    $self = $object{$class} = $class->SUPER::new (%static, @args);
	    $weaken->( $object{$class} );
	    return $self;
	}
    } else {
	return $class->SUPER::new (%static, @args);
    }
}

=item @almanac = $moon->almanac ($station, $start, $end);

This method produces almanac data for the Moon for the given observing
station, between the given start and end times. The station is assumed
to be Earth-Fixed - that is, you can't do this for something in orbit.

The C<$station> argument may be omitted if the C<station> attribute has

lib/Astro/Coord/ECI/Moon.pm  view on Meta::CPAN

this is a change in long-standing functionality, but a long-standing bug
is still a bug.

=cut

sub clone {
    my ( $self ) = @_;
    $Singleton
	and $weaken
	and return $self;
    return $self->SUPER::clone();
}

=item $elevation = $moon->correct_for_refraction( $elevation )

This override of the superclass' method simply returns the elevation
passed to it. Since the Moon has no atmosphere to speak of, there should
be no diffraction to speak of either.

See the L<Astro::Coord::ECI|Astro::Coord::ECI> C<azel()> and
C<azel_offset()> documentation for whether this class'

lib/Astro/Coord/ECI/Moon.pm  view on Meta::CPAN

(pg 408) of Jean Meeus' "Astronomical Algorithms," 2nd edition.

=cut

sub period {return 2360591.5968}	# 27.321662 * 86400

sub __horizon_name_tplt {
    my ( $self ) = @_;
    return $self->__object_is_self_named() ?
	[ '%s set', '%s rise' ] :
	$self->SUPER::__horizon_name_tplt();
}

sub __quarter_name {
    my ( $self, $event, $tplt ) = @_;
    $tplt ||= [ 'New %s', 'First quarter %s', 'Full %s', 'Last quarter %s' ];
    return $self->__event_name( $event, $tplt );
}

=item ($phase, $illum) = $moon->phase ($time);

lib/Astro/Coord/ECI/Star.pm  view on Meta::CPAN

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

lib/Astro/Coord/ECI/Sun.pm  view on Meta::CPAN


sub new {
    my ($class, @args) = @_;
    ref $class and $class = ref $class;
    if ( $Singleton && $weaken && __classisa( $class, __PACKAGE__ ) ) {
	my $self;
	if ( $self = $object{$class} ) {
	    $self->set( @args ) if @args;
	    return $self;
	} else {
	    $self = $object{$class} = $class->SUPER::new (%static, @args);
	    $weaken->( $object{$class} );
	    return $self;
	}
    } else {
	return $class->SUPER::new (%static, @args);
    }
}

=item @almanac = $sun->almanac( $station, $start, $end );

This method produces almanac data for the Sun for the given observing
station, between the given start and end times. The station is assumed
to be Earth-Fixed - that is, you can't do this for something in orbit.

The C<$station> argument may be omitted if the C<station> attribute has

lib/Astro/Coord/ECI/Sun.pm  view on Meta::CPAN

this is a change in long-standing functionality, but a long-standing bug
is still a bug.

=cut

sub clone {
    my ( $self ) = @_;
    $Singleton
	and $weaken
	and return $self;
    return $self->SUPER::clone();
}

=item $elevation = $tle->correct_for_refraction( $elevation )

This override of the superclass' method simply returns the elevation
passed to it. I have no algorithm for refraction at the surface of the
photosphere or anywhere else in the environs of the Sun, and explaining
why I make no correction at all seemed easier than explaining why I make
an incorrect correction.

lib/Astro/Coord/ECI/Sun.pm  view on Meta::CPAN


=cut

sub get {
    my ( $self, @args ) = @_;
    my @rslt;
    foreach my $name ( @args ) {
	push @rslt, 'sun' eq $name ? $self :
	    $attrib{$name} ?
	    ref $self ? $self->{$name} : $static{$name} :
	    $self->SUPER::get( $name );
    }
    return wantarray ? @rslt : $rslt[0];
}

=item ($point, $intens, $central) = $sun->magnitude ($theta, $omega);

This method returns the magnitude of the Sun at a point $theta radians
from the center of its disk, given that the disk's angular radius
(B<not> diameter) is $omega radians. The returned $point is the
magnitude at the given point (undef if $theta > $omega), $intens is the

lib/Astro/Coord/ECI/Sun.pm  view on Meta::CPAN

2nd edition.

=cut

sub period {return 31558149.7632}	# 365.256363 * 86400

sub __horizon_name_tplt {
    my ( $self ) = @_;
    return $self->__object_is_self_named() ?
	[ '%sset', '%srise' ] :
	$self->SUPER::__horizon_name_tplt();
}

sub __quarter_name {
    my ( $self, $event, $tplt ) = @_;
    $tplt ||= $self->__object_is_self_named() ?
    [
	'Spring equinox', 'Summer solstice',
	'Fall equinox', 'Winter solstice',
    ] : [
	'%s Spring equinox', '%s Summer solstice',

lib/Astro/Coord/ECI/Sun.pm  view on Meta::CPAN

    while ( @args ) {
	my ( $name, $val ) = splice @args, 0, 2;
	if ( 'sun' eq $name ) {
	} elsif ( $attrib{$name} ) {
	    if ( ref $self ) {
		$self->{$name} = $val;
	    } else {
		$static{$name} = $val;
	    }
	} else {
	    $self->SUPER::set( $name, $val );
	}
    }
    return $self;
}

=item $sun->time_set ()

This method sets coordinates of the object to the coordinates of the
Sun at the object's currently-set universal time.  The velocity
components are arbitrarily set to 0. The 'equinox_dynamical' attribute

lib/Astro/Coord/ECI/TLE.pm  view on Meta::CPAN

Any arguments get passed to the set() method.

It is both anticipated and recommended that you use the parse()
method instead of this method to create an object, since the models
currently have no code to guard against incomplete data.

=cut

sub new {
    my $class = shift;
    my $self = $class->SUPER::new (%static, @_);
    return $self;
}

=item $tle->after_reblessing (\%possible_attributes)

This method supports reblessing into a subclass, with the argument
representing attributes that the subclass may wish to set.  It is called
by rebless() and should not be called by the user.

At this level it does nothing.

lib/Astro/Coord/ECI/TLE.pm  view on Meta::CPAN


=cut

*apogee = \&apoapsis;

#	See Astro::Coord::ECI for docs.

sub attribute {
    return exists $attrib{$_[1]} ?
	__PACKAGE__ :
	$_[0]->SUPER::attribute ($_[1])
}

=item $tle->before_reblessing ()

This method supports reblessing into a subclass. It is intended to do
any cleanup the old class needs before reblessing into the new class. It
is called by rebless(), and should not be called by the user.

At this level it does nothing.

lib/Astro/Coord/ECI/TLE.pm  view on Meta::CPAN

=cut

{
    my %accessor = (
	tle => sub {$_[0]{$_[1]} ||= $_[0]->_make_tle()},
    );
    sub get {
	my $self = shift;
	my $name = shift;
	if (ref $self) {
	    exists $attrib{$name} or return $self->SUPER::get ($name);
	    return $accessor{$name} ?
		$accessor{$name}->($self, $name) :
		$self->{$name};
	} else {
	    exists $static{$name} or
		return $self->SUPER::get ($name);
	    return $static{$name};
	}
    }
}

=item $illuminated = $tle->illuminated();

This method returns a true value if the body is illuminated, and a false
value if it is not.

lib/Astro/Coord/ECI/TLE.pm  view on Meta::CPAN

after that Perl time are returned. Similarly, if optional argument
C<$end> is defined, only events occurring before that Perl time are
returned.

The return is an array of array references. Each array reference
specifies the Perl time of the event and a text description of the
event.

At this level of the object hierarchy nothing is returned. Subclasses
may override this to add C<pass()> events. The overrides should return
anything returned by C<SUPER::intrinsic_events(...)> in addition to
anything they return themselves.

The order of the returned events is undefined.

=cut

sub intrinsic_events {
    return;
}

lib/Astro/Coord/ECI/TLE.pm  view on Meta::CPAN

    my ($clear, $extant);
    if (ref $self) {
	$extant = \%attrib;
    } else {
	$self = $extant = \%static;
    }
    while (@args) {
	my $name = shift @args;
	my $val = shift @args;
	exists $extant->{$name} or do {
	    $self->SUPER::set ($name, $val);
	    next;
	};
	defined $attrib{$name} or croak "Attribute $name is read-only.";
	if ( CODE_REF eq ref $attrib{$name} ) {
	    $attrib{$name}->($self, $name, $val) and $clear = 1;
	} else {
	    $self->{$name} = $val;
	    $clear ||= $attrib{$name};
	}
    }

lib/Astro/Coord/ECI/TLE/Set.pm  view on Meta::CPAN

returns undef.

This override to UNIVERSAL::can is necessary because we want to return
true for member class methods, but we execute them by autoloading, so
they are not in our namespace.

=cut

sub can {
    my ($self, $method) = @_;
    my $rslt = eval {$self->SUPER::can($method)};
    $@ and return;
    $rslt and return $rslt;

    return eval {	## no critic (RequireCheckingReturnValueOfEval)
	$self->{current}->can($method)
    };
}

=item $set->clear ();



( run in 0.501 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )