README.md 3.1 KB
Newer Older
Dmitry Pavlov's avatar
Dmitry Pavlov committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Solar system ephemeris access library

## Repository contents

* `libephaccess` is a C library for calculating planetary positions and other
  data from [SPICE](https://naif.jpl.nasa.gov/naif/toolkit.html) files
* `ephcalculator` is a command-line utility based on `libephaccess`
* `python` directory contains Python wrapper for `libephaccess`
* `eph.sln` is a MS Visual Studio solution file for `libephaccess` and
  `ephcalculator`
* `setup.py` is a Distutils setup script for the Python wrapper

## Build

Dmitry Pavlov's avatar
Dmitry Pavlov committed
15
### libephaccess
Dmitry Pavlov's avatar
Dmitry Pavlov committed
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

On Windows, build the solution `eph.sln` in Visual Studio.

On Linux or OS X, `cd` to the `libephaccess` folder and run

```
make CONF=<configuration>
```

where `<configuration>` is one of:

- `ReleaseStatic32` (Linux 32-bit static library)
- `ReleaseShared32` (Linux 32-bit shared library)
- `ReleaseStatic64` (Linux 64-bit static library)
- `ReleaseShared64` (Linux 64-bit shared library)
- `ReleaseStatic64OSX` (OS X static library)
- `ReleaseShared64OSX` (OS X shared library)

Dmitry Pavlov's avatar
Dmitry Pavlov committed
34
### ephcalculator
Dmitry Pavlov's avatar
Dmitry Pavlov committed
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

On Windows, build the solution `eph.sln` in Visual Studio.

On Linux or OS X, `cd` to the `ephcalculator` folder and run

```
make CONF=<configuration>
```

where `<configuration>` is one of:

- `Release32` (Linux 32-bit executable)
- `Release64` (Linux 64-bit executable)
- `Release64OSX` (OS X executable)

Dmitry Pavlov's avatar
Dmitry Pavlov committed
50
### Python wrapper for libephaccess
Dmitry Pavlov's avatar
Dmitry Pavlov committed
51
52
53
54

#### Direct installation from repository

Direct installation from Gitlab repository is supported for both
Dmitry Pavlov's avatar
Dmitry Pavlov committed
55
Python 2.7 and Python 3:
Dmitry Pavlov's avatar
Dmitry Pavlov committed
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71

```
pip install git+ssh://git@gitlab.iaaras.ru:10022/iaaras/ephemeris-access.git
```
(use `pip2` or `pip3` to distinguish between Python 2 and Python 3)

or

```
python -m pip install git+ssh://git@gitlab.iaaras.ru:10022/iaaras/ephemeris-access.git
```
(use `python2` or `python3` to distinguish between Python 2 and Python 3)

C compiler and linker are needed in the system to compile and link the C modules
into a shared library. On Linux or OS X, `gcc` or `clang` should suffice. On
Windows, different versions of Microsoft Visual Studio are required depending on
Dmitry Pavlov's avatar
Dmitry Pavlov committed
72
73
74
75
Python major version. For Python 3, MSVS 2015 or later (including “Express”
versions) is required. For Python 2, a
[special distribution](https://www.microsoft.com/en-us/download/details.aspx?id=44266)
of MSVS is required.
Dmitry Pavlov's avatar
Dmitry Pavlov committed
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110

#### Manual installation

From parent folder of downloaded `ephemeris-access` folder, run

```
pip install ephemeris-access
```

or 

```
python -m pip install ephemeris-access
```

(The above notes regarding Python 2/3 and C compiler apply here, too)


#### Usage without installation

`ephaccess` folder can be used as is, as long as it resides in the same
directory as user's Python program. But the shared library still must be built
beforehand, in this case with the following command:

```
python setup.py build_ext --inplace
```

(The above notes regarding C compiler apply here, too)

## Usage

* For `libephaccess`, see the comments in the `ephaccess.h` file. Also,
  `ephcalculator` is a good example of `libephaccess` usage.
* For `ephcalculator`, a build-in help message is provided.
Dmitry Pavlov's avatar
Dmitry Pavlov committed
111
* For Python wrapper, see [`python/test.py`](python/test.py) example script.