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

# PreMeasure

*class* `samplomatic.pre_samplex.PreMeasure(subsystems: Partition[int], creg_names: list[str], creg_offsets: list[int], *, trace_info: TraceInfo | None = None)`

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

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

The propagation node type used for measurements during samplex building.

**Attributes Summary**

|                                                                                                                      |                                                                             |
| -------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
| [`creg_names`](#samplomatic.pre_samplex.PreMeasure.creg_names "samplomatic.pre_samplex.PreMeasure.creg_names")       | The classical register names this measurement writes to, one per subsystem. |
| [`creg_offsets`](#samplomatic.pre_samplex.PreMeasure.creg_offsets "samplomatic.pre_samplex.PreMeasure.creg_offsets") | The indices within the classical registers, one per subsystem.              |
| [`direction`](#samplomatic.pre_samplex.PreMeasure.direction "samplomatic.pre_samplex.PreMeasure.direction")          | The direction of virtual gates that can interact with this node.            |
| [`subsystems`](#samplomatic.pre_samplex.PreMeasure.subsystems "samplomatic.pre_samplex.PreMeasure.subsystems")       | The subsystems that virtual gates act on.                                   |
| [`trace_info`](#samplomatic.pre_samplex.PreMeasure.trace_info "samplomatic.pre_samplex.PreMeasure.trace_info")       | Debug trace information, populated when building with `debug=True`.         |

**Methods Summary**

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

**Attributes Documentation**

### creg\_names

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

Default value: `<dataclasses._MISSING_TYPE object>`

The classical register names this measurement writes to, one per subsystem.

### creg\_offsets

Type: [`list`](https://docs.python.org/3/builtins/stdtypes.html#list)\[[`int`](https://docs.python.org/3/builtins/functions.html#int)]

Default value: `<dataclasses._MISSING_TYPE object>`

The indices within the classical registers, one per subsystem.

### 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.

### 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`.

**Methods Documentation**

### from\_cluster

*classmethod* `from_cluster(nodes: list[PreMeasure]) → PreMeasure`

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

### get\_style

`get_style() → NodeStyle`

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

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

### to\_key

`to_key() → Hashable`

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