LockInAmplifier set monitor doesn't work in all configurations

Moku model: Moku:Go M2
Operating system: Windows 11
Software version: 3.3.3

Bug or support request description:
Noticed a bug where when I have an instance of a LockInAmplifier instrument, lia
lia.set_monitor(1, 'Input2') doesn’t work for the lock in amplifier, it raises moku.exceptions.InvalidParameterException: ['Unable to set to desired value. Coerced value: ']
This isn’t a particularly big deal as I can just use lia.set_monitor(2,‘Input2’), but it is a slight annoyance since I’ll have to change a bunch of ‘ch1’ to ‘ch2’ :stuck_out_tongue: You can certainly set monitor channel 1 to Input1 in the API, so I figure this shouldn’t be a very hard bug to deal with.
Cheers.

-Jack

Hello @JackAttack720 ,
I’m sorry to hear you are dealing with this issue. Would you be able to share your script with me? I attempted to replicate the error message but I was able to set channel 1 to monitor Input 2. Looking forward to hearing from you!

Hi @JackAttack720 ,
Are you able to run this script? Moku:Go Lock In Test - Google Drive
I suspect the error is coming from some other parameter in your script. Looking forward to hearing from you!

Hi Dylan,

I needed a moment to re-create the bug in a simpler script to avoid sending you my whole codebase since digging through my specific application wouldn’t be a good use of your time. After tracing back what controls were going to the lock in amp specifically, I realized that it’s a user error – I’d left monitor 2 connected to Input2, and trying to set monitor 1 to Input2 throws an error.

Cheers.

-Jack

(Attachment lock_in_bug_demo.py is missing)

Oops, I should’ve guessed python scripts wouldn’t be sent happily…

Here’s a plain text example:

from moku.instruments import LockInAmp
from moku.exceptions import InvalidParameterException

#replace with correct IP

lia = LockInAmp(ip = IP , force_connect=True)

#Try to change the monitor channel for a different measurement
#This fails because monitor channel 2 wasn’t taken off of Input2 first:

lia.set_monitor(2, “Input2”)

try:
lia.set_monitor(1, “Input2”)
except InvalidParameterException as e:
print(e)

Taking monitor 2 off of Input2 prior to trying to connect monitor 1 to Input2 works normally, no error

lia.set_monitor(2,“None”)
lia.set_monitor(1,“Input2”)

Hey @JackAttack720 ,
No worries! Yes, trying to connect multiple probes to the same signal will throw the error. I’m glad this ended up being an easy fix, please let us know if you need anything else!