Skip to content

Commit c6178c2

Browse files
committed
First commit.
0 parents  commit c6178c2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

205 files changed

+41169
-0
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
*.[oa]
2+
*.so
3+
*.pyc
4+
*~
5+
TAGS
6+
*egg-info
7+
build/

Makefile

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Makefile for SLALIB
2+
# for Pentium/Linux
3+
# by Scott M. Ransom
4+
5+
# OS type
6+
OS = Linux
7+
#OS = OSX
8+
9+
# Linux is the first choice
10+
ifeq ($(OS),Linux)
11+
LIBSUFFIX = .so
12+
LIBCMD = -shared
13+
SYSDIR = /usr
14+
LOCDIR = /usr/local
15+
# else assume Darwin (i.e. OSX)
16+
else
17+
LIBSUFFIX = .dylib
18+
LIBCMD = -dynamiclib
19+
SYSDIR = /sw
20+
LOCDIR = /sw
21+
endif
22+
23+
CC = gcc
24+
FC = gfortran
25+
#FC = g77
26+
CFLAGS = -O2 -Wall -W -fPIC
27+
CLINKFLAGS = $(CFLAGS)
28+
FFLAGS = -O2 -fPIC
29+
FLINKFLAGS = $(FFLAGS)
30+
31+
all: slalib
32+
33+
slalib: libsla$(LIBSUFFIX)
34+
$(FC) -o test/sla_test test/sla_test.f -fno-second-underscore -L. -lsla
35+
test/sla_test
36+
37+
libsla$(LIBSUFFIX):
38+
$(FC) $(FFLAGS) -fno-second-underscore -c -I. *.f *.F
39+
$(FC) $(LIBCMD) -o libsla$(LIBSUFFIX) -fno-second-underscore *.o
40+
41+
# Note: a better way to make pyslalib is to use the setup.py file
42+
pyslalib:
43+
f2py -c slalib.pyf -I. *.f *.F
44+
45+
clean:
46+
rm -f *.o *~ *#
47+
rm -rf build
48+
49+
cleaner: clean
50+
rm -f test/sla_test libsla.so slalib.so

README.txt

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
pySLALIB v1.0 (Nov 2007)
2+
-------------
3+
4+
This is archive contains new f2py-generated (and hand-tweaked to
5+
eliminate unnecessary function/subroutine arguments) wrappers for the
6+
Fortran version of P.T. Wallace's SLALIB positional astronomy library.
7+
SLALIB used to be hosted by the STARLINK site, although that service
8+
has been suspended. The version of SLALIB included here is 2.5-4
9+
(with several additional tweaks) and is released under the GPL.
10+
11+
The python wrappers cover every function in SLALIB and a comprehensive
12+
set of unit tests are available in the test/ directory. The only
13+
external dependency is numpy (http://numpy.scipy.org). These wrappers
14+
are not related to the older (and apparently abandoned) pySLALIB that
15+
was once available on the Web (and which depended on Numeric as
16+
opposed to numpy).
17+
18+
Installation
19+
------------
20+
Most users will only need to do:
21+
> python setup.py install
22+
to generate the wrappers, build, and install the library.
23+
24+
Once slalib.so has been installed in your PYTHONPATH, you can run the
25+
unittests via:
26+
> python test/test_slalib.py
27+
28+
Example Usage (using IPython)
29+
-------------
30+
In [1]: import slalib as S
31+
32+
In [2]: S.sla_veri()
33+
Out[2]: 2005004
34+
35+
In [3]: S.sla_caldj(1999, 12, 31)
36+
Out[3]: (51543.0, 0)
37+
38+
In [4]: S.sla_etrms(1976.9)
39+
Out[4]: array([ -1.62161710e-06, -3.31007009e-07, -1.43529663e-07])
40+
41+
In [5]: S.sla_fk45z(1.234, -0.123, 1984)
42+
Out[5]: (1.2446165107316911, -0.12141858395865548)
43+
44+
In [6]: S.sla_dafin("-00 03 34.6", 1)
45+
Out[6]: (12, -0.0010404101596610642, 0)
46+
47+
In [7]: S.sla_obs(0, "GBT")
48+
Out[7]:
49+
('GBT',
50+
'Green Bank Telescope ',
51+
1.3934679949996727,
52+
0.67078450520692623,
53+
880.0)
54+
55+
If you would like to build a shared library for linking with other
56+
programs, a simple Makefile is also included that should work with
57+
only minor tweaks for most Unix-like OSs.
58+
59+
Please let me know if you find any problems.
60+
61+
Scott
62+
63+
----------------------------------
64+
Scott M. Ransom <[email protected]>
65+
http://www.cv.nrao.edu/~sransom

addet.f

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
SUBROUTINE sla_ADDET (RM, DM, EQ, RC, DC)
2+
*+
3+
* - - - - - -
4+
* A D D E T
5+
* - - - - - -
6+
*
7+
* Add the E-terms (elliptic component of annual aberration)
8+
* to a pre IAU 1976 mean place to conform to the old
9+
* catalogue convention (double precision)
10+
*
11+
* Given:
12+
* RM,DM dp RA,Dec (radians) without E-terms
13+
* EQ dp Besselian epoch of mean equator and equinox
14+
*
15+
* Returned:
16+
* RC,DC dp RA,Dec (radians) with E-terms included
17+
*
18+
* Note:
19+
*
20+
* Most star positions from pre-1984 optical catalogues (or
21+
* derived from astrometry using such stars) embody the
22+
* E-terms. If it is necessary to convert a formal mean
23+
* place (for example a pulsar timing position) to one
24+
* consistent with such a star catalogue, then the RA,Dec
25+
* should be adjusted using this routine.
26+
*
27+
* Reference:
28+
* Explanatory Supplement to the Astronomical Ephemeris,
29+
* section 2D, page 48.
30+
*
31+
* Called: sla_ETRMS, sla_DCS2C, sla_DCC2S, sla_DRANRM, sla_DRANGE
32+
*
33+
* P.T.Wallace Starlink 18 March 1999
34+
*
35+
* Copyright (C) 1999 Rutherford Appleton Laboratory
36+
*
37+
* License:
38+
* This program is free software; you can redistribute it and/or modify
39+
* it under the terms of the GNU General Public License as published by
40+
* the Free Software Foundation; either version 2 of the License, or
41+
* (at your option) any later version.
42+
*
43+
* This program is distributed in the hope that it will be useful,
44+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
45+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
46+
* GNU General Public License for more details.
47+
*
48+
* You should have received a copy of the GNU General Public License
49+
* along with this program (see SLA_CONDITIONS); if not, write to the
50+
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
51+
* Boston, MA 02111-1307 USA
52+
*
53+
*-
54+
55+
IMPLICIT NONE
56+
57+
DOUBLE PRECISION RM,DM,EQ,RC,DC
58+
59+
DOUBLE PRECISION sla_DRANRM
60+
61+
DOUBLE PRECISION A(3),V(3)
62+
63+
INTEGER I
64+
65+
66+
67+
* E-terms vector
68+
CALL sla_ETRMS(EQ,A)
69+
70+
* Spherical to Cartesian
71+
CALL sla_DCS2C(RM,DM,V)
72+
73+
* Include the E-terms
74+
DO I=1,3
75+
V(I)=V(I)+A(I)
76+
END DO
77+
78+
* Cartesian to spherical
79+
CALL sla_DCC2S(V,RC,DC)
80+
81+
* Bring RA into conventional range
82+
RC=sla_DRANRM(RC)
83+
84+
END

afin.f

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
SUBROUTINE sla_AFIN (STRING, IPTR, A, J)
2+
*+
3+
* - - - - -
4+
* A F I N
5+
* - - - - -
6+
*
7+
* Sexagesimal character string to angle (single precision)
8+
*
9+
* Given:
10+
* STRING c*(*) string containing deg, arcmin, arcsec fields
11+
* IPTR i pointer to start of decode (1st = 1)
12+
*
13+
* Returned:
14+
* IPTR i advanced past the decoded angle
15+
* A r angle in radians
16+
* J i status: 0 = OK
17+
* +1 = default, A unchanged
18+
* -1 = bad degrees )
19+
* -2 = bad arcminutes ) (note 3)
20+
* -3 = bad arcseconds )
21+
*
22+
* Example:
23+
*
24+
* argument before after
25+
*
26+
* STRING '-57 17 44.806 12 34 56.7' unchanged
27+
* IPTR 1 16 (points to 12...)
28+
* A ? -1.00000
29+
* J ? 0
30+
*
31+
* A further call to sla_AFIN, without adjustment of IPTR, will
32+
* decode the second angle, 12deg 34min 56.7sec.
33+
*
34+
* Notes:
35+
*
36+
* 1) The first three "fields" in STRING are degrees, arcminutes,
37+
* arcseconds, separated by spaces or commas. The degrees field
38+
* may be signed, but not the others. The decoding is carried
39+
* out by the DFLTIN routine and is free-format.
40+
*
41+
* 2) Successive fields may be absent, defaulting to zero. For
42+
* zero status, the only combinations allowed are degrees alone,
43+
* degrees and arcminutes, and all three fields present. If all
44+
* three fields are omitted, a status of +1 is returned and A is
45+
* unchanged. In all other cases A is changed.
46+
*
47+
* 3) Range checking:
48+
*
49+
* The degrees field is not range checked. However, it is
50+
* expected to be integral unless the other two fields are
51+
* absent.
52+
*
53+
* The arcminutes field is expected to be 0-59, and integral if
54+
* the arcseconds field is present. If the arcseconds field
55+
* is absent, the arcminutes is expected to be 0-59.9999...
56+
*
57+
* The arcseconds field is expected to be 0-59.9999...
58+
*
59+
* 4) Decoding continues even when a check has failed. Under these
60+
* circumstances the field takes the supplied value, defaulting
61+
* to zero, and the result A is computed and returned.
62+
*
63+
* 5) Further fields after the three expected ones are not treated
64+
* as an error. The pointer IPTR is left in the correct state
65+
* for further decoding with the present routine or with DFLTIN
66+
* etc. See the example, above.
67+
*
68+
* 6) If STRING contains hours, minutes, seconds instead of degrees
69+
* etc, or if the required units are turns (or days) instead of
70+
* radians, the result A should be multiplied as follows:
71+
*
72+
* for to obtain multiply
73+
* STRING A in A by
74+
*
75+
* d ' " radians 1 = 1.0
76+
* d ' " turns 1/2pi = 0.1591549430918953358
77+
* h m s radians 15 = 15.0
78+
* h m s days 15/2pi = 2.3873241463784300365
79+
*
80+
* Called: sla_DAFIN
81+
*
82+
* P.T.Wallace Starlink 13 September 1990
83+
*
84+
* Copyright (C) 1995 Rutherford Appleton Laboratory
85+
*
86+
* License:
87+
* This program is free software; you can redistribute it and/or modify
88+
* it under the terms of the GNU General Public License as published by
89+
* the Free Software Foundation; either version 2 of the License, or
90+
* (at your option) any later version.
91+
*
92+
* This program is distributed in the hope that it will be useful,
93+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
94+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
95+
* GNU General Public License for more details.
96+
*
97+
* You should have received a copy of the GNU General Public License
98+
* along with this program (see SLA_CONDITIONS); if not, write to the
99+
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
100+
* Boston, MA 02111-1307 USA
101+
*
102+
*-
103+
104+
IMPLICIT NONE
105+
106+
CHARACTER*(*) STRING
107+
INTEGER IPTR
108+
REAL A
109+
INTEGER J
110+
111+
DOUBLE PRECISION AD
112+
113+
114+
115+
* Call the double precision version
116+
CALL sla_DAFIN(STRING,IPTR,AD,J)
117+
IF (J.LE.0) A=REAL(AD)
118+
119+
END

0 commit comments

Comments
 (0)