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.
Post-sampling nonlinear calibration
NonlinearMap compiles one monotone branch of calibration samples to a compact
native lookup table. A centered map is useful when a waveform describes a
frequency excursion around an idle point:
frequency = np.array([4.0e9, 4.5e9, 5.0e9, 5.5e9, 6.0e9])
flux = np.array([0.31, 0.22, 0.08, -0.06, -0.16])
frequency_to_flux = wf.NonlinearMap.from_samples(
frequency,
flux,
method="monotone_cubic", # PCHIP compiled to uniform cubic segments
reference=5.0e9, # map(0) == 0 around the idle frequency
dtype=np.float32,
extrapolate="error",
)
trajectory.start = 0
trajectory.stop = 200e-9
trajectory.sample_rate = 2_400_000_000
trajectory.nonlinear = frequency_to_flux
flux_samples = trajectory.sample(dtype=np.int16)
The sampling order is waveform accumulation, nonlinear mapping, optional SOS
filtering/predistortion, and finally integer quantization. This is important for
WaveVStack: the map is applied to the accumulated trajectory rather than to
each pulse event independently. method="linear" selects the smaller and
fastest two-point interpolation path. Maps serialize independently through
to_bytes()/from_bytes() using the language-neutral NLM1 format.
Reporting Issues
Please report all issues on github.
License
Metadata
Release files for waveforms 3.5.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.5.0.tar.gz | 96.4 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| waveforms-3.5.0-cp314-cp314t-win_amd64.whl | CPython 3.14 | CPython 3.14 free-threading | Windows x86-64 | Details |
| waveforms-3.5.0-cp314-cp314t-manylinux_2_31_x86_64.manylinux_2_34_x86_64.whl | CPython 3.14 | CPython 3.14 free-threading | Linux glibc 2.31+ x86-64, Linux glibc 2.34+ x86-64 | Details |
| waveforms-3.5.0-cp314-cp314t-macosx_10_15_universal2.whl | CPython 3.14 | CPython 3.14 free-threading | macOS 10.15+ universal2 (ARM64, x86-64) | Details |
| waveforms-3.5.0-cp314-cp314-win_amd64.whl | CPython 3.14 | CPython 3.14 | Windows x86-64 | Details |
| waveforms-3.5.0-cp314-cp314-manylinux_2_31_x86_64.manylinux_2_34_x86_64.whl | CPython 3.14 | CPython 3.14 | Linux glibc 2.31+ x86-64, Linux glibc 2.34+ x86-64 | Details |
| waveforms-3.5.0-cp314-cp314-macosx_10_15_universal2.whl | CPython 3.14 | CPython 3.14 | macOS 10.15+ universal2 (ARM64, x86-64) | Details |
| waveforms-3.5.0-cp313-cp313-win_amd64.whl | CPython 3.13 | CPython 3.13 | Windows x86-64 | Details |
| waveforms-3.5.0-cp313-cp313-manylinux_2_31_x86_64.manylinux_2_34_x86_64.whl | CPython 3.13 | CPython 3.13 | Linux glibc 2.31+ x86-64, Linux glibc 2.34+ x86-64 | Details |
| waveforms-3.5.0-cp313-cp313-macosx_10_13_universal2.whl | CPython 3.13 | CPython 3.13 | macOS 10.13+ universal2 (ARM64, x86-64) | Details |
| waveforms-3.5.0-cp312-cp312-win_amd64.whl | CPython 3.12 | CPython 3.12 | Windows x86-64 | Details |
| waveforms-3.5.0-cp312-cp312-manylinux_2_31_x86_64.manylinux_2_34_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.34+ x86-64, Linux glibc 2.31+ x86-64 | Details |
| waveforms-3.5.0-cp312-cp312-macosx_10_13_universal2.whl | CPython 3.12 | CPython 3.12 | macOS 10.13+ universal2 (ARM64, x86-64) | Details |
| waveforms-3.5.0-cp311-cp311-win_amd64.whl | CPython 3.11 | CPython 3.11 | Windows x86-64 | Details |
| waveforms-3.5.0-cp311-cp311-manylinux_2_31_x86_64.manylinux_2_34_x86_64.whl | CPython 3.11 | CPython 3.11 | Linux glibc 2.31+ x86-64, Linux glibc 2.34+ x86-64 | Details |
| waveforms-3.5.0-cp311-cp311-macosx_10_9_universal2.whl | CPython 3.11 | CPython 3.11 | macOS 10.9+ universal2 (ARM64, x86-64) | Details |
| waveforms-3.5.0-cp310-cp310-win_amd64.whl | CPython 3.10 | CPython 3.10 | Windows x86-64 | Details |
| waveforms-3.5.0-cp310-cp310-manylinux_2_31_x86_64.manylinux_2_34_x86_64.whl | CPython 3.10 | CPython 3.10 | Linux glibc 2.34+ x86-64, Linux glibc 2.31+ x86-64 | Details |
| waveforms-3.5.0-cp310-cp310-macosx_10_9_universal2.whl | CPython 3.10 | CPython 3.10 | macOS 10.9+ universal2 (ARM64, x86-64) | Details |
Total release size: 14.1 MB
Release files / waveforms-3.5.0.tar.gz
| Download URL | waveforms-3.5.0.tar.gz |
|---|---|
| Size | 96.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
199180eba7d32ee7ab63375d22e38075f4b34b84fcaf5887b7048af07cdd9ca0
|
|
BLAKE2b-256 checksum How to use checksums |
0151d7d5f74bda70c2a9fdd13e6f9ba7c5b61900315dee81c9b731f2f39e4511
|
| 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.5.0-cp314-cp314t-win_amd64.whl
| Download URL | waveforms-3.5.0-cp314-cp314t-win_amd64.whl |
|---|---|
| Size | 306.1 kB |
| Tags | CPython 3.14 CPython 3.14 free-threading Windows x86-64 |
|
SHA-256 checksum How to use checksums |
ee8e71e21a2f0fcf32391de43a7a09adbe0eed82996caf2bad319a44fbb5f694
|
|
BLAKE2b-256 checksum How to use checksums |
0c45631f7d489d4effafb90bd306bd7841812a2e042435fdb682ce0ed1ffd5cf
|
| 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.5.0-cp314-cp314t-manylinux_2_31_x86_64.manylinux_2_34_x86_64.whl
| Download URL | waveforms-3.5.0-cp314-cp314t-manylinux_2_31_x86_64.manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading Linux glibc 2.31+ x86-64 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
676677e8e251557cc525c602b41234225569401947b8219274790bdc952a55b8
|
|
BLAKE2b-256 checksum How to use checksums |
cda2f40c5d772e5d1b1338dc38bae21d526dc2d94327a245a4431e9e5a01a591
|
| 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.5.0-cp314-cp314t-macosx_10_15_universal2.whl
| Download URL | waveforms-3.5.0-cp314-cp314t-macosx_10_15_universal2.whl |
|---|---|
| Size | 577.9 kB |
| Tags | CPython 3.14 CPython 3.14 free-threading macOS 10.15+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
bc9e07a1d12e590aaf8a5047b5f5b238f6494f4203a55d9865a77b640de975f3
|
|
BLAKE2b-256 checksum How to use checksums |
617d811c0fc1fc91bed7d19cd2214cae1adb8d67ecc7f6039280a449f3cf7b0b
|
| 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.5.0-cp314-cp314-win_amd64.whl
| Download URL | waveforms-3.5.0-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 296.0 kB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
93456279c37b9be2a056948d80b517abefc875c671158964407d9dc069099ac6
|
|
BLAKE2b-256 checksum How to use checksums |
ca712d8db18ae52bec68a78a542e9b530d7264848ccd591bf6db018e50bbe9f8
|
| 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.5.0-cp314-cp314-manylinux_2_31_x86_64.manylinux_2_34_x86_64.whl
| Download URL | waveforms-3.5.0-cp314-cp314-manylinux_2_31_x86_64.manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.14 Linux glibc 2.31+ x86-64 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
284db680bd4df412833dc1169d852b035340456160c6c170edad095b4406af98
|
|
BLAKE2b-256 checksum How to use checksums |
df780ef144ac86175a7e5a992d74f0393f89894a910d7a3b169ec0dfb413e2d1
|
| 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.5.0-cp314-cp314-macosx_10_15_universal2.whl
| Download URL | waveforms-3.5.0-cp314-cp314-macosx_10_15_universal2.whl |
|---|---|
| Size | 567.9 kB |
| Tags | CPython 3.14 macOS 10.15+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
bbcbd93baf916799422c2caae08ba0dc33eefe64276c790ae85dda8f938138fb
|
|
BLAKE2b-256 checksum How to use checksums |
15f7647c8c01f25f56c6d23e52c623797f22412b8bbcf74620d1e7bebf63004b
|
| 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.5.0-cp313-cp313-win_amd64.whl
| Download URL | waveforms-3.5.0-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 289.3 kB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
fd9210dc3d5f3e35526a4b53aa064d4cebe89f93157774e9cfe368f14b0a63f0
|
|
BLAKE2b-256 checksum How to use checksums |
e7fb8602cf59d5c264701edf9a6806be11bd3a396808c700e8a08a8deed47fab
|
| 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.5.0-cp313-cp313-manylinux_2_31_x86_64.manylinux_2_34_x86_64.whl
| Download URL | waveforms-3.5.0-cp313-cp313-manylinux_2_31_x86_64.manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.13 Linux glibc 2.31+ x86-64 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
bb23414ea26bd508900559dc1bd8f6edbd68de8ef007e9d02f366ce8ed88862a
|
|
BLAKE2b-256 checksum How to use checksums |
0514b02425450510e4abc18936f2fbafbe6250c3966601075bf9110250bcb801
|
| 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.5.0-cp313-cp313-macosx_10_13_universal2.whl
| Download URL | waveforms-3.5.0-cp313-cp313-macosx_10_13_universal2.whl |
|---|---|
| Size | 566.9 kB |
| Tags | CPython 3.13 macOS 10.13+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
a3d162a00672010669957369d122143be646226a0a25d4081706e4dd8c1d15c8
|
|
BLAKE2b-256 checksum How to use checksums |
d90420d79c5b668b336758487e64a145eea2247bc3ede3c4cfee9ef5631d63dc
|
| 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.5.0-cp312-cp312-win_amd64.whl
| Download URL | waveforms-3.5.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 289.4 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
1337a91cd399c5ec50bfcf599f25e9b3fb28d2e6bc7339fc86bb5c5ba87ea144
|
|
BLAKE2b-256 checksum How to use checksums |
645971d895bf2858fb936c38d969ee28638a12f33ef079b47da1e64cb9ecd201
|
| 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.5.0-cp312-cp312-manylinux_2_31_x86_64.manylinux_2_34_x86_64.whl
| Download URL | waveforms-3.5.0-cp312-cp312-manylinux_2_31_x86_64.manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.12 Linux glibc 2.31+ x86-64 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
bdd7b94ebda9c77fc990a93b12a7631206c436cec09a5d747a84788ae6518062
|
|
BLAKE2b-256 checksum How to use checksums |
971d484959c6e657b1684bec15a697ece0556d01829a584b27fd0fb64bc55959
|
| 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.5.0-cp312-cp312-macosx_10_13_universal2.whl
| Download URL | waveforms-3.5.0-cp312-cp312-macosx_10_13_universal2.whl |
|---|---|
| Size | 565.8 kB |
| Tags | CPython 3.12 macOS 10.13+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
9096be53339d8985c565473cd40f05f61a905831cda593eab8f02d52d0b3cc15
|
|
BLAKE2b-256 checksum How to use checksums |
282e724940866e496cea0c2d079e13d42fd2b546d92b9d9996afe6fa2e4091f2
|
| 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.5.0-cp311-cp311-win_amd64.whl
| Download URL | waveforms-3.5.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 302.3 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
2d5db2cebb819d0c0acd5ded56cafcbf566f5e0153827b3c2347a9c1fcdd9102
|
|
BLAKE2b-256 checksum How to use checksums |
cc91f1a929a5b55d9ea0a3d3b37b7aabb8ce3ff6b798e5336d1a5b5edf3a22e2
|
| 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.5.0-cp311-cp311-manylinux_2_31_x86_64.manylinux_2_34_x86_64.whl
| Download URL | waveforms-3.5.0-cp311-cp311-manylinux_2_31_x86_64.manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.11 Linux glibc 2.31+ x86-64 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
f75fe89bf0e7b4d3cbc3b8012d4a060f99a3d0ca40106a6e334c32752761c6d6
|
|
BLAKE2b-256 checksum How to use checksums |
3b0197b1fa56f8164dfe75b59280c422e06b2996b87ecc24609876c80ec6e07f
|
| 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.5.0-cp311-cp311-macosx_10_9_universal2.whl
| Download URL | waveforms-3.5.0-cp311-cp311-macosx_10_9_universal2.whl |
|---|---|
| Size | 556.7 kB |
| Tags | CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
1b022da4036e412155c7300883cec1b8b5e5ecb44a72aa4c726d4708577df3fe
|
|
BLAKE2b-256 checksum How to use checksums |
c067413a0267ce6bb6288c594c7e9bc2609078b86eb37d217a3c424257c4103b
|
| 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.5.0-cp310-cp310-win_amd64.whl
| Download URL | waveforms-3.5.0-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 302.9 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
2e4c77418eac3b7d950c1b145f067e708f0d4ef99670c830f8954638287fd9fd
|
|
BLAKE2b-256 checksum How to use checksums |
e0bd958cc573d44b807d78193f7d88bcd4a6048dc29983fb7578f0a0244e7f77
|
| 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.5.0-cp310-cp310-manylinux_2_31_x86_64.manylinux_2_34_x86_64.whl
| Download URL | waveforms-3.5.0-cp310-cp310-manylinux_2_31_x86_64.manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.10 Linux glibc 2.31+ x86-64 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
b216c1f2371349cac66ecdeab1f221731cfaadc8abc896983cc18cd80a31e926
|
|
BLAKE2b-256 checksum How to use checksums |
5cddcd9e3c7d0f00794c8243e6d2123c465f47dc049bc162bae1b0dc834fb94b
|
| 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.5.0-cp310-cp310-macosx_10_9_universal2.whl
| Download URL | waveforms-3.5.0-cp310-cp310-macosx_10_9_universal2.whl |
|---|---|
| Size | 562.8 kB |
| Tags | CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
7153a520c97283d1b0179a401963e9a74014b44974e0361687cc3d52a5b4751f
|
|
BLAKE2b-256 checksum How to use checksums |
a8ca99ad651618e4319dbbad7b6ee4421bcafa9f4253fc1412f0d6517332e305
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|