pygsti.baseobjs.label

Defines the Label class

Module Contents

Classes

Label

A label used to identify a gate, circuit layer, or (sub-)circuit.

LabelTup

A label consisting of a string along with a tuple of integers or state-space-names.

LabelTupWithTime

A label consisting of a string along with a tuple of integers or state-space-names.

LabelStr

A string-valued label.

LabelTupTup

A label consisting of a tuple of (string, state-space-labels) tuples.

LabelTupTupWithTime

A label consisting of a tuple of (string, state-space-labels) tuples.

CircuitLabel

A (sub-)circuit label.

LabelTupWithArgs

A label consisting of a string along with a tuple of integers or state-space-names.

LabelTupTupWithArgs

A label consisting of a tuple of (string, state-space-labels) tuples.

Attributes

_debug_record

pygsti.baseobjs.label._debug_record
class pygsti.baseobjs.label.Label

Bases: object

A label used to identify a gate, circuit layer, or (sub-)circuit.

A label consisting of a string along with a tuple of integers or sector-names specifying which qubits, or more generally, parts of the Hilbert space that is acted upon by an object so-labeled.

property depth(self)

The depth of this label, viewed as a sub-circuit.

property reps(self)

Number of repetitions (of this label’s components) that this label represents.

property has_nontrivial_components(self)
collect_args(self)
strip_args(self)
expand_subcircuits(self)

Expand any sub-circuits within this label.

Returns a list of component labels which doesn’t include any CircuitLabel labels. This effectively expands any “boxes” or “exponentiation” within this label.

Returns

tuple – A tuple of component Labels (none of which should be :class:`CircuitLabel`s).

class pygsti.baseobjs.label.LabelTup

Bases: Label, tuple

A label consisting of a string along with a tuple of integers or state-space-names.

These state-space sector names specify which qubits, or more generally, parts of the Hilbert space that is acted upon by the object this label refers to.

__new__
__hash__
classmethod init(cls, name, state_space_labels)

Creates a new Model-item label.

The created label is comprised of a simple string label and a tuple specifying the part of the Hilbert space upon which the item acts (often just qubit indices).

Parameters
  • name (str) – The item name. E.g., ‘CNOT’ or ‘H’.

  • state_space_labels (list or tuple) – A list or tuple that identifies which sectors/parts of the Hilbert space is acted upon. In many cases, this is a list of integers specifying the qubits on which a gate acts, when the ordering in the list defines the ‘direction’ of the gate. If something other than a list or tuple is passed, a single-element tuple is created containing the passed object.

Returns

LabelTup

property time(self)

This label’s name time (always 0)

property name(self)

This label’s name (a string).

property sslbls(self)

This label’s state-space labels, often qubit labels (a tuple).

property args(self)

This label’s arguments.

property components(self)

The sub-label components of this label, or just (self,) if no sub-labels exist.

property qubits(self)

An alias for sslbls, since commonly these are just qubit indices. (a tuple)

property num_qubits(self)

The number of qubits this label “acts” on (an integer). None if self.ssbls is None.

has_prefix(self, prefix, typ='all')

Whether this label has the given prefix.

Usually used to test whether the label names a given type.

Parameters
  • prefix (str) – The prefix to check for.

  • typ ({"any","all"}) – Whether, when there are multiple parts to the label, the prefix must occur in any or all of the parts.

Returns

bool

map_state_space_labels(self, mapper)

Apply a mapping to this Label’s state-space (qubit) labels.

Return a copy of this Label with all of the state-space labels (often just qubit labels) updated according to a mapping function.

For example, calling this function with mapper = {0: 1, 1: 3} on the Label “Gcnot:0:1” would return “Gcnot:1:3”.

Parameters

mapper (dict or function) – A dictionary whose keys are the existing state-space-label values and whose value are the new labels, or a function which takes a single (existing state-space-label) argument and returns a new state-space-label.

Returns

Label

__str__(self)

Defines how a Label is printed out, e.g. Gx:0 or Gcnot:1:2

__repr__(self)

Return repr(self).

__add__(self, s)

Return self+value.

__eq__(self, other)

Defines equality between gates, so that they are equal if their values are equal.

__lt__(self, x)

Return self<value.

__gt__(self, x)

Return self>value.

__pygsti_reduce__(self)
__reduce__(self)

Helper for pickle.

to_native(self)

Returns this label as native python types.

Useful for faster serialization.

Returns

tuple

replace_name(self, oldname, newname)

Returns a label with oldname replaced by newname.

Parameters
  • oldname (str) – Name to find.

  • newname (str) – Name to replace found name with.

Returns

LabelTup

is_simple(self)

Whether this is a “simple” (opaque w/a true name, from a circuit perspective) label or not.

Returns

bool

class pygsti.baseobjs.label.LabelTupWithTime

Bases: Label, tuple

A label consisting of a string along with a tuple of integers or state-space-names.

These state-space sector names specify which qubits, or more generally, parts of the Hilbert space that is acted upon by the object this label refers to.

__hash__
classmethod init(cls, name, state_space_labels, time=0.0)

Creates a new Model-item label.

The created label is comprised of a simple string label and a tuple specifying the part of the Hilbert space upon which the item acts (often just qubit indices).

Parameters
  • name (str) – The item name. E.g., ‘CNOT’ or ‘H’.

  • state_space_labels (list or tuple) – A list or tuple that identifies which sectors/parts of the Hilbert space is acted upon. In many cases, this is a list of integers specifying the qubits on which a gate acts, when the ordering in the list defines the ‘direction’ of the gate. If something other than a list or tuple is passed, a single-element tuple is created containing the passed object.

  • time (float) – The time at which this label occurs (can be relative or absolute)

Returns

LabelTupWithTime

property name(self)

This label’s name (a string).

property sslbls(self)

This label’s state-space labels, often qubit labels (a tuple).

property args(self)

This label’s arguments.

property components(self)

The sub-label components of this label, or just (self,) if no sub-labels exist.

property qubits(self)

An alias for sslbls, since commonly these are just qubit indices. (a tuple)

property num_qubits(self)

The number of qubits this label “acts” on (an integer). None if self.ssbls is None.

has_prefix(self, prefix, typ='all')

Whether this label has the given prefix.

Usually used to test whether the label names a given type.

Parameters
  • prefix (str) – The prefix to check for.

  • typ ({"any","all"}) – Whether, when there are multiple parts to the label, the prefix must occur in any or all of the parts.

Returns

bool

map_state_space_labels(self, mapper)

Apply a mapping to this Label’s state-space (qubit) labels.

Return a copy of this Label with all of the state-space labels (often just qubit labels) updated according to a mapping function.

For example, calling this function with mapper = {0: 1, 1: 3} on the Label “Gcnot:0:1” would return “Gcnot:1:3”.

Parameters

mapper (dict or function) – A dictionary whose keys are the existing state-space-label values and whose value are the new labels, or a function which takes a single (existing state-space-label) argument and returns a new state-space-label.

Returns

Label

__str__(self)

Defines how a Label is printed out, e.g. Gx:0 or Gcnot:1:2

__repr__(self)

Return repr(self).

__add__(self, s)

Return self+value.

__eq__(self, other)

Defines equality between gates, so that they are equal if their values are equal.

__lt__(self, x)

Return self<value.

__gt__(self, x)

Return self>value.

__pygsti_reduce__(self)
__reduce__(self)

Helper for pickle.

to_native(self)

Returns this label as native python types.

Useful for faster serialization.

Returns

tuple

replace_name(self, oldname, newname)

Returns a label with oldname replaced by newname.

Parameters
  • oldname (str) – Name to find.

  • newname (str) – Name to replace found name with.

Returns

LabelTupWithTime

is_simple(self)

Whether this is a “simple” (opaque w/a true name, from a circuit perspective) label or not.

Returns

bool

class pygsti.baseobjs.label.LabelStr

Bases: Label, str

A string-valued label.

A Label for the special case when only a name is present (no state-space-labels). We create this as a separate class so that we can use the string hash function in a “hardcoded” way - if we put switching logic in __hash__ the hashing gets much slower.

__hash__
classmethod init(cls, name, time=0.0)

Creates a new Model-item label, which is just a simple string label.

Parameters
  • name (str) – The item name. E.g., ‘CNOT’ or ‘H’.

  • time (float) – The time at which this label occurs (can be relative or absolute)

Returns

LabelStr

property name(self)

This label’s name (a string).

property sslbls(self)

This label’s state-space labels, often qubit labels (a tuple).

property args(self)

This label’s arguments.

property components(self)

The sub-label components of this label, or just (self,) if no sub-labels exist.

property qubits(self)

An alias for sslbls, since commonly these are just qubit indices.

property num_qubits(self)

The number of qubits this label “acts” on (an integer). None if self.ssbls is None.

has_prefix(self, prefix, typ='all')

Whether this label has the given prefix.

Usually used to test whether the label names a given type.

Parameters
  • prefix (str) – The prefix to check for.

  • typ ({"any","all"}) – Whether, when there are multiple parts to the label, the prefix must occur in any or all of the parts.

Returns

bool

__str__(self)

Return str(self).

__repr__(self)

Return repr(self).

__add__(self, s)

Return self+value.

__eq__(self, other)

Defines equality between gates, so that they are equal if their values are equal.

__lt__(self, x)

Return self<value.

__gt__(self, x)

Return self>value.

__pygsti_reduce__(self)
__reduce__(self)

Helper for pickle.

to_native(self)

Returns this label as native python types.

Useful for faster serialization.

Returns

str

replace_name(self, oldname, newname)

Returns a label with oldname replaced by newname.

Parameters
  • oldname (str) – Name to find.

  • newname (str) – Name to replace found name with.

Returns

LabelStr

is_simple(self)

Whether this is a “simple” (opaque w/a true name, from a circuit perspective) label or not.

Returns

bool

class pygsti.baseobjs.label.LabelTupTup

Bases: Label, tuple

A label consisting of a tuple of (string, state-space-labels) tuples.

This typically labels a layer of a circuit (a parallel level of gates).

__new__
__hash__
classmethod init(cls, tup_of_tups)

Creates a new Model-item tuple-of-tuples label.

This is a tuple of tuples of simple string labels and tuples specifying the part of the Hilbert space upon which that item acts (often just qubit indices).

Parameters

tup_of_tups (tuple) – The item data - a tuple of (string, state-space-labels) tuples which labels a parallel layer/level of a circuit.

Returns

LabelTupTup

property time(self)

This label’s name time (always 0)

property name(self)

This label’s name (a string).

property sslbls(self)

This label’s state-space labels, often qubit labels (a tuple).

property args(self)

This label’s arguments.

property components(self)

The sub-label components of this label, or just (self,) if no sub-labels exist.

property qubits(self)

An alias for sslbls, since commonly these are just qubit indices.

property num_qubits(self)

The number of qubits this label “acts” on (an integer). None if self.ssbls is None.

has_prefix(self, prefix, typ='all')

Whether this label has the given prefix.

Usually used to test whether the label names a given type.

Parameters
  • prefix (str) – The prefix to check for.

  • typ ({"any","all"}) – Whether, when there are multiple parts to the label, the prefix must occur in any or all of the parts.

Returns

bool

map_state_space_labels(self, mapper)

Apply a mapping to this Label’s state-space (qubit) labels.

Return a copy of this Label with all of the state-space labels (often just qubit labels) updated according to a mapping function.

For example, calling this function with mapper = {0: 1, 1: 3} on the Label “Gcnot:0:1” would return “Gcnot:1:3”.

Parameters

mapper (dict or function) – A dictionary whose keys are the existing state-space-label values and whose value are the new labels, or a function which takes a single (existing state-space-label) argument and returns a new state-space-label.

Returns

Label

strip_args(self)

Return version of self with all arguments removed

__str__(self)

Defines how a Label is printed out, e.g. Gx:0 or Gcnot:1:2

__repr__(self)

Return repr(self).

abstract __add__(self, s)

Return self+value.

__eq__(self, other)

Defines equality between gates, so that they are equal if their values are equal.

__lt__(self, x)

Return self<value.

__gt__(self, x)

Return self>value.

__pygsti_reduce__(self)
__reduce__(self)

Helper for pickle.

__contains__(self, x)

Return key in self.

to_native(self)

Returns this label as native python types.

Useful for faster serialization.

Returns

tuple

replace_name(self, oldname, newname)

Returns a label with oldname replaced by newname.

Parameters
  • oldname (str) – Name to find.

  • newname (str) – Name to replace found name with.

Returns

LabelTupTup

is_simple(self)

Whether this is a “simple” (opaque w/a true name, from a circuit perspective) label or not.

Returns

bool

property depth(self)

The depth of this label, viewed as a sub-circuit.

expand_subcircuits(self)

Expand any sub-circuits within this label.

Returns a list of component labels which doesn’t include any CircuitLabel labels. This effectively expands any “boxes” or “exponentiation” within this label.

Returns

tuple – A tuple of component Labels (none of which should be :class:`CircuitLabel`s).

class pygsti.baseobjs.label.LabelTupTupWithTime

Bases: Label, tuple

A label consisting of a tuple of (string, state-space-labels) tuples.

This typically labels a layer of a circuit (a parallel level of gates).

__hash__
classmethod init(cls, tup_of_tups, time=None)

Creates a new Model-item tuple-of-tuples label.

This is a tuple of tuples of simple string labels and tuples specifying the part of the Hilbert space upon which that item acts (often just qubit indices).

Parameters
  • tup_of_tups (tuple) – The item data - a tuple of (string, state-space-labels) tuples which labels a parallel layer/level of a circuit.

  • time (float, optional) – A time value associated with this label. Often this is the duration of the object or operation labeled.

Returns

LabelTupTupWithTime

property name(self)

This label’s name (a string).

property sslbls(self)

This label’s state-space labels, often qubit labels (a tuple).

property args(self)

This label’s arguments.

property components(self)

The sub-label components of this label, or just (self,) if no sub-labels exist.

property qubits(self)

An alias for sslbls, since commonly these are just qubit indices.

property num_qubits(self)

The number of qubits this label “acts” on (an integer). None if self.ssbls is None.

has_prefix(self, prefix, typ='all')

Whether this label has the given prefix.

Usually used to test whether the label names a given type.

Parameters
  • prefix (str) – The prefix to check for.

  • typ ({"any","all"}) – Whether, when there are multiple parts to the label, the prefix must occur in any or all of the parts.

Returns

bool

map_state_space_labels(self, mapper)

Apply a mapping to this Label’s state-space (qubit) labels.

Return a copy of this Label with all of the state-space labels (often just qubit labels) updated according to a mapping function.

For example, calling this function with mapper = {0: 1, 1: 3} on the Label “Gcnot:0:1” would return “Gcnot:1:3”.

Parameters

mapper (dict or function) – A dictionary whose keys are the existing state-space-label values and whose value are the new labels, or a function which takes a single (existing state-space-label) argument and returns a new state-space-label.

Returns

Label

strip_args(self)

Return version of self with all arguments removed

__str__(self)

Defines how a Label is printed out, e.g. Gx:0 or Gcnot:1:2

__repr__(self)

Return repr(self).

abstract __add__(self, s)

Return self+value.

__eq__(self, other)

Defines equality between gates, so that they are equal if their values are equal.

__lt__(self, x)

Return self<value.

__gt__(self, x)

Return self>value.

__pygsti_reduce__(self)
__reduce__(self)

Helper for pickle.

__contains__(self, x)

Return key in self.

to_native(self)

Returns this label as native python types.

Useful for faster serialization.

Returns

tuple

replace_name(self, oldname, newname)

Returns a label with oldname replaced by newname.

Parameters
  • oldname (str) – Name to find.

  • newname (str) – Name to replace found name with.

Returns

LabelTupTupWithTime

is_simple(self)

Whether this is a “simple” (opaque w/a true name, from a circuit perspective) label or not.

Returns

bool

property depth(self)

The depth of this label, viewed as a sub-circuit.

expand_subcircuits(self)

Expand any sub-circuits within this label.

Returns a list of component labels which doesn’t include any CircuitLabel labels. This effectively expands any “boxes” or “exponentiation” within this label.

Returns

tuple – A tuple of component Labels (none of which should be :class:`CircuitLabel`s).

class pygsti.baseobjs.label.CircuitLabel

Bases: Label, tuple

A (sub-)circuit label.

This class encapsulates a complete circuit as a single layer. It lacks some of the methods and metadata of a true Circuit object, but contains the essentials: the tuple of layer labels (held as the label’s components) and line labels (held as the label’s state-space labels)

__hash__
property name(self)

This label’s name (a string).

property sslbls(self)

This label’s state-space labels, often qubit labels (a tuple).

property reps(self)

Number of repetitions (of this label’s components) that this label represents.

property args(self)

This label’s arguments.

property components(self)

The sub-label components of this label, or just (self,) if no sub-labels exist.

property qubits(self)

An alias for sslbls, since commonly these are just qubit indices. (a tuple)

property num_qubits(self)

The number of qubits this label “acts” on (an integer). None if self.ssbls is None.

has_prefix(self, prefix, typ='all')

Whether this label has the given prefix.

Usually used to test whether the label names a given type.

Parameters
  • prefix (str) – The prefix to check for.

  • typ ({"any","all"}) – Whether, when there are multiple parts to the label, the prefix must occur in any or all of the parts.

Returns

bool

map_state_space_labels(self, mapper)

Apply a mapping to this Label’s state-space (qubit) labels.

Return a copy of this Label with all of the state-space labels (often just qubit labels) updated according to a mapping function.

For example, calling this function with mapper = {0: 1, 1: 3} on the Label “Gcnot:0:1” would return “Gcnot:1:3”.

Parameters

mapper (dict or function) – A dictionary whose keys are the existing state-space-label values and whose value are the new labels, or a function which takes a single (existing state-space-label) argument and returns a new state-space-label.

Returns

CircuitLabel

abstract strip_args(self)
__str__(self)

Defines how a Label is printed out, e.g. Gx:0 or Gcnot:1:2

__repr__(self)

Return repr(self).

abstract __add__(self, s)

Return self+value.

__eq__(self, other)

Defines equality between gates, so that they are equal if their values are equal.

__lt__(self, x)

Return self<value.

__gt__(self, x)

Return self>value.

__pygsti_reduce__(self)
__reduce__(self)

Helper for pickle.

__contains__(self, x)

Return key in self.

to_native(self)

Returns this label as native python types.

Useful for faster serialization.

Returns

tuple

replace_name(self, oldname, newname)

Returns a label with oldname replaced by newname.

Parameters
  • oldname (str) – Name to find.

  • newname (str) – Name to replace found name with.

Returns

CircuitLabel

is_simple(self)

Whether this is a “simple” (opaque w/a true name, from a circuit perspective) label or not.

Returns

bool

property depth(self)

The depth of this label, viewed as a sub-circuit.

expand_subcircuits(self)

Expand any sub-circuits within this label.

Returns a list of component labels which doesn’t include any CircuitLabel labels. This effectively expands any “boxes” or “exponentiation” within this label.

Returns

tuple – A tuple of component Labels (none of which should be :class:`CircuitLabel`s).

class pygsti.baseobjs.label.LabelTupWithArgs

Bases: Label, tuple

A label consisting of a string along with a tuple of integers or state-space-names.

These state-space sector names specify which qubits, or more generally, parts of the Hilbert space that is acted upon by the object this label refers to. This label type also supports having arguments and a time value.

__hash__
classmethod init(cls, name, state_space_labels, time=0.0, args=())

Creates a new Model-item label.

The created is divided into a simple string label, a tuple specifying the part of the Hilbert space upon which the item acts (often just qubit indices), a time, and arguments.

Parameters
  • name (str) – The item name. E.g., ‘CNOT’ or ‘H’.

  • state_space_labels (list or tuple) – A list or tuple that identifies which sectors/parts of the Hilbert space is acted upon. In many cases, this is a list of integers specifying the qubits on which a gate acts, when the ordering in the list defines the ‘direction’ of the gate. If something other than a list or tuple is passed, a single-element tuple is created containing the passed object.

  • time (float) – The time at which this label occurs (can be relative or absolute)

  • args (iterable of hashable types) – A list of “arguments” for this label.

Returns

LabelTupWithArgs

property name(self)

This label’s name (a string).

property sslbls(self)

This label’s state-space labels, often qubit labels (a tuple).

property args(self)

This label’s arguments.

property components(self)

The sub-label components of this label, or just (self,) if no sub-labels exist.

property qubits(self)

An alias for sslbls, since commonly these are just qubit indices. (a tuple)

property num_qubits(self)

The number of qubits this label “acts” on (an integer). None if self.ssbls is None.

has_prefix(self, prefix, typ='all')

Whether this label has the given prefix.

Usually used to test whether the label names a given type.

Parameters
  • prefix (str) – The prefix to check for.

  • typ ({"any","all"}) – Whether, when there are multiple parts to the label, the prefix must occur in any or all of the parts.

Returns

bool

map_state_space_labels(self, mapper)

Apply a mapping to this Label’s state-space (qubit) labels.

Return a copy of this Label with all of the state-space labels (often just qubit labels) updated according to a mapping function.

For example, calling this function with mapper = {0: 1, 1: 3} on the Label “Gcnot:0:1” would return “Gcnot:1:3”.

Parameters

mapper (dict or function) – A dictionary whose keys are the existing state-space-label values and whose value are the new labels, or a function which takes a single (existing state-space-label) argument and returns a new state-space-label.

Returns

Label

strip_args(self)
__str__(self)

Defines how a Label is printed out, e.g. Gx:0 or Gcnot:1:2

__repr__(self)

Return repr(self).

__add__(self, s)

Return self+value.

__eq__(self, other)

Defines equality between gates, so that they are equal if their values are equal.

__lt__(self, x)

Return self<value.

__gt__(self, x)

Return self>value.

__pygsti_reduce__(self)
__reduce__(self)

Helper for pickle.

to_native(self)

Returns this label as native python types.

Useful for faster serialization.

Returns

tuple

replacename(self, oldname, newname)

Returns a label with oldname replaced by newname.

Parameters
  • oldname (str) – Name to find.

  • newname (str) – Name to replace found name with.

Returns

LabelTupWithArgs

is_simple(self)

Whether this is a “simple” (opaque w/a true name, from a circuit perspective) label or not.

Returns

bool

class pygsti.baseobjs.label.LabelTupTupWithArgs

Bases: Label, tuple

A label consisting of a tuple of (string, state-space-labels) tuples.

This typically labels a layer of a circuit (a parallel level of gates). This label type also supports having arguments and a time value.

__hash__
classmethod init(cls, tup_of_tups, time=None, args=())

Creates a new Model-item label.

The created label is a tuple of tuples of simple string labels and tuples specifying the part of the Hilbert space upon which that item acts (often just qubit indices).

Parameters
  • tup_of_tups (tuple) – The item data - a tuple of (string, state-space-labels) tuples which labels a parallel layer/level of a circuit.

  • time (float) – The time at which this label occurs (can be relative or absolute)

  • args (iterable of hashable types) – A list of “arguments” for this label.

Returns

LabelTupTupWithArgs

property name(self)

This label’s name (a string).

property sslbls(self)

This label’s state-space labels, often qubit labels (a tuple).

property args(self)

This label’s arguments.

property components(self)

The sub-label components of this label, or just (self,) if no sub-labels exist.

property qubits(self)

An alias for sslbls, since commonly these are just qubit indices. (a tuple)

property num_qubits(self)

The number of qubits this label “acts” on (an integer). None if self.ssbls is None.

has_prefix(self, prefix, typ='all')

Whether this label has the given prefix.

Usually used to test whether the label names a given type.

Parameters
  • prefix (str) – The prefix to check for.

  • typ ({"any","all"}) – Whether, when there are multiple parts to the label, the prefix must occur in any or all of the parts.

Returns

bool

map_state_space_labels(self, mapper)

Apply a mapping to this Label’s state-space (qubit) labels.

Return a copy of this Label with all of the state-space labels (often just qubit labels) updated according to a mapping function.

For example, calling this function with mapper = {0: 1, 1: 3} on the Label “Gcnot:0:1” would return “Gcnot:1:3”.

Parameters

mapper (dict or function) – A dictionary whose keys are the existing state-space-label values and whose value are the new labels, or a function which takes a single (existing state-space-label) argument and returns a new state-space-label.

Returns

Label

strip_args(self)

Return version of self with all arguments removed

__str__(self)

Defines how a Label is printed out, e.g. Gx:0 or Gcnot:1:2

__repr__(self)

Return repr(self).

abstract __add__(self, s)

Return self+value.

__eq__(self, other)

Defines equality between gates, so that they are equal if their values are equal.

__lt__(self, x)

Return self<value.

__gt__(self, x)

Return self>value.

__pygsti_reduce__(self)
__reduce__(self)

Helper for pickle.

__contains__(self, x)

Return key in self.

to_native(self)

Returns this label as native python types.

Useful for faster serialization.

Returns

tuple

replace_name(self, oldname, newname)

Returns a label with oldname replaced by newname.

Parameters
  • oldname (str) – Name to find.

  • newname (str) – Name to replace found name with.

Returns

LabelTupTupWithArgs

is_simple(self)

Whether this is a “simple” (opaque w/a true name, from a circuit perspective) label or not.

Returns

bool

property depth(self)

The depth of this label, viewed as a sub-circuit.