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

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.

Русский

Синхронный 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.3

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

Metadata

Release files for pypsgctrl 0.1.3

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.3
File Size Uploaded
pypsgctrl-0.1.3.tar.gz 28.5 kB Details

Built distribution (wheel)

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

Total release size: 42.9 kB

Release files / pypsgctrl-0.1.3.tar.gz

Download URL pypsgctrl-0.1.3.tar.gz
Size 28.5 kB
Tags Source
SHA-256 checksum
How to use checksums
df46f6b499f54f14c96652cd67dc9704239b8236241e491db29af00fb1eed70a
BLAKE2b-256 checksum
How to use checksums
9133634e282f1e98cf276be3193c04933a7e0226f70a70e19efec38908da14c1
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.3-py3-none-any.whl

Download URL pypsgctrl-0.1.3-py3-none-any.whl
Size 14.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
846a5a157af6b98bc1c35e560d7ea38c6a99788e742185d6977960ec8305a100
BLAKE2b-256 checksum
How to use checksums
1c095b9443271a23dd426b2394a926e639842c50bd58cc41e33b83bba7b1c28c
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

This release

0.1.3 This release

2 release files

0.1.2

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