Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 26 additions & 19 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
- Requires Python >= 3.9
- Package name: `autofit`

## Dependency Graph

PyAutoFit depends on **autoconf** (shared configuration and utilities).
PyAutoFit does **NOT** depend on PyAutoArray, PyAutoGalaxy, or PyAutoLens.
Never import from `autoarray`, `autogalaxy`, or `autolens` in this repo.
Shared utilities (e.g. `test_mode`, `jax_wrapper`) belong in autoconf.

## Repository Structure

- `autofit/` - Main package
Expand Down Expand Up @@ -38,25 +45,25 @@
- `anesthetic==2.8.14` - Posterior analysis/plotting
- Optional: `nautilus-sampler`, `ultranest`, `zeus-mcmc`, `getdist`

## Running Tests

```
pytest test_autofit
pytest test_autofit/non_linear
pytest test_autofit/mapper
```

## Codex / sandboxed runs

When running Python from Codex or any restricted environment, set writable cache directories so `numba` and `matplotlib` do not fail on unwritable home or source-tree paths:

```bash
NUMBA_CACHE_DIR=/tmp/numba_cache MPLCONFIGDIR=/tmp/matplotlib pytest test_autofit
```

This workspace is often imported from `/mnt/c/...` and Codex may not be able to write to module `__pycache__` directories or `/home/jammy/.cache`, which can cause import-time `numba` caching failures without this override.

## Shell Commands
## Running Tests
```
pytest test_autofit
pytest test_autofit/non_linear
pytest test_autofit/mapper
```
## Codex / sandboxed runs
When running Python from Codex or any restricted environment, set writable cache directories so `numba` and `matplotlib` do not fail on unwritable home or source-tree paths:
```bash
NUMBA_CACHE_DIR=/tmp/numba_cache MPLCONFIGDIR=/tmp/matplotlib pytest test_autofit
```
This workspace is often imported from `/mnt/c/...` and Codex may not be able to write to module `__pycache__` directories or `/home/jammy/.cache`, which can cause import-time `numba` caching failures without this override.
## Shell Commands

- Prefer simple shell commands
- Avoid chaining with `&&` or pipes; run commands separately
Expand Down
21 changes: 2 additions & 19 deletions autofit/non_linear/test_mode.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
import os
from autoconf.test_mode import test_mode_level, is_test_mode


def test_mode_level():
"""
Return the current test mode level.

0 = off (normal operation)
1 = reduce sampler iterations to minimum (existing behavior)
2 = bypass sampler entirely, call likelihood once
3 = bypass sampler entirely, skip likelihood call
"""
return int(os.environ.get("PYAUTOFIT_TEST_MODE", "0"))


def is_test_mode():
"""
Return True if any test mode is active.
"""
return test_mode_level() > 0
__all__ = ["test_mode_level", "is_test_mode"]
Loading