Simulator for the Cortical Labs cl API
Project description
Cortical Labs Mock API
*** EARLY ACCESS RELEASE ***
This package provides a mock cl API to assist with local development of applications that can run on a Cortical Labs CL1 system.
The following key features are implemented:
- Simulation of spikes and waveforms
- Stimulation (
neurons.stim(...),neurons.create_stim_plan()) - Time based code execution (
neurons.loop(...)) - Recording (
neurons.record(...))
Planned for future versions:
- Real-time visualisation of live data
Installation
Use of a venv is recommended:
$ python3 -m venv .venv
$ source .venv/bin/activate
$ pip3 install cl-sdk
Cortical Labs Developer Guide
The mock API is capable of running most of the Jupyter notebooks in our developer guide. Install cl-sdk as above, then:
$ git clone https://github.com/Cortical-Labs/cl-api-doc.git
From here you can open and run the *.ipynb notebooks directly in Visual Studio Code, or by installing and running Jupyter Lab:
$ pip3 install jupyterlab
$ jupyter lab cl-api-doc
Development
For working on the simulator itself:
$ pip3 install -e .
Running Tests
$ pip3 install -e '.[test]'
$ pytest
Needs Fixing
Loop timing
Currently, loop ticks will read the requisite number of frames. When using wall clock mode, this will block for the actual duration of the tick, which may cause a jitter error to be thrown as it leaves very little margin for executing the user's code for each tick.
User Options
Several user options can be set by defining environment variables in a .env file of your project directory.
Simulation from a recording
The Mock API simulates spikes and samples by replaying recordings as set by the CL_MOCK_REPLAY_PATH environment variable in the .env file. If this is omitted, a temporary recording with randomly generated samples and spikes will be used that is based on a Poisson distribution and the following optional environment variables:
CL_MOCK_SAMPLE_MEAN: Mean samples value (default 170). This value will be in microvolts when multiplied by the constant "uV_per_sample_unit" in the recording attributes;CL_MOCK_SPIKE_PERCENTILE: Percentile threshold for sample values, above which will correspond to a spike (default 99.995);CL_MOCK_DURATION_SEC: Duration of the temporary recording (default 60); andCL_MOCK_RANDOM_SEED: Random seed (defaults to Unix time).
Speed of simulation
The Mock API can operate in two timing modes:
- Based on wall clock time (default), or
- Accelerated time.
Accelerated time mode can be enabled by setting CL_MOCK_ACCELERATED_TIME=1 environment variable in the .env file. When enabled, passage of time will be decouple from the system wall clock time, enabling accelerated testing of applications.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cl_sdk-0.1.0.tar.gz.
File metadata
- Download URL: cl_sdk-0.1.0.tar.gz
- Upload date:
- Size: 37.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cfb5625eacd4c681a067e7d2c0f4aa6d8c306363e5e1bc63905be27b5ab7139e
|
|
| MD5 |
d9b3c829394f5b889e4d28b76b8c46ac
|
|
| BLAKE2b-256 |
d679d6a7b747868d10ccfa992ee82f1877423da702f68b1a12c9da6b6b2c3890
|
File details
Details for the file cl_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cl_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 35.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f83a3b9a8b651a83bfbd561176f6ae025a1abc17e0452cc404bf92c162506b0c
|
|
| MD5 |
26249ae61be5b4716df3a49ede6ab9f9
|
|
| BLAKE2b-256 |
c999b3e0447699620abcd24260c2e70c432a96c48f03f8e21809bdef1d533081
|