Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DID-python
Submodule DID-python added at 97ba45
1 change: 1 addition & 0 deletions NDI-compress-python
Submodule NDI-compress-python added at 0c05d9
1 change: 1 addition & 0 deletions NDI-matlab
Submodule NDI-matlab added at fc9967
58 changes: 58 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# NDI-python

A Python port of VH-Lab/NDI-matlab.

## Installation

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.):

```bash
pip install .
```

If you are installing for development (editable mode), use the `-e` flag (again, **note the dot `.` at the end**):

```bash
pip install -e .
```

## Usage

```python
import ndi
```

## Development

### Environment Setup

To set up the development environment, first create and activate a virtual environment:

```bash
python3 -m venv venv
source venv/bin/activate
```

### Dependency Installation

Install the package in editable mode, which will also install all dependencies:

```bash
pip install -e .
```

### Running Tests

To run the tests, use the following command:

```bash
python -m unittest discover tests
```

### Building Documentation

To build the documentation, use the following command:

```bash
mkdocs build
```
32 changes: 32 additions & 0 deletions docs/cache.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# ndi.cache

The `ndi.cache` module provides a simple in-memory cache for storing data.

## The `Cache` class

The `Cache` class is used to create a new cache object.

### `__init__(self, maxMemory=10e9, replacement_rule='fifo')`

Creates a new cache object.

* `maxMemory`: The maximum amount of memory (in bytes) that the cache can use.
* `replacement_rule`: The replacement rule to use when the cache is full. Can be `'fifo'`, `'lifo'`, or `'error'`.

### `add(self, key, type, data, priority=0)`

Adds an item to the cache.

* `key`: The key for the item.
* `type`: The type of the item.
* `data`: The data to be cached.
* `priority`: The priority of the item (higher priority items are less likely to be evicted).

### `lookup(self, key, type)`

Looks up an item in the cache.

* `key`: The key for the item.
* `type`: The type of the item.

Returns the cached item, or `None` if the item is not found.
9 changes: 9 additions & 0 deletions docs/file.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# File

This package contains classes for file I/O.

## Navigator

`ndi.file.Navigator(session, fileparameters=None, epochprobemap_class=None, epochprobemap_fileparameters=None)`

An object for accessing files on disk.
21 changes: 21 additions & 0 deletions docs/fun.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Fun

This package contains utility functions.

## timestamp

`ndi.fun.timestamp.timestamp()`

Returns a current time stamp string.

## name_to_variable_name

`ndi.fun.name_to_variable_name.name_to_variable_name(name)`

Converts a string into a camelCase variable name format.

## channel_name_to_prefix_number

`ndi.fun.channel_name_to_prefix_number.channel_name_to_prefix_number(channel_name)`

Identifies the prefix and number from a channel name string.
21 changes: 21 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Welcome to NDI-python

This is the documentation for the Python port of the VH-Lab/NDI-matlab project.

## Project Overview

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.

## Installation

To install the package, you can use pip:

```bash
pip install .
```

## Usage

```python
import ndi
```
6 changes: 6 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
site_name: NDI-python
nav:
- Home: index.md
- Cache: cache.md
- Fun: fun.md
- File: file.md
33 changes: 33 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "ndi"
version = "0.0.1"
authors = [
{ name="VH-Lab", email="info@vhlab.org" },
]
description = "A Python port of NDI-matlab"
readme = "README.md"
requires-python = ">=3.8"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
dependencies = [
"did @ git+https://github.com/VH-Lab/DID-python.git@main",
"mkdocs",
"pandas",
"requests",
"ndi-compress @ git+https://github.com/Waltham-Data-Science/NDI-compress-python",
"vhlab-newstim @ git+https://github.com/VH-Lab/vhlab-NewStim-python",
]

[project.urls]
"Homepage" = "https://github.com/VH-Lab/NDI-python"
"Bug Tracker" = "https://github.com/VH-Lab/NDI-python/issues"

[tool.hatch.metadata]
allow-direct-references = true
144 changes: 144 additions & 0 deletions site/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
<!DOCTYPE html>
<html lang="en" data-bs-theme="light">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">



<link rel="shortcut icon" href="/img/favicon.ico">
<title>NDI-python</title>
<link href="/css/bootstrap.min.css" rel="stylesheet">
<link href="/css/fontawesome.min.css" rel="stylesheet">
<link href="/css/brands.min.css" rel="stylesheet">
<link href="/css/solid.min.css" rel="stylesheet">
<link href="/css/v4-font-face.min.css" rel="stylesheet">
<link href="/css/base.css" rel="stylesheet">
<link id="hljs-light" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/styles/github.min.css" >
<link id="hljs-dark" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/styles/github-dark.min.css" disabled>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/highlight.min.js"></script>
<script>hljs.highlightAll();</script>
</head>

<body>
<div class="navbar fixed-top navbar-expand-lg navbar-dark bg-primary">
<div class="container">
<a class="navbar-brand" href="/.">NDI-python</a>
<!-- Expander button -->
<button type="button" class="navbar-toggler" data-bs-toggle="collapse" data-bs-target="#navbar-collapse" aria-controls="navbar-collapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>

<!-- Expanded navigation -->
<div id="navbar-collapse" class="navbar-collapse collapse">
<!-- Main navigation -->
<ul class="nav navbar-nav">
<li class="nav-item">
<a href="/." class="nav-link">Home</a>
</li>
<li class="nav-item">
<a href="/cache/" class="nav-link">Cache</a>
</li>
</ul>

<ul class="nav navbar-nav ms-md-auto">
<li class="nav-item">
<a href="#" class="nav-link" data-bs-toggle="modal" data-bs-target="#mkdocs_search_modal">
<i class="fa fa-search"></i> Search
</a>
</li>
</ul>
</div>
</div>
</div>

<div class="container">
<div class="row">

<div class="row-fluid">
<div id="main-content" class="span12">
<h1 id="404-page-not-found" style="text-align: center">404</h1>
<p style="text-align: center"><strong>Page not found</strong></p>
</div>
</div>


</div>
</div>

<footer class="col-md-12">
<hr>
<p>Documentation built with <a href="https://www.mkdocs.org/">MkDocs</a>.</p>
</footer>
<script src="/js/bootstrap.bundle.min.js"></script>
<script>
var base_url = "/",
shortcuts = {"help": 191, "next": 78, "previous": 80, "search": 83};
</script>
<script src="/js/base.js"></script>
<script src="/search/main.js"></script>

<div class="modal" id="mkdocs_search_modal" tabindex="-1" role="dialog" aria-labelledby="searchModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="searchModalLabel">Search</h4>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p>From here you can search these documents. Enter your search terms below.</p>
<form>
<div class="form-group">
<input type="search" class="form-control" placeholder="Search..." id="mkdocs-search-query" title="Type search term here">
</div>
</form>
<div id="mkdocs-search-results" data-no-results-text="No results found"></div>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div><div class="modal" id="mkdocs_keyboard_modal" tabindex="-1" role="dialog" aria-labelledby="keyboardModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="keyboardModalLabel">Keyboard Shortcuts</h4>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<table class="table">
<thead>
<tr>
<th style="width: 20%;">Keys</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr>
<td class="help shortcut"><kbd>?</kbd></td>
<td>Open this help</td>
</tr>
<tr>
<td class="next shortcut"><kbd>n</kbd></td>
<td>Next page</td>
</tr>
<tr>
<td class="prev shortcut"><kbd>p</kbd></td>
<td>Previous page</td>
</tr>
<tr>
<td class="search shortcut"><kbd>s</kbd></td>
<td>Search</td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>

</body>
</html>
Loading