首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >光照曲线后的nan值

光照曲线后的nan值
EN

Stack Overflow用户
提问于 2021-03-08 15:56:26
回答 1查看 152关注 0票数 1

我使用Python3.8.5和astropy4.2的浅色 2.0.2库来处理系外行星过境。然而,当我想要将光曲线转到固定数目的点时,除前两个值外,light_curve.flux中的所有值都是nan。我做错什么了?

代码语言:javascript
复制
import lightkurve as lk

tp = lk.search_targetpixelfile("Kepler-10", mission="Kepler", exptime="long", quarter=1).download()
lc = tp.to_lightcurve().flatten().remove_outliers()
fold = lc.fold(0.837)
bin = fold.bin(n_bins=101)

print(bin.flux)  # [0.99999749 0.99999977 nan nan nan nan nan nan nan ... nan nan nan nan]
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-03-17 21:13:18

在您的例子中,绑定是基于fold变量的时间数据完成的。让我们看一看数据:

代码语言:javascript
复制
print(fold)

# =>          time                flux        ... 
#                             electron / s    ... 
#     -------------------- ------------------ ... 
#     -0.41839904743025785 0.9999366372082438 ... 
#     -0.41790346068516393 0.9999900469016064 ... 
#     -0.41710349403700253  1.000098604170269 ... 
#                      ...                ... ... 
#      0.41749621545238175 1.0000351718333538 ... 
#       0.4178061659377394 1.0000272820282354 ... 
#      0.41829640771343823 1.0000199004079346 ...

这意味着我们有-0.4天到0.4天的数据。

然后使用bin = fold.bin(n_bins=101)完成绑定。有关bin方法的参数的文档(截断):

time\_bin\_size : `~astropy.units.Quantity`, float The time interval for the binned time series. (Default: 0.5 days; default unit: days.) time\_bin\_start : `~astropy.time.Time`, optional The start time for the binned time series. Defaults to the first time in the sampled time series. n\_bins : int, optional The number of bins to use. Defaults to the number needed to fit all the original points. Note that this will create this number of bins of length ``time\_bin\_size`` independent of the lightkurve length.

您只传递n_bins参数。这意味着,该方法将创建101个从-0.4开始宽度为0.5的回收箱。所以第一个垃圾桶从-0.4到0.1,第二个从0.1到0.6,第三个从0.6到1.1,

现在很明显,只有前两个回收箱包含数据。

不要使用n_bins,而是使用bins

bins : int The number of bins to divide the lightkurve into. In contrast to ``n\_bins`` this sets the length of ``time\_bin\_size`` accordingly.

其结果是:

代码语言:javascript
复制
bin = fold.bin(bins=101)
print(bin.flux) 

# => [1.0000268  1.00003322 1.00001914 1.00001018 1.00000905 1.00002073
#     0.99999502 1.00000155 1.0000071  0.99999901 1.000028   0.99998768
#     0.99998992 1.00003623 1.00001132 1.00005118 0.99998819 1.00001886
#     ...
#     1.00001082 1.00004898 1.0000009  1.00001234 1.00000681] electron / s

bins参数在Lightkurve2.0.2中不可用,但在2.0.6中可用(谢谢@Michal)。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66533025

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档