Skip to main content

No project description provided

Project description

NeuLogPy loggin module

This project provides a Python-based framework for managing and interacting with NeuLog sensors. It includes functionalities for setting up sensor experiments, retrieving and storing sensor data, and visualizing real-time data.

Project Structure

packaging
├── config
│   ├── sensors.yaml             # Configuration file with sensor definitions
├── core
│   ├── api_client.py            # API client for interacting with the NeuLog server
│   ├── services                 # Services for experiment and sensor management
│       ├── experiment_service.py   # Handles experiment setup, start, and stop
│       ├── sensor_service.py       # Manages sensor retrieval, addition, and listing
├── models
│   ├── sensor.py                # Pydantic models defining sensor schema
├── tests                        # Test suite
│   ├── core
│       ├── test_api_client.py   # Tests for the API client
│       ├── test_experiment_service.py  # Tests for experiment service
│       ├── test_sensor_service.py   # Tests for sensor service
├── utils
│   └── file_loader.py           # Utility function for loading YAML files
└── README.md                    # Project documentation

Installation

To get started, clone this repository and install the required dependencies:

git clone <repository-url>
cd NeuLog
pip install -r requirements.txt

Configuration

The config/sensors.yaml file defines the sensors available in the system. Each sensor has properties like code, unit, and description. Modify this file to add new sensors or update existing configurations.

Example structure of sensors.yaml:

sensors:
  Temperature:
    code: "TEMP"
    unit: "°C"
    description: "Measures temperature"
  CO2:
    code: "CO2"
    unit: "ppm"
    description: "Measures carbon dioxide levels"

Usage

Starting an Experiment

To start a new experiment with specified sensors, use the NeuLog interface in NeuLog.py.

from core.services.experiment_service import ExperimentService

# Example of setting up and starting an experiment
experiment_service = ExperimentService()
experiment_service.start_experiment(
    sensors=[("Temperature", "TEMP")],
    rate=8,
    samples=1000
)

Real-Time Data Visualization

The test.py script includes a visualization example using Matplotlib. This script retrieves real-time data from a respiration sensor and plots it dynamically.

python test.py

This script initializes an experiment, collects data samples, and plots them in real time. Modify parameters like sensor_type, sensor_id, rate, and samples within test.py to customize the experiment.

Combining Files

To generate a single combined Python file with the directory structure and content, run combiner.py:

python scripts/combine_files.py

This will output a combined_module.py file containing all the code and directory comments for easy review.

Running Tests

Tests are organized in the tests directory and use the pytest framework. To run the tests, use:

pytest tests/

Tests include:

  • API client tests to verify interaction with the NeuLog server.
  • Sensor and Experiment service tests to check sensor management and experiment lifecycle functionality.

Key Modules

  • core/api_client.py: Manages HTTP requests to the NeuLog API.
  • core/services/experiment_service.py: Configures and manages experiments.
  • core/services/sensor_service.py: Manages sensor registry and metadata.
  • models/sensor.py: Defines sensor schema and validation.
  • utils/file_loader.py: Loads YAML configurations for sensor metadata.

Contributing

Contributions are welcome! Please open issues to discuss potential improvements or submit pull requests.


License

This project is licensed under the MIT License.

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

neulogpy-1.1.1.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

NeuLogPy-1.1.1-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file neulogpy-1.1.1.tar.gz.

File metadata

  • Download URL: neulogpy-1.1.1.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.4

File hashes

Hashes for neulogpy-1.1.1.tar.gz
Algorithm Hash digest
SHA256 96f12f7ff49ddfb709b5e4ce37952e6d05052a4ca97b4cbe7220079878f164f3
MD5 2cb6553279160ea4d1821cfe181d5b56
BLAKE2b-256 0d7dadbc1a823d2c323787989d5eff12e59f33aa8ee127a3d3676a1edc2901bf

See more details on using hashes here.

File details

Details for the file NeuLogPy-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: NeuLogPy-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.4

File hashes

Hashes for NeuLogPy-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8545fa846a0c450e809f01a319a6a5142a75630c785e24b56e9f18f298147f91
MD5 14cf4498c66df6f72f1fdfeeef10c879
BLAKE2b-256 f64f2dad8fa62c9ea0b1de2f55bf765fb08c2b161be6ef4d1a8102ed6a51c424

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page