Add MATLAB API compatibility aliases for file, session, and dataset modules#17
Merged
Merged
Conversation
…ndi.session.dir
Three changes to match MATLAB behavior:
1. ndi.cloud.downloadDataset now creates target/{cloudDatasetId} subdirectory,
matching the MATLAB implementation where the actual download path includes
the cloud dataset ID.
2. Convert ndi/dataset.py to a package (ndi/dataset/) and expose
ndi.dataset.dir as an alias for Dataset, so ndi.dataset.dir(path) works
as a constructor just like in MATLAB.
3. Add ndi.session.dir = DirSession so ndi.session.dir(ref, path) works
as a constructor matching MATLAB's ndi.session.dir.
https://claude.ai/code/session_01SPLxWdyCaZ5VH8EUMneuJ3
Apply the same porting guide pattern used for ndi.dataset.dir and ndi.session.dir to the ndi.file namespace: - ndi.file.navigator(...) -> FileNavigator constructor - ndi.file.navigator_epochdir(...) -> EpochDirNavigator constructor - ndi.file.pfilemirror(...) -> pfilemirror function - ndi.file.type.mfdaq_epoch_channel(...) -> MFDAQEpochChannel constructor All existing import paths (from ndi.file.navigator import FileNavigator, etc.) continue to work unchanged. ndi.common has no MATLAB equivalent namespace so no changes needed. Updated MATLAB_MAPPING.md to document the new callable aliases. https://claude.ai/code/session_01SPLxWdyCaZ5VH8EUMneuJ3
…atabaseHierarchy, assertDIDInstalled Port the full ndi.common MATLAB namespace to Python: - getLogger(name) - renamed from get_logger to match MATLAB; old name kept for backwards compatibility - getCache() - returns singleton ndi.Cache instance, matching MATLAB's persistent cache pattern - getDatabaseHierarchy() - reads document definitions from ndi_common and returns cached type hierarchy dict - assertDIDInstalled() - raises ImportError if the did package is missing Also export ndi.common as a submodule from ndi/__init__.py so ndi.common.X is accessible after `import ndi`. Updated MATLAB_MAPPING.md with the new ndi.common section. https://claude.ai/code/session_01SPLxWdyCaZ5VH8EUMneuJ3
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
This PR adds MATLAB-compatible function and class aliases to improve API consistency between the Python and MATLAB implementations of NDI. Users can now call Python functions using the same naming conventions as MATLAB (e.g.,
ndi.file.navigator()instead ofndi.file.FileNavigator()).Key Changes
File module (
ndi.file): Added aliases for MATLAB-style constructors:navigator→FileNavigatornavigator_epochdir→EpochDirNavigatorpfilemirror→ pfilemirror functionFile type module (
ndi.file.type): Added alias:mfdaq_epoch_channel→MFDAQEpochChannelSession module (
ndi.session): Added alias:dir→DirSessionDataset module (
ndi.dataset):__init__.pywith MATLAB-compatible APIdiralias →Dataset_dataset.py(changed relative imports from.to..)Documentation: Updated
MATLAB_MAPPING.mdto reflect the new aliases and clarify that both MATLAB-style and Python-style names are supportedCloud orchestration: Fixed
downloadDataset()to create target directory astarget_folder / cloud_dataset_id, matching MATLAB behaviorImplementation Details
All aliases are implemented as simple assignments (e.g.,
navigator = FileNavigator) rather than wrapper functions, ensuring zero overhead and maintaining full compatibility with the underlying classes. The aliases are properly exported in__all__lists for discoverability.https://claude.ai/code/session_01SPLxWdyCaZ5VH8EUMneuJ3