-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathobscode_test.py
38 lines (31 loc) · 1.33 KB
/
obscode_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import pytest
from obs80 import obscode
@pytest.fixture(scope='module')
def sites():
# look a few places for a real obcode file
for fn in ['obscode.dat', 'ObsCodes.html',
'/var/www/html/mpc/public/iau/lists/ObsCodes.html']:
try:
return obscode.read5c(fn)
except IOError:
pass
# otherwise use small sample file in source control
return obscode.read5c('ocsample.dat')
def test_sites(sites):
assert sites['G96'] == obscode.Site5c(blank=False, long=249.21128,
rcos=0.845111, rsin=0.533614, site='Mt. Lemmon Survey')
# Blank parallax constants
assert sites['248'] == obscode.Site5c(blank=False, long=0.0, rcos=0.0,
rsin=0.0, site='Hipparcos')
# 0 parallax constants (not blank)
assert sites['248'] == obscode.Site5c(blank=False, long=0.0, rcos=0.0,
rsin=0.0, site='Hipparcos')
# Southern hemisphere
assert sites['413'] == obscode.Site5c(blank=False, long=149.06608,
rcos=0.855595, rsin=-0.516262, site='Siding Spring Observatory')
def test_xyz(sites):
xyz = obscode.siteXYZ(sites)
assert xyz['W14'] == (0.04652656088240064, -0.8205960653868969, 0.567774)
assert xyz['250'] == (None, None, None)
assert xyz['248'] == (0.0, 0.0, 0.0)
assert xyz['413'] == (-0.7338957925529292, 0.43981788242192676, -0.516262)