Skip to content

Comments

Feature/substrate modeler#138

Open
ajbailey4 wants to merge 8 commits intowmayner:developfrom
ajbailey4:feature/substrate_modeler
Open

Feature/substrate modeler#138
ajbailey4 wants to merge 8 commits intowmayner:developfrom
ajbailey4:feature/substrate_modeler

Conversation

@ajbailey4
Copy link
Contributor

Adds substrate modeler capability into pyphi with several major changes:

  • makes substrates stateless, which resolves reliance on side effects in many methods
  • makes substrate unit state ints instead of either ints or tuples
  • Removes BaseUnit class
  • Adds create_substrate method

ajbailey4 and others added 8 commits February 13, 2026 14:46
Make Unit, CompositeUnit, and Substrate stateless: state is now passed
explicitly to compute_tpm(), network(), and subsystem() rather than
stored as mutable instance attributes. This eliminates side effects
from TPM computation and makes the API safer for concurrent use.

- Replace BaseUnit/Unit/TPMDict with stateless Unit, CompositeUnit,
  and TPMCache
- Update unit function signatures to accept (unit, state, input_state)
  explicitly instead of reading state from the unit
- Remove System class and visualization methods from Substrate
- Remove state/input_state properties and setters

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add type annotations to mechanism_combinations functions and registry
- Fix utils.py to use relative import instead of top-level pyphi import
- Add public API exports to __init__.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Test Unit construction, equality, hashing, state-independent and
state-dependent mechanisms, TPM caching, CompositeUnit, Substrate
construction, TPM computation, connectivity matrix, network/subsystem
creation, serialization, and an end-to-end integration test.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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