Command line

The package installs a qecx command, also run as python -m qecx. It prints a summary of a QECX file, shows one part of it in detail, or validates it:

qecx steane_7_1_3.qecx                          # summary of the whole file
qecx steane_7_1_3.qecx --section registers      # one section in detail
qecx steane_7_1_3.qecx --gate cx                # a logical gate's operand groups and variants
qecx steane_7_1_3.qecx --variant logical_gates.cx.transversal
qecx steane_7_1_3.qecx --matrix H_X             # a binary matrix from the code section
qecx steane_7_1_3.qecx --validate               # validation findings

The display options --section, --variant, --gate, --matrix and --validate exclude each other. With none of them, qecx prints the summary.

The command loads the file without validating it, so an invalid file can still be inspected. --validate prints every finding with its rule ID and exits with status 1 when any finding is an error; warnings alone exit with status 0. A file that cannot be loaded, and a --variant, --gate or --matrix that names something the file does not declare, also exit with status 1.

Circuits are drawn as text, and --no-circuit leaves them out. The command is available with the core install. With the viewer extra, its output is formatted with color and syntax highlighting (see Installation).

To try the command on one of the example QECX files distributed with the package, get its path from qecx.examples:

qecx "$(python -c 'from qecx import examples; print(examples.path("steane_7_1_3.qecx"))')"

Alternatively, download one of the example QECX files from the package’s source repository and run:

qecx "/path/to/steane_7_1_3.qecx"

Options

This reference is generated from the command’s argument parser.

Browse and inspect QEC Exchange Format (QECX) files.

usage: qecx [-h]
            [--section {code,registers,operations,properties,layout} | --variant COMPONENT[.OUTER].VARIANT | --gate GATE_NAME | --matrix FIELD | --validate]
            [--no-circuit] [--circuit-scale SCALE] [--circuit-fold LAYERS]
            file

Positional Arguments

file

Path to a QECX file

Named Arguments

--section, -s

Possible choices: code, registers, operations, properties, layout

Show a specific section in detail.

--variant, -v

Show a specific variant. Use COMPONENT.VARIANT for flat containers (syndrome_measurement) or COMPONENT.OUTER.VARIANT wherever an outer key addresses the declaration: a prepared or reset state, a measurement basis, a gate name, or an observable (e.g. state_preparation.0.mqt_optimal, data_measurement.Z.direct, logical_gates.cx.transversal, logical_measurement.Z.encoded_helper). COMPONENT.VARIANT also works for a component with a single outer key.

--gate, -g

Show a logical gate’s operand groups and variants.

--matrix, -m

Display a binary matrix field from the code section (e.g. H_X).

--validate

Run validation and report any errors/warnings.

--no-circuit

Suppress circuit diagram drawing.

--circuit-scale

Scale factor for circuit rendering (defaults to viewer config).

--circuit-fold

Fold circuit after N layers; -1 = no fold (defaults to viewer config).