Retrieve,represent and manipulate JPL Horizons Ephemerides.
eph的Python项目详细描述
自述文件
eph包提供了一些有用的函数、类和工具 要检索,解析和操作星历表 以astropy兼容的方式。
有关详细信息,请参见eph-howto(jupyter笔记本)。
基本用法
importephreq=eph.JplReq()# create the requestreq.read('eph.ini',section='jplparams')# read parameters from 'jplparams' section in 'eph.ini'req.set({'COMMAND':'venus','START_TIME':'2007-11-17','STOP_TIME':'2017-4-22''STEP_SIZE':'10d'})# set parameters from dictionaryreq['OBJ_DATA']=False# set parameter dict-likereq.csv=True# set parameter as attributesreq.set(TABLE_TYPE='V',VEC_LABELS=False,VEC_TABLE=1)# set position vectors outputres=req.query()# perform the request obtaining a response from Jpl Horizons servicee=res.parse()# parse the ephemeris in an astropy QTablefromastropy.ioimportasciiascii.write(e,format='csv')# write output data
eph.ini的内容可以是这样的 (见ftp://ssd.jpl_process.nasa.gov/pub/ssd/horizons_batch_example.long 有关jpl参数的完整说明)
[jplparams]MAKE_EPHEM=YESREFERENCE_PLANE=ECLIPTICREF_SYSTEM=J2000OUT_UNITS=AU-D
快捷方式
ephpackage还定义了一些有用的快捷函数,可以方便地访问jpl horizons数据。 您可以使用
fromephimport*fromdatetimeimportdatetimee=get('venus',dates=['2000-1-1',datetime.now()])
快捷方式函数还接受一个日期查询(非间隔)和多个目标对象。 幕后eph多次调用jpl horizons系统并将结果合并为一个 桌子。在这种情况下,非键(用于连接)列将使用引用对象的前缀重命名 (例如x列表示金星变成金星)。 只有对所有对象采用相同的值时,才会将元信息列表化并折叠为单个值。
fromephimport*e=get(['venus','mars'],dates='2017-04-22')
Dates的默认值是DateTime.Now(),因此如果需要当前数据,可以忽略它。
fromephimport*e=get(['venus','mars'],table_type='V',vec_table=1)# present vector positional data for Venus and Mars
还有其他快捷方式函数,如vec、pos、vel、elem、obs、radec、altaz等。到 简化参数设置。
例如,如果需要向量,请键入
e=vec('venus',dates=['2018-1-1','2020-1-1']).
命令行工具
ephpackage还提供了一个命令行工具:
$ eph venus --dates 2007-11-07 2017-04-22
这个命令给你一个金星的星历表,从2007-11-17到2017-4-22。 您还可以更改参考帧、时间步长、输出等。 通过提供的选项或设置配置文件。检查可用选项键入
$ eph --help