Python API now available for Moku:Go

We have today launched the Beta of the python API for Moku:Go.

To download it : moku · PyPI

Or alternatively, from Linux or macOS : pip install moku
The package includes some BETA examples : /usr/lib/python3.5/site-packages/moku/examples

The documentation is here : https://apis.liquidinstruments.com

We welcome feedback, questions and comments.

Hi Paul,

Can you look at your document link and confirm it’s correct? I’m not able to access the document page.

Cheers

Jason

Hi @JasonNaughton : could you please try the documentation page again, it should now be working, thanks.

All good it’s reachable now.

Cheers
Jason

1 Like

Hi All,

While the Python API is in beta, we will be releasing a new package to support each new firmware version (this will stabilize once we come out of beta). If you’ve updated your Moku:Go to firmware 543 (included with Desktop App version 0.9.4) then you should update your moku package too. Simply pip install --upgrade moku.

If you skip this step, then your moku-based programs will just print an error when you try to connect to your device. The new package will be almost identical in terms of the API so all your old scripts will continue to work - in fact, they may even work a little better :slight_smile: .

If you’re having any issues with your Python installation, please reach out to us here on the forum!

Ben.

1 Like

this is the first time I’m using Mokugo,python verison is 3.9.7. when I run ```
osc = Oscilloscope(‘192.168.123.45’)

It looks like your message is incomplete Xiya! If you are looking for assistance from our support team, it may be better to reach out to us via the support form on our website especially if you don’t want to make your IP addresses public!

I am guessing you are having issues connecting to your Moku:Go via the python API. Here is a link to our API documentation site where you can find some examples to help you get started along with a troubleshooting guide.

Hi Mr. Paul! This is great news! I have started using the Moku Go and I could not see myself going back to a more traditional oscilloscope. I started using the Python API with my Moku Go in the lab but I am struggling to acquire data from the Moku directly to my file .py with get_data(). Currently, I am able to use get_data() from my Moku but I can only acquire one frame of data. If I want a longer period of data, I must use a for loop with get_data() in it. However, when doing so, I am losing a lot of quality in the data that I am acquiring which is problematic. Is there a way to specify that the Moku can start to acquire data and then stop after a certain time and to retrieve the data with a function such as get_data() ? In other words, is there a way to use get_data as a way to transfer data from the Moku to the .py through the API ? Thanks in advance for your help! :slight_smile:

Thank you for posting to the forum Anthony! Yes there is a way to stream data directly to your .py file without losing data points like with your current use of get_data().

Here is a link to our API reference site which details how to use the start_streaming() function in our Python library. Should you have any other issues with getting the streaming feature to work feel free to respond here.

Hello,

I’m using Moku:Go python API

I installed the Python package correctly but when I run

Oscilloscope(‘[fe80:0000:0000:0000:7269:79ff:feb9:3056%21]’,force_connect=True)

I’m getting this error >
Exception: Instrument files not available, please run moku download --fw_ver=577 to download latest instrument data

However when I run > moku download --fw_ver=577

File “”, line 1
moku download --fw_ver=577
^
SyntaxError: invalid syntax

Any suggestion? Thanks!

When you downloaded the python package, did you use

pip install pymoku

or

pip install moku

If you have used Moku:Lab or accidentally downloaded the pymoku library then it can cause issues when using both packages in the same terminal. Try running pip uninstall pymoku first.

If that isn’t the case, you may need to download our new Moku CLI that is a separate download from our website here which improves the moku commands you are trying to use.

Thank you for your reply!

I used pip install moku

I already installed Moku CLI but still have same problem when running moku download

Could you tell me if you are using an IDE (pycharm, visual studio, etc.)? Also, are you running moku download in a command terminal?

I’m using Jupyter notebook and running moku download in the notebook

Could you try opening a command prompt on your PC (Win+R on Windows, or in the Launchpad for Mac) and running the moku download command? There are also a few additional troubleshooting tips you can find here.