Skip to content

shapes

Carrier waveform shapes for use with ToneBurst. All shapes are PulseShape subclasses — Equinox modules with a normalised periodic output (peak amplitude 1).

Shapes are passed as the shape argument to ToneBurst:

from jbubble.pulse import ToneBurst
from jbubble.pulse.shapes import Sine, Square, Rectangular

pulse = ToneBurst(freq=1e6, pressure=100e3, shape=Sine())

Base classes

jbubble.pulse.shapes.PulseShape

Bases: Module

jbubble.pulse.shapes.FourierPulseShape

Bases: PulseShape


Concrete shapes

jbubble.pulse.shapes.Sine

Bases: PulseShape

jbubble.pulse.shapes.Square

jbubble.pulse.shapes.Sawtooth

jbubble.pulse.shapes.InvertedSawtooth

jbubble.pulse.shapes.Triangle

jbubble.pulse.shapes.Quadratic

jbubble.pulse.shapes.NegativeQuadratic

Bases: Quadratic

jbubble.pulse.shapes.Rectangular

Bases: FourierPulseShape

General duty-cycle rectangular waveform.

Parameterized by duty cycle, amplitude levels, and window placement::

f(t) = high_level  for (phase_offset / 2π) * T ≤ t' < (phase_offset / 2π + duty) * T
f(t) = low_level   otherwise

where t' = t mod T.

DC component: high_level * duty + low_level * (1 - duty)

Parameters:

Name Type Description Default
duty

Fraction of the period spent at high_level (0 < duty < 1).

required
high_level

Amplitude during the active window (default +1).

required
low_level

Amplitude outside the active window (default -1).

required
phase_offset

Cycle offset in radians, equal to 2π * (start fraction of high window). 0 places the window at the cycle start; π at the midpoint.

required

Examples:

Common named forms::

Rectangular(duty=0.5)                                          # ±1 square
Rectangular(duty=0.5, phase_offset=jnp.pi)                     # NegPos square
Rectangular(duty=0.25)                                         # +1 for 25%, -1 for 75%
Rectangular(duty=0.01, high_level=0.0, low_level=-1.0,
                 phase_offset=1.98 * jnp.pi)                       # monopolar 99%

jbubble.pulse.shapes.TimeDomainSquare

Bases: PulseShape

jbubble.pulse.shapes.TimeDomainSawtooth

Bases: PulseShape

jbubble.pulse.shapes.TimeDomainTriangle

Bases: PulseShape


Choosing a shape

Shape Spectral content Notes
Sine Single harmonic Default; smoothest, no harmonic artefacts
Square / TimeDomainSquare Odd harmonics Gibbs ringing in Fourier version; TimeDomainSquare avoids it
Sawtooth / TimeDomainSawtooth All harmonics Rising ramp; useful for asymmetric forcing
Triangle / TimeDomainTriangle Odd harmonics, faster roll-off Smoother than square
Rectangular(duty) General Full control over duty cycle, levels, and phase offset

For gradient-based optimisation of the carrier shape, prefer TimeDomain* variants or Sine — Fourier-series shapes truncate at 10 terms and are C^0 at sharp transitions.