Skip to content

Running Logical GST (LoGST)

Binder

Step 1: Generate a GST design

import pygsti
from pygsti.modelpacks import smq1Q_XZ as modelpack
gst_design = modelpack.create_gst_experiment_design(max_max_length=16, qubit_labels=["Q0"])
gst_model = modelpack.target_model(qubit_labels=["Q0"]) # 1 physical qubit model

Step 2: Simulate the GST design directly into a DataSet

EdesignRunner takes the place of a pygsti.data.simulate_data: it builds, runs, and collects outcomes for one circuit at a time, so LoQS never has to hold every circuit's QuantumProgram/ProgramResults in memory at once.

from loqs.backends import PyGSTiPhysicalCircuit, QSimQuantumState
from loqs.codepacks import codepack_5_1_3_quantinuum2022 as codepack
from loqs.tools import pygstitools as pt
qubits = ["A0", "A1"] + [f"D{i+2}" for i in range(5)]

ideal_model = codepack.create_ideal_model(qubits) # 7 physical qubit model for simulating 1 logical qubit
code_5q = codepack.create_qec_code(circuit_backend=PyGSTiPhysicalCircuit)

program_kwargs = {
    "default_noise_model": ideal_model,
    "state_type": QSimQuantumState,
    "patch_types":  {"5Q": code_5q},
}
physical_to_logical = {
    "rho0": [
        {"instruction": "Init State", "state": len(qubits), "qubit_labels": qubits},
        {"instruction": "Init Patch 5Q", "new_patch_label": "L0", "qubits": qubits},
        ("Non-FT Minus Prep", "L0"), # in logical minus
        ('H', "L0"), # in logical 1
        ('X', "L0"), # in logical 0
    ],
    ("Gxpi2", "Q0"): [
        ("X", "L0") # Not technically correct, but just an example
    ],
    ("Gzpi2", "Q0"): [
        ("Z", "L0") # Not technically correct, but just an example
    ],
    "Mdefault": [
        ("Non-FT Logical Z Measure", "L0")
    ]
}
runner = pt.EdesignRunner(gst_design, gst_model, physical_to_logical, num_shots=10, program_kwargs=program_kwargs)
ds = runner.run()
len(gst_design.all_circuits_needing_data) == len(ds)

Step 3: Normal GST pipeline

Step 4: Profit $$$