Cleanup - #38
Merged
Merged
Conversation
Subcycle assignment flips discretely at boundaries, so samples within floating-point noise of one are sensitive to the representation of the time axis (e.g. %.6e text round-trips). Warn with a relative, unit-free tolerance (boundary_eps, default 1e-6) scaled by elapsed subcycles.
Pre-1.0: no deprecation cycle, but a complete changelog, versioned schemas that refuse rather than misread, and patch/minor semantics. Post-1.0: deprecation cycle committed for the user API; the advanced tier is deferred to the planned API-tier guide (TODO road-item 3).
Pure pointer file (CLAUDE.md, TODO/PLAN conventions, design docs, docs/ai recipes) plus four stable quick facts, kept enumeration-free so it needs no maintenance. The complementary concern — orienting agents that *use* trspecfit for analysis — is captured as a new TODO item under "User and AI ergonomics".
Core workflow, YAML model syntax, naming/composition rules, and headless-use pitfalls in one fetchable file, served at the docs-site root via html_extra_path. AGENTS.md now routes usage-focused agents here. Bump version to 0.12.4.
Add pytest-xdist==3.8.0 to the dev pins and "-n auto --dist worksteal" to pytest addopts; tests/conftest.py pins BLAS/OpenMP to one thread per worker before numpy import (per-worker thread pools oversubscribed the machine, costing 2x wall time). Not-slow suite drops 72s -> 18s, full suite incl. slow runs in 4min wall. Pass -n 0 for a sequential run. Bump the CI uv pin alongside the dev pins, remove the superseded "fast verification slices" TODO item, and bump version to 0.12.5.
Apple Accelerate (numpy >= 2.0 macOS arm64 wheels) ignores OMP/OPENBLAS/MKL_NUM_THREADS; VECLIB_MAXIMUM_THREADS=1 closes the same oversubscription gap for parallel test runs on Apple Silicon.
Document the detection / noise_type / noise_level split precisely (pathway vs. distribution vs. amplitude, with per-type sigma formulas) and fix the stale absolute-units claim in set_noise_level. Add the Simulator.sigma_data property (constant sigma for analog gaussian simulations, aligned with the fit-side noise schema and File.set_sigma) and store it in saved HDF5 metadata — per config group in parameter sweeps, where it depends on each config's clean data. SweepDataset surfaces it separately from swept parameters. Bump version to 0.12.6.
lmfit.emcee(workers=N) built a default-context multiprocessing.Pool,
which fork()s on Linux before 3.14 — deprecated and deadlock-prone in
multithreaded processes. Hand lmfit a spawn-context pool instead
(matching the slice-by-slice executor) and drop the fork-warning
ignore from the pytest filters. The regression test records warnings
rather than escalating them: CPython emits the fork warning after the
fork succeeded and swallows filterwarnings("error"). Bump version
to 0.12.7.
Add tests/ to the pyright include set with an executionEnvironments entry: Optional-driven rules are off (File/Model attributes are `X | None` until a fit populates them, which tests access post-fit constantly), and the three residual rules are warnings so the ~25 real annotation gaps stay visible in editors without failing CI/pre-commit. Replaces the several-hundred-error Pylance noise; burn-down of the residual warnings is tracked in TODO.md.
Fix the 25 annotation gaps surfaced by type-checking tests: overload the spectra.fit_model_* functions (plot_sum=True returns ndarray, not ndarray | list) and File.load_model (model_type maps to the concrete Model subclass, so Dynamics/Profile methods type-check at call sites); narrow or cast the remaining test-side stub quirks (numpy .real on dtype[Any], pandas 3.0 __getitem__ unions, h5py group access). The three rules downgraded to warnings in the previous commit return to error severity.
create_model_path mkdir'd the {path_results}/{file}/{fit_type}/{model}/
tree as a side effect of computing the path, littering empty dir trees
even when auto_export=False and nothing was written. The method (renamed
File.model_path) now only builds the path; the write sites create their
own directory with mkdir(parents=True, exist_ok=True) — img_save covers
all figures (including sbs slices/), and the four CSV writers cover the
rest. The auto_export=False tests now assert the results tree does not
exist at all.
2026-07-13 scoping session: the disentangled writers already exist in fit_io (slot-based export); the legacy path survives only for the byte-for-byte auto-export layout, so the real work is the v1.0.0 layout/API decision. A 2D-only partial hoist was considered and declined. Recorded the three load-bearing decisions in the entry.
The mkdir-on-write change (0.12.10) missed the np.savetxt axis-sidecar writes in _save_2d_fit_legacy / _save_sbs_fit_legacy. File.fit_2d was unaffected (fit_wrapper's CSVs create the directory first), but Project.fit_2d's per-file save loop and save_2d_fit reach the savers with a fresh directory and raised FileNotFoundError on a clean tree (CI caught it; leftover local tests_fits/ dirs masked it). Create the directory at the top of each save_files branch, and add a fast regression test that exports through save_2d_fit into a fresh path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TODO quick-win burn-down: twelve independent small fixes, one per commit
(docs/agent orientation, test-suite parallelism, MCMC spawn pool, pyright
strictness for tests + warning burn-down, mkdir-on-write). Best reviewed
commit-by-commit — the unified diff mixes unrelated changes; each commit
message carries its own rationale. Version 0.12.0 → 0.12.10.