Skip to main content

Moku

A Python library for the command, control and monitoring of the Liquid Instruments Moku:Go.

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.8 installed
  • Your Moku connected to the same network as your computer
  • Internet access

2. Install dependencies

mokucli

The mokucli utility is required for device discovery and data streaming. Download and install it from the Moku Utilities page.

After installation, verify it works by listing Moku devices on your network:

mokucli list

Python package

Open a command-line terminal and install the Moku Python library:

pip install --upgrade moku

Or using uv (faster):

uv pip install --upgrade moku

If you wish to build and train models for the Moku Neural Network instrument, install optional machine learning dependencies:

pip install "moku[neuralnetwork]"
# or with uv:
uv pip install "moku[neuralnetwork]"

3. Using the moku CLI tool

The mokucli utility can be used to download instrument definitions:

mokucli instrument download <version>

This downloads the latest instrument definitions for the specified Moku OS version.

4. Start scripting

You are now ready to control your Moku:Go using Python! You can find a few example scripts in the examples/ folder. Here is a basic example of how to connect to a Moku:Go, deploy the Oscilloscope and fetch a single hi-res data trace. Open python and run the following code

from moku.instruments import Oscilloscope

# Connect to your Moku by its ip Oscilloscope('192.168.###.###')
# or by its serial m = Oscilloscope(serial=123)
i = Oscilloscope('192.168.###.###', force_connect=False)

try:
    # Span from -1s to 1s i.e. trigger point centred
    i.set_timebase(-1, 1)

    # Get and print a single frame worth of data (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.###.###')
    # ...

See examples/logging_debug.py for more detailed examples.

Troubleshooting

moku: command not found

Ensure moku has been successfully installed in your Python distrubution by open a python shell and running

import moku

No error indicates a successful install.

You may need to add python binaries to your PATH. This varies with operating system and python version but as an example

export PATH=$PATH:/home/user/.local/bin

ImportError: No Module named moku

Make sure you are running the version of Python you installed moku to. Often a system will have multiple Python installations. Try substituting pip with python -m pip in the installation. If you installed moku inside an Environment (i.e. via virtualenv or conda-env), ensure that Environment is activated. You can check that moku is installed in your currently running environment using

(myenv)$ pip list

Issue Tracking

Please report issues at https://www.liquidinstruments.com/support/contact/

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

moku-4.3.0.1.tar.gz (365.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

moku-4.3.0.1-py3-none-any.whl (93.9 kB view details)

Uploaded Python 3

File details

Details for the file moku-4.3.0.1.tar.gz.

File metadata

  • Download URL: moku-4.3.0.1.tar.gz
  • Upload date:
  • Size: 365.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for moku-4.3.0.1.tar.gz
Algorithm Hash digest
SHA256 5da8a6a79755592a4da7133500214fb9fc1ae934ca9701b9f4f823fb37b78778
MD5 261ee171bdcff9dcf3dbd07840c1e989
BLAKE2b-256 ba8d89d217f5f0a7c2d245d4e7279391f73e5b2c9e1da94cb46e48b376477f4c

See more details on using hashes here.

File details

Details for the file moku-4.3.0.1-py3-none-any.whl.

File metadata

  • Download URL: moku-4.3.0.1-py3-none-any.whl
  • Upload date:
  • Size: 93.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for moku-4.3.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0df9df73e0f9a088b51fb86ba5db59de718fb08638725cc73a3610981c3335ec
MD5 5ef1b2b5fadf42103fba760d434d9ac9
BLAKE2b-256 8322b906459f046cb22d93e6770be8d2a81802199707e236dac12350da196c26

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

4.3.0.1 This release

2 files

4.2.2.1

2 files

4.2.1.1

2 files

4.1.2.1

2 files

4.1.2

2 files

4.1.1.1

2 files

4.0.3.1

2 files

4.0.2.0

2 files

4.0.1.1

2 files

4.0.1

2 files

3.3.3

2 files

3.3.2

2 files

3.3.1

2 files

3.2.0

2 files

3.1.1

2 files

3.1.0

2 files

3.0.0

2 files

2.6.2

2 files

2.6.1

2 files

2.6.0

2 files

2.5.1

2 files

2.5

3 files

2.4

2 files

2.3

2 files

2.2

2 files

2.1

2 files

1.3.1

2 files

1.3

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page