Astro-Coords
view release on metacpan or search on metacpan
lib/Astro/Coords/Equatorial.pm view on Meta::CPAN
return;
}
=back
=begin __PRIVATE_METHODS__
=head2 Private Methods
=over 4
=item B<_calc_mtime>
Calculate meridian time, in the direction specified by C<$event>
(-1 before, +1 after).
$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
my $dtime = $self->_isdt();
my $mtime = $self->_local_mtcalc();
my $diff = $mtime->epoch - $reftime->epoch;
if (($diff >= 0 and $event == +1)
or ($diff <= 0 and $event == -1)) {
return $mtime;
}
else {
# We went the wrong way.
if ($dtime) {
$mtime->add(seconds => $event * $self->_sidereal_period());
} else {
$mtime = $mtime + ($event * $self->_sidereal_period());
}
}
return $mtime;
}
=item B<_iterative_el>
For the simplest case, the initial guess should have been good enough,
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
Usually called via C<Astro::Coords>.
=head1 REQUIREMENTS
C<Astro::PAL> is used for all internal astrometric calculations.
=head1 AUTHOR
Tim Jenness E<lt>tjenness@cpan.orgE<gt>
Proper motion, equinox and epoch support added by Brad Cavanagh
<b.cavanagh@jach.hawaii.edu>
=head1 COPYRIGHT
Copyright (C) 2001-2005 Particle Physics and Astronomy Research Council.
All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 3 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful,but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place,Suite 330, Boston, MA 02111-1307, USA
( run in 2.415 seconds using v1.01-cache-2.11-cpan-98e64b0badf )