Skip to content

Commit c3b302a

Browse files
Merge pull request #1 from VH-Lab/ndi-python-port
Port `ndi.app` and `ndi.probe.timeseries` classes
2 parents c3f1595 + ba4216c commit c3b302a

169 files changed

Lines changed: 10021 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

DID-python

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 97ba45ccd02a8d8070395a48e5a80e691414253a

NDI-compress-python

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 0c05d9dbd63ed5d15866eb1bf0a096568ef0c192

NDI-matlab

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit fc99679a3572881a56c5ae4738bbdaab73fb46fb

README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# NDI-python
2+
3+
A Python port of VH-Lab/NDI-matlab.
4+
5+
## Installation
6+
7+
To install the package, run the following command in the root directory. **Note the dot `.` at the end**, which tells pip to install from the current directory. This will automatically install all required dependencies (including `did`, `ndi-compress`, etc.):
8+
9+
```bash
10+
pip install .
11+
```
12+
13+
If you are installing for development (editable mode), use the `-e` flag (again, **note the dot `.` at the end**):
14+
15+
```bash
16+
pip install -e .
17+
```
18+
19+
## Usage
20+
21+
```python
22+
import ndi
23+
```
24+
25+
## Development
26+
27+
### Environment Setup
28+
29+
To set up the development environment, first create and activate a virtual environment:
30+
31+
```bash
32+
python3 -m venv venv
33+
source venv/bin/activate
34+
```
35+
36+
### Dependency Installation
37+
38+
Install the package in editable mode, which will also install all dependencies:
39+
40+
```bash
41+
pip install -e .
42+
```
43+
44+
### Running Tests
45+
46+
To run the tests, use the following command:
47+
48+
```bash
49+
python -m unittest discover tests
50+
```
51+
52+
### Building Documentation
53+
54+
To build the documentation, use the following command:
55+
56+
```bash
57+
mkdocs build
58+
```

docs/cache.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# ndi.cache
2+
3+
The `ndi.cache` module provides a simple in-memory cache for storing data.
4+
5+
## The `Cache` class
6+
7+
The `Cache` class is used to create a new cache object.
8+
9+
### `__init__(self, maxMemory=10e9, replacement_rule='fifo')`
10+
11+
Creates a new cache object.
12+
13+
* `maxMemory`: The maximum amount of memory (in bytes) that the cache can use.
14+
* `replacement_rule`: The replacement rule to use when the cache is full. Can be `'fifo'`, `'lifo'`, or `'error'`.
15+
16+
### `add(self, key, type, data, priority=0)`
17+
18+
Adds an item to the cache.
19+
20+
* `key`: The key for the item.
21+
* `type`: The type of the item.
22+
* `data`: The data to be cached.
23+
* `priority`: The priority of the item (higher priority items are less likely to be evicted).
24+
25+
### `lookup(self, key, type)`
26+
27+
Looks up an item in the cache.
28+
29+
* `key`: The key for the item.
30+
* `type`: The type of the item.
31+
32+
Returns the cached item, or `None` if the item is not found.

docs/file.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# File
2+
3+
This package contains classes for file I/O.
4+
5+
## Navigator
6+
7+
`ndi.file.Navigator(session, fileparameters=None, epochprobemap_class=None, epochprobemap_fileparameters=None)`
8+
9+
An object for accessing files on disk.

docs/fun.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Fun
2+
3+
This package contains utility functions.
4+
5+
## timestamp
6+
7+
`ndi.fun.timestamp.timestamp()`
8+
9+
Returns a current time stamp string.
10+
11+
## name_to_variable_name
12+
13+
`ndi.fun.name_to_variable_name.name_to_variable_name(name)`
14+
15+
Converts a string into a camelCase variable name format.
16+
17+
## channel_name_to_prefix_number
18+
19+
`ndi.fun.channel_name_to_prefix_number.channel_name_to_prefix_number(channel_name)`
20+
21+
Identifies the prefix and number from a channel name string.

docs/index.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Welcome to NDI-python
2+
3+
This is the documentation for the Python port of the VH-Lab/NDI-matlab project.
4+
5+
## Project Overview
6+
7+
NDI-python is a Python library for interacting with the Neuroscience Data Interface (NDI). It provides a set of tools for managing and analyzing neuroscience data.
8+
9+
## Installation
10+
11+
To install the package, you can use pip:
12+
13+
```bash
14+
pip install .
15+
```
16+
17+
## Usage
18+
19+
```python
20+
import ndi
21+
```

mkdocs.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
site_name: NDI-python
2+
nav:
3+
- Home: index.md
4+
- Cache: cache.md
5+
- Fun: fun.md
6+
- File: file.md

pyproject.toml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "ndi"
7+
version = "0.0.1"
8+
authors = [
9+
{ name="VH-Lab", email="info@vhlab.org" },
10+
]
11+
description = "A Python port of NDI-matlab"
12+
readme = "README.md"
13+
requires-python = ">=3.8"
14+
classifiers = [
15+
"Programming Language :: Python :: 3",
16+
"License :: OSI Approved :: MIT License",
17+
"Operating System :: OS Independent",
18+
]
19+
dependencies = [
20+
"did @ git+https://github.com/VH-Lab/DID-python.git@main",
21+
"mkdocs",
22+
"pandas",
23+
"requests",
24+
"ndi-compress @ git+https://github.com/Waltham-Data-Science/NDI-compress-python",
25+
"vhlab-newstim @ git+https://github.com/VH-Lab/vhlab-NewStim-python",
26+
]
27+
28+
[project.urls]
29+
"Homepage" = "https://github.com/VH-Lab/NDI-python"
30+
"Bug Tracker" = "https://github.com/VH-Lab/NDI-python/issues"
31+
32+
[tool.hatch.metadata]
33+
allow-direct-references = true

0 commit comments

Comments
 (0)