In order to create a script that uploads directly to elabFTW, you will need to
have the file eLabFTW_config_api2_semilab.py
present within the same directory as the script using elabFTW functionality:
This library provides a convenient set of functions to push measured data immediately into an electronic notebook.
This wrapper library relies on the elabapi_python
package that is preinstalled on the measurement computers. You will need to customize this library. The neccessary adaptions will be shown in a dedicated section below.
Your measurement script should contain at least the following lines of code:
eLabFTW_config_api2_semilab.py
present within the same directory as the script using elabFTW functionality.
Consult your lab instructor whether a new version is available.
upload_file()
requires the identification number (experiment_ID
) of the experiment. This identification number was set already in section 2 and is, hence, readily available. It is possible to upload files generated with the script, e.g., .csv
or .pdf
, and to upload the executed measurement script itself. To do the latter, pass the content of the __file__
Python variable as filename to upload_file()
.
Go to the TU Graz elabFTW webpage and log in with your TU Graz student credentials.
(1) Log into the elabFTW page, on the top right corner click the account icon and select USER PANEL in the dropdown menu.
ATTENTION
The key will be shown to you only once: Do not leave the page until you have stored the key in an appropriate place!
Refrain from uploading any file containing your key to elabFTW !
Should you loose this key, you can delete it from the list and generate a new one.
(2) Within the earlier mentioned eLabFTW_config_api2_semilab.py
, you will find a section CONFIG with the line API_KEY = '---ENTER-YOUR-APIKEY-HERE----'
. Replace the string ---ENTER-YOUR-APIKEY-HERE----
with your newly created token.
Replace in the next line USER_LAST_NAME = '---ENTER-YOUR-USER-LASTNAME-HERE----'
, with your last name, that is just the real last name associated to your TUGRAZonline user account. Enter this last name literally, including any special characters, e.g., "Großbäcker".
Upon being called in your working script, this function uses your token as authorization to control the data transmitted to elabFTW.
Once the experiment is set up correctly, go to the elabFTW page and find it under the Experiments tab. Click Edit (the pen symbol), then click the Visibility. Therein, you should set both options to the smallest possible group that you have access to. For example, it could be all members of your lab group. Each user can be asked for individually by providing her/his/their user name.
In order to find your data in the experiment tab, you can use the tag that is created (#semilab) and your own tags.
This is an example for ELabFTW integration into a diode measurement (diode_characteristic.py
):