Setting up and working with elabFTW

In order to create a script that uploads directly to elabFTW, you will need to have the file setupElab.py present within the same directory as the script using elabFTW functionality. Your measurement script should have at least have the following lines of code:


Mock Python script containing the basic lines needed for a script working with elabFTW.

In section 1, the elabFTW class is imported. You will need to have the file setupElab.py present within the same directory as the script using elabFTW functionality. It should be provided by your lab instructor, and will not be explicitly shown here as it is constantly evolving and the newest version should generally be used.
Section 2 mainly sets naming strings as well as preparing experiment parameters for the upload functions. Between sections 2 and 3 is where your measurements will happen. As you can see, the raw data would usually be recorded in a CSV file and uploaded. Plots can already be uploaded as well, but with the raw data you should have no issues creating them during analysis.
Section 3 showcases the simple upload commands. Make sure the script actually runs this part every time, as things like plots being displayed halts the Python kernel.

Notice that this is almost entirely taken from here except for the command add_tag(title, tag_string) to add a specific tag, which has been added for easier reference. This line can be commented out after the first run, but just as set_experiment(title, date, body) will not replace an existing experiment, the tag will also not be overwritten.

Basic setup

A tutorial video for elabFTW and the neccessary setup can also be found on TUbe.

Log in at elabFTW

Go to the TU Graz elabFTW webpage and log in with your TU Graz student credentials. If further information is requested, register for Team: Lab Electrical Characterization


Create and add your own token id="token"

Log into the elabFTW page, on the top right corner click the account icon and select USER PANEL in the dropdown menu. Then go to API KEYS, under Create new key enter a name (yourgroup_lab or similar), select Read/Write permissions and click Generate An API Key. You will now be shown a long string, copy this somewhere safe.

Screenshot highlighting the important points of navigation.



ATTENTION
The key will only be shown to you once so do not leave the page until you have stored the key in an appropriate place!
You should not upload a file containig this key to elabFTW!
Should you lose this key, you can delete it from the list and generate a new one.

Within the earlier mentioned setupElab.py, you will find a function named __init__, which calls for an elab manager instance. In this call, replace the string given to parameter token with your newly created token. Later versions of setupElab.py may also support the reset_token() function, in which case you can store the token in a file named "token" (no file extension!) within your directory. Upon being called directly from within your working script, this function should set your token as the one to be used, giving you full control over the experiment data on the elabFTW webpage.

__init__ function within setupElab.py with highlighted parameter.

Give team members access

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 three dots. Under Manage Permissions you should set both options to the smallest possible group that you have access to. For example, it could be Lab Electrical Measurement. Now all members of that group can work with the experiment, which should include you and your lab colleagues.

Screenshots showing the Edit view of an experiment owned by the user, as well as the specific permissions set.



In order to find your data in the experiment tab, you can utilize the tag you created earlier.

Screenshot showing the experiment filter.




Sample script

This is an example for ELabFTW integration into a diode measurement: diode_characteristic.py