Tim Jenness > Astro-SLA-1.02 > Astro::SLA



Annotate this POD


Related Modules

By perlmonks.org


Open  0
View/Report Bugs
Module Version: 1.02   Source   Latest Release: Astro-SLA-1.03


Astro::SLA - Perl interface to SLAlib positional astronomy library


  use SLA;
  use SLA qw(:constants :sla);

  slaFk45z($ra, $dec, 1950.0, $ra2000, $dec2000);
  slaCldj($yy, $mn, $dd, $mjd, $status);

  ($lst, $mjd) = lstnow($long);
  ($lst, $mjd) = ut2lst_tel($yy,$mn,$dd,$hh,$mm,$ss,'JCMT');


This modules provides a Perl interface to either the C or Fortran versions of the SLALIB astrometry library written by Pat Wallace.

In general the single precision routines have not been implemented since perl can work in double precision.

The SLALIB constants (as provided in slamac.h) are available.

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.

Routines ^

There are 3 distinct groups of routines that can be imported into the namespace via tags:

sla - import just the SLALIB routines
constants - import the SLALIB constants
funcs - import the extra routines

Each group will be discussed in turn.


All the double precision SLA routines are implemented except for slaPxy, slaDmat, slaSvd, slaSvdcov, slaSvdsol (I may do these some other time -- although they should be done in PDL).

The implemented routines are:

 slaAddet slaAfin slaAirmas slaAmp slaAmpqk slaAop
 slaAoppa slaAoppat slaAopqk slaAtmdsp slaAv2m slaBear
 slaCaf2r slaCaldj slaCalyd slaCc2s slaCc62s slaCd2tf
 slaCldj slaClyd slaCr2af slaCr2tf slaCs2c6 slaDaf2r
 slaDafin slaDat slaDav2m slaDbear slaDbjin slaDc62s
 slaDcc2s slaDcmpf slaDcs2c slaDd2tf slaDe2h slaDeuler
 slaDfltin slaDh2e slaDimxv slaDjcal slaDjcl slaDm2av
 slaDmoon slaDmxm slaDmxv slaDpav slaDr2af slaDr2tf
 slaDrange slaDranrm slaDs2c6 slaDs2tp slaDsep slaDtf2d
 slaDtf2r slaDtp2s slaDtp2v slaDtps2c slaDtpv2c slaDtt
 slaDv2tp slaDvdv slaDvn slaDvxv slaE2h slaEarth slaEcleq
 slaEcmat slaEcor slaEg50 slaEpb slaEpb2d slaEpco slaEpj
 slaEpj2d slaEqecl slaEqeqx slaEqgal slaEtrms slaEuler
 slaEvp slaFk425 slaFk45z slaFk54z slaFloatin slaGaleq
 slaGalsup slaGe50 slaGeoc slaGmst slaGmsta slaGresid slaH2e
 slaImxv slaInvf slaKbj slaM2av slaMap slaMappa slaMapqk
 slaMapqkz slaMoon slaMxm slaMxv slaNut slaNutc slaOap
 slaOapqk slaObs slaPa slaPav slaPcd slaPda2h slaPdq2h
 slaPlanel slaPlanet slaPlante slaPm slaPolmo slaPrebn
 slaPrec slaPreces slaPrecl slaPrenut slaPvobs slaRandom
 slaRange slaRanorm slaRcc slaRdplan slaRefco slaRefcoq
 slaRefv slaRefz slaRverot slaRvgalc slaRvlg slaRvlsrd
 slaRvlsrk slaS2tp slaSep slaSubet slaSupgal slaTp2s slaTp2v
 slaTps2c slaTpv2c slaUnpcd slaV2tp slaVdv slaVxv slaWait
 slaXy2xy slaZd slaIntin

Also, slaGresid and slaRandom are not in the C library (although they are in the Fortran version). slaWait is implemented using the perl 'select(ready file descriptors)' command.

In general single precision routines are simply aliases of the double precision equivalents.

For more information on the SLALIB routines consult the Starlink documentation (Starlink User Note 67 (SUN/67)). This document is available from the Starlink web site (http://www.starlink.ac.uk/) [SUN67 available from: http://www.starlink.ac.uk/cgi-bin/htxserver/sun67.htx/sun67.html ]


Constants supplied by this module (note that they are implemented via the constant pragma):

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 (using the 'funcs' tag)


Return current LST (in radians) and MJD for a given telescope. The telescope identifiers should match those present in slaObs. 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 >tjenness@cpan.org<


The Fortran version of SLALIB is available from Starlink under the Gnu GPL. You can download it as part of the Starlink software collection (http://www.starlink.rl.ac.uk).

The SLALIB library (C version) is proprietary. Please contact Patrick Wallace (ptw@tpsoft.demon.co.uk) if you would like to obtain a copy.


Copyright (C) 2007, 2010 Tim Jenness and the Science and Technology Facilities Council. Copyright (C) 1998-2005 Tim Jenness and the 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

syntax highlighting: