Setting up a LabRat

Setting up a LabRat#

This is a guide to starting logging with LabRat. Currently LabRat is at an early stage of development with lots likely to change

Requirements

  1. A computer with Python installed

Go to the repo[inator-project/LabRat] and download the repo contents.

The first step is to install the necessary Python libraries. An environment.yml file is included to do this using conda (or mamba). It can be find in the installation directory

conda env create -f environment.yml

LabRat can currently log via MQTT or through a serial connection (more connections will be added with time). They can only do one or the other at present, selected using the options on the command line interface.

On the first run you will want to set up the SQL database for logging. The simplest method for this is to run the LabRat Dashboard programme ([inator-project/Dashboard]). If the Dashboard programme is started with a path to a database that doesn’t exist then it will offer to create that database. It also has the ability to add new inator devices to the database through a GUI. LabRat can create a DB and add inator devices, but requires the device information be added from a json file. Once the dashboard is downloaded and libraries installed run the following to create a database:

python main.py -db <path/to/nonexistant/db.sql> -setup

Saving to File

It is possible to log the data straight to a text file. This can be useful for quick tests when getting started. But long term the database is more robust and better from a FAIR data perspective

If not using the dashboard, for your first run use the following command:

python labrat_mqtt.py -sql [path\to\db] -secrets [path\to\secrets] -setupsql --createdb

This will start the LabRat MQTT logger. It will create a SQL database at path\to\db" if it doesn’t exist

If you want to add a device (or devices) to the database then add the –dev_file flag with the path to the dev_file.json file containing the device information. This file follow the LabRat inator schema found here. It is also possible to add devices from a GUI using the Dashboard programme found in our repo(inator-project/Dashboard)