waveform

See the How-To guide for complete instructions on defining new user waveforms.

class wavgen.waveform.Superposition(freqs, mags=None, phases=None, sample_length=None, amp=1.0)[source]

Bases: waveform_base.Waveform

A static trap configuration.

Waves

The list of composing pure tones. Each object holds a frequency, magnitude, and relative phase.

Type

list of Wave

Hint

There are now 3 relevant amplitudes here: Output Voltage Limit, Waveform Amplitude, & the amplitudes of each pure tone composing a superposition. Each one is expressed as a fraction of the previous.

See also

even_spacing()

An alternative constructor for making Superposition objects.

__init__(freqs, mags=None, phases=None, sample_length=None, amp=1.0)[source]

Provides several options for defining waveform duration.

Parameters
  • freqs (list of int) – A list of frequency values, from which wave objects are automatically created.

  • mags (list of float, optional) – Vector representing relative magnitude of each trap, within [0,1] (in order of increasing frequency).

  • phases (list of float, optional) – Vector representing initial phases of each trap tone, within [0, 2*pi] (in order of increasing frequency).

  • sample_length (int, optional) – Length of waveform in samples.

  • amp (float, optional) – Amplitude of waveform relative to maximum output voltage.

get_magnitudes()[source]
Returns

Value of Magnitude for each pure tone, in order of increasing frequency.

Return type

list of float

set_magnitudes(mags)[source]

Sets the Magnitude of each pure tone.

Parameters

mags (list of float) – Each new magnitude, limited to ([0, 1]), ordered by ascending frequency).

set_phases(phases)[source]

Sets the relative phase of each pure tone.

Parameters

phases (list of float) – New phases, expressed as (radians), ordered by ascending frequency.

randomize()[source]

Randomizes each pure tone’s phase.

wavgen.waveform.even_spacing(ntraps, center, spacing, mags=None, phases=None, sample_length=None, amp=1.0)[source]
Wrapper function which simplifies defining Superposition objects

to describe equally spaced traps.

Parameters
  • ntraps (int) – Number of optical traps.

  • center (int) – Mean or center frequency of the traps.

  • spacing (int) – Frequency spacing between traps.

  • mags (list of float, optional) – Vector representing relative magnitude of each trap, within [0,1] (in order of increasing frequency).

  • phases (list of float, optional) – Vector representing initial phases of each trap tone, within [0, 2*pi] (in order of increasing frequency).

  • sample_length (int, optional) – Length of waveform in samples.

  • amp (float, optional) – Amplitude of waveform relative to maximum output voltage.

Returns

Return type

Superposition

class wavgen.waveform.Sweep(config_a, config_b, sweep_time=None, sample_length=16000000)[source]

Bases: waveform_base.Waveform

Describes a waveform which smoothly modulates from one Superposition to another.

WavesA, WavesB

Basically full descriptions of 2 Superposition objects; i.e. 2 lists of pure tones, including each frequency, magnitude, & phase.

Type

list of Wave

Damp

Expresses the change in Amplitude as the waveform modulates from initial to final configuration.

Type

float

Warning

Sometimes, roughly 1 out of 8 times, the calculation of a Sweep object will silently fail; resulting in correct number of data points, except all 0-valued. To avoid the uncertainty of re-calculation, be sure to save Sweep objects to named files. Also, check calculations with Sweep.plot().

__init__(config_a, config_b, sweep_time=None, sample_length=16000000)[source]

Allows for defining the duration in terms of milliseconds or samples.

Parameters
  • config_b (config_a,) – These play the initial & final configurations of the Sweep form, going from A to B respectively.

  • sweep_time (float, optional) – The time, in milliseconds, that the waveform will spend to complete the entire modulation. Overrides sample_length

  • sample_length (int, optional) – Otherwise, one can simply fix the length to an integer number of samples.

class wavgen.waveform.HS1(pulse_time, center_freq, sweep_width, duration=None, amp=1.0)[source]

Bases: waveform_base.Waveform

Embodies a Hyperbolic-Secant Pulse.

Tau

Characteristic length of pulse; expressed in samples.

Type

float

Center

The frequency at which the sweep is centered about; expressed as oscillations per sample.

Type

float

BW

Bandwith or width of the range the frequency is swooped across; expressed as oscillations per sample.

Type

float

See also

B Peaudecerf et al 2019 New J. Phys. 21 013020 (Section 3.1)

Relevant context. Used to verify functional form.

M. Khudaverdyan et al 2005 Phys. Rev. A 71, 031404(R)

Slightly more relevant…yet less useful.

__init__(pulse_time, center_freq, sweep_width, duration=None, amp=1.0)[source]
Parameters
  • pulse_time (float) – Sets the characteristic time.

  • center_freq (int) – The frequency sweep is centered about this value.

  • sweep_width (int) – How wide, in frequency, the sweep swoops.

  • duration (float, optional) – Used to fix the waveform duration, while the pulse width itself is unaffected. Otherwise, we follow a recommendation from the first reference above.

  • amp (float, optional) – Amplitude of waveform relative to maximum output voltage.