pge2py
The official pulseg and pge2 MATLAB toolboxes (Pulseq on GE), called from Python on a pypulseq sequence, with the same calls as in MATLAB:
import pge2py as pge2
from pge2py import pulseg
psq = pulseg.fromSeq(seq) # a pypulseq Sequence, or a .seq file
sys_ge = pge2.opts(100e-6, 100e-6, 0.25, 5, 20, "xrm") # psd_rf_wait, psd_grd_wait, b1_max, g_max, slew_max, coil
params = pge2.check(psq, sys_ge, PNSwt=(1, 1, 1))
pge2.validate(psq, sys_ge, seq)
pge2.serialize(psq, "sequence.pge", pislquant=10, params=params)
psq shows as the list of virtual segments and their block layout; params
is a dict (b1max, gmax, smax). Errors raise pge2py.PGE2Error with the
toolbox's message; warnings and validate mismatches are in
pge2py.last_messages.
The toolboxes run in GNU Octave:
- In the browser (Pyodide, JupyterLite): GNU Octave 10.3 compiled to
WebAssembly is bundled in the wheel and runs in a Web Worker, on the user's
own computer. Nothing to install:
%pip install pge2pyin a JupyterLite notebook. - On the desktop: the GNU Octave installed on the computer, through
oct2py:
pip install pge2py[octave].
The toolboxes are bundled at pinned commits (see pge2py/_assets/MANIFEST.json),
with the small changes they need to run in Octave.
In the browser
The calls block until Octave is done where the browser lets Python wait for JavaScript (WebAssembly JSPI, e.g. Chrome). Elsewhere, use the coroutines:
from pge2py import aio
psq = await aio.fromSeq(seq)
params = await aio.check(psq, sys_ge)
await aio.validate(psq, sys_ge, seq)
await aio.serialize(psq, "sequence.pge", params=params)
Each call starts a fresh Octave (about 0.5 s); fromSeq, check and
validate take a few seconds each on a 790-block 2D GRE.
Building from source
python tools/build_assets.py # Octave wasm + toolboxes -> src/pge2py/_assets
python -m build --wheel
Licences
pge2py is MIT licensed. The wheel bundles GNU Octave (GPL-3.0-or-later) and
the Pulseq, pulseg and pge2 toolboxes (MIT); see LICENSES/.
Releases
Versions follow pge2py.__version__. A release is cut by adding its section
to CHANGELOG.md, setting __version__, and creating the tag vX.Y.Z on that
commit, by pushing it or by creating the release in the GitHub web interface:
.github/workflows/release.yml builds the wheel, publishes it to PyPI and
attaches the files to the GitHub release.
Metadata
Release files for pge2py 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pge2py-0.1.0.tar.gz | 35.1 kB | With provenance | Details for pge2py-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pge2py-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pge2py-0.1.0-py3-none-any.whl |
Total release size: 12.3 MB
Release files / pge2py-0.1.0.tar.gz
| Download URL | pge2py-0.1.0.tar.gz |
|---|---|
| Size | 35.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
719992dcf12a01eda6589c88cf053b114a8fc91ce2524f4b684a43c10cc93795
|
|
BLAKE2b-256 checksum How to use checksums |
897915d94d28a5e941b30eb0d489accb117c77baac53f4f69b84b72bd418c7cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 24, 2026.
Transparency logRelease files / pge2py-0.1.0-py3-none-any.whl
| Download URL | pge2py-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.3 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e1436016bc878e9c07990fc34811f8a2fcfd361925420ada850ed2750131f58f
|
|
BLAKE2b-256 checksum How to use checksums |
1f037bad7ff753a7720ba245b077a6957f389bf98a2a3148c8f03fa887f5f3fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 24, 2026.
Transparency logSecurity for pge2py 0.1.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pge2py-0.1.0.tar.gz
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 Nov 24, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.