Outputs not a valid modulation source for Waveform Gen. in MIM with Matlab/Python

Moku model: Moku:Pro
Operating system: Windows 11
Software version: Firmware 580, MATLAB/Python API

Bug or support request description:
I’m trying to use the second channel of the WG as the modulation source for the first channel in MIM, which I can easily set-up using the iPad and desktop apps. When trying to automate the measurement and do it via the API, code that sets up FM modulation of Channel 1 with Channel 2 being the modulation source produces an error “Output2 not a valid modulation source”. A MWE for matlab

%Minimal working example of Moku:Pro MultiInstrument mode waveform
%generator API bug: cannot set Output2 as modulation source, while in single
%instrument mode yes

%Single instrument mode
wg=MokuWaveformGenerator('192.168.200.15',1)
wg.generate_waveform(1,'Sine','amplitude',2.0, 'frequency',57.8e6)
wg.generate_waveform(2,'Pulse', 'amplitude',1.0, 'frequency',1.0, 'offset',0.5, 'edge_time',4e-9,'pulse_width',69e-6)
wg.set_modulation(1,'Frequency','Output2','depth',30e3)

%connect to Moku:Pro via Ethernet, check the IP through desktop app/configure
%device/ethernet
mim = MokuMultiInstrument('192.168.200.15',4,1)
wg = mim.set_instrument(1, @MokuWaveformGenerator)
wg.generate_waveform(1,'Sine','amplitude',2.0, 'frequency',57.8e6)
wg.generate_waveform(2,'Pulse', 'amplitude',1.0, 'frequency',1.0, 'offset',0.5, 'edge_time',4e-9,'pulse_width',69e-6)
wg.set_modulation(1,'Frequency','Output2','depth',30e3)

The issue is reproducible with both MATLAB and Python. By playing around i’ve also noticed that “Input” 1-4 are also not valid sources, but “InputA” and B are.

It looks like the issue is because you are trying to access the device level input from inside the instrument, which is not possible. To fix this, you will need to first manually set the connections of your Moku:Pro like you would inside the app, then use the instrument level inputs as the source. Below is an example where InputA is used as the modulation source and the MiM connections have the instrument slot output B connected to the same instrument slot input A.

from moku.instruments import WaveformGenerator
from moku.instruments import MultiInstrument

mim = MultiInstrument('192.168.XXX.XXX', platform_id=4, force_connect=True)

try:
	wg = mim.set_instrument(1, WaveformGenerator)
	connections =   [dict(source="Slot1OutB", destination="Slot1InA"),
					dict(source="Slot1OutA", destination="Output1"),
					dict(source="Slot1OutB", destination="Output2")]
	wg.generate_waveform(channel=1, type='Sine', amplitude=2.0, frequency=57.8e6)
	wg.generate_waveform(channel=1, type='Pulse', amplitude=1.0, frequency=1.0, offset=0.5, edge_time=4e-9, pulse_width=69e-6)
	wg.set_modulation(channel=1,type='Frequency',source='InputA',depth=0, frequency=30e3, strict=False)

except Exception as e:
	raise e
finally:
	mim.relinquish_ownership()

Sorry for the late reply, but thanks a lot Sam!