Skip to main content

pypsgctrl

English documentation is followed by the Russian translation. После английского текста приведена русская версия.

English

A synchronous Python driver for the PSG9080 dual-channel function generator over USB serial. Supports waveforms, frequency, amplitude, offset, duty cycle, phase, modulation, measurement, sweep, system settings, and parameter memory.

Installation

Python 3.10 or newer is required. pyserial is installed automatically.

Install the latest release from PyPI:

python -m pip install pypsgctrl

The package is published on PyPI. To install the development version directly from GitHub:

python -m pip install "git+https://github.com/realspinner/pypsgctrl.git"

To install this release from TestPyPI in a fresh virtual environment:

python -m pip install pyserial
python -m pip install --index-url https://test.pypi.org/simple/ --no-deps pypsgctrl==0.1.2

After cloning the repository, use python -m pip install -e . for development. Serial settings: 115200 baud, 8-N-1, without flow control. Replace the macOS example port with your device's port. Opening a connection does not enable outputs.

Quick start

from pypsgctrl import PSG9080, Waveform

with PSG9080.connect('/dev/cu.usbserial-2120', timeout=1.0) as generator:
    print(generator.ch1.frequency)       # Decimal, Hz
    generator.ch1.waveform = Waveform.SINE
    generator.ch1.frequency = 1000
    generator.ch1.amplitude = '0.100'    # Vpp, not RMS
    generator.ch1.offset = 0            # V
    generator.set_outputs(True, False)

Writes take effect immediately. Physical readbacks use Decimal; numeric strings and Decimal support exact fractions. Values between device steps are rejected. Transactions are serialized with an instance lock. After a timeout, close and reopen the connection. Hardware limits absent from the protocol remain the caller's responsibility.

Documentation and structure

English API reference · Russian API reference

Module Purpose
pypsgctrl/__init__.py Stable public imports and version
pypsgctrl/device.py Connection, wire exchange, general settings
pypsgctrl/channel.py Channel properties, frequency/output control
pypsgctrl/registers.py Register metadata and unit conversion
pypsgctrl/enums.py Waveform, frequency, modulation, trigger enums
pypsgctrl/errors.py Driver exceptions
pypsgctrl/transport.py Injectable transport contract

Public imports use from pypsgctrl import PSG9080, Waveform. Report bugs through GitHub Issues. Source comments use Doxygen tags. With Doxygen installed, run doxygen Doxyfile from the repository root to generate build/doxygen/html.

License

MIT License, copyright 2026 Oleg Kochetov. See LICENSE. Vendor PDFs and recorder calibration utilities are not included in this repository.

Русский

Синхронный Python-драйвер двухканального генератора PSG9080 по USB serial. Поддерживает форму, частоту, амплитуду, смещение, duty, фазу, модуляцию, измерение, sweep, системные настройки и память параметров.

Установка

Требуется Python 3.10 или новее. pyserial устанавливается автоматически.

Установка последнего релиза с PyPI:

python -m pip install pypsgctrl

Пакет опубликован на PyPI. Для установки версии для разработки непосредственно из GitHub:

python -m pip install "git+https://github.com/realspinner/pypsgctrl.git"

Установка этой версии с TestPyPI в новом виртуальном окружении:

python -m pip install pyserial
python -m pip install --index-url https://test.pypi.org/simple/ --no-deps pypsgctrl==0.1.2

После клонирования для разработки: python -m pip install -e .. Порт: 115200 baud, 8-N-1, без flow control. Замените пример macOS на свой порт. Подключение не включает выходы.

Быстрый старт

from pypsgctrl import PSG9080, Waveform

with PSG9080.connect('/dev/cu.usbserial-2120', timeout=1.0) as generator:
    print(generator.ch1.frequency)       # Decimal, Hz
    generator.ch1.waveform = Waveform.SINE
    generator.ch1.frequency = 1000
    generator.ch1.amplitude = '0.100'    # Vpp, not RMS
    generator.ch1.offset = 0            # V
    generator.set_outputs(True, False)

Записи применяются немедленно. Физические значения возвращаются как Decimal; строки и Decimal позволяют задать точные дроби. Значения между шагами отвергаются. Обмен защищён блокировкой экземпляра. После таймаута соединение следует открыть заново. Неописанные в протоколе аппаратные пределы учитывает вызывающий код.

Документация и структура

Справочник на английском · Справочник на русском

Модуль Назначение
pypsgctrl/__init__.py Стабильные публичные импорты и версия
pypsgctrl/device.py Соединение, обмен, общие настройки
pypsgctrl/channel.py Свойства канала, частота и управление выходом
pypsgctrl/registers.py Метаданные регистров и преобразование единиц
pypsgctrl/enums.py Перечисления формы, частоты, модуляции и запуска
pypsgctrl/errors.py Исключения драйвера
pypsgctrl/transport.py Контракт внедряемого транспорта

Публичные импорты: from pypsgctrl import PSG9080, Waveform. Об ошибках можно сообщить через GitHub Issues. Комментарии оформлены тегами Doxygen. При установленном Doxygen команда doxygen Doxyfile из корня репозитория генерирует build/doxygen/html.

Лицензия

MIT License, правообладатель — Oleg Kochetov, 2026. См. LICENSE. PDF производителя и утилиты калибровки рекордера в репозиторий не включены.

Metadata

Release files for pypsgctrl 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pypsgctrl 0.1.2
File Size Uploaded
pypsgctrl-0.1.2.tar.gz 28.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pypsgctrl 0.1.2
File Interpreter ABI Platform
pypsgctrl-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 43.1 kB

Release files / pypsgctrl-0.1.2.tar.gz

Download URL pypsgctrl-0.1.2.tar.gz
Size 28.7 kB
Tags Source
SHA-256 checksum
How to use checksums
afb6dabac1a2905d46bccce134ea2bb86e1b41485bf1e84c4889f366716bad86
BLAKE2b-256 checksum
How to use checksums
8189701e0dc97fdde8bff2e8266add2c7f90a049b753ec31bfe51a06cc38dcfa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.

Transparency log

Release files / pypsgctrl-0.1.2-py3-none-any.whl

Download URL pypsgctrl-0.1.2-py3-none-any.whl
Size 14.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8092fba9d93fb920fad349d044275c9aa630ffe5a995c9513ac8435b7bdf00f8
BLAKE2b-256 checksum
How to use checksums
429c7d46cc2c30d445424ee539074e2998e382c3ec1648cb0b9410ad40b2f642
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.3

2 release files

This release

0.1.2 This release

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page