Pattern Text Format¶
GraphQOMB writes pattern files using format version 2. Version 2 adds optional per-input positive Pauli eigenstate initialization:
.version 2
.input 0:0 1:1 2:2
.input_basis 1:Y 2:Z
Each .input_basis entry has the form node:X, node:Y, or node:Z
and must reference a node declared by .input. X initialization is the
default and is omitted when serializing, so the example initializes nodes 0,
1, and 2 as X+, Y+, and Z+ respectively.
Version 1 files remain readable. Inputs in a version 1 file, or in a version 2
file without a corresponding .input_basis entry, are initialized as
X+. The .input_basis directive is rejected in version 1 files.
graphqomb.ptn_format module¶
Pattern text format (.ptn) module.
This module provides:
dump: Write a pattern to a .ptn file or string.load: Read a pattern from a .ptn file or string.dumps: Serialize a pattern to a .ptn format string.loads: Deserialize a pattern from a .ptn format string.
- graphqomb.ptn_format.dump(pattern, file)[source]¶
Write a pattern to a .ptn file.
- Parameters:
pattern (
Pattern) – The pattern to write.file (
pathlib.Path|str) – The file path to write to.