waveforms
Form waveforms used in experiment.
Installation
We encourage installing waveforms via the pip tool (a python package manager):
python -m pip install waveforms
To install from the latest source, you need to clone the GitHub repository on your machine.
git clone https://github.com/feihoo87/waveforms.git
Then dependencies and waveforms can be installed in this way:
cd waveforms
python -m pip install numpy
python -m pip install -e .
Usage
import numpy as np
import matplotlib.pyplot as plt
from waveforms import *
pulse = cosPulse(20e-9)
x_wav = zero()
y_wav = zero()
I, Q = mixing(0.5*pulse, freq=-20e6, DRAGScaling=0.2)
x_wav += I
y_wav += Q
I, Q = mixing(pulse >> 1e-6, freq=-20e6, phase=np.pi/2, DRAGScaling=0.2)
x_wav += I
y_wav += Q
I, Q = mixing((0.5 * pulse) >> 2e-6, freq=-20e6, DRAGScaling=0.2)
x_wav += I
y_wav += Q
t = np.linspace(-1e-6, 9e-6, 10001)
plt.plot(t, x_wav(t))
plt.plot(t, y_wav(t))
plt.show()
Packed binary representation
Starting with version 3, Waveform and WaveVStack use a packed-binary backend.
It is intended for workloads with many small pulses and for low-overhead
serialization.
import waveforms as wf
# The default tick is already the period of 120 GHz (1 / 120e9 seconds).
# To use another global tick, override it before constructing/loading waveforms:
# wf.set_time_resolution(1e-12)
pulse = (wf.gaussian(12e-9) >> 20e-9) * wf.cos(2 * wf.pi * 5e9)
data = pulse.to_bytes()
restored = wf.Waveform.from_bytes(data)
Time resolution is process-wide and is not stored in each binary block. A process loading a block must therefore use the same resolution as the process that created it. The setting is locked when the first waveform object is created or loaded.
sample() has integer-grid fast paths for 500 MHz, 1 GHz, 1.2 GHz, 2 GHz,
2.4 GHz, 2.5 GHz, 4 GHz, 6 GHz, 8 GHz, and 10 GHz. Real waveforms can be
quantized directly to signed DAC buffers:
pulse.start = 0
pulse.stop = 100e-9
dac16 = pulse.sample(2_400_000_000, dtype=np.int16, full_scale=1.0)
The packed core stores and evaluates real-valued signals only. Complex signals are represented in Python as independent real and imaginary channels:
z = (1 + 0.25j) * wf.gaussian(12e-9)
assert isinstance(z, wf.ComplexWaveform)
stack = wf.ComplexWaveVStack([z, z >> 20e-9])
samples = stack(t) # complex NumPy array
Waveform and WaveVStack therefore avoid complex storage and arithmetic for
the common real-valued case. ComplexWaveform.real and .imag expose the two
real channel waveforms.
Reporting Issues
Please report all issues on github.
License
Metadata
Release files for waveforms 3.2.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 | |
|---|---|---|---|
| waveforms-3.2.0.tar.gz | 78.6 kB | Details |
Built distributions (wheels)
Total release size: 38.2 MB
Release files / waveforms-3.2.0.tar.gz
| Download URL | waveforms-3.2.0.tar.gz |
|---|---|
| Size | 78.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4237dca885daf44807f9a88f81c6d11e166f87fbfc62d6d9ab15e672d5d7ae62
|
|
BLAKE2b-256 checksum How to use checksums |
e17a581da9cee9e2f4398840f84f2947178f50794a28ffcc29230b61328ad023
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / waveforms-3.2.0-cp314-cp314t-win_amd64.whl
| Download URL | waveforms-3.2.0-cp314-cp314t-win_amd64.whl |
|---|---|
| Size | 572.8 kB |
| Tags | CPython 3.14 CPython 3.14 free-threading Windows x86-64 |
|
SHA-256 checksum How to use checksums |
1b79d6737301497943b85eb243e7062e0f2360c2fe9b13ab3e6bab3574831289
|
|
BLAKE2b-256 checksum How to use checksums |
e951727d582748ee5ad7661e0777574e5d6702cef34e4c38c7d6e32c574bd449
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / waveforms-3.2.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl
| Download URL | waveforms-3.2.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl |
|---|---|
| Size | 4.4 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading Linux glibc 2.17+ x86-64 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
30cd0b936fa707f0dc4de6c6a70e3d3f1605ced7e5f8e3b9d07269a124d9652c
|
|
BLAKE2b-256 checksum How to use checksums |
4732c5aec6c228f50912eb3ed5cf7effa06500edc7e4baa5dc5d6b42a800e273
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / waveforms-3.2.0-cp314-cp314t-macosx_10_15_universal2.whl
| Download URL | waveforms-3.2.0-cp314-cp314t-macosx_10_15_universal2.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading macOS 10.15+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
1c395c5a298d7d8d7fd69bcf625dbd83a24aa4b7840ce159ce138204c6db17e5
|
|
BLAKE2b-256 checksum How to use checksums |
86652290f5b3c6d87da14586d6faa6a93ac1ff5e267aad53e0b779fa1fcb1872
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / waveforms-3.2.0-cp314-cp314-win_amd64.whl
| Download URL | waveforms-3.2.0-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 538.0 kB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
886d183e63e62690fb2a70ff5f788773a7f6a4065c3c46e0af72ac5b78ab5a74
|
|
BLAKE2b-256 checksum How to use checksums |
c6ce7e85ba45b7bedfdbc1dae0048c5ffb883ecd4dc57eed2a8b55631eab3c3a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / waveforms-3.2.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl
| Download URL | waveforms-3.2.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl |
|---|---|
| Size | 4.4 MB |
| Tags | CPython 3.14 Linux glibc 2.17+ x86-64 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
91f91bcbaaebb798b5eecf4cbaa4d10f8b289903061b3265380534e4443159f6
|
|
BLAKE2b-256 checksum How to use checksums |
23658ff6116ef3e45515638d71e99d590ec26d66fc249247ccc53642ce604cfa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / waveforms-3.2.0-cp314-cp314-macosx_10_15_universal2.whl
| Download URL | waveforms-3.2.0-cp314-cp314-macosx_10_15_universal2.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.14 macOS 10.15+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
608f3e578fe0598d15f3b7f1341d1967623756a2742676f1aa6923f03b086a77
|
|
BLAKE2b-256 checksum How to use checksums |
c466a45aeee11aa338c262424b5357f113701214e1b4f351084630c2a4ddcdd3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / waveforms-3.2.0-cp313-cp313-win_amd64.whl
| Download URL | waveforms-3.2.0-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 523.5 kB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
ae8e8843c21053b2e167b7feffa84dd81382e6b1e1aa1c9cec588b767b42fdcb
|
|
BLAKE2b-256 checksum How to use checksums |
6a22db7d46360bf7d96617a18e017640d5cb50dbf5da5bbd21b4370782a9b2dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / waveforms-3.2.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl
| Download URL | waveforms-3.2.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl |
|---|---|
| Size | 4.4 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
d11e61c30b7b3831fef5c0e5ab262fbba19f2865710ea6c51c5b592db38fdd0a
|
|
BLAKE2b-256 checksum How to use checksums |
01403071aff4542aaa5376722082beb9c0ac851e896cee930f3ed075dd71199a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / waveforms-3.2.0-cp313-cp313-macosx_10_13_universal2.whl
| Download URL | waveforms-3.2.0-cp313-cp313-macosx_10_13_universal2.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.13 macOS 10.13+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
b5399f5892151340e6461ba8c3de5b2f6adc490429451a9c5cfe9d34792fa846
|
|
BLAKE2b-256 checksum How to use checksums |
055887784a36547fae9217727ad6f101f07fbe07804e898cb87bf05a871d3978
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / waveforms-3.2.0-cp312-cp312-win_amd64.whl
| Download URL | waveforms-3.2.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 524.6 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
0d7e04ba00baaf16244f3650b90526965182fa5543d4ef8b9557fb75aaa5f437
|
|
BLAKE2b-256 checksum How to use checksums |
b46e0f8121b6621b7c65732bdd6a70e21013c809dfacb8e4298352d3261d77a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / waveforms-3.2.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl
| Download URL | waveforms-3.2.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl |
|---|---|
| Size | 4.4 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
ea31e1cc88a5a915964e36c3e224d40e10eb6e3df3fc7bbf7f09fecaacb7f2c6
|
|
BLAKE2b-256 checksum How to use checksums |
36f3e96c5e06a97e620a6ef8839a7c9dc29b50666beb7bcfc03ce9861c14a02f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / waveforms-3.2.0-cp312-cp312-macosx_10_13_universal2.whl
| Download URL | waveforms-3.2.0-cp312-cp312-macosx_10_13_universal2.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.12 macOS 10.13+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
ae3927b3de6e71aef67f758518baa9c01df698f7544fae2c3184c9d0d9ac49a4
|
|
BLAKE2b-256 checksum How to use checksums |
f600182e0739465d09a8435408d6b0f1be47f533040d9eedae140c3d1ba5ad08
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / waveforms-3.2.0-cp311-cp311-win_amd64.whl
| Download URL | waveforms-3.2.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 578.7 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
082fd79c13ffb22c899b3d802fcc22b88ebc5c878b9f51f9e623851fffc2a31d
|
|
BLAKE2b-256 checksum How to use checksums |
1cc22c851eecec2a577e8a1f1161715771005a661f81b8bc81be400e2d0b9a94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / waveforms-3.2.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl
| Download URL | waveforms-3.2.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl |
|---|---|
| Size | 4.8 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
6882acdfd9eb37bcd2c68cd49f9e23ecbb2161ae417d999cd1fcb27c8eddb34e
|
|
BLAKE2b-256 checksum How to use checksums |
043bf44924da772bc707bdce5bffaab486037799bdc8196a57a08f940999501b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / waveforms-3.2.0-cp311-cp311-macosx_10_9_universal2.whl
| Download URL | waveforms-3.2.0-cp311-cp311-macosx_10_9_universal2.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
2e571e8af0bbdcc133d6f26e6ac9103ace473f22499a2ebf509f36f0bb8e50b1
|
|
BLAKE2b-256 checksum How to use checksums |
5d48256efa3e8de73c7540acb0d65d040a7f4cf91c007d56419deb84b6816641
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / waveforms-3.2.0-cp310-cp310-win_amd64.whl
| Download URL | waveforms-3.2.0-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 579.2 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
0d4288a0f04a292c8e35483af880f4cf96a70003c4210f5f690700bf837202a0
|
|
BLAKE2b-256 checksum How to use checksums |
50adfbf27ada429ce5d91f9500156edb92a931c8f340f66fd2af432c81c990ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / waveforms-3.2.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl
| Download URL | waveforms-3.2.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl |
|---|---|
| Size | 4.6 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
e5234ddd876bd671723ff0dddfb84f87a1a197ec63bfce6263ad13ff7b3b6ce6
|
|
BLAKE2b-256 checksum How to use checksums |
47349304ae57544f76722543acdf5476b81a31ea62c30884f6e39ca5f9436426
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / waveforms-3.2.0-cp310-cp310-macosx_10_9_universal2.whl
| Download URL | waveforms-3.2.0-cp310-cp310-macosx_10_9_universal2.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
d62c2d377603046cb66acbd1e5f71b1f882bd4addb3ef9cb45ee2d650c29b967
|
|
BLAKE2b-256 checksum How to use checksums |
2a1ae897f3f7f86c5a59ec8ed0a0825b36e48ab6e37ddd70393d027d3374cc20
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|