view release on metacpan or search on metacpan
lib/Astro/Coords/Angle/Hour.pm view on Meta::CPAN
$hr = $hour->in_format( 'hour' );
=cut
sub in_format {
my $self = shift;
my $format = shift;
$format = lc($format) if $format;
return $self->hours() if (defined $format && $format =~ /^h/);
return $self->SUPER::in_format( $format );
}
=back
=head2 Class Methods
The following methods control the default behaviour of the class.
=over 4
lib/Astro/Coords/Angle/Hour.pm view on Meta::CPAN
# if units are hours, tell the base class we have degrees
# $unt is the unit that will be reported to the base class
# $units is the unit known to the subclass
my $unt = $units;
if (defined $units && $units =~ /^h/) {
$unt = 'deg';
}
# Do the conversion
my $rad = $self->SUPER::_cvt_torad( $input, $unt );
# scale if we had sexagesimal or hour as units
if (defined $rad && $units =~ /^[sh]/) {
$rad *= 15;
}
return $rad;
}
=item B<_guess_units>
lib/Astro/Coords/Angle/Hour.pm view on Meta::CPAN
Guess the units. Same as base class except that values greater than 2PI
radians are assumed to be hours rather than degrees.
$guess = $hr->_guess_units( $input );
=cut
sub _guess_units {
my $self = shift;
my $input = shift;
my $guess = $self->SUPER::_guess_units( $input );
$guess = 'h' if $guess =~ /^d/;
return $guess;
}
=item B<_r2f>
Routine to convert angle in radians to a formatted array
of numbers in order of sign, hour, min, sec, frac.
@retval = $ang->_r2f( $ndp );
lib/Astro/Coords/Calibration.pm view on Meta::CPAN
$c = new Astro::Coords::Calibration( name => 'DARK' );
=cut
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
my %args = @_;
my $self = $class->SUPER::new( az => 0.0, el => 90.0, units => 'deg' );
$self->name( $args{name} ) if exists $args{name};
return $self;
}
=back
=head2 General Methods
=over 4
lib/Astro/Coords/Elements.pm view on Meta::CPAN
=item B<apply_offset>
Overrided method to warn if C<Astro::Coords::apply_offset> is
called on this subclass.
=cut
sub apply_offset {
my $self = shift;
warn "apply_offset: applying offset to orbital elements position for a specific time.\n";
return $self->SUPER::apply_offset(@_);
}
=back
=head1 NOTES
Usually called via C<Astro::Coords>.
=head1 LINKS
lib/Astro/Coords/Equatorial.pm view on Meta::CPAN
$mtime = $self->_calc_mtime($reftime, $event);
This is a non-iterative version of Astro::Coords::_calc_mtime,
for the simplest case. It calls the superclass method if
proper motion or parallax are involved.
=cut
sub _calc_mtime {
my $self = shift;
return $self->SUPER::_calc_mtime(@_)
if $self->parallax() or $self->pm();
my ($reftime, $event ) = @_;
# event must be 1 or -1
if (!defined $event || ($event != 1 && $event != -1)) {
croak "Event must be either +1 or -1";
}
# do we have DateTime objects
lib/Astro/Coords/Equatorial.pm view on Meta::CPAN
so iterating would not be necessary. Therefore if there is no
proper motion or parallax, this subroutine does nothing.
See L<Astro::Coords/_iterative_el>.
=cut
sub _iterative_el {
my $self = shift;
return $self->SUPER::_iterative_el(@_)
if $self->parallax() or $self->pm();
# Check that the elevation is indeed correct:
# (Should not be necessary, remove if it wastes too much time.)
my ($refel, undef) = @_;
my $el = $self->el();
my $tol = 30 * Astro::PAL::DAS2R;
return $self->SUPER::_iterative_el(@_)
if (abs($el - $refel) > $tol);
return 1;
}
=back
=end __PRIVATE_METHODS__
=head1 NOTES
lib/Astro/Coords/Interpolated.pm view on Meta::CPAN
=item B<apply_offset>
Overrided method to warn if C<Astro::Coords::apply_offset> is
called on this subclass.
=cut
sub apply_offset {
my $self = shift;
warn "apply_offset: applying offset to interpolated position for a specific time.\n";
return $self->SUPER::apply_offset(@_);
}
=back
=head1 NOTES
Usually called via C<Astro::Coords>. This is the coordinate style
used by SCUBA for non-sidereal sources instead of using orbital elements.
Apparent RA/Decs suitable for use in this class can be obtained
lib/Astro/Coords/Planet.pm view on Meta::CPAN
=item B<apply_offset>
Overrided method to warn if C<Astro::Coords::apply_offset> is
called on this subclass.
=cut
sub apply_offset {
my $self = shift;
warn "apply_offset: applying offset to planet position for a specific time.\n";
return $self->SUPER::apply_offset(@_);
}
=back
=begin __PRIVATE_METHODS__
=over 4
=item B<_default_horizon>
lib/Astro/Coords/Planet.pm view on Meta::CPAN
sub _sidereal_period {
my $self = shift;
my $name = lc($self->name);
if ($name eq 'sun') {
return 24 * 3600;
} elsif ($name eq 'moon') {
return 24 * 3600 * (1 + 1 / 29.53059);
}
else {
$self->SUPER::_sidereal_period();
}
}
=back
=end __PRIVATE_METHODS__
=head1 NOTES
Usually called via C<Astro::Coords>.