# Lyman-alpha forest: independent scientific calculations

These are Python calculations, not a browser Engine or a static copy of the Lab.
The synthetic screen is original and prescribed. It does not evolve gas pressure,
reionization or dark matter. No original paper, FITS, author code or figures are
included. Fixed source versions and reading limits appear in the course sources.

Tested environment: Python3.12.12, NumPy2.3.5, SciPy1.17.1, Astropy7.1.1.
The exact versions are also recorded in input-manifest.json.

## 中文：先复算合成光谱

使用 Python 3.11 或更新版本、NumPy 与 SciPy。可在自己建立的虚拟环境安装依赖：

```sh
python -m pip install numpy scipy
python calculate.py --out synthetic-output
```

默认完全离线。脚本独立计算密度归一化、纯氢光电离平衡和完整 Voigt
积分，比较三条保存光谱，再把实空间积分从256格、每格8点细化至512格、
每格16点。输出每条实际光谱CSV和summary.json。输出目录必须尚不存在，
避免覆盖旧结果。合成例子固定红移三、8共动百万秒差距；平均透射率在
负500至正500千米每秒的601个样点上计算。特殊速度只改变频率映射，
不是这个指定密度场的连续性演化解。谱线可饱和，但电离背景的光学薄假设
须由中性柱检查；没有氦、碰撞电离、自屏蔽、仪器线扩散或压力历史。

## 中文：从固定SDSS文件重算

另需Astropy：`python -m pip install astropy`。可手动从input-manifest.json
的地址取得文件，或明确运行下面这一次下载：

```sh
python fetch_sdss.py --out spec-2068-53386-0316.fits
python sdss.py spec-2068-53386-0316.fits --out observed-output
```

下载只有一个GET，没有自动重试；TLS正常验证。长度必须2036160字节，
SHA-256须与清单相同。原FITS由SDSS另行提供，请遵守其数据使用与引用要求：
https://www.sdss4.org/collaboration/citing-sdss/
既有文件不会覆盖；失败的.partial保留用于诊断，不能当作通过准入的输入。

计算固定管线红移2.69456148147583，三个连续谱窗口1270–1290、
1315–1325、1340–1360埃，森林窗口1040–1180埃。窗口均为类星体静止系；
前景吸收体红移另按观测波长与1215.67埃计算。使用有限值、正逆方差及
AND掩码为零的像素；另做OR为零的对照。保留548个森林像素、166个连续谱
像素。均值约0.7461836；13个负值与109个大于一的比值不会截断。
输出像素表和全部统计；expected-observed.json给出固定预期。

这些是条件于幂律连续谱、对角像素噪声的统计。没有完整协方差、LSF、
金属/DLA/BAL识别或连续谱协方差，不是温度、压力尺度或暗物质质量测量。
手动的百分之五连续谱扰动不是一倍标准差。

## English: reproduce the synthetic screen

Use Python 3.11+, NumPy and SciPy. `calculate.py` is offline and independently
normalizes the prescribed field, solves pure-hydrogen equilibrium and integrates
the full Voigt function with SciPy. It calculates three velocity settings, checks
saved spectra, and refines 256-cell/eight-point quadrature to 512/sixteen.
Each spectrum CSV and a summary are written to a new output directory.

The screen is an original finite example at redshift three, eight comoving Mpc
wide. The mean uses 601 velocity samples from -500 to +500 km/s. Its linear-parent
peculiar velocity is not an evolved continuity solution for the exponential
screen. There is no helium, collisional ionization, self-shielding, instrumental
line spread or hydrodynamic pressure-history evolution. The neutral-column
ionizing-opacity check is distinct from potentially saturated Ly-alpha absorption.

## English: reproduce the observed exercise

Install Astropy as well. Fetch the original coadd separately with the explicit
optional command above, or supply a manually downloaded file matching the manifest.
The download makes one GET, checks normal TLS, fixed length and SHA-256, and never
retries or replaces an existing file. SDSS supplies the source FITS under its own
citation/data-use requirements; it is not part of this archive.

`sdss.py` reads the fixed plate2068/MJD53386/fibre316/run2d26 coadd. It uses pipeline
redshift2.69456148147583, inverse-variance weighted power-law continuum in the
three redward windows, and the1040–1180-angstrom forest window. Windows are in the
quasar rest frame; absorber redshifts differ. Baseline selects finite values,
positive inverse variance and AND-zero masks, with a separate OR-zero comparison.

Expected counts are166 continuum and548 forest pixels. Mean ratio is approximately
0.7461836, including13 negative and109 above-one values without clipping. Outputs
include the derived pixel table, conditional diagonal noise correction and chosen
continuum sensitivities. These are not cosmological confidence intervals. A full
LSF, covariance, contaminant treatment and continuum uncertainty are absent.

## Sources and notices

- Verner & Ferland1995v1, equation4 and hydrogen parameter row: radiative recombination.
- Tepper García2006v1, equations1–8: Voigt convention; full SciPy wofz is used.
- Peeples et al.0910.0256v3, targeted sections2–3: uniform opacity and pressure/thermal distinction.
- SDSS DR17 Spectroscopic Data Basics: vacuum heliocentric wavelength, flux/ivar and masks.
- Chen et al.2017 target table fixed object SDSSJ030335.42−002001.1 before flux analysis.
- Iršič et al.2607.19938v1 is a reading guide source. No simulation, template fit or Table2 value is reproduced by these scripts.

Original teaching code and synthetic examples: Sandbox Physics,2026. NumPy,
SciPy and Astropy are separate dependencies installed by the reader; none of
those libraries is bundled. The private source FITS and papers are not included.
