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.tar.gz (5.3 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-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: neulogpy-1.1.tar.gz
  • Upload date:
  • Size: 5.3 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.tar.gz
Algorithm Hash digest
SHA256 7365b613268af00d497639ac1ff069b0f73b77e7a9ffdedb252ccad5007c16f9
MD5 aeda77ba7e8d67d6772eb9bf6bf42a2a
BLAKE2b-256 46a6fa72fd86556066407f1d872e1e5ec5bb7fb3c202ffabccff106e8ab72838

See more details on using hashes here.

File details

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

File metadata

  • Download URL: NeuLogPy-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-py3-none-any.whl
Algorithm Hash digest
SHA256 a41832c0d1277946a23a16e75d9ae9cee0c542e9961ca4a4953e1aee24ed429e
MD5 daedec0ef3b2780e02ab6624d7460a62
BLAKE2b-256 9ce3066c4d33d67d97862869bb9cb4fb102e3987b74c192cf2a6b62841bf9910

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