我使用Python3.8.5和astropy4.2的浅色 2.0.2库来处理系外行星过境。然而,当我想要将光曲线转到固定数目的点时,除前两个值外,light_curve.flux中的所有值都是nan。我做错什么了?
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]发布于 2021-03-17 21:13:18
在您的例子中,绑定是基于fold变量的时间数据完成的。让我们看一看数据:
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.
其结果是:
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 / sbins参数在Lightkurve2.0.2中不可用,但在2.0.6中可用(谢谢@Michal)。
https://stackoverflow.com/questions/66533025
复制相似问题