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()
Unified binary representation
Waveform is the common base class for every signal object. RealWaveform
and ComplexWaveform are concrete waveforms; WaveVStack is the common stack
base, with RealWaveVStack and ComplexWaveVStack as its concrete forms.
The original construction style remains unchanged and automatically selects
the compact C core for common pulses and repeated-pulse stacks:
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)
assert isinstance(pulse, wf.Waveform)
stack = wf.WaveVStack([pulse, pulse >> 40e-9])
assert isinstance(stack, wf.RealWaveVStack)
assert isinstance(stack, wf.WaveVStack)
The C block format stores signed 64-bit ticks using a process-wide clock. The default is 120 GHz. A different process-wide time resolution may be selected before the first waveform is constructed; the same C representation and evaluator continue to be used. The setting is locked by the first object.
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 low-level cores store and evaluate 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
Real waveforms and stacks 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.3.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.3.0.tar.gz | 73.3 kB | Details |
Built distributions (wheels)
Total release size: 12.5 MB
Release files / waveforms-3.3.0.tar.gz
| Download URL | waveforms-3.3.0.tar.gz |
|---|---|
| Size | 73.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5a8feb6da20b8546d206d04854c6fbf53921f7174fdd32caeb089ad424cae462
|
|
BLAKE2b-256 checksum How to use checksums |
3e7d80d726f1e7e9ada80c03e34827e9130e2f68668bf031178d61fb138781b5
|
| 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.3.0-cp314-cp314t-win_amd64.whl
| Download URL | waveforms-3.3.0-cp314-cp314t-win_amd64.whl |
|---|---|
| Size | 266.0 kB |
| Tags | CPython 3.14 CPython 3.14 free-threading Windows x86-64 |
|
SHA-256 checksum How to use checksums |
fcd398f01b952eadbe47141870b289a033cd0615f722549f31e7405d9334c973
|
|
BLAKE2b-256 checksum How to use checksums |
289465f2b0cb7188f3b05f5adac58d6e2e0fcf8a24cc586ae5d6c1ef325bc576
|
| 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.3.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl
| Download URL | waveforms-3.3.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.3 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 |
1902cfc8455183efc061f1d057dcdf9110795a823ce8043f906bc9e6d29b626e
|
|
BLAKE2b-256 checksum How to use checksums |
d176669ea88eb64c972f88dfa202d775da3ebae84131e43e658e176e0f0f7b22
|
| 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.3.0-cp314-cp314t-macosx_10_15_universal2.whl
| Download URL | waveforms-3.3.0-cp314-cp314t-macosx_10_15_universal2.whl |
|---|---|
| Size | 515.1 kB |
| Tags | CPython 3.14 CPython 3.14 free-threading macOS 10.15+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
317f68ebaff170a5b0739e52cbade33c82ab1a62d65a0685e61accb41f0a943f
|
|
BLAKE2b-256 checksum How to use checksums |
bfe6db6fa06ac135276eeb1c84b582e2c976f68f3bf1f28de806c0f59d97448b
|
| 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.3.0-cp314-cp314-win_amd64.whl
| Download URL | waveforms-3.3.0-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 255.9 kB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
2a33e137363dce338e889819db9bb72b852d74f969eaa9cbfe98b012828fdf1f
|
|
BLAKE2b-256 checksum How to use checksums |
bd3d165ed186bc3f836b51e6acffc338eed38a2d884d1b4f20685d7d7fb64877
|
| 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.3.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl
| Download URL | waveforms-3.3.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.14 Linux glibc 2.17+ x86-64 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
5552e9228a3dc51c8e8970f1d175fc2eff9402949e5bf16407babfb0fd6b533e
|
|
BLAKE2b-256 checksum How to use checksums |
453e55e5eee9f0a362c80353de8ee070e15111bf3089dbf0430398eaadac0a9a
|
| 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.3.0-cp314-cp314-macosx_10_15_universal2.whl
| Download URL | waveforms-3.3.0-cp314-cp314-macosx_10_15_universal2.whl |
|---|---|
| Size | 504.2 kB |
| Tags | CPython 3.14 macOS 10.15+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
0f9c1c1f051ebf46f1215c3c208878339e65dd359714aecad2b7fd27d646ee14
|
|
BLAKE2b-256 checksum How to use checksums |
b51264b26f2b33c87b84c2206919005e90ef57b2e62055f3890362ef9b43edf1
|
| 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.3.0-cp313-cp313-win_amd64.whl
| Download URL | waveforms-3.3.0-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 249.6 kB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
0de273a9f1a9287856f0f69d3a419d9823ac8ff24e99847d281bbb05d2de717f
|
|
BLAKE2b-256 checksum How to use checksums |
13d3c305e24b9aae5a054c85864cdd2bccb2b270c0bdd06839a70584bf03e340
|
| 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.3.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl
| Download URL | waveforms-3.3.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
dfa110eb5957a6ba644e1031e8d3104ca4c7560550f4224002550334bc6a5261
|
|
BLAKE2b-256 checksum How to use checksums |
3f5ff4876da434611dda6fe170386eb988bf541d5a1eedd5127873090de2d446
|
| 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.3.0-cp313-cp313-macosx_10_13_universal2.whl
| Download URL | waveforms-3.3.0-cp313-cp313-macosx_10_13_universal2.whl |
|---|---|
| Size | 503.0 kB |
| Tags | CPython 3.13 macOS 10.13+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
3782f901fd3de01a82a186694048a3def43e1d496b50287e9c7ebeedda28c836
|
|
BLAKE2b-256 checksum How to use checksums |
a01a195c7aa50ec66999e52d4686529d135dc9464b6ddd15c0a4d6d00348616a
|
| 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.3.0-cp312-cp312-win_amd64.whl
| Download URL | waveforms-3.3.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 249.6 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
88412702618363be7780ca75ca3886db9145b085d5ffb6d6b114d8cd6839de3c
|
|
BLAKE2b-256 checksum How to use checksums |
6348c4c770e6a025ef9b85b9cf63d673f06bcae27bcc899c9a684d1df66cabdb
|
| 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.3.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl
| Download URL | waveforms-3.3.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
6a8077d73f65f4e557668595eb5cd019ace53dccd798d0f6f70aaa5deca57e52
|
|
BLAKE2b-256 checksum How to use checksums |
63b53f77bf572cd159efece95577496039e9797e99748279a303e6446622d8b4
|
| 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.3.0-cp312-cp312-macosx_10_13_universal2.whl
| Download URL | waveforms-3.3.0-cp312-cp312-macosx_10_13_universal2.whl |
|---|---|
| Size | 502.7 kB |
| Tags | CPython 3.12 macOS 10.13+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
bf9b512aabff6fa541ce68b5594c175b267f95ce7880292390a366cb08725cc1
|
|
BLAKE2b-256 checksum How to use checksums |
37b99a3bec06930b3da38efae6e75cb2e47185bc3934336833e2996017eaa395
|
| 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.3.0-cp311-cp311-win_amd64.whl
| Download URL | waveforms-3.3.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 262.0 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
504128c3ea15999cf406c1c34caa949c8dbc8dad8e5218a521d3925c93b6af0b
|
|
BLAKE2b-256 checksum How to use checksums |
65327bc15da6a6b8cd501329f2c8ec40ae943a4564287b08161cf611cf17a0fb
|
| 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.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl
| Download URL | waveforms-3.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
aeb246f89fec9f89e7f38286b8cbd43e6e4b8eff650ea4ad38c5fed7a671a8d4
|
|
BLAKE2b-256 checksum How to use checksums |
e3c8c42f93a60a61e5c3f1b271973ced47c10ca899c225b776fab41768d09a26
|
| 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.3.0-cp311-cp311-macosx_10_9_universal2.whl
| Download URL | waveforms-3.3.0-cp311-cp311-macosx_10_9_universal2.whl |
|---|---|
| Size | 494.0 kB |
| Tags | CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
efb34a81e9a3a79d1e11c09fa9d016b847ba4b9a321afa08450e893a64723fd8
|
|
BLAKE2b-256 checksum How to use checksums |
04fd3d9a540208245380d54a20fb72e8f25fe45e63252a82b1c52b5db5610de7
|
| 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.3.0-cp310-cp310-win_amd64.whl
| Download URL | waveforms-3.3.0-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 262.7 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
28a15a0e5bb69d6ae59a3427df87018642ca54907ccef299e5190f8ab7b45a5c
|
|
BLAKE2b-256 checksum How to use checksums |
162e442585c7062147889d4cf675a594da4dac3bc6f7cdff54b42a6b4510aba2
|
| 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.3.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl
| Download URL | waveforms-3.3.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
64ce6ea49e9d261e51b8fde7e7d209bcdf21cf644aecd82f870776abc08683f3
|
|
BLAKE2b-256 checksum How to use checksums |
10c71dd793a1dcddbd20cf8f9211e0bfb99728faafa0f2f3122792c37205d7e9
|
| 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.3.0-cp310-cp310-macosx_10_9_universal2.whl
| Download URL | waveforms-3.3.0-cp310-cp310-macosx_10_9_universal2.whl |
|---|---|
| Size | 498.9 kB |
| Tags | CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
ed947d87f4547c594014f612e3b3a5f53a1bcefb5af451642304ec4cd72b9e49
|
|
BLAKE2b-256 checksum How to use checksums |
37b41cfd350f30d2bd1c77ce70b478c478c8d7b0651bec3c1baf879d5463fdf9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|