-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathfixstars.py
More file actions
69 lines (48 loc) · 1.41 KB
/
fixstars.py
File metadata and controls
69 lines (48 loc) · 1.41 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import astrology
class FixStars:
"""Calculates the positions of the fixstars"""
NAME = 0
NOMNAME = 1
LON = 2
LAT = 3
RA = 4
DECL = 5
def __init__(self, tjd_ut, flag, names, obl):
self.data = []
i = 0
for k in names.keys():
self.data.append(['', '', 0.0, 0.0, 0.0, 0.0])
ret, name, dat, serr = astrology.swe_fixstar_ut(','+k, tjd_ut, flag)
nam = name[0].strip()
nomnam = ''
DELIMITER = ','
if nam.find(DELIMITER) != -1:
snam = nam.split(DELIMITER)
nam = snam[0].strip()
nomnam = snam[1].strip()
# ★ pyd가 laSco를 'Mula'로 돌려줘도 표시명은 'Shaula'로 강제 통일
if nomnam == u'laSco' or nam == u'Mula':
nam = u'Shaula'
self.data[i][FixStars.NAME] = nam
self.data[i][FixStars.NOMNAME] = nomnam
self.data[i][FixStars.LON] = dat[0]
self.data[i][FixStars.LAT] = dat[1]
ra, decl, dist = astrology.swe_cotrans(dat[0], dat[1], 1.0, -obl)
self.data[i][FixStars.RA] = ra
self.data[i][FixStars.DECL] = decl
i += 1
self.sort()
def sort(self):
num = len(self.data)
self.mixed = []
for i in range(num):
self.mixed.append(i)
for i in range(num):
for j in range(num-1):
if (self.data[j][FixStars.LON] > self.data[j+1][FixStars.LON]):
tmp = self.data[j][:]
self.data[j] = self.data[j+1][:]
self.data[j+1] = tmp[:]
tmp = self.mixed[j]
self.mixed[j] = self.mixed[j+1]
self.mixed[j+1] = tmp