Skip to content

Add MATLAB-Python bridge contracts for epoch and common namespaces#24

Merged
stevevanhooser merged 1 commit into
mainfrom
claude/create-ndi-bridge-files-SGIO6
Mar 12, 2026
Merged

Add MATLAB-Python bridge contracts for epoch and common namespaces#24
stevevanhooser merged 1 commit into
mainfrom
claude/create-ndi-bridge-files-SGIO6

Conversation

@stevevanhooser

Copy link
Copy Markdown
Contributor

Summary

This PR introduces formal MATLAB-Python bridge contracts via YAML specification files for the ndi.epoch and ndi.common namespaces. These contracts document the API mapping between MATLAB and Python implementations, establishing clear naming policies, indexing conventions, and design decisions for cross-language compatibility.

Key Changes

  • Added src/ndi/epoch/ndi_matlab_python_bridge.yaml: Comprehensive bridge contract for the epoch namespace covering:

    • 6 standalone functions (epochrange, findepochnode, is_epoch_or_empty, parse_devicestring, build_devicestring)
    • 4 classes: epochset (abstract base), epoch, epochprobemap, and epochprobemap_daqsystem
    • Detailed method signatures, type mappings, and decision logs explaining divergences
    • Semantic parity indexing policy: 1-based for user-facing concepts, 0-based for internal data access
  • Added src/ndi/common/ndi_matlab_python_bridge.yaml: Bridge contract for the common namespace covering:

    • 4 standalone functions (timestamp, getLogger, getCache, getDatabaseHierarchy, assertDIDInstalled)
    • 1 class: PathConstants with class properties and configuration methods
    • Type mappings and design rationale for each API element
  • Removed deprecated get_logger alias: Cleaned up backwards compatibility wrapper in src/ndi/common/__init__.py and updated imports in src/ndi/__init__.py to use only the canonical getLogger function name

Notable Implementation Details

  • Bridge contracts establish "Strict MATLAB Mirror" naming policy while allowing Python-idiomatic implementations (e.g., immutable tuples instead of cell arrays, pathlib.Path instead of char arrays)
  • Indexing policy explicitly documents the intentional divergence in findepochnode: MATLAB returns 1-based indices for user concepts, Python returns 0-based indices for internal array access
  • Extracted utility functions (parse_devicestring, build_devicestring) are documented as Python-specific refactorings of inline MATLAB logic
  • All abstract methods, properties, and computed properties are explicitly documented with their Python equivalents

https://claude.ai/code/session_012G5yTp2wY8NwPHZzNbbahD

…gger alias

Create ndi_matlab_python_bridge.yaml contracts for the ndi.epoch and
ndi.common namespaces, documenting all classes, methods, properties,
and standalone functions with their MATLAB-Python type mappings.
Remove the backwards-compat get_logger alias in favor of the
MATLAB-mirrored getLogger per Strict Naming policy.

https://claude.ai/code/session_012G5yTp2wY8NwPHZzNbbahD
@stevevanhooser stevevanhooser merged commit d371eda into main Mar 12, 2026
4 checks passed
@stevevanhooser stevevanhooser deleted the claude/create-ndi-bridge-files-SGIO6 branch March 14, 2026 16:32
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.

2 participants