跳转到主要内容

太阳系历数文件

项目描述

太阳系历数

一个包含太阳系历数文件的包,存储了地球和太阳在一系列JPL开发历数版本中的位置(以光秒为单位)、速度(lts/s)和加速度(lts/s2)。这些可用于计算连续引力波信号的Doppler调制和相对论校正。该包包含一个命令行脚本和Python API,用于生成这些文件,它使用了Astropyjplephem包。脚本可以更一般地用于创建太阳系内任何主要行星的历数文件。

除了地球和太阳的历数外,该包还包含两个文件,提供地球时间(TT)和地心坐标系时间(TCB)或地心动力时间(TDB)之间的时间校正。这些是用LALSuite中的一个脚本创建的,名为lalpulsar_create_time_correction_ephemeris,它使用TIMEEPH_short.te405(用于TCB转换)和TDB.1950.2050(用于TDB转换)在Tempo2中。

安装

可以从PyPI使用pip安装此包及其需求

pip install solar-system-ephemerides

或者,在conda环境中,从conda-forge使用

conda install -c conda-forge solar_system_ephemerides

可以从源代码安装

git clone git@github.com:cwinpy/solar-system-ephemerides.git
cd solar-system-ephemerides
pip install .

用法

安装完成后,要在Python中获取历数文件的路径,例如地球的DE405文件,可以执行以下操作

from solar_system_ephemerides import body_ephemeris_path

path = body_ephemeris_path("earth", DE405)

或者,可以使用ephemeris_path命令行脚本来输出路径,例如:

ephemeris_path --body earth --ephem DE405

使用--help标志可以查看ephemeris_path的完整用法

$ ephemeris_path --help
usage: ephemeris_path [-h] [--body [BODY [BODY ...]]]
                      [--ephem [EPHEM [EPHEM ...]]]
                      [--units [UNITS [UNITS ...]]] [--return-dir]
                      [--rel-path REL_PATH]

Return the path to an ephemeris file or directory containing ephemeris files

optional arguments:
  -h, --help            show this help message and exit
  --body [BODY [BODY ...]], -b [BODY [BODY ...]]
                        The solar system body[ies] to return the path for.
                        These must be in "earth" or "sun".
  --ephem [EPHEM [EPHEM ...]], -e [EPHEM [EPHEM ...]]
                        The JPL development ephemeris version(s) to use. These
                        must be in "DE200", "DE405", "DE421", "DE430", "DE435"
                        or "DE436".
  --units [UNITS [UNITS ...]], -u [UNITS [UNITS ...]]
                        The time system units to return the path for. This
                        must be "TCB" or "TDB".
  --return-dir, -d      Return the ephemeris directory for a given body/time
                        system unit rather than the file path.
  --rel-path REL_PATH, -r REL_PATH
                        Return paths relative to this given path.

它还会显示JPL开发历书版本和包中可用的太阳系天体的历书文件。

历书生成

该包附带一个名为create_solar_system_ephemeris的脚本,可用于生成新的历书文件。

注意:此脚本基于LALSuite脚本lalpulsar_create_solar_system_ephemeris_python,旨在取代它以及等效的C脚本lalpulsar_create_solar_system_ephemeris

例如,要使用JPL DE421从2015年到2035年创建一个太阳的历书文件,每个值之间间隔20小时,可以这样做:

create_solar_system_ephemeris --target SUN --year-start 2015 --interval 20 --num-years 20 --ephemeris DE421 --output-file sun15-35-DE421.dat.gz

使用--help标志可以查看脚本的完整用法

$ create_solar_system_ephemeris --help
usage: create_solar_system_ephemeris [-h] -e EPHEMERIS -o OUTPUT [-g GPSSTART]
                                     [-y YEARSTART] -n NYEARS -i INTERVAL -t
                                     TARGET

optional arguments:
  -h, --help            show this help message and exit
  -e EPHEMERIS, --ephemeris EPHEMERIS, --jplde EPHEMERIS, --ephem EPHEMERIS
                        Set the ephemeris to use (e.g. DE405)
  -o OUTPUT, --output-file OUTPUT
                        Set the output file. If this ends in '.gz' it will be
                        gzipped.
  -g GPSSTART, --gps-start GPSSTART
                        Set the GPS time at which to start generating the
                        ephemeris
  -y YEARSTART, --year-start YEARSTART
                        Set the (decimal) year at which to start generating
                        the ephemeris
  -n NYEARS, --num-years NYEARS
                        Set the number of years over which to generate the
                        ephemeris
  -i INTERVAL, --interval INTERVAL
                        Set the time step (in hours) between successive output
                        points
  -t TARGET, --target TARGET, --body TARGET
                        Set the solar system body to generate the ephemeris
                        for

Python中的历书访问

提供了名为BodyEphemeris的便利类,用于在Python中读取和操作历书文件信息。它具有返回位置、速度和加速度(距离以光秒为单位存储在文件中或在SI单位中输出)的属性。它还可以将历书转换为Astropy QTable或Pandas DataFrame

from solar_system_ephemerides.ephemeris import BodyEphemeris

# load the DE405 ephemeris for the Earth
earth = BodyEphemeris(body="earth", jplde="DE405")

# return a NumPy array of the 3D cartesian positions of Earth (in light seconds)
# for all time steps. Equivalently use .vel and .acc for velocities and
# accelerations. To return, e.g., just the x-positions use .pos_x.
earth.pos

# return the positions (in SI units)
earth.pos_si

# return the GPS seconds time stamp for each ephemeris valie
earth.times

# return the ephemeris as an Astropy QTable
earth.to_table()

# return the ephemeris as a Pandas DataFrame
earth.to_pandas()

要获取SWIG LALSuite EphemerisData对象中的地球和太阳历书,可以使用lal_ephemeris_data函数,例如:

from solar_system_ephemerides.ephemeris import lal_ephemeris_data

# get Sun and Earth ephemerides for DE421
edat = lal_ephemeris_data(jplde="DE421")

等价地,要获取SWIG LALSuite TimeCorrectionData对象中的时间校正文件信息,可以使用lal_time_ephemeris_data函数,例如:

from solar_system_ephemerides.ephemeris import lal_time_ephemeris_data

# get the TT to TDB time correction data
tdat = lal_time_ephemeris_data(units="TDB")

PyPI version | Conda Version

项目详情


下载文件

下载您平台上的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分发

solar_system_ephemerides-1.1.0.tar.gz (123.7 MB 查看哈希值)

上传时间:

构建分发

solar_system_ephemerides-1.1.0-py3-none-any.whl (123.7 MB 查看哈希值)

上传时间: Python 3

由以下机构支持