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.

For releases published on PyPI:

python -m pip install pypsgctrl

The package is available on TestPyPI; production publication is pending. Until then, install 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.1

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

Пакет доступен на TestPyPI; публикация на основном 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.1

После клонирования для разработки: 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.1

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.1
File Size Uploaded
pypsgctrl-0.1.1.tar.gz 28.7 kB Details

Built distribution (wheel)

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

Total release size: 43.2 kB

Release files / pypsgctrl-0.1.1.tar.gz

Download URL pypsgctrl-0.1.1.tar.gz
Size 28.7 kB
Tags Source
SHA-256 checksum
How to use checksums
00765736225a47ce303d786588dab1a651743cfde9326dcd6a1bbff924bed3e4
BLAKE2b-256 checksum
How to use checksums
caa9806ef72b6ecebe8cb5a391879d6ac278bd57e059acd35d55bcdc992a30ee
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.1-py3-none-any.whl

Download URL pypsgctrl-0.1.1-py3-none-any.whl
Size 14.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aba9c8b6bb10ced11f01809ca04b91711b2da522be1310dfdd53fd7505fc29a5
BLAKE2b-256 checksum
How to use checksums
63334241ea03f466f8ee0ca22479df8fcf19b752c5eb000bc4763aa1877a01a1
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

0.1.2

2 release files

This release

0.1.1 This release

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