Astro-PAL
view release on metacpan or search on metacpan
lib/Astro/PAL.pm view on Meta::CPAN
status is bad. Additionally, palObs is called with a single
argument and the behaviour depends on whether the argument looks
like an integer or a string.
($ident, $name, $w, $p, $h) = palObs( 27 );
($ident, $name, $w, $p, $h) = palObs( "JCMT" );
=cut
# We need a local version of palObs that converts the single
# argument to the right form for the internal XS implementation
sub palObs {
my $arg = shift;
return () unless defined $arg;
my $n = 0;
my $c = "";
if ( $arg =~ /^\d+$/) {
$n = $arg;
} else {
$c = $arg;
}
return _palObs( $n, $c );
}
=item palAopqk
palAopqk can be called either with a reference to an
array or a list
@results = palAopqk( $rap, $dap, @aoprms );
@results = palAopqk( $rap, $dap, \@aoprms );
=cut
# Sanity check argument counting before passing to XS layer
sub palAopqk {
my $rap = shift;
my $dap = shift;
my @aoprms;
if (@_ > 1) {
@aoprms = @_;
} else {
@aoprms = @{$_[0]};
}
croak "palAopqk: Need 14 elements in star-independent apparent to observed array"
unless @aoprms == 14;
return pal_Aopqk( $rap, $dap, \@aoprms );
}
=item palAoppat
For the C API the calling convention is to modify the AOPRMS array in
place, for the perl API we accept the AOPRMS array but return the
updated version.
@aoprms = Astro::PAL::palAoppat( $date, \@aoprms );
@aoprms = Astro::PAL::palAoppat( $date, @aoprms );
=cut
sub palAoppat {
croak 'Usage: palAoppat( date, @aoprms )'
unless @_ > 1;
my $date = shift;
my @aoprms;
if (@_ > 1) {
@aoprms = @_;
} else {
@aoprms = @{$_[0]};
}
croak "palAoppat: Need 14 elements in star-independent apparent to observed array"
unless @aoprms == 14;
$aoprms[13] = pal_Aoppat( $date, $aoprms[12] );
return @aoprms;
}
# palAoppat C interface requires the full @AOPRMS array and simply updates
# element 13 based on element 12.
=back
=head2 Constants
Constants supplied by this module (note that they are implemented via the
L<constant> pragma):
=over 4
=item DPI - Pi
=item D2PI - 2 * Pi
=item D1B2PI - 1 / (2 * Pi)
=item D4PI - 4 * Pi
=item D1B4PI - 1 / (4 * Pi)
=item DPISQ - Pi ** 2 (Pi squared)
=item DSQRPI - sqrt(Pi)
=item DPIBY2 - Pi / 2: 90 degrees in radians
=item DD2R - Pi / 180: degrees to radians
=item DR2D - 180/Pi: radians to degrees
( run in 0.483 second using v1.01-cache-2.11-cpan-39bf76dae61 )