Python interface for NeuLog sensors with real-time visualization
Project description
NeuLogPy
A Python interface for NeuLog sensors, providing easy-to-use functions for data collection, experiment management, and real-time visualization. This package simplifies the process of collecting and analyzing data from NeuLog sensors in educational and research settings.
Features
- Simple and intuitive interface for NeuLog sensors
- Real-time data collection and visualization
- Configurable sampling rates (up to 100 Hz)
- Support for multiple concurrent sensors
- Automatic sensor discovery and configuration
- Robust error handling and detailed logging
- Interactive respiratory data visualization with DearPyGui
- YAML-based sensor configuration
- Comprehensive experiment management
- Built-in data export capabilities
Installation
pip install NeuLogPy
Quick Start
Basic Data Collection
from NeuLogPy import NeuLog
import time
# Initialize NeuLog
neulog = NeuLog(config_file="config/sensors.yaml")
# Setup experiment parameters
sensor_name = "Respiration"
rate = 8 # 8 Hz sampling rate
samples = 1000 # Number of samples to collect
respiration_sensor = [(sensor_name, 1)] # Sensor name and ID
# Start experiment
neulog.start_experiment(sensors=respiration_sensor, rate=rate, samples=samples)
# Wait for data collection
time_to_wait = samples / rate
time.sleep(time_to_wait)
# Get samples
samples = neulog.experiment.get_samples()
if samples:
print(f"Collected {len(samples)} samples")
# Access data for specific sensor
sensor_data = samples.get(sensor_name, [])
# Stop experiment
neulog.experiment.stop()
Advanced Usage
from NeuLogPy import NeuLog
# Initialize with custom logging level
neulog = NeuLog(config_file="config/sensors.yaml", log_level="DEBUG")
# Configure multiple sensors
sensors = [
("Respiration", 1),
("Temperature", 2)
]
# Start continuous experiment
neulog.start_experiment(
sensors=sensors,
rate=100, # 100 Hz sampling
samples=0 # 0 means continuous sampling
)
# Get real-time data
while True:
try:
latest_samples = neulog.experiment.get_samples()
# Process your data here
if latest_samples:
resp_data = latest_samples.get("Respiration", [])
temp_data = latest_samples.get("Temperature", [])
except KeyboardInterrupt:
break
# Clean up
neulog.experiment.stop()
Real-time Visualization
The package includes a built-in visualization tool for respiratory data:
# Run from command line
neulog-respiratory-viz
Or in your Python code:
from NeuLogPy.respiratory_visualization import RespiratoryVisualizer
# Create and run visualizer
app = RespiratoryVisualizer()
app.setup_gui()
app.run()
The visualization provides:
- Real-time plotting of respiratory data
- Adjustable time window (default: 60 seconds)
- Auto-scaling axes
- Configurable sample rate up to 100 Hz
- Data export capabilities
- Interactive GUI controls
Configuration
Create a sensors.yaml file in your config directory:
sensors:
Respiration:
id: 1
name: "Respiration"
type: "respiratory"
units: "arbitrary"
Temperature:
id: 2
name: "Temperature"
type: "temperature"
units: "celsius"
Requirements
- Python 3.7+
- NeuLog Software and Drivers (latest version)
- Connected NeuLog Sensor
- Windows, macOS, or Linux operating system
Dependencies
- pydantic >= 2.0.0
- requests >= 2.25.0
- pyyaml >= 5.4.0
- dearpygui >= 1.9.0
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
For bug reports and feature requests, please use the GitHub issue tracker. For general questions and discussions, feel free to reach out to info@sustronics.com
Project details
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 neulogpy-1.4.0.tar.gz.
File metadata
- Download URL: neulogpy-1.4.0.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
937254de7cc38c8f2f19e40932db4d6a80684d434dd091ac7df34cc04af0e310
|
|
| MD5 |
a3c41a53c7609ee03a20e198f1a3a634
|
|
| BLAKE2b-256 |
c303e6ebabb9d35d5ae6c1569979cbf125932566859146e3058ca788042c7e46
|
File details
Details for the file NeuLogPy-1.4.0-py3-none-any.whl.
File metadata
- Download URL: NeuLogPy-1.4.0-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b4871644d1c91f452c24d98d4c8caa0baa92f7a24fd97e806dd5a381b69e621
|
|
| MD5 |
adf52fae8046ed422a1fea3343549cdf
|
|
| BLAKE2b-256 |
2bbb25736c6ccd2a2d5b978645eedcfca484f7dffecc2ea3b1e7343397d35d75
|