星历表计算软件pyephem指南

上传人:子 文档编号:46974211 上传时间:2018-06-28 格式:PDF 页数:5 大小:71.83KB
返回 下载 相关 举报
星历表计算软件pyephem指南_第1页
第1页 / 共5页
星历表计算软件pyephem指南_第2页
第2页 / 共5页
星历表计算软件pyephem指南_第3页
第3页 / 共5页
星历表计算软件pyephem指南_第4页
第4页 / 共5页
星历表计算软件pyephem指南_第5页
第5页 / 共5页
亲,该文档总共5页,全部预览完了,如果喜欢就下载吧!
资源描述

《星历表计算软件pyephem指南》由会员分享,可在线阅读,更多相关《星历表计算软件pyephem指南(5页珍藏版)》请在金锄头文库上搜索。

1、星历表计算软件PyEphem指南 Mrstarlitsky (中国科学院植物研究所) PyEphem是Python下的一个软件包,可以用来进行专业水平的星历表计算,用户可用其计算不同坐标系下太阳、月亮、行星、彗星及人造卫星的位置,亮度,出没时刻,中天时刻等等。这为天文爱好者制作星历表提供了极大的方便。但是初次接触该软件可能觉得无从下手,本文做简要介绍。 一一 下载和安装软件下载和安装软件 下载Python http:/www.python.org/download/ 下载SciPy http:/ 下载NumPy http:/ 下载PyEphem http:/rhodesmill.org/py

2、ephem/ 按照以上顺序,安装好。 二二 软件配置与计算实例软件配置与计算实例 1 Python 的配置的配置 对于windows用户,在我的电脑高级环境变量系统变量ATH中, 在原有的路径上加上;,并加入C:python26(如果下载的Python2.6版本的话)。 开始运行cmd 输入python,则可直接运行python即可。 2 Python 脚本的准备脚本的准备 参考PyEphem的Tutorial,将要计算的内容写入编辑器(如记事本) 例如,python的脚本为 #计算2010年1月16日天王星的位置和亮度 #另存为uran.py文件 import ephem u = ephem

3、.Uranus() pute(2010/1/16) print u.ra, u.dec, u.mag print ephem.constellation(u) print rise_time ,另存为.py文件, 例如对于下文的第一个模块,本人另存为uran.py文件,并放入C:astrocalc文件夹下。 3 bat 文件的准备文件的准备 bat文件中输入需要运行的DOS批处理命令,例如,要运行C:astrocalcuran.py 文件,可直接打开记事本 键入 cd C:astrocalc uran.pyuran.results.txt 并另存为.bat文件。 批处理文件的编写使得在大量处理

4、数据的时候比较方便。 4 运行运行bat文件文件 鼠标左键双击uran.py文件,即可给出相应计算结果。 分别将以下模块另存为.py文件,即可计算相应的结果。 由于本人学识有限,难免存在不妥之处,欢迎各位读者批评指正。请发邮件到 #附录: 计算星历表Python脚本举例 #计算2010年1月16日天王星的位置和亮度 #另存为uran.py文件 import ephem u = ephem.Uranus() pute(2010/1/16) print u.ra, u.dec, u.mag print ephem.constellation(u) print rise_time #计算2010年

5、1月16日木星的位置和亮度 import ephem j = ephem.Jupiter(2010/1/16) n = ephem.Neptune(2010/1/16) print j.ra, j.dec, j.mag print n.ra, n.dec, n.mag print ephem.separation(j, n) #计算火星在近日点和远日点速度的差异 import ephem def hpos(body): return body.hlong, body.hlat ma0 = ephem.Mars(1976/05/21) # ma: mars near aphelion ma1 =

6、 ephem.Mars(1976/05/22) print ephem.separation(hpos(ma0), hpos(ma1) mp0 = ephem.Mars(1975/06/13) # mp: mars near perihelion mp1 = ephem.Mars(1975/06/14) print ephem.separation(hpos(mp0), hpos(mp1) # import ephem d = ephem.Date(1984/12/21 15:00) ephem.localtime(d) print ephem.localtime(d).ctime() # 时

7、间的计算 d = ephem.Date(1950/2/28) print d + 1 print ephem.Date(d + 1) # 赋值类型 d = ephem.Date(34530.34375) d = ephem.Date(1994/7/16.84375) d = ephem.Date(1994/7/16 20:15) d = ephem.Date(1994, 7, 16.84375) d = ephem.Date(1994, 7, 16, 20, 15, 0) print as a float: %fnas a string: “%s“ % (d, d) print d.tripl

8、e() print d.tuple() #计算2010年1月15日16:20:56日环食时北京(126, 40)太阳和月亮的高度和方位 import ephem gatech = ephem.Observer() gatech.long, gatech.lat = 126, 40 gatech.date = 2010/1/15 16:20:56 sun, moon = ephem.Sun(), ephem.Moon() pute(gatech) pute(gatech) print sun.alt, sun.az print moon.alt, moon.az print ephem.sepa

9、ration(sun.az, sun.alt), (moon.az, moon.alt) print sun.size, moon.size, sun.size - moon.size #计算每隔五分钟太阳的方位角和高度 Suns apparent angular speed gatech.date = 1984/5/31 00:00 # 20:00 EDT pute(gatech) for i in range(8): old_az, old_alt = sun.az, sun.alt gatech.date += ephem.minute * 5. pute(gatech) sep = e

10、phem.separation(old_az, old_alt), (sun.az, sun.alt) print gatech.date, sun.alt, sep print gatech.next_setting(sun) print gatech.next_setting(sun) print sun.alt, sun.az #给出轨道根数计算小行星和彗星的位置 #ephem database format格式 小行星或彗星的轨道根数 yh = ephem.readdb(“C/2002 Y1 (Juels-Holvorcem),e,103.7816,“ “166.2194,128.82

11、32,242.5695,0.0002609,0.99705756,0.0000,“ “04/13.2508/2003,2000,g 6.5,4.0“) pute(2003/4/11) print yh.name print yh.ra, yh.dec print ephem.constellation(yh), yh.mag print yh #NORAD Two-Line Element format (TLE) 卫星的轨道根数 计算卫星出没时刻 iss = ephem.readtle(“ISS (ZARYA)“, “1 25544U 98067A 03097.78853147 .00021

12、906 00000-0 28403-3 0 8652“ , “2 25544 51.6361 13.7980 0004256 35.6671 59.2566 15.58778559250029“ ) gatech.date = 2003/3/23 pute(gatech) print iss.rise_time, iss.transit_time, iss.set_time gatech.date = 2003/3/23 8:00 pute(gatech) print iss.rise_time, iss.transit_time, iss.set_time # 设定历元,计算在不同历元下,星

13、体的位置 polaris = ephem.readdb(“Polaris,f|M|F7,2:31:48.704,89:15:50.72,2.02,2000“ ) print polaris.dec pute() # uses the current time by default print polaris.a_dec print ephem.degrees(ephem.degrees(90) - polaris.a_dec) pute(epoch=2100) print polaris.a_dec thuban = ephem.readdb(“Thuban,f|V|A0,14:4:23.3,64:22:33,3.65,2000“ ) pute() print thuban.a_dec pute(epoch=-2800) print thuban.a_dec pute(epoch=-2800) print polaris.a_dec

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 生活休闲 > 科普知识

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号