Repository navigation
Fix default arguments and logging calls - #2
Merged
Merged
Conversation
- 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.
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.
Summary
ClosedSystem/OpenSystem:configanddatanow default toNone, and freshTimeEvolutionConfig()/DataContainer()objects are created per instance. Before,ClosedSystemdefaulted to the classes themselves andOpenSystemshared one instance of each across all runs.DataContainer.configusesfield(default_factory=DataConfig). The old default raisesValueErrorat import on Python 3.11+.np.linalg.norm(np.trace(x) > 1e-16)(norm of a boolean); it now comparesnp.linalg.norm(np.trace(x))to the threshold.logger.info(...)calls passed arguments without a format placeholder; they now format correctly.tests/test_default_arguments.pychecks 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).tests/test_time_evolution.pyandtests/test_lindbladian_evolution.py: ~130 tests passed with no failures before I stopped the run; not run to completion (slow).Generated by Claude Code