# Reproduce the two spectrum exercises

Unzip `materials.zip` into a new folder and run these commands inside it:

```sh
python3 calspec-tutorial.py
python3 spectrum-tutorial.py
```

Python 3.10 or later and its standard library are sufficient. The scripts find their accompanying inputs and write `reproduced/calspec-results.json` and `reproduced/tutorial-results.json`. Compare them with the two `expected-` JSON files. Both scripts accept `--data-dir <directory>` and `--output <file>`. The extracted folder contains everything used in this calculation.

The first exercise reads the pinned [CALSPEC Vega STIS v011 FITS](https://ssb.stsci.edu/trds/calspec/alpha_lyr_stis_011.fits), verifies its checksum, extracts 82 observed optical rows, and compares empirical profile/continuum choices. Its apparent centers and widths do not determine a precision radial velocity or an elemental abundance. The input includes the original FITS header and the separate excerpt provenance.

The second exercise reads a separate frozen synthetic spectrum with a known generating calibration. Its metadata names the seed, units, truth and checksum. The two records stay separate. The `--generate` option deliberately regenerates only the synthetic control; ordinary reproduction reads the saved input.

## 中文

解压后进入文件夹，依次运行上面的两条命令。只需 Python 3.10 及以上版本的标准库。结果写在 `reproduced/`，可与两个 `expected-` JSON 文件比较。两份脚本都接受 `--data-dir` 与 `--output`，解压目录保存了这次计算所需文件。

第一份读取固定版本的真实 CALSPEC FITS，检查校验和，截取八十二行光学观测，再比较线型和连续谱选择。结果只描述表观中心与宽度，不用于测精密径向速度或元素丰度。第二份读取独立的合成光谱，标定、种子与真值均保存在元数据里；默认重跑不会重新生成输入。
