I have made a driver for controlling a PI spectrometer and a connected CCD camera to be used via SweepMe. Normally the device is controlled with an LightField application, but in automated use a Microsoft .Net “AddInProcess” of the LightField is created for running commands.
Our experiment procedure would be the following: 1. Go to a certain location on the studied sample, 2. measure EL-spectra vs current (sourcing with an SMU), 3. Change location on the substrate (moved manually, cannot be automated currently), 4. Repeat measurement.
The issue here arises from the subsequent measurements in that every time the sequence containing the spectrometer driver is run, a new AddInProcess is created. Every time a new addinprocess of the LightField application opens, it runs processes such as selecting a grating, center wavelength of the CCD array and so on which all take some time.
The ideal operation would be to initialize the spectrometer once and during subsequent measurements just perform the acquisition. One way I am able to make this happen is using Jupyter notebook to structure the cells for initialization and acquisition separately.
So after the somewhat long message, is there any way to create a measurement tree, where the “Run” for initializing the device happens only once but multiple measurements could be performed? If not, I believe my only option might be to import necessary drivers to jupyter with pysweepme.
Hopefully you can make sense of this message, let me know if anything needs more clarification.
Here you can find a list of all phases/functions that you can use in a driver: Function calls
The typical solution is to create an object during ‘initialize’ or ‘configure’ phase of the sequencer procedure. ‘initialize’ is only called once at the beginning of measurement which is often ideal if the object is not further modified and used later during ‘apply’ or ‘measure’. ‘configure’ can be used if you need to create an object that needs to change whenever you enter an branch, e.g. because you configuration has changed.
You can find examples in many existing drivers: SweepMe! instrument drivers on GitHub
by searching for drivers with ‘initialize’ or ‘connect’ phase.
‘connect’ could be also a good choice because it is called even earler than ‘initialize’ and should be used if the object that you create is essential for communication with an instrument or software application.
Hope this helps. If you struggle with creating the driver, we also offer services to help you with your automation tasks.
I thought about your problem again and now understand it better.
After starting a new measurement with SweepMe!, a process must be created as the reference to the previous object is lost.
For such issues, we added once a “parameter store” to the Driver API. Parameter store
There you can save any python object for a given key and restore the object with the same key later on during a SweepMe! session. After restarting SweepMe!, you need to create the object again, but at least during one SweepMe! session you can reuse an object in multiple measurement runs.
Procedure would be that you first check whether your specific key is already available. If you receive None, you create and add your object. Otherwise, you proceed with the existing object.
Yes I already created a functional driver, but only for one run. This parameter store seems to be exactly what I would need. I will try it out and update on you whether it solved the problem!
Great, glad to hear it works!
If you are happy with the driver, it would be possible to make it available to other users as well. Just contact us at contact@sweep-me.net in case of interest and we can check whether it is possible.