Skip to main content

A (distributed) data logger for the (physics) lab.

Project description

Lab Data Logger ‒ A (distributed) CLI data logger for the (physics) lab.

PyPI Code style: black

A command-line tool that allows logging of data locally or over a network to a InfluxDB.

Installation

pip install lab_data_logger

Usage

Basic usage

Lab Data Logger comes with a CLI tool, ldl. To get help with all the available options, use ldl --help.

In these examples

Setting up a data source

First, we setup a data service that provides data to be logged. As an example, we use the RandomNumerService provided. Here, we want to

$ ldl services start lab_data_logger.services.RandomNumberService 18862 
Trying to start RandomNumberService from lab_data_logger.services
Started RandomNumberService on port 18862.

Setting up the logger

Second, in order to log te data provided by this service, we first start a logger. We want the Logger to be accessible at port 18866. We pass the default host port and database of the InfluxDB explicitly for demonstration:

$ ldl logger --port 18866 start --host localhost --port 8083 --database test
Started logger on port 18866.

Open another terminal to add the data service to the logger:

ldl logger --port 18866 add --interval 3 localhost:18862 rand_num1

The second argument rand_num1 is the measurement the data is written to. The --interval option specifies the logging interval (in this case 3 seconds).

If succesful, the terminal where the logger service was started wil print Connected to RANDOMNUMBER on port 18862

Show logger status

$ ldl logger --port 18866 show
LAB DATA LOGGER
Logging to test on localhost:8083 (processed entry 66).
Pulling from these services:
MEASUREMENT   |     HOSTNAME     |    PORT    |   COUNTER   
-----------   |   ------------   |   ------   |   -------   
rand_num1     |   localhost      |    18862   |        66

Creating your own data services

To make use of LDL, you have to create your own data services by subclassing lab_data_services.services.LabDataService. An example is given in the examples folder.

To start this data service, use the relative path from your current location, for example from the parent directory of the cloned git repo:

    $ ldl service run lab_data_logger.examples.const_numbers.ConstNumberService
    Trying to start ConstNumberService from lab_data_logger.examples.const_numbers
    No module lab_data_logger.examples.const_numbers found
    Looking for ConstNumberService in ~/lab_data_logger/examples/const_numbers.py
    Started ConstNumberService on port 18861.

Authors

License

Lab Data Logger ‒ A (distributed) CLI data logger for the (physics) lab.

Copyright © 2020 Bastian Leykauf

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

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

lab_data_logger-0.3.2.tar.gz (37.2 kB view details)

Uploaded Source

Built Distribution

lab_data_logger-0.3.2-py3-none-any.whl (21.7 kB view details)

Uploaded Python 3

File details

Details for the file lab_data_logger-0.3.2.tar.gz.

File metadata

  • Download URL: lab_data_logger-0.3.2.tar.gz
  • Upload date:
  • Size: 37.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.9.0

File hashes

Hashes for lab_data_logger-0.3.2.tar.gz
Algorithm Hash digest
SHA256 236dd9667cf5f53d18db4b693e3e591b2058b5ac07f23aa991164ccbde213d36
MD5 7528afb2914b5d82956811d552679000
BLAKE2b-256 c1f9d876f468402c932e1ae45113d32183e3534217fdd00ed8d3991ca75573f3

See more details on using hashes here.

File details

Details for the file lab_data_logger-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: lab_data_logger-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 21.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.9.0

File hashes

Hashes for lab_data_logger-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 46341fe94777f6109129a4a62cda0f448894a8a1e2b0677ca880ff15b2ec977b
MD5 58c1131c426b10eca77d2eaed53b16e0
BLAKE2b-256 50850b34f2bc05c632ac5b09fddec9965ebadba90ae2302097262f107c1ea1b4

See more details on using hashes here.

Supported by

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