Dummy Device to move new image files into lyse

69 views
Skip to first unread message

Jonas Kruip

unread,
Jan 17, 2024, 8:29:55 AMJan 17
to the labscript suite
Hey, I would like to set up a Dummy device, which takes images aquired by my Camera via an external trigger sent through labscript, saves them into a .h5 file and then sends it to Lyse corresponding to the same shot the trigger was sent in. I can save the images into a .h5 file but am struggeling with sending this over to Lyse. Could you point me to the right direction or provide already existing code on how to construct this device, such that it has only this minimal capability? Thanks in advance!

dihm....@gmail.com

unread,
Jan 19, 2024, 12:10:02 PMJan 19
to the labscript suite
Jonas,

You may need to provide a little more detail about your system, since it sounds a little bit custom.

For normal labscript usage, sending to lyse is automatic for a shot (if the analyse box is checked in BLACS, lower left corner), assuming you have created the appropriate device code. This presumes you have written a device driver with minimal labscript_device code, a minimal BLACS_tab, and a simple BLACS_worker that somehow stuffs your camera images into the shot h5 file. 

I'm assuming what you are doing is a separate program that controls your camera and can save images to an h5 file. Getting that to lyse is possible (just mimic the BLACS code that handles sending completed shots to lyse), but I wouldn't call that ideal. I would definitely recommend having your images added to the shot file directly if at all possible. Also, if your camera has an available SDK (or ideally python bindings), getting a camera driver so BLACS can handle everything isn't too hard.

Hopefully that was mildly helpful,
-David

Alessandro Muzi Falconi

unread,
Jan 19, 2024, 12:43:09 PMJan 19
to the labscript suite
Hi Jonas and all,

We recently set up our experiment control system and, if I am understanding well, we probably encountered the same difficulty you are having.

In our case we did not (mainly because we didn't want to invest too much time on it) implement our camera as a labscript device.Instead, we are running the camera with a separate python script that runs parallel to the experiment control and we just trigger the image acquistion with a digital channel during our experimental sequence. 
We had the problem of saving image and associating it to the corresponding h5 shot file. 
As David suggested, the best should be to save the image in the same h5 file of the shot file. 
However, we found a workaround which for us is working fine and maybe it is easier to implement: 
at the start of each experimental sequence we call the function_runner device which we use to open a "last_shot.txt" file and write there the full name and path of the shot file that is starting execution. As the camera (programmed in python) takes the trigger for image acquisition, it reads the "last_shot.txt" file and saves the image  as a tiff filei, in an appropriate folder and with the same name of the shot file. Something like this:  
"{shot_name}+_'image.tiff' "

So, when the shot is executed we have both the shot file (h5) and corresponding image (tiff) saved in known folders and with corresponding names. Then in lyse we just read the name of the shot file from the h5 file and we import the corresponding image to make all our analysis.

This maybe is not the best or most elegant way of doing things but for us it is working very well. 

I hope this is understandable and useful, if you are interested I can give you more information.

Best,
Alessandro
Reply all
Reply to author
Forward
0 new messages