|
| 1 | +# PyAutoCTI — Agent Instructions |
| 2 | + |
| 3 | +Canonical, agent-agnostic instructions for this repo. `CLAUDE.md` imports this |
| 4 | +file; any tool that does not process `@`-imports should read this directly. |
| 5 | + |
| 6 | +## What this repo is |
| 7 | + |
| 8 | +**PyAutoCTI** (package `autocti`) is a Bayesian library for calibrating and |
| 9 | +modelling Charge Transfer Inefficiency (CTI) in CCD imaging: charge-injection |
| 10 | +imaging (`ImagingCI`) and 1D datasets (`Dataset1D`), trap/CCD models clocked |
| 11 | +through the C++ **arctic** code (`Clocker1D`/`Clocker2D` wrapping `arcticpy`), |
| 12 | +FPR/EPER extraction (`autocti/extract/`), and per-dataset `Fit*`/`Analysis*` |
| 13 | +classes. Heritage: Euclid VIS CTI calibration; also HST ACS |
| 14 | +(`autocti/instruments/acs`). |
| 15 | + |
| 16 | +Dependency direction: autocti may import **autoarray** (data structures), |
| 17 | +**autofit** (model-fitting), and **autoconf** (config). Nothing in the PyAuto |
| 18 | +stack imports autocti — it is a leaf like PyAutoLens. |
| 19 | + |
| 20 | +## Resurrection status (2026-07) |
| 21 | + |
| 22 | +This repo was unmaintained for ~2 years and is being brought back into the |
| 23 | +ecosystem via the CTI resurrection epic |
| 24 | +([PyAutoCTI#82](https://github.com/PyAutoLabs/PyAutoCTI/issues/82)). Phase 0 |
| 25 | +(importable + unit tests green on the current stack) is complete. **The |
| 26 | +visualization layer (`autocti/plot/`, `*/plot/*_plotters.py`, |
| 27 | +`*/model/plotter_interface.py`) is quarantined**: it still targets the removed |
| 28 | +autoarray Plotter API and is rewritten on the matplotlib function API |
| 29 | +(mirroring PyAutoGalaxy) in Phase 1. Until then `autocti.plot` is not |
| 30 | +importable, `Analysis` visualization no-ops with a logged warning, and the |
| 31 | +plot tests are skipped via `test_autocti/conftest.py`. |
| 32 | + |
| 33 | +## arcticpy (read before installing) |
| 34 | + |
| 35 | +`import autocti` requires **arcticpy** (pinned 2.6), which is deliberately not |
| 36 | +a pip dependency: |
| 37 | + |
| 38 | +- Its PyPI sdist is **source-only C++** — it needs `libgsl-dev` headers and a |
| 39 | + toolchain to build. |
| 40 | +- Its own requirements **downgrade numpy below 2.0**, breaking a modern stack. |
| 41 | + |
| 42 | +Install it after numpy is in place: |
| 43 | + |
| 44 | +```bash |
| 45 | +pip install arcticpy==2.6 --no-build-isolation --no-deps |
| 46 | +``` |
| 47 | + |
| 48 | +If GSL headers are missing and you lack root, extract them locally |
| 49 | +(`apt-get download libgsl-dev && dpkg -x ...`) and point `CPPFLAGS`/`LDFLAGS` |
| 50 | +at them. |
| 51 | + |
| 52 | +## Quick commands |
| 53 | + |
| 54 | +```bash |
| 55 | +pip install -e ".[dev]" # install with dev/test extras |
| 56 | +python -m pytest test_autocti/ # full test suite |
| 57 | +python -m pytest test_autocti/extract/ # one focused directory |
| 58 | +``` |
| 59 | + |
| 60 | +In a sandboxed / restricted environment, point numba and matplotlib at |
| 61 | +writable caches: |
| 62 | + |
| 63 | +```bash |
| 64 | +NUMBA_CACHE_DIR=/tmp/numba_cache MPLCONFIGDIR=/tmp/matplotlib python -m pytest test_autocti/ |
| 65 | +``` |
| 66 | + |
| 67 | +## Related repos |
| 68 | + |
| 69 | +- **Source siblings:** PyAutoConf, PyAutoArray, PyAutoFit (upstream). |
| 70 | +- **autocti_workspace** — runnable examples/tutorials (updated in epic Phase 4). |
| 71 | +- **autocti_workspace_test** — regression scripts + Euclid tvac/temporal |
| 72 | + heritage (rebuilt in epic Phase 5). |
| 73 | +- **Science context:** `PyAutoMemory/wiki/cti/` (trap physics, arctic |
| 74 | + algorithm, Euclid VIS / HST ACS heritage). |
| 75 | + |
| 76 | +## Public API |
| 77 | + |
| 78 | +The public surface is defined authoritatively in `autocti/__init__.py` — read |
| 79 | +it rather than trusting a hand-maintained table. Canonical import: |
| 80 | + |
| 81 | +```python |
| 82 | +import autocti as ac |
| 83 | +``` |
| 84 | + |
| 85 | +## Key rules / footguns |
| 86 | + |
| 87 | +- Import direction: autoarray / autofit / autoconf only — never autogalaxy or |
| 88 | + autolens. |
| 89 | +- Unit tests are numpy-only; there is no JAX in this library (arctic is C++). |
| 90 | +- Slicing an autoarray `Mask2D` returns a plain ndarray — rebuild a `Mask2D` |
| 91 | + with the parent's `pixel_scales` before constructing an `Array2D` from it |
| 92 | + (see `autocti/extract/two_d/abstract.py`). |
| 93 | +- Fits I/O goes through `autoconf.fitsable` (`ndarray_via_fits_from`, |
| 94 | + `output_to_fits`, `hdu_list_for_output_from`) — instance `.output_to_fits` |
| 95 | + methods no longer exist on autoarray structures. |
| 96 | +- All files use Unix line endings (LF, `\n`) — never `\r\n`. |
| 97 | + |
| 98 | +## Working on issues |
| 99 | + |
| 100 | +1. Read the issue description and any linked plan. |
| 101 | +2. Identify affected files and make the change. |
| 102 | +3. Run the full suite: `python -m pytest test_autocti/`. |
| 103 | +4. If you changed public API, say so explicitly — autocti_workspace may need |
| 104 | + updates. |
| 105 | +5. Ensure all tests pass before opening a PR. |
| 106 | + |
| 107 | +## Never rewrite history |
| 108 | + |
| 109 | +Never rewrite pushed history on any repo with a remote — no `git init` over a |
| 110 | +tracked repo, no force-push to `main`, no fresh-start "Initial commit", no |
| 111 | +`filter-repo` / `filter-branch` / `rebase -i` on pushed branches. To get a |
| 112 | +clean tree: `git fetch origin && git reset --hard origin/main && git clean -fd`. |
0 commit comments