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

# PreCollect

*class* `samplomatic.pre_samplex.PreCollect(subsystems: Partition[int], direction: Direction, synth: Synth, param_idxs: ndarray[tuple[int, int], dtype[int64]], *, trace_info: TraceInfo | None = None)`

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

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

The collection node type used during samplex building.

**Attributes Summary**

|                                                                                                                |                                                                        |
| -------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
| [`direction`](#samplomatic.pre_samplex.PreCollect.direction "samplomatic.pre_samplex.PreCollect.direction")    | The direction of virtual gates that can interact with this node.       |
| [`param_idxs`](#samplomatic.pre_samplex.PreCollect.param_idxs "samplomatic.pre_samplex.PreCollect.param_idxs") | The indices of the template circuit to write the synthesis results to. |
| [`subsystems`](#samplomatic.pre_samplex.PreCollect.subsystems "samplomatic.pre_samplex.PreCollect.subsystems") | The subsystems that virtual gates act on.                              |
| [`synth`](#samplomatic.pre_samplex.PreCollect.synth "samplomatic.pre_samplex.PreCollect.synth")                | The synthesizer to convert virtual to physical gates.                  |
| [`trace_info`](#samplomatic.pre_samplex.PreCollect.trace_info "samplomatic.pre_samplex.PreCollect.trace_info") | Debug trace information, populated when building with `debug=True`.    |

**Methods Summary**

|                                                                                                                                                               |                                                                                                                                                                  |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`add_subsystems`](#samplomatic.pre_samplex.PreCollect.add_subsystems "samplomatic.pre_samplex.PreCollect.add_subsystems")(new\_subsystems, new\_param\_idxs) | Add subsystems to existing `PreCollect` node.                                                                                                                    |
| [`get_style`](#samplomatic.pre_samplex.PreCollect.get_style "samplomatic.pre_samplex.PreCollect.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**

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

### param\_idxs

Type: [`ndarray`](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray)\[[`tuple`](https://docs.python.org/3/builtins/stdtypes.html#tuple)\[[`int`](https://docs.python.org/3/builtins/functions.html#int), [`int`](https://docs.python.org/3/builtins/functions.html#int)], [`dtype`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.html#numpy.dtype)\[`int64`]]

Default value: `<dataclasses._MISSING_TYPE object>`

The indices of the template circuit to write the synthesis results to.

This should be ordered according to [`subsystems`](#samplomatic.pre_samplex.PreCollect.subsystems "samplomatic.pre_samplex.PreCollect.subsystems").

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

### synth

Type: [`Synth`](/docs/api/samplomatic/auto/synths-synth "samplomatic.synths.synth.Synth")

Default value: `<dataclasses._MISSING_TYPE object>`

The synthesizer to convert virtual to physical gates.

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

### add\_subsystems

`add_subsystems(new_subsystems: Partition[int], new_param_idxs: ndarray[tuple[int, int], dtype[int64]])`

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

Add subsystems to existing `PreCollect` node.

### get\_style

`get_style()`

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

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