# Reproduce the frozen TESS photometry

Unzip `materials.zip` into a new folder and run this command inside that folder:

```sh
python3 extract-lightcurve.py
```

Python 3.10 or later and its standard library are sufficient. The script finds the accompanying JSON input and writes `reproduced/tess-aperture-lightcurve.csv` and `reproduced/summary.json`. Compare these with `expected-lightcurve.csv` and `expected-summary.json`. Use `--input <file> --out <directory>` to select other paths. The extracted folder contains everything used in this calculation.

The input retains 57 measured TESS pixel frames for TIC 25155310, sector 1, their errors, quality flags and aperture mask. Forty-six rows pass the stated quality/finite-value policy. The SHA-256 and original SPOC product provenance are inside the input. `FLUX` already has the background removed; the deliberately wrong double-subtraction column is a comparison, not the reported flux. The sparse selection supports an extraction exercise, not a transit measurement or survey completeness estimate.

Source: [MAST TESS product documentation](https://spacetelescope.github.io/mast_notebooks/notebooks/TESS/beginner_how_to_use_tp/beginner_how_to_use_tp.html). The exact source filename, release 42, SPOC processing version and source checksum accompany the measured input.

## 中文

解压后进入文件夹，运行 `python3 extract-lightcurve.py`。只需 Python 3.10 及以上版本的标准库。脚本自动读取同目录的固定输入，在 `reproduced/` 写出光变 CSV 和汇总 JSON；可与文件包中的 `expected-` 文件比较。换路径时使用 `--input` 和 `--out`。解压目录保存了这次计算所需文件。

输入保存了五十七帧真实 TESS 像素、误差、质量标记和孔径掩膜，其中四十六帧通过所述筛选。原始产品已经扣除了背景。错误的二次扣背景列仅用于比较。这个稀疏片段用于练习提取，不用于测凌日参数或巡天完备性。

Optional raw-FITS refresh uses the accompanying `freeze-tess.py <source.fits> --output refrozen.json` and additionally requires Astropy (the original extraction used 6.0.1). It checks the pinned original FITS hash before extracting rows. The ordinary frozen-data exercise above needs no Astropy.
