Astro::PAL - Perl interface to Starlink PAL positional astronomy library
use PAL; use PAL qw(:constants :pal); ($ra2000, $dec2000) = palFk45z($ra, $dec, 1950.0); ($mjd, $status) = palCldj($yy, $mn, $dd); ($lst, $mjd) = lstnow($long); ($lst, $mjd) = ut2lst_tel($yy,$mn,$dd,$hh,$mm,$ss,'JCMT');
This modules provides a Perl interface to either the Starlink PAL positional astronomy library.
Return values are returned on the stack rather than being modified in place.
In addition small utility subroutines are provided that do useful tasks (from the author's point of view) - specifically routines for calculating the Local Sidereal Time.
There are 3 distinct groups of routines that can be imported into the namespace via tags:
Each group will be discussed in turn.
The PAL routines directly match the C API with the caveat that returned values are returned on the perl argument stack rather than being modified directly in the call arguments. Arguments are never modified. This differs from the Astro::SLA wrapper around the SLALIB library.
($xi, $eta, $j) = palDst2p( $ra, $dec, $raz, $decz ); @pv = palDmoon( $date ); ($nstrt, $fd, $j) = palDafin( $time, $nstrt );
If a routine returns an array as well as a status the status value is returned first:
($j, @iymsf) = palDjcal( $ndp, $djm );
If a routine returns multiple arrays they are returned as references:
($dvb, $dpb, $dvh, $dph) = palEvp( $date, $deqx ); @dvbarr = @$dvb;
Routines that take vectors or matrices should be given references to arrays:
@rmatn = palNut( $djtt ); @mposr = palDmxv( \@rmatn, \@mpos );
See the PAL or SLALIB documentation for details of the functions themselves.
palObs is special in that it returns an empty list if the return 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" );
palAopqk can be called either with a reference to an array or a list
@results = palAopqk( $rap, $dap, @aoprms ); @results = palAopqk( $rap, $dap, \@aoprms );
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 );
Constants supplied by this module (note that they are implemented via the constant pragma):
These are exportable using the 'funcs' tag or used directly through the Astro::PAL namespace.
They directly match the Astro::SLA equivalents.
Return current LST (in radians) and MJD for a given telescope. The telescope identifiers should match those present in palObs. The supplied telescope name is converted to upper case.
($lst, $mjd) = lstnow_tel($tel);
Aborts if telescope name is unknown.
Return current LST (in radians) and MJD (days) Longitude should be negative if degrees west and in radians.
($lst, $mjd) = lstnow($long);
Given the UT time, calculate the Modified Julian date (UTC) and the local sidereal time (radians) for the specified longitude.
($lst, $mjd) = ut2lst(yy, mn, dd, hh, mm, ss, long)
Longitude should be negative if degrees west and in radians.
Given the UT time, calculate the Modified Julian date and the local sidereal time (radians) for the specified telescope.
($lst, $mjd) = ut2lst_tel(yy, mn, dd, hh, mm, ss, tel)
Tim Jenness >firstname.lastname@example.org<
The PAL library is available from Starlink.
Copyright (C) 2014 Tim Jenness Copyright (C) 2012 Tim Jenness and the Science and Technology Facilities Council.
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