Skip to main content

Python scripting interface to the Liquid Instruments Moku hardware

Project description

Moku

A Python library for the command, control and monitoring of the Liquid Instruments Moku:Go. API documentation can be found at ReadTheDocs.

Getting Started

1. Requirements

  • Python installed. We support Python >= 3.5.
  • Zeroconf to browse for Moku's on network
  • Your Moku connected to the same network as your computer.
  • Internet access.

1. Install Moku

Open a command-line terminal and type

pip install --upgrade moku

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

pip install moku[neuralnetwork]

The IP address of your Moku:Go device can be found with

moku list

3. 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()

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/

Project details


Download files

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

Source Distribution

moku-3.3.1.tar.gz (52.3 kB view details)

Uploaded Source

Built Distribution

moku-3.3.1-py3-none-any.whl (78.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: moku-3.3.1.tar.gz
  • Upload date:
  • Size: 52.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.5 Darwin/23.6.0

File hashes

Hashes for moku-3.3.1.tar.gz
Algorithm Hash digest
SHA256 76e826456df6f6e1acc1d767d9abe0cec019cf26e1539f8663dfd2c829a08e43
MD5 4725dc8643ec4ae32fc69832370d8cd2
BLAKE2b-256 9bf1a5d8e47d1c44f6e7e4b49ee4b529959f052f068ca65663b2b4048492f405

See more details on using hashes here.

File details

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

File metadata

  • Download URL: moku-3.3.1-py3-none-any.whl
  • Upload date:
  • Size: 78.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.5 Darwin/23.6.0

File hashes

Hashes for moku-3.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1820511b81549aa43f758b9daa5f35b56258e2ac84db00274d12ff1ac4e07eb5
MD5 8e319469b8c5d5a45478bae316cda217
BLAKE2b-256 f58a94cef920b5ac999e0ec6b62dedddf0dac60c672c2f12c5a28e53e77e8c10

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page