Skip to content

Results are limited to Pulser v1.9.1

Product news
You are reading Pulser v1.9.1, an older version of this documentation. Go to the latest version (v1.10.0)

InterpolatedWaveform

class pulser.waveforms.InterpolatedWaveform(duration, values, times=None, interpolator='PchipInterpolator', **interpolator_kwargs)

Bases: Waveform

A waveform created from interpolation of a set of data points.

Parameters:
  • duration (int | Parametrized) – The waveform duration (in ns).

  • values (ArrayLike | Parametrized) – Values of the interpolation points. Must be a list of castable to float or a parametrized object.

  • times (ArrayLike | Parametrized | None, default: None) – Fractions of the total duration (between 0 and 1, 1 corresponding to the time duration-1), indicating where to place each value on the time axis. Must be a list of castable to float or a parametrized object. If not given, the values are spread evenly throughout the full duration of the waveform.

  • interpolator (str, default: 'PchipInterpolator') –

    The SciPy interpolation class to use. Supports “PchipInterpolator” and “interp1d”.

    Passing “interp1d” is deprecated since pulser v1.9 and will be removed in a future version; only “PchipInterpolator” (the default) will remain supported.

  • **interpolator_kwargs (Any) –

    Extra parameters to give to the chosen interpolator class.

    Deprecated since pulser v1.9; extra keyword arguments for the interpolator will no longer be accepted in a future version.

Attributes

data_points

Points (t[ns], value[arb.

duration

The duration of the pulse (in ns).

first_value

The first value in the waveform.

integral

Integral of the waveform (in [waveform units].µs).

interp_function

The interpolating function.

last_value

The last value in the waveform.

samples

The value at each time step that describes the waveform.

Methods

change_duration

Returns a new waveform with modified duration.

draw

Draws the waveform.

modulated_samples

The waveform samples as output of a given channel.

modulation_buffers

The minimal buffers needed around a modulated waveform.

truncated

Returns a new waveform, truncated to a new duration.

with_new_duration

Returns a new waveform with modified duration.

Signatures

change_duration(new_duration)

Returns a new waveform with modified duration.

Warning

Deprecated since v1.6. Please use Waveform.with_new_duration() instead.

Parameters:

new_duration (int) – The duration of the new waveform.

Return type:

Waveform

draw(output_channel=None, ylabel=None)

Draws the waveform.

Parameters:
  • output_channel (Channel | None, default: None) – The output channel. If given, will draw the modulated waveform on top of the input one.

  • ylabel (str | None, default: None) – An optional label for the y-axis of the plot.

Return type:

None

modulated_samples(channel, eom=False)

The waveform samples as output of a given channel.

This duration is adjusted according to the minimal buffer times.

Parameters:
  • channel (Channel) – The channel modulating the waveform.

  • eom (bool, default: False) – Whether to modulate for the EOM.

Return type:

AbstractArray

Returns:

The array of samples after modulation.

modulation_buffers(channel, eom=False)

The minimal buffers needed around a modulated waveform.

Parameters:
  • channel (Channel) – The channel modulating the waveform.

  • eom (bool, default: False) – Whether to calculate the modulation buffers with the EOM bandwidth.

Return type:

tuple[int, int]

Returns:

The minimum buffer times at the start and end of the samples, in ns.

truncated(new_duration)

Returns a new waveform, truncated to a new duration.

If the new duration is above this waveform’s duration, a copy is returned instead.

Parameters:

new_duration (int) – The duration of the truncated waveform.

Return type:

Waveform

Returns:

The truncated waveform (if applicable).

with_new_duration(new_duration)

Returns a new waveform with modified duration.

Parameters:

new_duration (int) – The duration of the new waveform.

Return type:

InterpolatedWaveform

Returns:

The new waveform with the same coordinates for interpolation but a new duration.

property data_points: ndarray

Points (t[ns], value[arb. units]) that define the interpolation.

property duration: int

The duration of the pulse (in ns).

property first_value: float

The first value in the waveform.

property integral: float

Integral of the waveform (in [waveform units].µs).

property interp_function: PchipInterpolator | interp1d

The interpolating function.

property last_value: float

The last value in the waveform.

property samples: AbstractArray

The value at each time step that describes the waveform.

Returns:

A numpy array with a value for each time step.