:py:mod:`pygsti.models.cloudnoisemodel` ======================================= .. py:module:: pygsti.models.cloudnoisemodel .. autoapi-nested-parse:: Defines the CloudNoiseModel class and supporting functions Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: pygsti.models.cloudnoisemodel.CloudNoiseModel pygsti.models.cloudnoisemodel.CloudNoiseLayerRules .. py:class:: CloudNoiseModel(processor_spec, gatedict, prep_layers=None, povm_layers=None, build_cloudnoise_fn=None, build_cloudkey_fn=None, simulator='map', evotype='default', errcomp_type='gates', implicit_idle_mode='none', verbosity=0) Bases: :py:obj:`pygsti.models.implicitmodel.ImplicitOpModel` A n-qudit model using a low-weight and geometrically local error model with a common "global idle" operation. Parameters ---------- processor_spec : ProcessorSpec The processor specification to create a model for. This object specifies the gate names and unitaries for the processor, and their availability on the processor. gatedict : dict A dictionary (an `OrderedDict` if you care about insertion order) that associates with string-type gate names (e.g. `"Gx"`) :class:`LinearOperator`, `numpy.ndarray`, or :class:`OpFactory` objects. When the objects may act on fewer than the total number of qudits (determined by their dimension/shape) then they are repeatedly embedded into operation on the entire state space as specified by their availability within `processor_spec`. These operations represent the ideal target operations, and thus, any `LinearOperator` or `OpFactory` objects must be *static*, i.e., have zero parameters. prep_layers, povm_layers : None or operator or dict or list, optional The SPAM operations as n-qudit layer operations. If `None`, then no preps (or POVMs) are created. If a dict, then the keys are labels and the values are layer operators. If a list, then the elements are layer operators and the labels will be assigned as "rhoX" and "MX" where X is an integer starting at 0. If a single layer operation is given, then this is used as the sole prep or POVM and is assigned the label "rho0" or "Mdefault" respectively. build_cloudnoise_fn : function, optional A function which takes a single :class:`Label` as an argument and returns the cloud-noise operation for that primitive layer operation. Note that if `errcomp_type="gates"` the returned operator should be a superoperator whereas if `errcomp_type="errorgens"` then the returned operator should be an error generator (not yet exponentiated). build_cloudkey_fn : function, optional An function which takes a single :class:`Label` as an argument and returns a "cloud key" for that primitive layer. The "cloud" is the set of qudits that the error (the operator returned from `build_cloudnoise_fn`) touches -- and the "key" returned from this function is meant to identify that cloud. This is used to keep track of which primitive layer-labels correspond to the same cloud - e.g. the cloud-key for ("Gx",2) and ("Gy",2) might be the same and could be processed together when selecing sequences that amplify the parameters in the cloud-noise operations for these two labels. The return value should be something hashable with the property that two noise which act on the same qudits should have the same cloud key. simulator : ForwardSimulator or {"auto", "matrix", "map"} The circuit simulator used to compute any requested probabilities, e.g. from :meth:`probs` or :meth:`bulk_probs`. The default value of `"auto"` automatically selects the simulation type, and is usually what you want. Other special allowed values are: - "matrix" : op_matrix-op_matrix products are computed and cached to get composite gates which can then quickly simulate a circuit for any preparation and outcome. High memory demand; best for a small number of (1 or 2) qubits. - "map" : op_matrix-state_vector products are repeatedly computed to simulate circuits. Slower for a small number of qubits, but faster and more memory efficient for higher numbers of qubits (3+). evotype : Evotype or str, optional The evolution type of this model, describing how states are represented. The special value `"default"` is equivalent to specifying the value of `pygsti.evotypes.Evotype.default_evotype`. errcomp_type : {"gates","errorgens"} How errors are composed when creating layer operations in the created model. `"gates"` means that the errors on multiple gates in a single layer are composed as separate and subsequent processes. Specifically, the layer operation has the form `Composed(target,idleErr,cloudErr)` where `target` is a composition of all the ideal gate operations in the layer, `idleErr` is idle error (`.operation_blks['layers']['globalIdle']`), and `cloudErr` is the composition (ordered as layer-label) of cloud- noise contributions, i.e. a map that acts as the product of exponentiated error-generator matrices. `"errorgens"` means that layer operations have the form `Composed(target, error)` where `target` is as above and `error` results from composing the idle and cloud-noise error *generators*, i.e. a map that acts as the exponentiated sum of error generators (ordering is irrelevant in this case). implicit_idle_mode : {'none', 'add_global', 'pad_1Q', 'only_global'} The way idle operations are added implicitly within the created model. `"none"` doesn't add any "extra" idle operations when there is a layer that contains some gates but not gates on all the qubits. `"add_global"` adds the global idle operation, i.e., the operation for a global idle layer (zero gates - a completely empty layer), to every layer that is simulated, using the global idle as a background idle that always occurs regardless of the operation. `"pad_1Q"` applies the 1-qubit idle gate (if one exists) to all idling qubits within a circuit layer. `"only_global"` uses a global idle operation, if one exists, to simulate the completely empty layer but nothing else, i.e., this idle operation is *not* added to other layers as in `"add_global"`. verbosity : int, optional An integer >= 0 dictating how must output to send to stdout. Creates a new OpModel. Rarely used except from derived classes `__init__` functions. Parameters ---------- state_space : StateSpace The state space for this model. basis : Basis The basis used for the state space by dense operator representations. evotype : Evotype or str, optional The evolution type of this model, describing how states are represented. The special value `"default"` is equivalent to specifying the value of `pygsti.evotypes.Evotype.default_evotype`. layer_rules : LayerRules The "layer rules" used for constructing operators for circuit layers. This functionality is essential to using this model to simulate ciruits, and is typically supplied by derived classes. simulator : ForwardSimulator or {"auto", "matrix", "map"} The forward simulator (or typ) that this model should use. `"auto"` tries to determine the best type automatically. .. py:property:: clouds Returns the set of cloud-sets used when creating sequences which amplify the parameters of this model. Returns ------- dict .. py:attribute:: processor_spec .. py:attribute:: errcomp_type :value: "'gates'" .. py:method:: create_processor_spec() .. py:method:: errorgen_coefficients(normalized_elem_gens=True) TODO: docstring - returns a nested dict containing all the error generator coefficients for all the operations in this model. .. py:class:: CloudNoiseLayerRules(errcomp_type, qubit_labels, implicit_idle_mode, singleq_idle_layer_labels, implied_global_idle_label) Bases: :py:obj:`pygsti.models.layerrules.LayerRules` Rules for composing a layer operation from the elements stored within a model. A :class:`LayerRules` object serves as an intermediary between a :class:`ImplicitModel` object and a :class:`ForwardSimulator`. It contains the logic for creating layer operations based on the partial/fundamental operation "blocks" stored within the model. Since different models hold different operation blocks, layer rules are usually tailored to a specific models. .. py:attribute:: qubit_labels .. py:attribute:: errcomp_type .. py:attribute:: implied_global_idle_label .. py:attribute:: single_qubit_idle_layer_labels .. py:attribute:: implicit_idle_mode .. py:method:: prep_layer_operator(model, layerlbl, caches) Create the operator corresponding to `layerlbl`. Parameters ---------- layerlbl : Label A circuit layer label. Returns ------- State .. py:method:: povm_layer_operator(model, layerlbl, caches) Create the operator corresponding to `layerlbl`. Parameters ---------- layerlbl : Label A circuit layer label. Returns ------- POVM or POVMEffect .. py:method:: operation_layer_operator(model, layerlbl, caches) Create the operator corresponding to `layerlbl`. Parameters ---------- layerlbl : Label A circuit layer label. Returns ------- LinearOperator