西方星座边界图
为了绘画西方星座的边界图以供对比,你需要以下几项:
-
星座名称:清楚列出你想要绘制的所有西方星座的名称。
-
星座边界信息:找到每个星座的边界坐标相关资料,以确保绘制的准确性。
-
绘图工具:可以使用专业的绘图软件(如 Python matplotlib 绘图包)。
例如:中国的太微垣约在西方的室女座与狮子座之间。

图1: 中国的太微垣

图2: 西方的88个星座
绘画西方星座边界程序:
# constellation_boundaries.py
def dd2dms(dd):
is_positive = dd >= 0
dd = abs(dd)
minutes,seconds = divmod(dd*3600,60)
degrees,minutes = divmod(minutes,60)
degrees = degrees if is_positive else -degrees
return (str(degrees)+":"+str(minutes)+":"+str(seconds))
def dms2dd(degrees, minutes, seconds):
is_positive = degrees.find('-') # is_positive = -1 if positive
dd = abs(float(degrees)) + float(minutes)/60 + float(seconds)/(60*60);
dd = dd if is_positive == -1 else -dd
return dd
def deg_ra(hms):
parts = hms.split(':')
lon = dms2dd(parts[0], parts[1], parts[2])
return (lon*15)
def deg_dec(dms):
parts = dms.split(':')
lat = dms2dd(parts[0], parts[1], parts[2])
return (lat)
import matplotlib.pyplot as plt
fig = plt.figure(1, figsize=(64, 40))
plt.clf() # 清画布
# 加入赤纬标志
positions =[60,50,40,30,20,10,0,-10,-20,-30,-40,-50,-60]
labels = ["60°","50°","40°","30°","20°","10°","0°","-10°","-20°","-30°","-40°","-50°","-60°"]
plt.yticks(positions, labels)
# 加入赤经标志
positions = [360, 330,300, 270, 240, 210, 180, 150, 120, 90, 60, 30, 0]
labels = ["0h", "22h", "20h", "18h", "16h", "14h", "12h", "10h", "8h", "6h", "4h", "2h", "0h"]
plt.xticks(positions, labels)
# 绘画黄道
import ephem
eclx_values = []
ecly_values = []
for d in range (0, 361, 2):
m = ephem.Ecliptic(dd2dms(d),"0") # 黄道 long 和 lat
equ = ephem.Equatorial(m) # 转变为赤道 ra 和 dec
# 找出对应的赤道座标系 x,y
x = deg_ra(str(equ.ra))
y = deg_dec(str(equ.dec))
eclx_values.append(x)
ecly_values.append(y)
# 每15度加一标记及寫上黄道经度
if d % 15 ==0:
plt.annotate(str(d), (x, y), ha='center', size=6)
plt.plot(x,y, "|", color = "green")
plt.plot(eclx_values, ecly_values, color="green", linestyle="dashed", linewidth=1)
# 绘画西方星座边界
ra_cst=[];dec_cst=[]
old_cst = "AND" # 由室女座开結
with open("const_boundaries.txt", "r", encoding="utf-8") as filestream:
next(filestream) # 跳过第一行
for line in filestream:
currentline = line.split(";") # 分隔符是分号
if currentline[2].strip() == old_cst: # 同一星座?
ra_cst.append(float(currentline[0])) # 是, 放在同一列表内
dec_cst.append(float(currentline[1]))
else:
# 否则是新的一个星座
# 先画之前的星座
plt.plot(ra_cst, dec_cst, color="green", linestyle="dotted", linewidth=0.2)
# 新的一个星座, 先清列表
ra_cst = []
dec_cst = []
ra_cst.append(float(currentline[0]))
dec_cst.append(float(currentline[1]))
old_cst = currentline[2].strip() # 更新星座名称
# 写出星座简称
import constellation_names
constellation_names.write_text(plt)
plt.xlim(360, 0) # x 轴反方向
plt.ylim(-62,62) # y 轴
axes=plt.gca() # 长宽比
axes.set_aspect(1) # x/y = 1
axes.grid() # 加入格线
plt.tight_layout()
plt.show()
星座边界的数据可以在以下网站找到:
https://cdsarc.cds.unistra.fr/viz-bin/cat/VI/49
VI/49 星座边界表的格式:RAJ2000;DEJ2000;cst;type
该表列出了星座边界的赤经 (RAJ2000) 和赤纬 (DEJ2000),星座名称 (cst),type I 代表插入值,type O 代表原有值。
RAJ2000;DEJ2000;cst;type
353.035698;+35.1897736;AND ;I
352.027387;+35.1880264;AND ;I
351.018963;+35.1860695;AND ;I
350.010539;+35.1838989;AND ;I
349.002342;+35.1815186;AND ;I
347.994003;+35.1789322;AND ;I
346.985692;+35.1761322;AND ;I
345.977554;+35.1731300;AND ;I
344.969329;+35.1699181;AND ;I
344.465304;+35.1682358;AND ;O
344.460181;+36.1682281;AND ;I
344.454889;+37.1682205;AND ;I
344.449482;+38.1682091;AND ;I
344.443932;+39.1682014;AND ;I
共有 12948行。
在星图上写出星座名称的程序:
#constellation_names.py
def write_text(plt):
# 星座位置: RA, DEC, 星座名称: Const_abbreviation
cst_names = [355, 36, "And", 9, 22, "And", 39, 41, "And", 154, -39.5, "Ant",
358, -22, "Aqr", 314, -14, "Aqr", 292, -11.5, "Aql", 260, -47, "Ara",
47, 11, "Ari", 95, 32, "Aur", 227, 8, "Boo", 73, -46, "Cae",
58.8, 53.2,"Cam", 310, -27,"Cap",110,-52.5, "Car", 22, 51, "Cas",
359, 51, "Cas", 225,-32,"Cen",173, -56, "Cen",322, 56, "Cep",
20,-19.5, "Cet", 50, 7, "Cet", 110,-33, "CMa", 118, 0.3, "CMi",
132, 8, "Cnc", 95, -42, "Col", 202, 15, "Com", 276, -45, "CrA",
246, 27, "CrB",177,-8, "Crt", 184,-57, "Cru", 192,-13, "Crv",
195, 32, "CVn",325, 32, "Cyg", 312, 3, "Del", 67, -49.8, "Dor",
283, 48, "Dra", 225, 55.5,"Dra",320, 3, "Equ", 65, -2, "Eri",
33, -57.5, "Eri", 36, -26, "For",112, 13, "Gem",346, -38, "Gru",
268, 21, "Her", 63.5, -41.3,"Hor",143, 5, "Hya" , 215, -24, "Hya",
320, -47, "Ind", 342, 36, "Lac", 165, 12, "Leo", 89, -26.5, "Lep",
237, -9, "Lib", 159, 28.5, "LMi", 239, -31, "Lup",132, 34, "Lyn",
99, 54.5, "Lyn", 285 ,27, "Lyr", 320, -29.5,"Mic", 105, -9.5, "Mon",
247, -44, "Nor", 259,-29.5, "Oph", 274, 13, "Oph", 94, -3, "Ori",
342, 3, "Peg", 2.5, 20.5, "Peg", 66, 32, "Per", 28, -42, "Phe",
358, -41, "Phe", 89, -46, "Pic", 346,-26, "PsA", 12, 10.5, "Psc",
349, -3, "Psc", 125, -22, "Pup",140, -26, "Pyx", 59, -55, "Ret",
25, -26, "Scl", 359, -26, "Scl", 260, -32, "Sco", 282, -15, "Sct",
233, -3, "Ser", 274, -15, "Ser", 162, -11, "Sex", 291, 18, "Sge",
295, -32, "Sgr", 67, 11, "Tau", 285, -47, "Tel", 28, 32, "Tri",
148, 42, "UMa",216, 55.5, "UMa",165, -42, "Vel", 213, -19, "Vir",
316, 20.5, "Vul"]
for i in range(0, len(cst_names), 3):
plt.text(cst_names[i], cst_names[i+1], cst_names[i+2], color="#1f77b4", fontsize=8)
运行结果:

2123

被折叠的 条评论
为什么被折叠?



