Contributing and development ============================ Setup ----- .. code-block:: bash git clone git@github.com:schmidt-observatories/lfast-etc.git && cd lfast-etc python -m venv .venv && source .venv/bin/activate pip install -e ".[web,docs,dev]" pytest -q Layout ------ .. code-block:: text src/lfast_etc/ etc.py (LFASTETC, ETCResult), source.py, telescope.py, instrument.py, sky.py, plotting.py src/lfast_etc/data/ throughput/*.npy (Choi et al. 2026), sky/*.fits (SkyCalc), config/*.toml (presets) src/lfast_etc/web/ Flask + Bokeh browser ETC and its template scripts/ build_bench_presets.py, build_notebooks.py (01-05), build_science_notebooks.py (06-10) notebooks/ executed notebooks (outputs committed) tests/ pytest; reference_notebook.py is the verbatim regression oracle docs/ this Sphinx site Tests ----- ``tests/test_etc.py::test_regression_against_reference_notebook`` compares the package with a verbatim port of the reference LFAST ETC notebook (2026-10-12) to 1e-6. Any change to the physics must either keep that test passing or change the oracle on purpose, with the reason in the commit message. Every bug fix comes with the reproduction as a test. Notebooks --------- The ``.ipynb`` files are generated. Edit the cell lists in ``scripts/build_notebooks.py`` (01-05) or ``scripts/build_science_notebooks.py`` (06-10), then .. code-block:: bash python scripts/build_notebooks.py # all of 01-05, about 20 s python scripts/build_notebooks.py 01_quickstart # one of them python scripts/build_science_notebooks.py # 06-10, a few minutes and commit the executed notebooks. The science builder writes PDF figures into ``../memo/figures`` only when that directory exists. To confirm nothing errored: .. code-block:: bash python - <<'EOF' import json, glob for p in sorted(glob.glob("notebooks/*.ipynb")): nb = json.load(open(p)) errs = [o["ename"] for c in nb["cells"] if c["cell_type"] == "code" for o in c.get("outputs", []) if o.get("output_type") == "error"] print(p, errs or "ok") EOF Presets ------- ``bench_r1800`` is hand-written; the other ``bench_*`` presets are generated by ``scripts/build_bench_presets.py`` from the WIYN table and must be regenerated, not edited, when the anchor changes. CSHELL presets are hand-written. Documentation ------------- .. code-block:: bash cd docs && sphinx-build -W --keep-going -b html . _build/html # needs pandoc on PATH Figures on these pages come from ``.. plot::`` directives and are regenerated on every build; the preset table is written to ``docs/_generated/presets.rst`` by ``conf.py``. The notebooks are copied in from ``../notebooks`` and rendered without execution. CI builds the site with warnings as errors. Issues ------ Bugs and features are tracked on GitHub with the labels ``bug``, ``enhancement``, ``physics``, ``plotting``, ``web``, ``notebooks``, ``ci`` and ``priority: high/medium/low``. The open physics issues (fiber-image height for :math:`n_{pix}`, seeing dependence, sky tables, telluric handling, placeholder instrument numbers) are the ones that change the numbers; start there. Commit style ------------ Short imperative subject, body only when the reason is not obvious from the diff. Commits and pull requests are read by external collaborators. Releasing --------- Bump ``version`` in ``pyproject.toml``, merge, then tag the merge commit and push the tag:: git tag v0.1.0 && git push origin v0.1.0 The ``Publish`` workflow builds the sdist and wheel, checks that the tag matches the pyproject version, and uploads to PyPI through trusted publishing (no API token). The ``pypi`` GitHub environment and the PyPI trusted publisher must exist for this to work.