---
title: PreChangeBasis (latest version)
description: API reference for samplomatic.pre_samplex.PreChangeBasis in the latest version of samplomatic
source: https://eu-de.quantum.cloud.ibm.com/docs/en/api/samplomatic/auto/pre-samplex-pre-change-basis
---

# PreChangeBasis

*class* `samplomatic.pre_samplex.PreChangeBasis(subsystems: Partition[int], direction: Direction, register_type: VirtualType, basis_ref: str, basis_change: Literal['local_clifford', 'pauli_prepare', 'pauli_measure'], *, trace_info: TraceInfo | None = None, twirl_gate: str | None = None)`

[GitHub](https://github.com/Qiskit/samplomatic/tree/main/samplomatic/pre_samplex/graph_data.py#L415-L429)

Bases: [`PreEmit`](/docs/api/samplomatic/auto/pre-samplex-pre-emit "samplomatic.pre_samplex.graph_data.PreEmit")

The basis emit node type used during samplex building.

**Attributes Summary**

|                                                                                                                                 |                                                                     |
| ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
| [`basis_change`](#samplomatic.pre_samplex.PreChangeBasis.basis_change "samplomatic.pre_samplex.PreChangeBasis.basis_change")    | What kind of basis change to use.                                   |
| [`basis_ref`](#samplomatic.pre_samplex.PreChangeBasis.basis_ref "samplomatic.pre_samplex.PreChangeBasis.basis_ref")             | Unique identifier of this basis change.                             |
| [`direction`](#samplomatic.pre_samplex.PreChangeBasis.direction "samplomatic.pre_samplex.PreChangeBasis.direction")             | The direction of virtual gates that can interact with this node.    |
| [`register_type`](#samplomatic.pre_samplex.PreChangeBasis.register_type "samplomatic.pre_samplex.PreChangeBasis.register_type") | The virtual register type of the basis change.                      |
| [`subsystems`](#samplomatic.pre_samplex.PreChangeBasis.subsystems "samplomatic.pre_samplex.PreChangeBasis.subsystems")          | The subsystems that virtual gates act on.                           |
| [`trace_info`](#samplomatic.pre_samplex.PreChangeBasis.trace_info "samplomatic.pre_samplex.PreChangeBasis.trace_info")          | Debug trace information, populated when building with `debug=True`. |
| [`twirl_gate`](#samplomatic.pre_samplex.PreChangeBasis.twirl_gate "samplomatic.pre_samplex.PreChangeBasis.twirl_gate")          | The gate name used for gate-dependent sampling, or `None`.          |

**Methods Summary**

|                                                                                                                       |                                                                                                                                                                  |
| --------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`get_style`](#samplomatic.pre_samplex.PreChangeBasis.get_style "samplomatic.pre_samplex.PreChangeBasis.get_style")() | Summarizes the style of this node when plotted via [`plot_graph()`](/docs/api/samplomatic/auto/visualization-plot-graph "samplomatic.visualization.plot_graph"). |

**Attributes Documentation**

### basis\_change

Type: [`Literal`](https://docs.python.org/3/library/typing.html#typing.Literal)\[`'local_clifford'`, `'pauli_prepare'`, `'pauli_measure'`]

Default value: `<dataclasses._MISSING_TYPE object>`

What kind of basis change to use.

### basis\_ref

Type: [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

Default value: `<dataclasses._MISSING_TYPE object>`

Unique identifier of this basis change.

### direction

Type: [`Direction`](/docs/api/samplomatic/auto/constants-direction "samplomatic.constants.Direction")

Default value: `<dataclasses._MISSING_TYPE object>`

The direction of virtual gates that can interact with this node.

### register\_type

Type: [`VirtualType`](/docs/api/samplomatic/auto/virtual-registers-virtual-type "samplomatic.virtual_registers.virtual_type.VirtualType")

Default value: `<dataclasses._MISSING_TYPE object>`

The virtual register type of the basis change.

### subsystems

Type: [`Partition`](/docs/api/samplomatic/auto/partition-partition "samplomatic.partition.Partition")\[[`int`](https://docs.python.org/3/builtins/functions.html#int)]

Default value: `<dataclasses._MISSING_TYPE object>`

The subsystems that virtual gates act on.

### trace\_info

Type: `TraceInfo` | [`None`](https://docs.python.org/3/builtins/constants.html#None)

Default value: `None`

Debug trace information, populated when building with `debug=True`.

### twirl\_gate

Type: [`str`](https://docs.python.org/3/builtins/stdtypes.html#str) | [`None`](https://docs.python.org/3/builtins/constants.html#None)

Default value: `None`

The gate name used for gate-dependent sampling, or `None`.

**Methods Documentation**

### get\_style

`get_style() → NodeStyle`

[GitHub](https://github.com/Qiskit/samplomatic/tree/main/samplomatic/pre_samplex/graph_data.py#L428-L429)

Summarizes the style of this node when plotted via [`plot_graph()`](/docs/api/samplomatic/auto/visualization-plot-graph "samplomatic.visualization.plot_graph").
