Astro::PAL(3pm)

๐Ÿ“ฆ version 1.09, in alpine 3.24

๐Ÿ’ซ 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 routines
  • constants โ€” import the PAL constants
  • funcs โ€” 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 so 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. So:
 ($ident, $name, $w, $p, $h) = palObs( 27 );
 ($ident, $name, $w, $p, $h) = palObs( "JCMT" );
  • palAopqk โ€” palAopqk can 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 the AOPRMS array in place; for the perl API we accept the AOPRMS array 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 โ€” Pi
  • D2PI โ€” 2 * Pi
  • D1B2PI โ€” 1 / (2 * Pi)
  • D4PI โ€” 4 * Pi
  • D1B4PI โ€” 1 / (4 * Pi)
  • DPISQ โ€” Pi ** 2 (Pi squared)
  • DSQRPI โ€” sqrt(Pi)
  • DPIBY2 โ€” Pi / 2: 90 degrees in radians
  • DD2R โ€” Pi / 180: degrees to radians
  • DR2D โ€” 180/Pi: radians to degrees
  • DAS2R โ€” pi/(180*3600): arcseconds to radians
  • DR2AS โ€” 180*3600/pi: radians to arcseconds
  • DH2R โ€” pi/12: hours to radians
  • DR2H โ€” 12/pi: radians to hours
  • DS2R โ€” pi / (12*3600): seconds of time to radians
  • DR2S โ€” 12*3600/pi: radians to seconds of time
  • D15B2P โ€” 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 in palObs. 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 (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