时尚的开普勒曲线
untrend的Python项目详细描述
在这个时代,研究系外行星只是有史以来最时髦的事情,有时 太好了,出轨了,有点偏僻!这个图书馆是一套 可以有力地消除光曲线上的超车趋势 数据。
安装
untrendy依赖于numpy和scipy,因此请确保安装 首先是那些。然后,您可以使用pip:
安装pip install untrendy
用法
untrendy非常复杂。它具有大约^ {EM1}$ $EME>函数和 大约200行代码(包括文档)。主要是因为爱 和魔术(如果你想的话,下面会给出更完整的细节)。
假设你有一条光曲线,有时间样本t,通量 测量值f和不确定度sigma。您只需运行:
importuntrendyf_detrend,sigma_detrend=untrendy.untrend(t,f,sigma)
找到时间序列全局趋势的稳健估计并删除 它。默认设置经过调整,可以很好地查找 开普勒数据中的“过境”趋势,但详细描述了 选项如下。你也可以顺应潮流, 趋势的可调用表示:
trend=untrendy.fit_trend(t,f,ferr)
在本例中,您可以通过调用 函数:
bkg=trend(t0)
注释
- 样条曲线有时会在你没有任何 所以样品要小心。
- 整个过程引入了相关误差。你被警告了。
命令行取消终止
也可以从命令行使用untrendy如果 不想为所有的python东西烦恼。如果有空格 包含光曲线的分离ascii文件,可以通过 跑步:
untrend /path/to/data.txt
代码将假设您的文件有2或3列,其中包括time、flux和 (可选)每次观测的不确定性。然后,去趋势的光线 曲线将以相同格式写入标准输出。或者, 同一程序可以在以下位置从标准读取数据:
cat /path/to/data.txt | untrend
这让你可以选择做一些疯狂的事情,然后把所有的事情都说出来 像Unix一样。就我个人而言,我只会使用python。
API
顺应潮流
国家。fit_trend(x,y,yerr=None,Q=12,dt=3.0, tol=0.00125,maxiter=15,fill_times=None,maxditer=4, nfill=4)
使用迭代加权最小二乘法将样条曲线拟合到 时间序列中的非运输趋势。输入数据应该是“干净的”。 换句话说,坏数据应该被屏蔽,它通常有助于规范化 通量(通过中间带或其他东西)。
参数
^{tt8}$: | The sampled times. |
---|---|
^{tt9}$: | The fluxes corresponding to the times in ^{tt8}$. |
^{tt21}$: | (optional) The 1-sigma error bars on ^{tt9}$. |
^{tt23}$: | (optional) The parameter controlling the severity of the re-weighting. |
^{tt24}$: | (optional) The initial spacing between time control points. |
^{tt25}$: | (optional) The convergence criterion. |
^{tt26}$: | (optional) The maximum number of re-weighting iterations to run. |
^{tt27}$: | (optional) If provided, this number sets the minimum time spacing between adjacent samples that is acceptable. If the spacing is larger, knots will be added to fill in the gap. |
^{tt28}$: | (optional) The maximum number of discontinuity search iterations to run. |
^{tt29}$: | (optional) The number of knots to use to fill in the gaps. |
返回
^{tt30}$: | A callable representation of the trend. |
---|
消除趋势
国家。untrend(x,y,yerr=None,**kwargs)
使用迭代重加权最小二乘法消除过境 轻曲线的趋势。与fit_trend不同,此函数屏蔽坏的 数据(NaN)并在拟合之前规范化数据。
参数
^{tt8}$: | The sampled times. |
---|---|
^{tt9}$: | The fluxes corresponding to the times in ^{tt8}$. |
^{tt21}$: | (optional) The 1-sigma error bars on ^{tt9}$. |
^{tt34}$: | (optional) Other arguments passed to the ^{tt35}$ function. |
返回
^{tt44}$: | The de-trended relative fluxes. |
---|---|
^{tt45}$: | The de-trended uncertainties on ^{tt44}$. |