qat.core.Parameter

class qat.core.Parameter(value=0, func=None, psd=None, sampling_frequency=None)

Represents a time-dependent parameter which can be included in the description of a Hamiltonian with a Schedule.

For example, imagine we want to encode the parameter \(\alpha(t) = 5 + \cos(t) + g(t)\), where \(g(t)\) is a stochastic signal. This signal can have a Power spectral density (PSD) function \(\tilde{G}(f) = \frac{1}{1+f^2}\) for a frequency \(f\). The PSD is related to the stochastic signal via \(\tilde{G}(f) = \frac{1}{t_f} \left \langle |G(f)|^2 \right \rangle\) where \(G(f)\) is the Fourier transform of \(g(t)\), \(\langle \dots \rangle\) denotes the average over many noise realizations and \(t_f\) defines the time window \([0, t_f]\) over which \(\tilde{G}(f)\) is considered.

One can represent the expression above for \(\alpha(t)\) via alpha = Parameter(value=5, func=cos_expr, psd=psd_expr), where cos_expr and psd_expr are of type ArithExpression. and are defined with the Variable t and f, respectively:

from qat.core import Variable
from qat.core.variables import cos

t = Variable(\"t\", float)
cos_expr = cos(t)

f = Variable(\"f\", float)
psd_expr = 1 / (1 + f**2)

alpha = Parameter(value=5, func=cos_expr, psd=psd_expr)

If one wants to investigate the parameter on its own, for example via plotting it versus time, one needs to create the noise \(g(t)\) corresponding to the PSD \(\tilde{G}(f)\) via the method generate_noise().

However, generating the noise is not needed if the Parameter is passed to a HardwareModel which will enter the analog QPU.

Parameters
  • value (float, optional) – the constant component of the parameter

  • func (ArithExpression, optional) – the explicit time-dependence of the parameter, specified by the Variable t.

  • psd (ArithExpression, optional) – the PSD of the stochastic time-dependence of the parameter. It dependends on frequency and should make use of the Variable f.

  • sampling_frequency (float, optional) – the sampling frequency of the noise component - needed for the creation of the noise corresponding to the PSD via the method generate_noise().

property func

Returns the time-dependent function.

generate_noise(tf, seed=None)

Creates the noise with the respective times for some given time tf. Both the noise and the times can then be accessed via the get_noise() method.

Parameters

tf (float) – duration of the signal

Returns

None

get_noise()

Returns the noise signal and the time points at which the noise was evaluated if the method generate_noise() has been called.

Returns

2-element tuple containing

  • noise signal (1D numpy array) - an array with the amplitudes of the noise at each time

  • time points (1D numpy array) - an array with the times at which the noise was evaluated

property psd

Returns the PSD.