API documentation
=================

This is the autogenerated reference for the ``pygsti`` package, built from
docstrings and intended primarily for advanced usage and development. It is
organized by subpackage; within each subpackage the modules are listed and link
through to their classes and functions.

Subpackages
-----------

``pygsti.algorithms``
~~~~~~~~~~~~~~~~~~~~~

Core GST and characterization algorithms: model fitting, gauge optimization, fiducial/germ selection, and RB analysis.

.. autosummary::
   :toctree: _autosummary
   :template: custom-module-template.rst
   :recursive:

   pygsti.algorithms.compilers
   pygsti.algorithms.contract
   pygsti.algorithms.core
   pygsti.algorithms.fiducialpairreduction
   pygsti.algorithms.fiducialselection
   pygsti.algorithms.gaugeopt
   pygsti.algorithms.germselection
   pygsti.algorithms.grammatrix
   pygsti.algorithms.grasp
   pygsti.algorithms.mirroring
   pygsti.algorithms.randomcircuit
   pygsti.algorithms.rbfit
   pygsti.algorithms.robust_phase_estimation
   pygsti.algorithms.scoring

``pygsti.baseobjs``
~~~~~~~~~~~~~~~~~~~

Foundational utility objects: labels, matrix bases, state spaces, polynomials, and resource allocation.

.. autosummary::
   :toctree: _autosummary
   :template: custom-module-template.rst
   :recursive:

   pygsti.baseobjs.advancedoptions
   pygsti.baseobjs.basis
   pygsti.baseobjs.basisconstructors
   pygsti.baseobjs.errorgenbasis
   pygsti.baseobjs.errorgenlabel
   pygsti.baseobjs.errorgenspace
   pygsti.baseobjs.exceptions
   pygsti.baseobjs.label
   pygsti.baseobjs.mongoserializable
   pygsti.baseobjs.nicelyserializable
   pygsti.baseobjs.opcalc
   pygsti.baseobjs.outcomelabeldict
   pygsti.baseobjs.polynomial
   pygsti.baseobjs.profiler
   pygsti.baseobjs.protectedarray
   pygsti.baseobjs.qubitgraph
   pygsti.baseobjs.resourceallocation
   pygsti.baseobjs.smartcache
   pygsti.baseobjs.statespace
   pygsti.baseobjs.unitarygatefunction
   pygsti.baseobjs.verbosityprinter

``pygsti.circuits``
~~~~~~~~~~~~~~~~~~~

Quantum circuits and circuit lists, plus their construction and parsing.

.. autosummary::
   :toctree: _autosummary
   :template: custom-module-template.rst
   :recursive:

   pygsti.circuits.circuit
   pygsti.circuits.circuitconstruction
   pygsti.circuits.circuitlist
   pygsti.circuits.circuitparser
   pygsti.circuits.circuitstructure
   pygsti.circuits.cloudcircuitconstruction
   pygsti.circuits.gstcircuits
   pygsti.circuits.rpecircuits
   pygsti.circuits.subcircuit_selection

``pygsti.data``
~~~~~~~~~~~~~~~

Datasets of experimental counts and the supporting analysis objects.

.. autosummary::
   :toctree: _autosummary
   :template: custom-module-template.rst
   :recursive:

   pygsti.data.datacomparator
   pygsti.data.dataset
   pygsti.data.datasetconstruction
   pygsti.data.freedataset
   pygsti.data.hypothesistest
   pygsti.data.multidataset
   pygsti.data.rpedata

``pygsti.drivers``
~~~~~~~~~~~~~~~~~~

High-level driver routines that tie protocols and analysis together.

.. autosummary::
   :toctree: _autosummary
   :template: custom-module-template.rst
   :recursive:

   pygsti.drivers.bootstrap

``pygsti.errorgenpropagation``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Tools for propagating error generators through the layers of a circuit.

.. autosummary::
   :toctree: _autosummary
   :template: custom-module-template.rst
   :recursive:

   pygsti.errorgenpropagation.errorpropagator
   pygsti.errorgenpropagation.localstimerrorgen

``pygsti.extras``
~~~~~~~~~~~~~~~~~

Beyond-GST sub-packages: drift, idle tomography, IBMQ and Cirq interfaces, interpolation, and more.

.. autosummary::
   :toctree: _autosummary
   :template: custom-module-template.rst
   :recursive:

   pygsti.extras.crosstalk
   pygsti.extras.devices
   pygsti.extras.drift
   pygsti.extras.ibmq
   pygsti.extras.idletomography
   pygsti.extras.interpygate
   pygsti.extras.lfh
   pygsti.extras.paritybenchmarking
   pygsti.extras.rpe

``pygsti.forwardsims``
~~~~~~~~~~~~~~~~~~~~~~

Forward simulators that compute the outcome probabilities a model predicts for a circuit.

.. autosummary::
   :toctree: _autosummary
   :template: custom-module-template.rst
   :recursive:

   pygsti.forwardsims.distforwardsim
   pygsti.forwardsims.forwardsim
   pygsti.forwardsims.mapforwardsim
   pygsti.forwardsims.mapforwardsim_calc_densitymx
   pygsti.forwardsims.mapforwardsim_calc_generic
   pygsti.forwardsims.matrixforwardsim
   pygsti.forwardsims.successfailfwdsim
   pygsti.forwardsims.termforwardsim
   pygsti.forwardsims.termforwardsim_calc_generic
   pygsti.forwardsims.termforwardsim_calc_stabilizer
   pygsti.forwardsims.termforwardsim_calc_statevec
   pygsti.forwardsims.torchfwdsim
   pygsti.forwardsims.weakforwardsim

``pygsti.io``
~~~~~~~~~~~~~

Reading and writing pyGSTi objects, datasets, and results.

.. autosummary::
   :toctree: _autosummary
   :template: custom-module-template.rst
   :recursive:

   pygsti.io.metadir
   pygsti.io.mongodb
   pygsti.io.readers
   pygsti.io.stdinput
   pygsti.io.writers

``pygsti.layouts``
~~~~~~~~~~~~~~~~~~

Circuit/COPA layouts that organize (and distribute) the computation behind forward simulation.

.. autosummary::
   :toctree: _autosummary
   :template: custom-module-template.rst
   :recursive:

   pygsti.layouts.cachedlayout
   pygsti.layouts.copalayout
   pygsti.layouts.distlayout
   pygsti.layouts.evaltree
   pygsti.layouts.maplayout
   pygsti.layouts.matrixlayout
   pygsti.layouts.prefixtable
   pygsti.layouts.termlayout

``pygsti.modelmembers``
~~~~~~~~~~~~~~~~~~~~~~~

The states, POVMs, operations, and instruments held inside models.

.. autosummary::
   :toctree: _autosummary
   :template: custom-module-template.rst
   :recursive:

   pygsti.modelmembers.errorgencontainer
   pygsti.modelmembers.instruments
   pygsti.modelmembers.modelmember
   pygsti.modelmembers.modelmembergraph
   pygsti.modelmembers.operations
   pygsti.modelmembers.povms
   pygsti.modelmembers.states
   pygsti.modelmembers.term
   pygsti.modelmembers.torchable

``pygsti.models``
~~~~~~~~~~~~~~~~~

Model objects representing a QIP, plus model construction, parameterization, and noise.

.. autosummary::
   :toctree: _autosummary
   :template: custom-module-template.rst
   :recursive:

   pygsti.models.cloudnoisemodel
   pygsti.models.explicitcalc
   pygsti.models.explicitmodel
   pygsti.models.fogistore
   pygsti.models.gaugegroup
   pygsti.models.implicitmodel
   pygsti.models.layerrules
   pygsti.models.localnoisemodel
   pygsti.models.memberdict
   pygsti.models.model
   pygsti.models.modelconstruction
   pygsti.models.modelnoise
   pygsti.models.modelparaminterposer
   pygsti.models.oplessmodel
   pygsti.models.qutrit
   pygsti.models.rpemodel
   pygsti.models.stencillabel

``pygsti.objectivefns``
~~~~~~~~~~~~~~~~~~~~~~~

Objective functions (e.g. chi-squared, log-likelihood) and wildcard-error budgets.

.. autosummary::
   :toctree: _autosummary
   :template: custom-module-template.rst
   :recursive:

   pygsti.objectivefns.objectivefns
   pygsti.objectivefns.wildcardbudget

``pygsti.optimize``
~~~~~~~~~~~~~~~~~~~

Optimization routines used during model fitting.

.. autosummary::
   :toctree: _autosummary
   :template: custom-module-template.rst
   :recursive:

   pygsti.optimize.arraysinterface
   pygsti.optimize.customcg
   pygsti.optimize.customlm
   pygsti.optimize.customsolve
   pygsti.optimize.optimize
   pygsti.optimize.simplerlm
   pygsti.optimize.wildcardopt

``pygsti.processors``
~~~~~~~~~~~~~~~~~~~~~

Processor specifications and compilation rules.

.. autosummary::
   :toctree: _autosummary
   :template: custom-module-template.rst
   :recursive:

   pygsti.processors.compilationrules
   pygsti.processors.processorspec
   pygsti.processors.random_compilation

``pygsti.protocols``
~~~~~~~~~~~~~~~~~~~~

Protocol objects (GST, RB, RPE, drift, …) with their inputs, data, and results.

.. autosummary::
   :toctree: _autosummary
   :template: custom-module-template.rst
   :recursive:

   pygsti.protocols.confidenceregionfactory
   pygsti.protocols.estimate
   pygsti.protocols.freeformsim
   pygsti.protocols.gst
   pygsti.protocols.mirror_edesign
   pygsti.protocols.modeltest
   pygsti.protocols.protocol
   pygsti.protocols.rb
   pygsti.protocols.rpe
   pygsti.protocols.scarab
   pygsti.protocols.stability
   pygsti.protocols.treenode
   pygsti.protocols.vb
   pygsti.protocols.vbdataframe

``pygsti.serialization``
~~~~~~~~~~~~~~~~~~~~~~~~

JSON serialization helpers.

.. autosummary::
   :toctree: _autosummary
   :template: custom-module-template.rst
   :recursive:

   pygsti.serialization.jsoncodec

``pygsti.tools``
~~~~~~~~~~~~~~~~

General-purpose numerical and quantum-information utilities.

.. autosummary::
   :toctree: _autosummary
   :template: custom-module-template.rst
   :recursive:

   pygsti.tools.basistools
   pygsti.tools.chi2fns
   pygsti.tools.compilationtools
   pygsti.tools.dataframetools
   pygsti.tools.edesigntools
   pygsti.tools.errgenproptools
   pygsti.tools.exceptions
   pygsti.tools.fastcalc
   pygsti.tools.fasterrgencalc
   pygsti.tools.fogitools
   pygsti.tools.gatetools
   pygsti.tools.group
   pygsti.tools.hypothesis
   pygsti.tools.internalgates
   pygsti.tools.jamiolkowski
   pygsti.tools.leakage
   pygsti.tools.legacytools
   pygsti.tools.likelihoodfns
   pygsti.tools.lindbladtools
   pygsti.tools.listtools
   pygsti.tools.locking
   pygsti.tools.matrixmod2
   pygsti.tools.matrixtools
   pygsti.tools.mcfetools
   pygsti.tools.metaprogramming
   pygsti.tools.mpitools
   pygsti.tools.mptools
   pygsti.tools.nameddict
   pygsti.tools.optools
   pygsti.tools.opttools
   pygsti.tools.pdftools
   pygsti.tools.profile
   pygsti.tools.rbtheory
   pygsti.tools.rbtools
   pygsti.tools.sdptools
   pygsti.tools.sharedmemtools
   pygsti.tools.slicetools
   pygsti.tools.symplectic
   pygsti.tools.typeddict

Large internal subpackages
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

A few subpackages are large internal or data-heavy trees that are not expanded
in this reference: ``pygsti.report`` (HTML-report generation machinery),
``pygsti.modelpacks`` (standard model packs — data rather than API), and
``pygsti.evotypes`` (internal evolution-type representations). The most commonly
used entry points from these areas are listed below.

Frequently used entry points
----------------------------

A handful of widely used classes and functions from the subpackages above are
documented individually here for convenience.

.. autosummary::
   :toctree: _autosummary_manual
   :template: custom-class-template.rst

   pygsti.report.Report
   pygsti.modelpacks.GSTModelPack

.. autosummary::
   :toctree: _autosummary_manual

   pygsti.report.construct_standard_report
