pygsti.extras.drift.probtrajectory.ConstantProbTrajectory#

class ConstantProbTrajectory(outcomes, probabilities)#

Bases: ProbTrajectory

Encapulates a time-dependent probability distribution that is actually a constant. Useful when wanting to encode a constant probability distribution in a way that can be used consistently with any other ProbTrajectory object.

Initializes a ConstantProbTrajectory object.

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

  • probabilities (dict) – The static probability to obtained all but the last outcome (which is set by the other probabilities).

Return type:

A new ConstantProbTrajectory object.

Methods

__init__(outcomes, probabilities)

Initializes a ConstantProbTrajectory object.

basisfunction(i, times)

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)#
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