I have just started to play around with the moku pro python API (moku 3.3.1, fw 600.0) and have successfully run a number of my own scripts, building off the example code and API documentation. Thanks for all of that, it is very well done! At the moment I am trying to use the arbitrary waveform generator and am having issues with look up table data. If I try to run the example code here: Examples for Python | Moku API
The AWG loads and configures but doesn’t have any waveform data (2 points, both zero). I believe this is an issue with the API because I can get the AWG to load a custom waveform through the moku desktop/ipad app. Any thoughts? Workarounds?
EDIT I found a workaround for my particular use case. Since I’m just doing pulse sequences I was able to get something to work with the regular waveform generator in pulse mode along with Ncycle burst mode.
Thanks for pointing this issue out, and I’m glad that you’ve found a work-around in your case. The lut_data parameter is indeed not uploading the lut data correctly, I’ve flagged this issue with our dev team to be fixed as soon as possible.
Upon further testing I believe the waveforms are generating correctly, but that the waveform does not show up in the App UI once uploaded via the API. Is this what you are seeing?
The following code generates a pulse and square waves and then outputs them, viewing the generated signals on another device or in MultiInstrument Mode shows the signals are being generated accurately so you can still set your pulse wave in the AWG, even if it does not show in the App.
import numpy as np
from moku.instruments import ArbitraryWaveformGenerator
t = np.linspace(0, 1, 100) # Evaluate our waveform at 100 points
pulse1 = np.array([-1.0 if x < 0.9 else 1.0 for x in t])
sq_wave = np.array([-1.0 if x < 0.5 else 1.0 for x in t])
i = ArbitraryWaveformGenerator('10.1.xxx.xxx', force_connect=True)
try:
# Load and configure the waveform.
i.generate_waveform(channel=1, sample_rate='Auto', lut_data=list(sq_wave), frequency=10e3, amplitude=1)
i.generate_waveform(channel=2, sample_rate='Auto', lut_data=list(pulse1), frequency=10e3, amplitude=1)
except Exception as e:
print(f'Exception occurred: {e}')
finally:
# Close the connection to the Moku device
i.relinquish_ownership()
Thanks for all your help in this matter. In fact, I had not looked at the outputs. Your UI is so reliable on the Ipad/desktop app I didn’t look further. Since your reply, I have independently confirmed your results. The output works even if the UI doesn’t reflect the waveform. This is great in case I do need the AWG at a later date, or someone else is trying to use it. Good to know the API isn’t broken.