Skip to content

Fix default arguments and logging calls - #2

Merged
ctfle merged 1 commit into
mainfrom
fix/default-args-and-logging
Nov 7, 2026
Merged

ctfle merged 1 commit into
mainfrom
fix/default-args-and-logging

Conversation

@ctfle

@ctfle ctfle commented Nov 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • ClosedSystem / OpenSystem: config and data now default to None, and fresh TimeEvolutionConfig() / DataContainer() objects are created per instance. Before, ClosedSystem defaulted to the classes themselves and OpenSystem shared one instance of each across all runs.
  • DataContainer.config uses field(default_factory=DataConfig). The old default raises ValueError at import on Python 3.11+.
  • Conjugate gradient: the trace check was np.linalg.norm(np.trace(x) > 1e-16) (norm of a boolean); it now compares np.linalg.norm(np.trace(x)) to the threshold.
  • Two logger.info(...) calls passed arguments without a format placeholder; they now format correctly.
  • New tests/test_default_arguments.py checks the defaults are real instances and are not shared.

Test plan

  • tests/test_default_arguments.py, tests/config, tests/core/minimization: 54 passed (Python 3.11, OpenMPI).
  • New tests fail without the source changes (import error on 3.11).
  • tests/test_time_evolution.py and tests/test_lindbladian_evolution.py: ~130 tests passed with no failures before I stopped the run; not run to completion (slow).
  • CI has not run on this repo yet; the logging fix has no direct test.

Generated by Claude Code

- ClosedSystem/OpenSystem: default config and data are created per instance
  instead of using classes (ClosedSystem) or shared instances (OpenSystem).
- DataContainer: use default_factory for its DataConfig (required on
  Python >= 3.11, where the old default raised at import).
- Conjugate gradient: compare the trace to the threshold instead of
  taking the norm of a boolean.
- Fix logger calls that passed arguments without a format placeholder.
- Add tests for the default arguments.
@ctfle
ctfle merged commit e0fc20b into main Nov 7, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant