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