How do you use Python in your lab?

I have been developing software in Python for over 6 years now. I started first to automate the running of complex programs written in Fortran to simulate industrial processes. Later, out of frustration with LabView in the lab.

I’ve built many command-line tools to perform experiments, lowering the amount of involvement from the user. For example, I was acquiring spectra of particles over time. The routine was quite simple: refocus on a particle, trigger a spectrometer, move to another particle, repeat.

I have also built software for acquiring Cameras, monitoring optical tweezers and controlling devices through the network. Everything in Python.

My biggest struggle was with the lack of documentation of different manufacturers. For example, Hamamatsu camera’s have a common API called DCAM, but its documentation is nowhere to be found. The communication with the camera relies on a DLL that has some strange behavior. For instance, setting regions of interest is limited to even pixels, but it is not documented anywhere.

Anyways, I was wondering how do you use Python in your lab. Have you ever built software for controlling an experiment? With what kind of issues do you deal regularly?

1 Like

Python is a great tool that help me a lot in many part of my PhD in pharmaceuticals sciences.

  • I do many experiments on cells, many protocols need to be slightly modify according to tested pearameters. Python help me to automatise protocole creation by given parameters and I get a properly formated protocole as PDF with every internal parameters calculated according to input parameters.

  • Scientific machines gives data with many kind of format as output. Here again, python give me opportunities to format data to the same maners for futher analysis.

  • Well, you get your protocol, your perform your experiment, you get back raw results that you format, then you need to analyse your results. I wrote several script for this purpose.

  • Finally, you put everthing together to make a final report from start to end with your data. This time too, I do this in python :slight_smile:

I teach also pharmaceutical calculations, I wrote some scripts to interact with students by email if there results are pretty low during exam training. Training are perfomed on internet via a dedicated platform.

Hello Hatoris!
Welcome to Python for the Lab!

How do you write your protocols? Do you use Jupyter or any other editor?

Do you use Python to control your instruments?

Hello aqui_c ;),

Yes, most of protocols are written with Jupyter (Lab), pretty streight foward to include informations or rapidly calculates infos and then to integrate in protocols.

Unfortunaly no, I use instruments to perform experiments few time then I move to another protocols. So automation for aquisition doesn’t worth it. However, cleanning raw data to a more usefull format is perfect and it’s exactly what I do.

Finaly, I found that I use a lot of “biological plate” I was not able to find a package to do what I want, so I written it : BioPlate

And what about you, what is your accademic background ?

Do you work for compagny or academia as developer or scientitst ?

Thanks for your website :slight_smile:

Yeah! I Saw BioPlate! Nice that you made your own solution!

I am a physicist, finished my PhD and started Uetke , a small company providing solutions for people struggling with instrumentation, and as a child project, this website. I am curious to see how different people find solutions for their problems in the labs, in order to understand where a solution could be appropriate. My main focus is instrumentation though

Yes, I take BioPlate as my showcase for my python skills :), so I try to do my best.

Your compagny is really interessting, I don’t know for your previous lab, but in my case on 30 students in our research axe, I’m the only one to use programmation. When I see collegues, work several days on cleaning/formating/reporting results thaht they do routinely, I’m amaze that no one as try to automate their stuffs.

Then you come with Uetke, It is a great idea because I guess many compagny have the same issues, their experiemnts and analizes are realizes by hand when they can be automatized. When you free times from basic tasks, you can focus on more important tasks such as result interpretations or planing your next move.

Your website is pretty cool, and with time will help many students and lab members by providing usefull resources and tricks.

Hi Aquiles. I have been implementing LAB instrumentation and goniometer for a few years now. Python scripts and specific hardware are used to test/measure LED cluster and other lab tasks. A goniometer is used for device-under-test movement and programmable power supplies, spectro, light, multi-meters for test drive and measure. Self-made Arduino-like hardware (including DAQs, ADCs, current meters, etc) with serial/can-bus/gpib/ethernet to interface with the lab PC. Automating lab tests has greatly reduced the workload. Python scripts are also used to calibrate instrumentation, collect, analyse and store data. My aim is to give the user an easy as well as fast way to setup/execute new tests. PFTL-style coding will be a gradual integration job to simplify and make code reading clearer in the future.

Looks like an ideal use-case for what the model-view-controller architecture can help you achieve. Do keep us posted!