API Reference#
WaveformConstructor.default module#
WaveformConstructor.series module#
- class WaveformConstructor.series.DigitalWaveformSeries(time_segments: List[float], waveform_functions: List[DigitalWaveformBase])[source]#
Bases:
WaveformSeries- WAVEFORM_TO_PAD = <WaveformConstructor.waveform.Off object>#
Series of waveforms. Each waveform is defined by a waveform function and a time segment.
- Parameters:
time_segments (list of float) – A list of time segments of the waveforms.
waveform_functions (list of WaveformFunctionBase) – A list of waveform functions. The length of the list must be the same as the time_segments.
Notes
The waveform series is defined by a list of time segments and a list of waveform functions. The waveform series is evaluated by evaluating the waveform functions segment by segment. The total time of the waveform series is the sum of the time segments.
- Raises:
ValueError – If the length of the time_segments and the waveform_functions are not the same.
ValueError – If the time_segments contains negative values.
- append(t: float, waveform_function: DigitalWaveformBase)[source]#
Append a new waveform.
- Parameters:
t (float) – Time duration of the new waveform.
waveform_function (DigitalWaveformBase) – Waveform function of the new waveform.
- class WaveformConstructor.series.PointSumWaveformSeries(waveform_series1: WaveformSeries, waveform_series2: WaveformSeries)[source]#
Bases:
objectWaveform series by adding the two waveform series point by point.
- Parameters:
waveform_series1 (WaveformSeries) – First waveform series.
waveform_series2 (WaveformSeries) – Second waveform series.
- Raises:
ValueError – If the time_segments of the two waveform series are not equal.
- static maketimeseries(t: float, sample_rate: float) ndarray[source]#
Make a time series with a given total time and sampling rate.
- Parameters:
t (float) – Total time of the waveform series.
sample_rate (float) – Sampling rate of the AWG.
- Returns:
t – Time series
- Return type:
np.ndarray
- pad_to(new_total_time: float)[source]#
Pad zeros at the end. If the new total time is smaller than the current total time, raise an error.
- Parameters:
new_total_time (float) – Extend the waveform series to the new time.
- Raises:
ValueError – If the new total time is smaller than the current total time.
- property total_time: float#
Total duration of the waveform series.
- waveform(sampling_rate: int | None = None, start_time: float = 0.0) Tuple[ndarray, ndarray][source]#
Evaluate the waveforms with a given sampling rate.
- Parameters:
sampling_rate (int, optional) – Sampling rate of the AWG. If not specified, use the DefaultValues.sampling_rate.
start_time (float, optional) – Start time of the waveform series. If not specified, use 0.
- Returns:
t (np.ndarray) – Time series
v (np.ndarray) – Voltage values
- class WaveformConstructor.series.WaveformSeries(time_segments: List[float], waveform_functions: List[WaveformFunctionBase])[source]#
Bases:
object- WAVEFORM_TO_PAD = <WaveformConstructor.waveform.Zero object>#
Series of waveforms. Each waveform is defined by a waveform function and a time segment.
- Parameters:
time_segments (list of float) – A list of time segments of the waveforms.
waveform_functions (list of WaveformFunctionBase) – A list of waveform functions. The length of the list must be the same as the time_segments.
Notes
The waveform series is defined by a list of time segments and a list of waveform functions. The waveform series is evaluated by evaluating the waveform functions segment by segment. The total time of the waveform series is the sum of the time segments.
- Raises:
ValueError – If the length of the time_segments and the waveform_functions are not the same.
ValueError – If the time_segments contains negative values.
- append(t: float, waveform_function: WaveformFunctionBase)[source]#
Append a new waveform.
- static make_time_series(t: float, sample_rate: float) ndarray[source]#
Make a time series with a given total time and sampling rate.
- Parameters:
t (float) – Total time of the waveform series.
sample_rate (float) – Sampling rate of the AWG.
- Returns:
t – Time series
- Return type:
np.ndarray
- pad_to(new_total_time: float)[source]#
Pad zeros at the end. If the new total time is smaller than the current total time, raise an error.
- Parameters:
new_total_time (float) – Extend the waveform series to the new time.
- Raises:
ValueError – If the new total time is smaller than the current total time.
- property total_time: float#
Total duration of the waveform series
- waveform(sampling_rate: int | None = None, start_time: float = 0.0) Tuple[ndarray, ndarray][source]#
Evaluate the waveforms with a given sampling rate.
- Parameters:
sampling_rate (float) – Sampling rate of the AWG. If not specified, use the DefaultValues.sampling_rate.
start_time (float) – Start time of the waveform series. If not specified, use 0.
- Returns:
t (np.ndarray) – Time series
v (np.ndarray) – Voltage values
WaveformConstructor.util module#
- class WaveformConstructor.util.MultiChannelComposer(n_channel: int, digital=[])[source]#
Bases:
objectA helper class for composing multi-channel waveforms that requires synchronization.
- Parameters:
n_channel (int) – Number of channels.
- channel#
A list of waveform series for each channel.
- Type:
list of WaveformSeries
- append_series(channel: int, waveform_series: WaveformSeries, sync_after: bool = False)[source]#
- append_waveform(channel: int, waveform: WaveformFunctionBase, time: float, sync_after: bool = False)[source]#
- class WaveformConstructor.util.WaveformFactory(waveform_series_collection: List[WaveformSeries], sampling_rate=None, start_time=0.0)[source]#
Bases:
objectTools for evaluating waveforms with multi-threading.
- Parameters:
waveform_series_collection (list of WaveformConstructor.series.WaveformSeries) – A list of waveform series.
sampling_rate (int, Optional) – Sampling rate of the AWG. If not specified, use the DefaultValues.sampling_rate.
- class WaveformConstructor.util.WaveformFactoryDigital(waveform_series_collection: List[WaveformSeries], sampling_rate=None, start_time=0.0)[source]#
Bases:
WaveformFactory
- class WaveformConstructor.util.WaveformFactoryIQ(waveform_series_collection: List[WaveformSeries], sampling_rate=None, start_time=0.0, q_delay=0.0)[source]#
Bases:
WaveformFactoryTools for evaluating IQ waveforms stream with multi-threading.
- WaveformConstructor.util.sync(*waveform_series_collection: WaveformSeries) float[source]#
Pad the waveform series to the time of the longest waveform series.
- Parameters:
waveform_series_collection (list of WaveformSeries) – A list of waveform series.
- Returns:
time – The time after synchronization.
- Return type:
float
WaveformConstructor.waveform module#
- class WaveformConstructor.waveform.CarrierFlopping(amp: float, phase: float, freq=None)[source]#
Bases:
SineWaveWaveform for the carrier flopping.
- Parameters:
amp (float) – Amplitude of the waveform
phase (float) – Phase of the waveform
freq (float or None) – Driving frequency. If None is given, it uses the value in DefaultValues.
- class WaveformConstructor.waveform.Constant(value: float)[source]#
Bases:
WaveformFunctionBaseConstant waveform
- Parameters:
value (float) – Value of the waveform
- class WaveformConstructor.waveform.DigitalWaveformBase[source]#
Bases:
WaveformFunctionBase
- class WaveformConstructor.waveform.FloquetBase(floquet_freq, base_waveform: WaveformFunctionBase | None = None)[source]#
Bases:
WaveformFunctionBaseBase class for the Floquet waveform functions
- Parameters:
floquet_freq (float) – Floquet frequency. Note that the floquet_freq is the frequency where the sign of the waveform changes.
- class WaveformConstructor.waveform.FloquetCosDrive(floquet_freq, base_waveform: WaveformFunctionBase | None = None)[source]#
Bases:
FloquetBase
- class WaveformConstructor.waveform.FloquetSinDrive(floquet_freq, base_waveform: WaveformFunctionBase | None = None)[source]#
Bases:
FloquetBase
- class WaveformConstructor.waveform.MS(amp_rsb, amp_bsb, detuning, phase_rsb, phase_bsb, carrier_freq=None)[source]#
Bases:
WaveformFunctionSumWaveform for the Molmer Sorensen interaction.
- Parameters:
amp_rsb (float) – Amplitude of the red sideband waveform.
amp_bsb (float) – Amplitude of the blue sideband waveform.
detuning (float) – Detuning from the carrier frequency.
phase_rsb (float) – Phase of the red sideband waveform.
phase_bsb (float) – Phase of the blue sideband waveform.
carrier_freq (float or None) – Carrier frequency. If None is given, it uses the value in DefaultValues.
- class WaveformConstructor.waveform.MS2(amp_rsb1, amp_bsb1, detuning1, phase_rsb1, phase_bsb1, amp_rsb2, amp_bsb2, detuning2, phase_rsb2, phase_bsb2, carrier_freq=None)[source]#
Bases:
WaveformFunctionSumWaveform for the Molmer Sorensen interaction for two detunings.
- Parameters:
amp_rsb1 (float) – Amplitude of the red sideband waveform1.
amp_bsb1 (float) – Amplitude of the blue sideband waveform1.
detuning1 (float) – Detuning from the carrier frequency for waveform1.
phase_rsb1 (float) – Phase of the red sideband waveform1.
phase_bsb1 (float) – Phase of the blue sideband waveform1.
amp_rsb2 (float) – Amplitude of the red sideband waveform2.
amp_bsb2 (float) – Amplitude of the blue sideband waveform2.
detuning2 (float) – Detuning from the carrier frequency for waveform2.
phase_rsb2 (float) – Phase of the red sideband waveform2.
phase_bsb2 (float) – Phase of the blue sideband waveform2.
carrier_freq (float or None) – Carrier frequency. If None is given, it uses the value in DefaultValues.
- class WaveformConstructor.waveform.Off[source]#
Bases:
DigitalWaveformBase
- class WaveformConstructor.waveform.On[source]#
Bases:
DigitalWaveformBase
- class WaveformConstructor.waveform.One[source]#
Bases:
WaveformFunctionBaseOne waveform
- class WaveformConstructor.waveform.OneFloquet(floquet_freq)[source]#
Bases:
FloquetBase,One
- class WaveformConstructor.waveform.SineWave(amp: float, freq: float, phase: float)[source]#
Bases:
WaveformFunctionBaseSinusoidal waveform
- Parameters:
amp (float) – Amplitude of the waveform
freq (float) – Frequency of the waveform
phase (float) – Phase of the waveform
- class WaveformConstructor.waveform.WaveformFunctionBase[source]#
Bases:
ABCAbstract class for the waveform function
- class WaveformConstructor.waveform.WaveformFunctionSum(waveform_funcs: List[WaveformFunctionBase])[source]#
Bases:
WaveformFunctionBaseSum of waveform functions
- Parameters:
waveform_funcs (List[WaveformFunctionBase]) – List of waveform functions to be summed
- class WaveformConstructor.waveform.X(amp, carrier_freq=None)[source]#
Bases:
CarrierFlopping
- class WaveformConstructor.waveform.XFloquet(amp, floquet_freq, carrier_freq=None)[source]#
Bases:
FloquetBase,X
- class WaveformConstructor.waveform.XFloquetCosDrive(amp, floquet_freq, carrier_freq=None)[source]#
Bases:
FloquetCosDrive,XFloquet
- class WaveformConstructor.waveform.XFloquetSinDrive(amp, floquet_freq, carrier_freq=None)[source]#
Bases:
FloquetSinDrive,XFloquet
- class WaveformConstructor.waveform.XX(amp_rsb, amp_bsb, detuning, carrier_freq=None)[source]#
Bases:
MSWaveform for the XX interaction.
- Parameters:
amp_rsb (float) – Amplitude of the red sideband waveform.
amp_bsb (float) – Amplitude of the blue sideband waveform.
detuning (float) – Detuning from the carrier frequency.
carrier_freq (float or None) – Carrier frequency. If None is given, it uses the value in DefaultValues.
- class WaveformConstructor.waveform.XY(amp_rsb1, amp_bsb1, detuning1, amp_rsb2, amp_bsb2, detuning2, carrier_freq=None)[source]#
Bases:
MS2
- class WaveformConstructor.waveform.Y(amp, carrier_freq=None)[source]#
Bases:
CarrierFlopping
- class WaveformConstructor.waveform.YFloquet(amp, floquet_freq, carrier_freq=None)[source]#
Bases:
FloquetBase,Y
- class WaveformConstructor.waveform.YFloquetCosDrive(amp, floquet_freq, carrier_freq=None)[source]#
Bases:
FloquetCosDrive,YFloquet
- class WaveformConstructor.waveform.YFloquetSinDrive(amp, floquet_freq, carrier_freq=None)[source]#
Bases:
FloquetSinDrive,YFloquet
- class WaveformConstructor.waveform.YY(amp_rsb, amp_bsb, detuning, carrier_freq=None)[source]#
Bases:
MSWaveform for the YY interaction.
- Parameters:
amp_rsb (float) – Amplitude of the red sideband waveform.
amp_bsb (float) – Amplitude of the blue sideband waveform.
detuning (float) – Detuning from the carrier frequency.
carrier_freq (float or None) – Carrier frequency. If None is given, it uses the value in DefaultValues.
WaveformConstructor.composit module#
- class WaveformConstructor.composit.BB1CarrierFlopping(amp, freq, pi_time)[source]#
Bases:
CompositePulseCarrierFloppingComposite pulses for carrier flopping using BB1 protocol.
- Parameters:
amp (float) – Amplitude of the waveform
freq (float) – Frequency of the waveform
pi_time (float) – Time of the pi pulse corresponding to the amplitude and frequency
Notes
Ref: https://www.sciencedirect.com/science/article/pii/S1064185884711594
- waveform_series(angle, phase) WaveformSeries[source]#
Return the waveform series for the given angle and phase
- Parameters:
angle (float) – Angle of the rotation
phase (float) – Phase of the rotation
- class WaveformConstructor.composit.BB2CarrierFlopping(amp, freq, pi_time)[source]#
Bases:
CompositePulseCarrierFloppingComposite pulses for carrier flopping using BB2 protocol.
- Parameters:
amp (float) – Amplitude of the waveform
freq (float) – Frequency of the waveform
pi_time (float) – Time of the pi pulse corresponding to the amplitude and frequency
Notes
Ref: https://www.sciencedirect.com/science/article/pii/S1064185884711594
- waveform_series(angle, phase) WaveformSeries[source]#
Return the waveform series for the given angle and phase
- Parameters:
angle (float) – Angle of the rotation
phase (float) – Phase of the rotation
- class WaveformConstructor.composit.CompositePulseCarrierFlopping[source]#
Bases:
ABCAbstract class for composite pulse carrier flopping waveform.
- abstract waveform_series(angle: float, phase: float) WaveformSeries[source]#
Return the waveform series for the given angle and phase
- Parameters:
angle (float) – Angle of the rotation
phase (float) – Phase of the rotation
- class WaveformConstructor.composit.SinglePulseCarrierFlopping(amp: float, freq: float, pi_time: float)[source]#
Bases:
CompositePulseCarrierFloppingSingle pulse carrier flopping waveform
- Parameters:
amp (float) – Amplitude of the waveform
freq (float) – Frequency of the waveform
pi_time (float) – Time of the pi pulse corresponding to the amplitude and frequency
- waveform_series(angle, phase) WaveformSeries[source]#
Return the waveform series for the given angle and phase
- Parameters:
angle (float) – Angle of the rotation
phase (float) – Phase of the rotation
- class WaveformConstructor.composit.XBB1(amp, freq, pi_time)[source]#
Bases:
BB1CarrierFlopping- waveform_series(angle) WaveformSeries[source]#
Return the waveform series for the given angle and phase
- Parameters:
angle (float) – Angle of the rotation
phase (float) – Phase of the rotation
- class WaveformConstructor.composit.XBB2(amp, freq, pi_time)[source]#
Bases:
BB2CarrierFlopping- waveform_series(angle) WaveformSeries[source]#
Return the waveform series for the given angle and phase
- Parameters:
angle (float) – Angle of the rotation
phase (float) – Phase of the rotation
- class WaveformConstructor.composit.XSinglePulse(amp: float, freq: float, pi_time: float)[source]#
Bases:
SinglePulseCarrierFlopping- waveform_series(angle: float) WaveformSeries[source]#
Return the waveform series for the given angle and phase
- Parameters:
angle (float) – Angle of the rotation
phase (float) – Phase of the rotation
- Returns:
The waveform series for the given angle and phase
- Return type:
- class WaveformConstructor.composit.YBB1(amp, freq, pi_time)[source]#
Bases:
BB1CarrierFlopping- waveform_series(angle) WaveformSeries[source]#
Return the waveform series for the given angle and phase
- Parameters:
angle (float) – Angle of the rotation
phase (float) – Phase of the rotation
- class WaveformConstructor.composit.YBB2(amp, freq, pi_time)[source]#
Bases:
BB2CarrierFlopping- waveform_series(angle) WaveformSeries[source]#
Return the waveform series for the given angle and phase
- Parameters:
angle (float) – Angle of the rotation
phase (float) – Phase of the rotation
- class WaveformConstructor.composit.YSinglePulse(amp: float, freq: float, pi_time: float)[source]#
Bases:
SinglePulseCarrierFlopping- waveform_series(angle: float) WaveformSeries[source]#
Return the waveform series for the given angle and phase
- Parameters:
angle (float) – Angle of the rotation
phase (float) – Phase of the rotation
- Returns:
The waveform series for the given angle and phase
- Return type: