pygsti.extras.drift.probtrajectory.CosineProbTrajectory#

class CosineProbTrajectory(outcomes, hyperparameters, parameters, starttime, timestep, numtimes)#

Bases: ProbTrajectory

Encapulates a time-dependent probability distribution that is parameterized as a sum of cosines. Specifically, it is parameterized as the sum of the Type-II DCT basis functions.

Initializes a CosineProbTrajectory object.

Parameters:
  • outcomes (list) – What the probability distribution is over. Typically, all possible outcomes for the circuit that this is a probability trajectory for.

  • hyperparameters (list) – A set of integers, that specify the indices of the the DCT basis functions to include. This must include 0 as the first element, corresponding to the constant component of the probability trajectories.

  • parameters (dict) – A dictonary where the keys are all but the last element of outcomes, and the elements are lists of the same lengths as hyperparameters. These are amplitudes for the DCT basis functions, for each outcome. The first element of each list is the constant component of the that probability trajectory.

  • starttime (float) – The start time of the time period over which the DCT basis functions are being defined. This is typically set to the first data collection time of the circuit that this probability trajectory is being defined for.

  • timestep (float) – The size of the time step used to define the DCT basis functions. This is typically set to the time step between the data collection times of the circuit that this probability trajectory is being defined for

  • numtimes (int) – The number of data collection times defining the DCT basis functions (defines the total number of DCT basis functions: the hyperparameters list is then a subset of this [0,1,2,…,numtimes-1]). This is typically set to the number of data collection times for the circuit that this probability trajectory is being defined for.

Return type:

A new CosineProbTrajectory object.

Methods

__init__(outcomes, hyperparameters, ...)

Initializes a CosineProbTrajectory object.

basisfunction(i, times)

The ith Type-II DCT basis function, evaluated at the specified times, where the DCT basis functions under consideration are defined by the time parameters set in the initialization.

copy()

parameters_as_list()

Returns the parameters as a list, in the same format as when input to set_parameters_from_list.

parameters_copy()

Returns the values of the parameters, in the dictionary form in which it is internally stored.

probabilities(times[, trim])

Returns the probability distribution for each time in times.

set_hyperparameters(hyperparameters, parameters)

Sets the hyperparameters -- i.e., defines a new parameterized model -- and the parameters (see init for details).

set_parameters(parameters)

Sets the parameters of the model (see init for details).

set_parameters_from_list(parameterslist)

Sets the parameters of the model from a list

basisfunction(i, times)#

The ith Type-II DCT basis function, evaluated at the specified times, where the DCT basis functions under consideration are defined by the time parameters set in the initialization.

The normalization of the functions is such that the max/min of each function is +1/-1.

Parameters:
  • i (int) – The frequency index of the DCT basis function.

  • times (list) – The times to evaluate the basis function at

Returns:

The value of the basis function at the specified times.

Return type:

array

parameters_as_list()#

Returns the parameters as a list, in the same format as when input to set_parameters_from_list. See the docstring of that method for more info.

parameters_copy()#

Returns the values of the parameters, in the dictionary form in which it is internally stored.

probabilities(times, trim=True)#

Returns the probability distribution for each time in times.

Parameters:
  • times (list) – A list of times, to return the probability distributions for.

  • time (bool, optional) – Whether or not to set probability > 1 to 1 and probabilities < 0 to 0. If set to True then there is no guarantee that the probabilities will sum to 1 at all times anymore.

Returns:

A dictionary where the keys are the possible outcomes, and the value for a key is a list (of the same lengths as times) containing the probability for that outcome at the times in times.

Return type:

dict

set_hyperparameters(hyperparameters, parameters)#

Sets the hyperparameters – i.e., defines a new parameterized model – and the parameters (see init for details).

set_parameters(parameters)#

Sets the parameters of the model (see init for details).

set_parameters_from_list(parameterslist)#

Sets the parameters of the model from a list

Parameters:

parametersaslist (list) – The new parameter values as a list, where the first len(self.hyperparameters) values are the parameter values for the first outcome (the first element of self.outcomes), the second set of len(self.hyperparameters) values are for the second outcome in this list, and so on, up to the second last value of self.outcomes.

Return type:

None