Astro::PAL(3pm)
๐ซ NAME ๐ซ
Astro::PAL โ your Perl bestie for the Starlink PAL positional astronomy library ๐ชโจ Like, it's a Perl interface to PAL, and it's here to make your star-math life cute and correct.
๐ธ SYNOPSIS ๐ธ
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');
๐ฆ DESCRIPTION ๐ฆ
Okay so this module gives you a Perl interface to either the Starlink PAL positional astronomy library โจ (yes, "either" โ that's literally what the original says, iykyk).
Return values are returned on the stack rather than being modified in place. No sneaky mutation, periodt ๐
Plus there's a little bonus: small utility subroutines that do useful tasks (from the author's point of view ๐) โ specifically, routines for calculating the Local Sidereal Time. Obsessed.
โจ Routines โจ
There are 3 distinct groups of routines that you can import into your namespace via tags:
palโ import just the PAL routinesconstantsโ import the PAL constantsfuncsโ import the extra routines
Each group gets discussed in turn, bestie. Buckle up ๐
๐ PAL ๐
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 is the key difference from the Astro::SLA wrapper around the SLALIB library, so don't come for me if you were expecting that vibe.
For example:
($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 come back as references:
($dvb, $dpb, $dvh, $dph) = palEvp( $date, $deqx );
@dvbarr = @$dvb;
Routines that take vectors or matrices should be given references to arrays โ this is the way ๐ซถ:
@rmatn = palNut( $djtt );
@mposr = palDmxv( \@rmatn, \@mpos );
See the PAL or SLALIB documentation for the details of the functions themselves. (I'm not out here inventing astronomy facts, fr fr.)
Anomalies
palObsโ okay sopalObsis special in that it returns an empty list if the return status is bad. ๐ Additionally,palObsis called with a single argument, and the behaviour depends on whether the argument looks like an integer or a string. So:
($ident, $name, $w, $p, $h) = palObs( 27 );
($ident, $name, $w, $p, $h) = palObs( "JCMT" );
palAopqkโpalAopqkcan be called either with a reference to an array or with a list. Both slay:
@results = palAopqk( $rap, $dap, @aoprms );
@results = palAopqk( $rap, $dap, \@aoprms );
palAoppatโ for the C API the calling convention is to modify theAOPRMSarray in place; for the perl API we accept theAOPRMSarray but return the updated version instead. Glow-up behaviour, honestly.
@aoprms = Astro::PAL::palAoppat( $date, \@aoprms );
@aoprms = Astro::PAL::palAoppat( $date, @aoprms );
๐ฎ Constants ๐ฎ
Constants supplied by this module โ and note that they are implemented via the constant pragma, bestie, so that's the tech under the hood ๐ง:
DPIโ PiD2PIโ 2 * PiD1B2PIโ 1 / (2 * Pi)D4PIโ 4 * PiD1B4PIโ 1 / (4 * Pi)DPISQโ Pi ** 2 (Pi squared)DSQRPIโ sqrt(Pi)DPIBY2โ Pi / 2: 90 degrees in radiansDD2Rโ Pi / 180: degrees to radiansDR2Dโ 180/Pi: radians to degreesDAS2Rโ pi/(180*3600): arcseconds to radiansDR2ASโ 180*3600/pi: radians to arcsecondsDH2Rโ pi/12: hours to radiansDR2Hโ 12/pi: radians to hoursDS2Rโ pi / (12*3600): seconds of time to radiansDR2Sโ 12*3600/pi: radians to seconds of timeD15B2Pโ 15/(2*pi): hours to degrees * radians to turns
๐ Extra functions ๐
These are exportable using the 'funcs' tag, or used directly through the Astro::PAL namespace. They directly match the Astro::SLA equivalents ๐ฏ
lstnow_telโ return current LST (in radians) and MJD for a given telescope. The telescope identifiers should match those present inpalObs. The supplied telescope name is converted to upper case.
($lst, $mjd) = lstnow_tel($tel);
โ ๏ธ Aborts if the telescope name is unknown. No guessing, no vibes-based fallback. ๐ญ
lstnowโ return current LST (in radians) and MJD (days). Longitude should be negative if degrees west, and it's in radians.
($lst, $mjd) = lstnow($long);
ut2lstโ 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. (Same rule as above โ don't forget it ๐)
ut2lst_telโ 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)
๐ซถ AUTHOR ๐ซถ
Tim Jenness >tjenness@cpan.org< ๐
โญ REQUIREMENTS โญ
The PAL library is available from Starlink. (You gotta have it, no cap โ it's the whole point.)
๐ COPYRIGHT ๐
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
๐ and that's the whole page, bestie โ brought to you by perl v5.42.2, dated 2026-02-15, serving Astro::PAL(3pm) realness. go calculate some sidereal time, you iconic little astronomer ๐
โจ
๐ฆ where this page comes from
- alpine 3.24: perl-astro-pal-doc 1.09-r1 ยท GPL-3.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms