Skip to main content

PyPulsePal: Python API for the PulsePal open-source pulse train generator

Project description

PyPulsePal

DOI PyPI Ruff

Python API for the PulsePal open-source pulse train generator.

→ Full documentation

Example usage

Load and apply a saved config file:

from pypulsepal import PulsePal
from pypulsepal.config_io import load_config

cfg = load_config("my_params.json")   # or .yaml
with PulsePal.from_config(cfg, serial_port="/dev/ttyACM0") as pp:
    pp.trigger_selected_channels(channel_1=True)

Standard instantiation:

import time
from pypulsepal import PulsePal

pp = PulsePal(serial_port="/dev/ttyACM0")
pp.channel_configs[0].phase1Voltage = 5.0
pp.channel_configs[0].pulseTrainDuration = 1.0
pp.sync_all_params()
pp.trigger_selected_channels(channel_1=True)
time.sleep(1)
pp.stop_all_outputs()
pp.close()

As a context manager (saves settings and closes on exit automatically):

import time
from pypulsepal import PulsePal

with PulsePal(serial_port="/dev/ttyACM0") as pp:
    pp.channel_configs[0].phase1Voltage = 5.0
    pp.channel_configs[0].pulseTrainDuration = 1.0
    pp.sync_all_params()
    pp.trigger_selected_channels(channel_1=True)
    time.sleep(1)
    pp.stop_all_outputs()

Installation

pip install pypulsepal

With YAML config file support:

pip install "pypulsepal[yaml]"

From source:

git clone https://github.com/larsrollik/pypulsepal.git
cd pypulsepal
pip install -e ".[yaml]"

Citation

To cite PyPulsePal:

Rollik, Lars B. (2022). PyPulsePal: Python API for the PulsePal open-source pulse train generator. doi: 10.5281/zenodo.6379627.

@misc{rollik2022pypulsepal,
    author    = {Lars B. Rollik},
    title     = {{PyPulsePal: Python API for the PulsePal open-source pulse train generator}},
    year      = {2022},
    publisher = {Zenodo},
    url       = {https://doi.org/10.5281/zenodo.6379627},
    doi       = {10.5281/zenodo.6379627},
}

Please also cite the original PulsePal hardware and PyBpod publications that this package builds on.

License & sources

This software is released under the GNU GPL v3.0.

This work is derived from the Sanworks PulsePal Python API (commit: 5bb189f).

src/pypulsepal/_arcom.py is vendored from pybpod-api 1.8.2 (MIT, Copyright © 2016 Champalimaud Foundation) with minor adaptations.

Useful references

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

pypulsepal-0.3.0.tar.gz (30.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pypulsepal-0.3.0-py3-none-any.whl (25.5 kB view details)

Uploaded Python 3

File details

Details for the file pypulsepal-0.3.0.tar.gz.

File metadata

  • Download URL: pypulsepal-0.3.0.tar.gz
  • Upload date:
  • Size: 30.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pypulsepal-0.3.0.tar.gz
Algorithm Hash digest
SHA256 e2c7c860bc2278ac596284c27fb22890fe7bafa4a4d1f82e3cd42cc3710fa4f7
MD5 d79920f2abbf1a566e4c7ff4d02a6470
BLAKE2b-256 1d374259e0380cd239763f3f08e8c0af7af7cd176fb086caedaa348b598e6324

See more details on using hashes here.

File details

Details for the file pypulsepal-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: pypulsepal-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 25.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pypulsepal-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b0657383745e54f4d2eb2ee6a81718f306d9f24fe41620df998b8e596939c66d
MD5 3ab689dbb2767bd9f88c3f29be5d4141
BLAKE2b-256 092648bf1e79360d36076575e3ccee97eb5b6b59e4ab3156a85f922ab7343667

See more details on using hashes here.

Supported by

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