pygsti.protocols.modeltest

ModelTest Protocol objects

Module Contents

Classes

ModelTest

A protocol that tests how well a model agrees with a given set of data.

class pygsti.protocols.modeltest.ModelTest(model_to_test, target_model=None, gaugeopt_suite=None, objfn_builder=None, badfit_options=None, set_trivial_gauge_group=True, verbosity=2, name=None)

Bases: pygsti.protocols.protocol.Protocol

A protocol that tests how well a model agrees with a given set of data.

Parameters
  • model_to_test (Model) – The model to compare with data when :method:`run` is called.

  • target_model (Model, optional) – The ideal or desired model of perfect operations. It is often useful to bundle this together with model_to_test so that comparison metrics can be easily computed.

  • gaugeopt_suite (GSTGaugeOptSuite, optional) – Specifies which gauge optimizations to perform on each estimate. Can also be any object that can be cast to a GSTGaugeOptSuite object, such as a string or list of strings (see below) specifying built-in sets of gauge optimizations. This object also optionally stores an alternate target model for gauge optimization. This model is used as the “target” for gauge- optimization (only), and is useful when you want to gauge optimize toward something other than the ideal target gates.

  • objfn_builder (ObjectiveFunctionBuilder) – The objective function (builder) that is used to compare the model to data, i.e. the objective function that defines this model test.

  • badfit_options (GSTBadFitOptions) – Options specifing what constitutes a “bad fit” (or “failed test”) and what additional actions to take if and when this occurs.

  • set_trivial_gauge_group (bool, optional) – A convenience flag that updates the default gauge group of model_to_test to the trivial gauge group before performing the test, so that no actual gauge optimization is performed (even if gaugeopt_suite is non-None).

  • verbosity (int, optional) – Level of detail printed to stdout.

  • name (str, optional) – The name of this protocol, also used to (by default) name the results produced by this protocol. If None, the class name will be used.

classmethod create_objective_builder(cls, obj)

Creates objective function builders from obj that are commonly used in model tests.

Parameters

obj (object) – If obj is already an ObjectiveFunctionBuilder it is used directly. A dictionary is assumed to hold arguments of :method:`ObjectiveFunctionBuilder.simple`. A list or tuple is assumed to hold positional arguments of :method:`ObjectiveFunctionBuilder.__init__`.

Returns

ObjectiveFunctionBuilder

run(self, data, memlimit=None, comm=None)

Run this protocol on data.

Parameters
  • data (ProtocolData) – The input data.

  • memlimit (int, optional) – A rough per-processor memory limit in bytes.

  • comm (mpi4py.MPI.Comm, optional) – When not None, an MPI communicator used to run this protocol in parallel.

Returns

ModelEstimateResults