Metadata-Version: 2.4
Name: saleae-mso-api
Version: 0.3.1
Summary: Saleae Logic MSO Python Automation API
Classifier: Private :: Do Not Upload
Requires-Python: >=3.11
Requires-Dist: numpy>=2.2.3
Requires-Dist: psutil>=7.0.0
Requires-Dist: pyusb>=1.3.1
Requires-Dist: wmi>=1.5.1
Provides-Extra: build
Requires-Dist: hatchling; extra == 'build'
Provides-Extra: dev
Requires-Dist: boto3-stubs>=1.37.14; extra == 'dev'
Requires-Dist: boto3>=1.37.14; extra == 'dev'
Requires-Dist: dotenv>=0.9.9; extra == 'dev'
Requires-Dist: jupyter-book>=0.15.1; extra == 'dev'
Requires-Dist: matplotlib>=3.10.1; extra == 'dev'
Requires-Dist: nbconvert>=7.0.0; extra == 'dev'
Requires-Dist: nbformat>=5.9.0; extra == 'dev'
Requires-Dist: playwright>=1.40.0; extra == 'dev'
Requires-Dist: pytest>=7.4.0; extra == 'dev'
Requires-Dist: pyvisa>=1.14.1; extra == 'dev'
Requires-Dist: ruff>=0.10.0; extra == 'dev'
Description-Content-Type: text/markdown

# Saleae MSO API

This repository contains the Saleae Mixed Signal Oscilloscope (MSO) API, which provides programmatic control
over capturing analog signals in various configurations.

## Features

- Configure and run captures on a Saleae Logic MSO
- Load and analyze capture data
- Extract specific segments based on trigger conditions after the fact

## Installation

Your system will need to have drivers installed, which happens automatically
any time Logic is installed.

We recommend using the `uv` package manager over `pip`, `pipx`, or even `poetry`.
Get `uv` by visiting the [uv installation instructions](https://docs.astral.sh/uv/getting-started/installation/).

```bash
# set up a virual environment
uv venv
# Install the package from the Saleae private python package index
uv add saleae-mso-api --index https://downloads.saleae.com/pypi/
```

## Quick Example

```python
from pathlib import Path
import numpy as np
from saleae import mso_api

mso = mso_api.MSO()

capture_config = mso_api.CaptureConfig(
    enabled_channels=[mso_api.AnalogChannel(channel=0, name="clock")],
    analog_settings=mso_api.AnalogSettings(sample_rate=100e6),
    capture_settings=mso_api.TimedCapture(capture_length_seconds=0.1),
)

for n in range(3):
    save_dir = Path('my-captures') / f'{n:02d}'
    capture = mso.capture_analog(capture_config, save_dir=save_dir)
    avg_voltage = np.mean(capture.analog_data["clock"])
    print(f"Capture {n:02d} in {save_dir} avg voltage: {avg_voltage:.3f} V")
```

## Development

See the [Contributing](docs/contributing.md) guide for full information on how to contribute to this project.

### Development Quick Setup

The following should get you set up quickly on Windows:

If you are missing the NI VISA drivers, install those
[from National Instruments here](https://www.ni.com/en/support/downloads/drivers/download.ni-visa.html).

```
git clone git@github.com:saleae/mso-api.git
cd mso-api
uv venv
.venv\Scripts\activate
uv sync --all-extras
pytest tests
```

## License, Copyright

This project is proprietary and not licensed for public use.
Copyright 2025, Saleae Inc.
