Moku
A Python library for the command, control and monitoring of Liquid Instruments Moku Moku hardware.
Official documentation for this library is available on the Moku API documentation page, and includes more information on getting started, tutorials and examples.
Getting Started
1. Requirements
- Python >= 3.11 installed
- Your Moku connected to the same network as your computer
- Internet access (once off to fetch data files)
2. Install the mokucli utility
mokucli is a separate command-line utility, required for device data management, discovery and data streaming. Download and install it from the Moku Utilities page.
After installation, verify it works by listing the Moku devices on your network:
mokucli list
3. Install the Python package
pip install --upgrade moku
If you wish to build and train models for the Moku Neural Network instrument, install the optional machine learning dependencies:
pip install "moku[neuralnetwork]"
4. Download instrument bitstreams
Before an instrument can be deployed, it must be present in your local cache. Download the set matching your device with:
mokucli instrument download --ip <your-moku-ip>
This auto-detects the device's firmware version and downloads the matching bitstreams. If you don't have network access to your Moku at this time, you can specify the set by version instead
mokucli instrument download 4.3.1
Find your device's version and IP address in the output of mokucli list, or in a compatible Moku App, available for Desktop and iPad.
5. Start scripting
You are now ready to control your Moku using Python! You can find example scripts in the moku/examples/ folder of the installed package. Here is a basic example of how to connect to a Moku, deploy the Oscilloscope and fetch a single data trace. Open python and run the following code:
from moku.instruments import Oscilloscope
# Connect by IP address, or by serial with Oscilloscope(serial=123)
i = Oscilloscope('192.168.###.###', force_connect=False)
try:
# Span -1s to 1s, i.e. trigger point centred
i.set_timebase(-1, 1)
# Fetch one frame: a time series of voltage per channel
data = i.get_data()
print(data['ch1'], data['ch2'], data['time'])
except Exception as e:
print(f'Exception occurred: {e}')
finally:
i.relinquish_ownership()
Debug Logging
The Moku library includes built-in logging support for debugging connection issues and monitoring API calls. By default, the library does not produce any log output. To enable debug logging:
import moku.logging
# Enable debug logging to stderr
moku.logging.enable_debug_logging()
# Your Moku code here - all operations will be logged
from moku.instruments import Oscilloscope
osc = Oscilloscope('192.168.###.###')
# Disable logging when done
moku.logging.disable_debug_logging()
For temporary debugging, use the context manager:
import moku.logging
with moku.logging.LoggingContext():
# Debug logging only enabled within this block
osc = Oscilloscope('192.168.###.###')
# ...
Troubleshooting
ModuleNotFoundError: No module named 'moku'
A system often has several Python installations. Make sure you install into the same interpreter you run:
-
Install with
python -m pip install --upgrade mokuso it targets the interpreter you invoke aspython. -
If you use a virtualenv or conda environment, activate it first, then confirm the package is present with
pip list. -
You may need to add your Python scripts directory to
PATH. This varies by operating system and Python version, for example:export PATH=$PATH:/home/user/.local/bin
Verify the install with:
python -c "import moku"
No error indicates a successful install.
Issue Tracking
Please report issues at https://www.liquidinstruments.com/support/contact/
Metadata
Release files for moku 4.4.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| moku-4.4.0.0.tar.gz | 378.4 kB | Without provenance | Details for moku-4.4.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| moku-4.4.0.0-py3-none-any.whl | Python 3 | none | any | Details for moku-4.4.0.0-py3-none-any.whl |
Total release size: 571.3 kB
Release files / moku-4.4.0.0.tar.gz
| Download URL | moku-4.4.0.0.tar.gz |
|---|---|
| Size | 378.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
882eb765fb9230f331489678ee5a8da8d6a1361db236cecf51093aed421c27c3
|
|
BLAKE2b-256 checksum How to use checksums |
dd623831123fb64c6a0a4aceb40446bc65ee1bc75abeadaf80ff98ded29a04c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / moku-4.4.0.0-py3-none-any.whl
| Download URL | moku-4.4.0.0-py3-none-any.whl |
|---|---|
| Size | 192.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ca5740c05e06afcce219bdd613cd573b57266a3e3529b8a88f785f30aaa52492
|
|
BLAKE2b-256 checksum How to use checksums |
f6570685e77a36e0c5f4495a7944582d00bad9cc9db6faf37bcd9cde5a1ace0a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for moku 4.4.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.