Project

General

Profile

multicall interface

Added by Jim Pulokas about 16 years ago

Sometimes in Leginon, you need to get the entire state of the microscope. The existing implementation in Leginon would call each of the get... functions in pyScope, for instance getMagnification, getSpotSize, etc... On the Tecnai, this has not been a problem because at the lower level (tecnai scripting interface) these are individual function calls, and they all return very quickly.

Things are different on the CM. The low level interface to the CM (cmremote) has certain calls that return more than just one parameter. For instance the cmremote function GetCMVar returns many parameters (magnification, defocus, etc...). Also, calling GetCMVar or other cmremote functions can be slow. If we call the pyScope functions getMagnification and then getDefocus, each one would have to call GetCMVar. This is inefficient if we could get away with calling GetCMVar only once.

The new multicall module in pyScope allows for this type of interface. You can ask for several functions to be called in a group. Before actually calling the individual functions, a cache is set up so that GetCMVar (and other similar functions) are only called once. When all the results are known, the list of all results is returned.

Leginon will now try to use the multicall method if it is available in the pyScope module. Right now, only the CM module uses this.