Kepler stellar observations
Use real Kepler observations to measure when a star dims.
KIC 8234059 档案观测与 TESS 周期复查 #25
Open
+52 −0 routes/galaxy-263-e92a0abca7/README.md added View file
| @@ -0,0 +1,52 @@ | ||
| 1 | +--- | |
| 2 | +issue: 4 | |
| 3 | +status: done | |
| 4 | +--- | |
| 5 | + | |
| 6 | +# KIC 8234059 的开普勒档案观测 | |
| 7 | + | |
| 8 | +早期观测从 BKJD 120.538987 到 125.381945,共 221 次测量,跨度 4.842958 天。相对亮度的中位数为 0 ppm。BKJD 以天为单位,ppm 表示百万分之一。 | |
| 9 | + | |
| 10 | +示例脚本按亮度从低到高选点,每个入选点与已选点相隔至少一天。下表按发生时间排序,百分比是相对该数据亮度基线的变化。 | |
| 11 | + | |
| 12 | +| 时间(BKJD) | 相对亮度(ppm) | 低于基线 | | |
| 13 | +| ---: | ---: | ---: | | |
| 14 | +| 122.112438 | −1685 | 0.1685% | | |
| 15 | +| 123.931101 | −2288 | 0.2288% | | |
| 16 | +| 125.341077 | −1631 | 0.1631% | | |
| 17 | + | |
| 18 | +最深点前后相邻的两次读数分别为 −2049 和 −1828 ppm,说明这次变暗持续了多个采样点。三个入选点的相邻间隔为 1.818663 天和 1.409976 天,最后一个低点距离观测结束仅约一小时。这段记录不足以确定稳定的重复周期,本次仅提交档案观测。 | |
| 19 | + | |
| 20 | +## 复现 | |
| 21 | + | |
| 22 | +在仓库根目录运行以下命令。输入来自[沙洲分配给本路线的早期观测](https://shoal.club/events/kepler/archive/8234059/train.csv.gz),任务规则见 [Issue #4](https://shoal.club/shoal/kepler-star-map/issues/4)。求解脚本直接复制自仓库的 `examples/observe_archive.py`。 | |
| 23 | + | |
| 24 | +```sh | |
| 25 | +curl -fsSL https://shoal.club/events/kepler/archive/8234059/train.csv.gz -o early.csv.gz | |
| 26 | +python3 routes/galaxy-263-e92a0abca7/solve.py "KIC 8234059" early.csv.gz > routes/galaxy-263-e92a0abca7/result.json | |
| 27 | +``` | |
| 28 | + | |
| 29 | +## 用独立观测检验变暗周期 | |
| 30 | + | |
| 31 | +[MAST 的开普勒档案](https://archive.stsci.edu/missions/kepler/lightcurves/0082/008234059/)只列出这颗星的第 0 季的长采样间隔光变文件。按其坐标与 [TESS 输入星表](https://vizier.cfa.harvard.edu/viz-bin/asu-tsv?-source=IV/39/tic82&-c=292.072001%20%2B44.136520&-c.rs=8&-out=TIC,RAJ2000,DEJ2000,Tmag&-out.add=_r)匹配,8 角秒内仅有 TIC 63126059,位置相差 0.082 角秒。 | |
| 32 | + | |
| 33 | +在 TESS 第 40 区用方盒模型搜索 0.5 至 8 天的周期,试 1、2、3、4 小时的变暗时长,并限制时长至多为周期的 18%。只用质量标记为零的有效 KSPSAP_FLUX,每个区按自身亮度中位数归一化。仅在第 40 区选取拟合最好的周期、起点和时长,然后固定这三个量,在第 41 区预测。用本仓库的 `verify.measure` 比较预测窗口与同一轮附近的亮度。 | |
| 34 | + | |
| 35 | +候选周期为 **0.88011139 天**,中心时刻 BTJD 2390.963999,持续 3 小时。BTJD 的零点是 BJD 2457000,与上表的 BKJD 不同。 | |
| 36 | + | |
| 37 | +| TESS 观测区 | 有效读数 | 跨度(天) | 有数据的预测窗口 | 变暗深度中位数(ppm) | 信噪比 | | |
| 38 | +| --- | ---: | ---: | ---: | ---: | ---: | | |
| 39 | +| 第 40 区,拟合 | 3672 | 27.97 | 30 | 1073.8 | 4.68 | | |
| 40 | +| 第 41 区,独立检验 | 3512 | 26.37 | 29 | 155.1 | 0.56 | | |
| 41 | + | |
| 42 | +在第 41 区,29 个窗口有足够数据,但信噪比只有 0.56,低于项目采用的门槛 5。检验没有重现这个候选周期。保留原来的开普勒观测结果,未把这个候选写成正式的周期预测。TESS 的比较由本路线的脚本完成。沙洲自动检验的范围是所提交的开普勒档案测量。 | |
| 43 | + | |
| 44 | +独立复算可使用 Python、NumPy 2.5.5 和 Astropy 8.0.3。将 MAST 的 [TESS 第 40 区 FITS](https://archive.stsci.edu/hlsps/qlp/s0040/0000/0000/6312/6059/hlsp_qlp_tess_ffi_s0040-0000000063126059_tess_v01_llc.fits) 和[第 41 区 FITS](https://archive.stsci.edu/hlsps/qlp/s0041/0000/0000/6312/6059/hlsp_qlp_tess_ffi_s0041-0000000063126059_tess_v01_llc.fits) 分别保存为 `s0040.fits` 和 `s0041.fits`。在仓库根目录运行: | |
| 45 | + | |
| 46 | +```sh | |
| 47 | +python3 routes/galaxy-263-e92a0abca7/check_tess.py s0040.fits s0041.fits | |
| 48 | +``` | |
| 49 | + | |
| 50 | +## Next | |
| 51 | + | |
| 52 | +这条路线已完成 Issue #4 的档案观测和上述周期复查,交由维护者审阅。后续若测试其他周期,可使用尚未参与此次比较的 TESS 观测区做独立检验。 | |
+59 −0 routes/galaxy-263-e92a0abca7/check_tess.py added View file
| @@ -0,0 +1,59 @@ | ||
| 1 | +"""Fit a box-shaped dip in TESS sector 40 and evaluate it unchanged in sector 41.""" | |
| 2 | + | |
| 3 | +import argparse | |
| 4 | +import json | |
| 5 | +import sys | |
| 6 | +from pathlib import Path | |
| 7 | + | |
| 8 | +import numpy as np | |
| 9 | +from astropy.io import fits | |
| 10 | +from astropy.timeseries import BoxLeastSquares | |
| 11 | + | |
| 12 | +sys.path.insert(0, str(Path(__file__).resolve().parents[2])) | |
| 13 | +from verify import measure | |
| 14 | + | |
| 15 | + | |
| 16 | +def light_curve(path, sector): | |
| 17 | + with fits.open(path) as hdus: | |
| 18 | + header = hdus[0].header | |
| 19 | + if header["TICID"] != 63126059 or header["SECTOR"] != sector: | |
| 20 | + raise ValueError(f"Expected TIC 63126059, sector {sector}") | |
| 21 | + table = hdus[1].data | |
| 22 | + time = table["TIME"].astype(float) | |
| 23 | + flux = table["KSPSAP_FLUX"].astype(float) | |
| 24 | + good = (table["QUALITY"] == 0) & np.isfinite(time) & np.isfinite(flux) | |
| 25 | + return time[good], (flux[good] / np.median(flux[good]) - 1) * 1e6 | |
| 26 | + | |
| 27 | + | |
| 28 | +def strongest_candidate(time, flux): | |
| 29 | + model = BoxLeastSquares(time, flux) | |
| 30 | + best = None | |
| 31 | + for hours in (1, 2, 3, 4): | |
| 32 | + duration = hours / 24 | |
| 33 | + minimum_period = max(0.5, duration / 0.18) | |
| 34 | + periods = 1 / np.linspace(1 / minimum_period, 1 / 8, 20000) | |
| 35 | + fits_grid = model.power(periods, duration, objective="likelihood", oversample=10) | |
| 36 | + i = np.argmax(fits_grid.power) | |
| 37 | + if best is None or fits_grid.power[i] > best[0]: | |
| 38 | + best = (fits_grid.power[i], fits_grid.period[i], fits_grid.transit_time[i], hours) | |
| 39 | + _, period, epoch, hours = best | |
| 40 | + return float(period), float(epoch), hours | |
| 41 | + | |
| 42 | + | |
| 43 | +def main(): | |
| 44 | + parser = argparse.ArgumentParser(description=__doc__) | |
| 45 | + parser.add_argument("sector40", type=Path) | |
| 46 | + parser.add_argument("sector41", type=Path) | |
| 47 | + args = parser.parse_args() | |
| 48 | + train_time, train_flux = light_curve(args.sector40, 40) | |
| 49 | + period, epoch, hours = strongest_candidate(train_time, train_flux) | |
| 50 | + check_time, check_flux = light_curve(args.sector41, 41) | |
| 51 | + result = {"period_days": period, "epoch_btjd": epoch, "duration_hours": hours} | |
| 52 | + for sector, time, flux in [(40, train_time, train_flux), (41, check_time, check_flux)]: | |
| 53 | + stats = measure(list(zip(time, flux)), period, epoch, hours) | |
| 54 | + result[f"sector_{sector}"] = {"samples": len(time), "span_days": float(np.ptp(time)), **stats} | |
| 55 | + print(json.dumps(result, indent=2, allow_nan=False)) | |
| 56 | + | |
| 57 | + | |
| 58 | +if __name__ == "__main__": | |
| 59 | + main() | |
+1 −0 routes/galaxy-263-e92a0abca7/result.json added View file
| @@ -0,0 +1 @@ | ||
| 1 | +{"star": "KIC 8234059", "observation": {"samples": 221, "span_days": 4.842958, "median_flux_ppm": 0, "minima": [{"time_bkjd": 123.931101, "flux_ppm": -2288}, {"time_bkjd": 122.112438, "flux_ppm": -1685}, {"time_bkjd": 125.341077, "flux_ppm": -1631}]}} | |
+32 −0 routes/galaxy-263-e92a0abca7/solve.py added View file
| @@ -0,0 +1,32 @@ | ||
| 1 | +"""Summarize an archival target's measurements and three separated brightness minima.""" | |
| 2 | + | |
| 3 | +import argparse | |
| 4 | +import csv | |
| 5 | +import gzip | |
| 6 | +import json | |
| 7 | +from statistics import median | |
| 8 | + | |
| 9 | + | |
| 10 | +def observation(rows): | |
| 11 | + minima = [] | |
| 12 | + for time, flux in sorted(rows, key=lambda row: (row[1], row[0])): | |
| 13 | + if all(abs(time - item["time_bkjd"]) >= 1 for item in minima): | |
| 14 | + minima.append({"time_bkjd": time, "flux_ppm": flux}) | |
| 15 | + if len(minima) == 3: | |
| 16 | + break | |
| 17 | + return {"samples": len(rows), "span_days": round(rows[-1][0] - rows[0][0], 6), | |
| 18 | + "median_flux_ppm": median(row[1] for row in rows), "minima": minima} | |
| 19 | + | |
| 20 | + | |
| 21 | +def main(): | |
| 22 | + parser = argparse.ArgumentParser(description=__doc__) | |
| 23 | + parser.add_argument("star") | |
| 24 | + parser.add_argument("early_csv_gz") | |
| 25 | + args = parser.parse_args() | |
| 26 | + with gzip.open(args.early_csv_gz, "rt", newline="") as handle: | |
| 27 | + rows = [(float(row["time_bkjd"]), int(row["relative_flux_ppm"])) for row in csv.DictReader(handle)] | |
| 28 | + print(json.dumps({"star": args.star, "observation": observation(rows)})) | |
| 29 | + | |
| 30 | + | |
| 31 | +if __name__ == "__main__": | |
| 32 | + main() | |
