How to switch from gui to API smoothly

Hi all, I’m using MIM mode where LockinAmps extract phase signal and feedback through pid as shown in the attached picture.

By monitoring phase signal in pid slot, I note that pid doesn’t break during switching from API to gui while break during switching from gui to API. Here is the minimum python API code that breaks pid during handing over the LockinAmp:

from moku.instruments import MultiInstrument
from moku.instruments import WaveformGenerator, LockInAmp, PIDController
mim = MultiInstrument('', platform_id=4, persist_state=True, ignore_busy=True, force_connect=True)
oppositePhase = LockInAmp(slot=2, multi_instrument=mim)

The (phase) pulse in following picture(only one pic is allowed so I attached in the reply) illustrates pid breaking which is not acceptable in our experiment. By adding long delay I find out that is oppositePhase = LockInAmp(slot=2, multi_instrument=mim) that cause the pid to break.

I noticed that LockinAmp has a parameter ‘persist_state’. However this doesn’t work both from my tests and from the truth that ‘persist_state’ is not used in MIM mode by taking a look at the python API codes.

So my question is: Is there any ways to switch to API w/o breaking pid, given that the pid doesn’t break during switch to gui?

Hi @eliot

Would you be able to update your firmware and moku package and try this again? If the issue persists, could you upload the summary of each of the instrument states: