Pulses

Gates on real quantum devices are commonly implemented as radiofrequency (RF) pulses. The present classes represent the pulse shapes, which can then be used to build to construct a gateset.

Instances and Classes

class quantum_gates.pulses.Pulse(pulse: callable, parametrization: callable, perform_checks: bool = False, use_lookup: bool = False)[source]

Bases: object

Parent class for pulses with basic utility.

Parameters:
  • pulse (callable) – Function f: [0,1] -> R>=0: Waveform of the pulse, must integrate up to 1.

  • parametrization (callable) – Function F: [0,1] -> [0,1]: Parameter integral of the pulse. Monotone with F(0) = 0 and F(1) = 1, as well as x <= y implies F(x) <= F(y).

  • perform_checks (bool) – Tells whether the properties of the pulse and parametrization should be validated.

  • use_lookup (bool) – Bool whether the pulse is constant. Then one can lookup the integration result in the integrator.

Example

from quantum_gates.pulses import Pulse

pulse = lambda x: 1
parametrization = lambda x: x

constant_pulse = Pulse(
    pulse=pulse,
    parametrization=parametrization,
    perform_checks=False
    )
pulse[source]

Waveform of the pulse as function, f: [0,1] -> R, f >= 0

parametrization[source]

Parameter integral of the waveform, F: [0,1] -> [0,1], F >= 0, monotonically increasing

use_lookup[source]

In the Integrator, should a integration result lookup be used. True if pulse is constant

epsilon = 1e-06[source]
check_n_points = 10[source]
get_pulse()[source]

Get the waveform f of the pulse as callable.

get_parametrization()[source]

Get the parametrization F of the pulse as callable.

_pulse_is_valid(pulse: callable) bool[source]

Returns whether the pulse is a probability distribution on [0,1].

Parameters:

pulse (callable) – The waveform which is to be checked.

Returns:

Result of the check as boolean.

Return type:

bool

_parametrization_is_valid(parametrization: callable) bool[source]

Returns whether the parametrization is monotone and has valid bounds.

Parameters:

parametrization (callable) – The parametrization which is to be checked.

Returns:

Result of the check as boolean.

Return type:

bool

_are_compatible(pulse, parametrization) bool[source]

Returns whether the integral of the pulse is the parametrization.

Parameters:
  • pulse (callable) – The waveform which is to be checked.

  • parametrization (callable) – The parametrization which is to be checked.

Returns:

Result of the check as boolean.

Return type:

bool

class quantum_gates.pulses.GaussianPulse(loc: float, scale: float, perform_checks: bool = False)[source]

Bases: Pulse

Pulse based on a Gaussian located at loc with variance according to scale.

Make sure that loc is near to the interval [0,1] or has a high variance. Otherwise, the overlap with the interval [0,1] is too small.

Note

The integral over the interval [0,1] of the choosen Gaussian should be larger than 1e-6. This is because the shape of the pulse is the shape that the Gaussian has in this interval.

Example

from quantum_gates.pulses import GaussianPulse

loc = 0.5   # Location of the Gaussian
scale = 0.5 # Standard deviation of the Gaussian

constant_pulse = GaussianPulse(loc=loc, scale=scale)
Parameters:
  • loc (float) – Location of the pulse on the real axis.

  • scale (float) – Standard deviation or size of the Gaussian pulse.

  • perform_check (bool) – Whether the pulse should be verified.

  • perform_checks (bool) –

use_lookup = False[source]
class quantum_gates.pulses.ConstantPulse[source]

Bases: Pulse

Constant pulse which uses the lookup in the integrator.

class quantum_gates.pulses.ConstantPulseNumerical[source]

Bases: Pulse

Constant pulse which uses numerical integration.

Note

We can use this class for unit testing the ConstantPulse class.