qiskit.pulse.library.discrete¶
Module for builtin discrete pulses.
Note the sampling strategy use for all discrete pulses is midpoint
.
Functions
|
Generates constant-sampled |
|
Generates cosine wave |
|
Generates Y-only correction DRAG |
|
Generates unnormalized gaussian |
|
Generates unnormalized gaussian derivative |
|
Generates gaussian square |
|
Generates sawtooth wave |
|
Generates unnormalized sech |
|
Generates unnormalized sech derivative |
|
Generates sine wave |
|
Generates square wave |
|
Generates triangle wave |
|
Generates zero-sampled |
-
constant
(duration, amp, name=None)[código fonte]¶ Generates constant-sampled
Waveform
.For A=
amp
, samples from the function:f(x)=A- Parâmetros
duration (
int
) – Duration of pulse. Must be greater than zero.amp (
complex
) – Complex pulse amplitude.name (
Optional
[str
]) – Name of pulse.
- Tipo de retorno
Waveform
-
cos
(duration, amp, freq=None, phase=0, name=None)[código fonte]¶ Generates cosine wave
Waveform
.For A=
amp
, ω=freq
, and ϕ=phase
, applies the midpoint sampling strategy to generate a discrete pulse sampled from the continuous function:f(x)=Acos(2πωx+ϕ)- Parâmetros
duration (
int
) – Duration of pulse. Must be greater than zero.amp (
complex
) – Pulse amplitude.freq (
Optional
[float
]) – Pulse frequency, units of 1/dt. IfNone
defaults to single cycle.phase (
float
) – Pulse phase.name (
Optional
[str
]) – Name of pulse.
- Tipo de retorno
Waveform
-
drag
(duration, amp, sigma, beta, name=None, zero_ends=True)[código fonte]¶ Generates Y-only correction DRAG
Waveform
for standard nonlinear oscillator (SNO) [1].For A=
amp
, σ=sigma
, and β=beta
, applies themidpoint
sampling strategy to generate a discrete pulse sampled from the continuous function:f(x)=g(x)+iβh(x),where g(x) is the function sampled in
gaussian()
, and h(x) is the function sampled ingaussian_deriv()
.If
zero_ends == True
, the samples from g(x) are remapped as ingaussian()
.Referências
- Parâmetros
duration (
int
) – Duration of pulse. Must be greater than zero.amp (
complex
) – Pulse amplitude at centerduration/2
.sigma (
float
) – Width (standard deviation) of pulse.beta (
float
) – Y correction amplitude. For the SNO this is β=−λ214Δ2. Where λ1 is the relative coupling strength between the first excited and second excited states and Δ2 is the detuning between the respective excited states.name (
Optional
[str
]) – Name of pulse.zero_ends (
bool
) – If True, zero ends atx = -1, x = duration + 1
, but rescale to preserve amp.
- Tipo de retorno
Waveform
-
gaussian
(duration, amp, sigma, name=None, zero_ends=True)[código fonte]¶ Generates unnormalized gaussian
Waveform
.For A=
amp
and σ=sigma
, applies themidpoint
sampling strategy to generate a discrete pulse sampled from the continuous function:f(x)=Aexp((x−μ2σ)2),with the center μ=
duration/2
.If
zero_ends==True
, each output sample y is modified according to:y↦Ay−y∗A−y∗,where y∗ is the value of the endpoint samples. This sets the endpoints to 0 while preserving the amplitude at the center. If A=y∗, y is set to 1. By default, the endpoints are at
x = -1, x = duration + 1
.Integrated area under the full curve is
amp * np.sqrt(2*np.pi*sigma**2)
- Parâmetros
duration (
int
) – Duration of pulse. Must be greater than zero.amp (
complex
) – Pulse amplitude atduration/2
.sigma (
float
) – Width (standard deviation) of pulse.name (
Optional
[str
]) – Name of pulse.zero_ends (
bool
) – If True, zero ends atx = -1, x = duration + 1
, but rescale to preserve amp.
- Tipo de retorno
Waveform
-
gaussian_deriv
(duration, amp, sigma, name=None)[código fonte]¶ Generates unnormalized gaussian derivative
Waveform
.For A=
amp
and σ=sigma
applies the midpoint sampling strategy to generate a discrete pulse sampled from the continuous function:f(x)=A(x−μ)σ2exp((x−μ2σ)2)i.e. the derivative of the Gaussian function, with center μ=
duration/2
.- Parâmetros
duration (
int
) – Duration of pulse. Must be greater than zero.amp (
complex
) – Pulse amplitude of corresponding Gaussian at the pulse center (duration/2
).sigma (
float
) – Width (standard deviation) of pulse.name (
Optional
[str
]) – Name of pulse.
- Tipo de retorno
Waveform
-
gaussian_square
(duration, amp, sigma, risefall=None, width=None, name=None, zero_ends=True)[código fonte]¶ Generates gaussian square
Waveform
.For d=
duration
, A=amp
, σ=sigma
, and r=risefall
, applies themidpoint
sampling strategy to generate a discrete pulse sampled from the continuous function:f(x)={g(x−r))x≤rAr≤x≤d−rg(x−(d−r))d−r≤xwhere g(x) is the Gaussian function sampled from in
gaussian()
with A=amp
, μ=1, and σ=sigma
. I.e. f(x) represents a square pulse with smooth Gaussian edges.If
zero_ends == True
, the samples for the Gaussian ramps are remapped as ingaussian()
.- Parâmetros
duration (
int
) – Duration of pulse. Must be greater than zero.amp (
complex
) – Pulse amplitude.sigma (
float
) – Width (standard deviation) of Gaussian rise/fall portion of the pulse.risefall (
Optional
[float
]) – Number of samples over which pulse rise and fall happen. Width of square portion of pulse will beduration-2*risefall
.width (
Optional
[float
]) – The duration of the embedded square pulse. Only one ofwidth
orrisefall
should be specified as the functional form requireswidth = duration - 2 * risefall
.name (
Optional
[str
]) – Name of pulse.zero_ends (
bool
) – If True, zero ends atx = -1, x = duration + 1
, but rescale to preserve amp.
- Levanta
PulseError – If
risefall
andwidth
arguments are inconsistent or not enough info.- Tipo de retorno
Waveform
-
sawtooth
(duration, amp, freq=None, phase=0, name=None)[código fonte]¶ Generates sawtooth wave
Waveform
.For A=
amp
, T=period
, and ϕ=phase
, applies the midpoint sampling strategy to generate a discrete pulse sampled from the continuous function:f(x)=2A(g(x)−⌊12+g(x)⌋)where g(x)=x/T+ϕ/π.
- Parâmetros
duration (
int
) – Duration of pulse. Must be greater than zero.amp (
complex
) – Pulse amplitude. Wave range is [−amp
,amp
].freq (
Optional
[float
]) – Pulse frequency, units of 1./dt. IfNone
defaults to 1./duration.phase (
float
) – Pulse phase.name (
Optional
[str
]) – Name of pulse.
Exemplo
import matplotlib.pyplot as plt from qiskit.pulse.library import sawtooth import numpy as np duration = 100 amp = 1 freq = 1 / duration sawtooth_wave = np.real(sawtooth(duration, amp, freq).samples) plt.plot(range(duration), sawtooth_wave)
[<matplotlib.lines.Line2D at 0x7f8f0678c950>]
- Tipo de retorno
Waveform
-
sech
(duration, amp, sigma, name=None, zero_ends=True)[código fonte]¶ Generates unnormalized sech
Waveform
.For A=
amp
and σ=sigma
, applies themidpoint
sampling strategy to generate a discrete pulse sampled from the continuous function:f(x)=Asech(x−μσ)with the center μ=
duration/2
.If
zero_ends==True
, each output sample y is modified according to:y↦Ay−y∗A−y∗,where y∗ is the value of the endpoint samples. This sets the endpoints to 0 while preserving the amplitude at the center. If A=y∗, y is set to 1. By default, the endpoints are at
x = -1, x = duration + 1
.- Parâmetros
duration (
int
) – Duration of pulse. Must be greater than zero.amp (
complex
) – Pulse amplitude at duration/2.sigma (
float
) – Width (standard deviation) of pulse.name (
Optional
[str
]) – Name of pulse.zero_ends (
bool
) – If True, zero ends atx = -1, x = duration + 1
, but rescale to preserve amp.
- Tipo de retorno
Waveform
-
sech_deriv
(duration, amp, sigma, name=None)[código fonte]¶ Generates unnormalized sech derivative
Waveform
.For A=
amp
, σ=sigma
, and center μ=duration/2
, applies the midpoint sampling strategy to generate a discrete pulse sampled from the continuous function:f(x)=ddx[Asech(x−μσ)],i.e. the derivative of sech.
- Parâmetros
duration (
int
) – Duration of pulse. Must be greater than zero.amp (
complex
) – Pulse amplitude at center.sigma (
float
) – Width (standard deviation) of pulse.name (
Optional
[str
]) – Name of pulse.
- Tipo de retorno
Waveform
-
sin
(duration, amp, freq=None, phase=0, name=None)[código fonte]¶ Generates sine wave
Waveform
.For A=
amp
, ω=freq
, and ϕ=phase
, applies the midpoint sampling strategy to generate a discrete pulse sampled from the continuous function:f(x)=Asin(2πωx+ϕ)- Parâmetros
duration (
int
) – Duration of pulse. Must be greater than zero.amp (
complex
) – Pulse amplitude.freq (
Optional
[float
]) – Pulse frequency, units of 1/dt. IfNone
defaults to single cycle.phase (
float
) – Pulse phase.name (
Optional
[str
]) – Name of pulse.
- Tipo de retorno
Waveform
-
square
(duration, amp, freq=None, phase=0, name=None)[código fonte]¶ Generates square wave
Waveform
.For A=
amp
, T=period
, and ϕ=phase
, applies the midpoint sampling strategy to generate a discrete pulse sampled from the continuous function:f(x)=Asign[sin(2πxT+2ϕ)]with the convention sign(0)=1.
- Parâmetros
duration (
int
) – Duration of pulse. Must be greater than zero.amp (
complex
) – Pulse amplitude. Wave range is [−amp
,amp
].freq (
Optional
[float
]) – Pulse frequency, units of 1./dt. IfNone
defaults to 1./duration.phase (
float
) – Pulse phase.name (
Optional
[str
]) – Name of pulse.
- Tipo de retorno
Waveform
-
triangle
(duration, amp, freq=None, phase=0, name=None)[código fonte]¶ Generates triangle wave
Waveform
.For A=
amp
, T=period
, and ϕ=phase
, applies the midpoint sampling strategy to generate a discrete pulse sampled from the continuous function:f(x)=A(−2|sawtooth(x,A,T,ϕ)|+1)This a non-sinusoidal wave with linear ramping.
- Parâmetros
duration (
int
) – Duration of pulse. Must be greater than zero.amp (
complex
) – Pulse amplitude. Wave range is [−amp
,amp
].freq (
Optional
[float
]) – Pulse frequency, units of 1./dt. IfNone
defaults to 1./duration.phase (
float
) – Pulse phase.name (
Optional
[str
]) – Name of pulse.
Exemplo
import matplotlib.pyplot as plt from qiskit.pulse.library import triangle import numpy as np duration = 100 amp = 1 freq = 1 / duration triangle_wave = np.real(triangle(duration, amp, freq).samples) plt.plot(range(duration), triangle_wave)
[<matplotlib.lines.Line2D at 0x7f8f062819d0>]
- Tipo de retorno
Waveform
-
zero
(duration, name=None)[código fonte]¶ Generates zero-sampled
Waveform
.Samples from the function:
f(x)=0- Parâmetros
duration (
int
) – Duration of pulse. Must be greater than zero.name (
Optional
[str
]) – Name of pulse.
- Tipo de retorno
Waveform