The question
Compare each route alone with the same route running beside a second one.
Circuit & method
Use A = 53–54–55 and B = 74–75–59, with adjacent receivers. Interleave eight solo/joint input cases in four 64-shot blocks per case, giving 256 shots each.
Results
A passed 411/512 solo checks and 767/1,024 joint checks, a −5.37-point difference. Its recorded familywise 95% interval was −10.19 to −0.24 points. B changed by +0.68 points with an interval spanning zero.
| Route | Joint minus solo | Familywise 95% interval |
|---|---|---|
| A | -5.371 points | -10.187 to -0.238 points |
| B | +0.684 points | -2.390 to +4.196 points |

What this supports
Percentages are rounded for reading. The original integer counts, physical layouts, settings and available uncertainty calculations remain in the records below. Sampling intervals do not account for drift or every systematic error.
Full experiment record
Every top-level field from the primary hardware JSON is reproduced below, including the complete saved measurement distributions where present. Field names and outcome strings retain their original order and spelling.
- Neighbor-Kingston.jsonWorkspace original · 16,012 bytes
backend
ibm_kingston
map_job
dc0i902nj2vs73de2dg0
selection
{
"A": [
53,
54,
55
],
"B": [
74,
75,
59
],
"map_passes": [
[
241,
248,
249
],
[
249,
250,
250
]
],
"candidate_pairs": 484,
"score": 0.21261258749614076,
"criterion": "Disjoint triples, adjacent receiver qubits. Minimize summed negative log smoothed map pass fractions and CZ successes."
}stage
done
order
[ "-1", "10", "-0", "01", "11", "0-", "00", "1-", "10", "01", "-1", "-0", "1-", "0-", "00", "11", "00", "-0", "11", "1-", "10", "-1", "0-", "01", "00", "01", "-1", "-0", "11", "0-", "1-", "10" ]
shots_per_block
64
shots_per_case
256
native_counts
{
"0-": {
"rz": 12,
"sx": 6,
"cz": 2,
"measure_2": 2,
"if_else": 2,
"barrier": 1,
"measure": 1
},
"1-": {
"rz": 12,
"sx": 6,
"cz": 2,
"measure_2": 2,
"if_else": 2,
"x": 1,
"barrier": 1,
"measure": 1
},
"-0": {
"rz": 12,
"sx": 6,
"cz": 2,
"measure_2": 2,
"if_else": 2,
"barrier": 1,
"measure": 1
},
"-1": {
"rz": 12,
"sx": 6,
"cz": 2,
"measure_2": 2,
"if_else": 2,
"x": 1,
"barrier": 1,
"measure": 1
},
"00": {
"rz": 24,
"sx": 12,
"cz": 4,
"measure_2": 4,
"if_else": 4,
"measure": 2,
"barrier": 1
},
"01": {
"rz": 24,
"sx": 12,
"cz": 4,
"measure_2": 4,
"if_else": 4,
"measure": 2,
"x": 1,
"barrier": 1
},
"10": {
"rz": 24,
"sx": 12,
"cz": 4,
"measure_2": 4,
"if_else": 4,
"measure": 2,
"x": 1,
"barrier": 1
},
"11": {
"rz": 24,
"sx": 12,
"cz": 4,
"measure_2": 4,
"if_else": 4,
"x": 2,
"measure": 2,
"barrier": 1
}
}tag
adjacent-receivers-20261120-v1
job_id
dc0i93anj2vs73de2dmg
counts_by_block
[
{
"110": 16,
"101": 14,
"111": 15,
"100": 14,
"010": 1,
"001": 1,
"000": 1,
"011": 2
},
{
"010011": 5,
"011100": 5,
"000111": 2,
"010111": 4,
"001010": 2,
"011111": 2,
"001110": 3,
"000011": 2,
"001011": 1,
"111011": 1,
"000100": 2,
"011011": 2,
"011001": 4,
"100110": 1,
"000010": 1,
"001000": 1,
"010010": 2,
"000001": 3,
"011101": 1,
"000110": 1,
"011000": 1,
"010100": 3,
"001100": 2,
"011010": 3,
"011110": 1,
"001111": 1,
"010001": 2,
"001001": 1,
"110001": 1,
"110101": 1,
"010101": 1,
"010000": 1,
"100100": 1
},
{
"011": 15,
"001": 10,
"000": 15,
"010": 18,
"110": 1,
"100": 3,
"111": 1,
"101": 1
},
{
"101111": 1,
"111010": 1,
"100111": 1,
"100011": 4,
"111110": 2,
"101011": 6,
"001110": 1,
"100010": 2,
"110110": 1,
"100110": 3,
"010000": 1,
"100101": 3,
"111111": 2,
"110111": 1,
"101101": 5,
"000001": 1,
"101110": 2,
"100100": 4,
"100001": 3,
"110000": 2,
"100000": 3,
"001100": 1,
"101100": 2,
"110001": 1,
"111101": 2,
"101010": 2,
"110011": 1,
"110010": 2,
"000010": 1,
"101000": 2,
"111000": 1
},
{
"111111": 3,
"100011": 3,
"111101": 5,
"011100": 1,
"110101": 5,
"100101": 1,
"110111": 4,
"100100": 2,
"001101": 1,
"101001": 2,
"100110": 2,
"111010": 2,
"110001": 3,
"111001": 2,
"110011": 2,
"111110": 2,
"110000": 4,
"011010": 1,
"110110": 4,
"111011": 4,
"111100": 2,
"101100": 1,
"101111": 1,
"101011": 1,
"101110": 1,
"111000": 2,
"100111": 1,
"100000": 1,
"110010": 1
},
{
"010": 9,
"001": 17,
"000": 17,
"110": 6,
"101": 3,
"011": 6,
"111": 1,
"100": 5
},
{
"010001": 1,
"000001": 3,
"000101": 5,
"011001": 3,
"001001": 4,
"011000": 1,
"000010": 2,
"000111": 3,
"001110": 6,
"000100": 5,
"000011": 4,
"011011": 1,
"011101": 2,
"010101": 1,
"001101": 4,
"001011": 2,
"110011": 1,
"010000": 2,
"011100": 2,
"110110": 1,
"001111": 2,
"000000": 1,
"010100": 1,
"100011": 1,
"111101": 1,
"001000": 3,
"001010": 1,
"100001": 1
},
{
"100": 13,
"110": 14,
"000": 4,
"101": 12,
"111": 15,
"001": 4,
"011": 2
},
{
"010010": 4,
"010011": 4,
"001101": 2,
"001111": 2,
"000010": 2,
"011111": 4,
"110010": 2,
"001001": 3,
"011101": 4,
"000000": 3,
"011001": 2,
"000110": 1,
"010110": 1,
"011100": 1,
"011010": 2,
"010101": 1,
"000100": 1,
"011110": 5,
"011000": 3,
"010000": 2,
"011011": 2,
"001010": 1,
"111110": 1,
"001100": 1,
"010111": 2,
"000111": 1,
"001110": 1,
"010001": 2,
"111101": 1,
"001011": 1,
"010100": 1,
"100100": 1
},
{
"100001": 6,
"100110": 2,
"100101": 5,
"101000": 7,
"100000": 1,
"100010": 3,
"111001": 1,
"101001": 4,
"110101": 1,
"110111": 1,
"101101": 2,
"101010": 2,
"101110": 3,
"100100": 1,
"100011": 5,
"001000": 1,
"100111": 1,
"101011": 2,
"101100": 3,
"010110": 1,
"101111": 1,
"111111": 1,
"111110": 2,
"110000": 1,
"111000": 1,
"110010": 1,
"000111": 1,
"000100": 1,
"001100": 1,
"111101": 1,
"010011": 1
},
{
"100": 17,
"101": 12,
"110": 13,
"111": 15,
"010": 4,
"011": 3
},
{
"010": 14,
"011": 16,
"001": 13,
"000": 17,
"101": 1,
"100": 3
},
{
"110": 17,
"100": 9,
"101": 15,
"111": 10,
"010": 4,
"001": 4,
"011": 4,
"000": 1
},
{
"011": 11,
"010": 13,
"001": 15,
"110": 1,
"000": 14,
"100": 5,
"111": 2,
"101": 3
},
{
"000000": 2,
"001100": 3,
"011100": 1,
"001000": 3,
"001111": 2,
"001010": 2,
"000110": 4,
"001001": 3,
"000001": 4,
"100010": 2,
"000011": 5,
"100001": 1,
"000101": 4,
"101011": 1,
"000010": 4,
"000111": 4,
"001101": 5,
"001110": 1,
"010011": 1,
"100111": 1,
"001011": 1,
"101100": 2,
"011110": 1,
"110110": 1,
"011010": 1,
"000100": 2,
"010110": 1,
"011111": 2
},
{
"111001": 2,
"110000": 7,
"100011": 1,
"110101": 2,
"101101": 2,
"001000": 1,
"111110": 1,
"100100": 1,
"111100": 3,
"110111": 6,
"100110": 1,
"100000": 3,
"110110": 2,
"100010": 1,
"110001": 2,
"100111": 1,
"110100": 2,
"101011": 2,
"110011": 2,
"101010": 2,
"111010": 2,
"110010": 3,
"101100": 1,
"111000": 2,
"111101": 4,
"100101": 2,
"000010": 1,
"111111": 2,
"101001": 3
},
{
"010000": 2,
"001111": 3,
"101011": 1,
"000111": 6,
"000001": 4,
"001100": 3,
"001011": 1,
"011101": 1,
"000010": 2,
"000100": 3,
"001000": 3,
"000101": 5,
"000000": 5,
"101101": 1,
"000110": 5,
"011111": 3,
"001110": 1,
"001001": 4,
"010110": 1,
"000011": 3,
"010100": 1,
"101001": 2,
"001101": 2,
"011011": 1,
"111001": 1
},
{
"011": 17,
"001": 15,
"000": 18,
"010": 11,
"111": 2,
"100": 1
},
{
"111111": 3,
"111001": 7,
"110011": 2,
"101111": 2,
"111011": 2,
"110010": 5,
"111101": 5,
"100111": 1,
"110101": 3,
"110110": 2,
"001001": 2,
"111010": 5,
"110000": 1,
"011110": 1,
"111000": 1,
"110111": 5,
"111100": 2,
"111110": 1,
"100000": 2,
"010010": 1,
"000101": 1,
"101101": 2,
"011111": 1,
"110001": 1,
"101000": 1,
"101001": 1,
"100011": 1,
"010011": 1,
"110100": 2
},
{
"111": 11,
"101": 12,
"110": 16,
"100": 17,
"011": 2,
"000": 3,
"001": 2,
"010": 1
},
{
"011011": 3,
"010111": 2,
"010010": 2,
"000100": 2,
"010011": 4,
"011000": 6,
"010000": 1,
"011100": 4,
"110000": 1,
"011010": 4,
"011101": 4,
"011111": 3,
"001001": 2,
"000110": 1,
"010101": 3,
"010100": 2,
"001101": 2,
"001010": 1,
"011110": 5,
"000101": 1,
"000000": 3,
"111111": 1,
"010001": 1,
"001011": 1,
"110100": 1,
"000001": 2,
"011001": 1,
"101000": 1
},
{
"111": 11,
"101": 19,
"011": 1,
"000": 4,
"100": 18,
"110": 9,
"001": 2
},
{
"000": 13,
"010": 15,
"100": 4,
"101": 2,
"001": 16,
"111": 8,
"011": 5,
"110": 1
},
{
"111110": 3,
"101111": 4,
"100000": 2,
"101110": 4,
"110001": 1,
"100100": 4,
"111010": 1,
"100001": 4,
"100110": 3,
"100101": 3,
"000110": 1,
"010001": 1,
"101000": 2,
"100111": 4,
"101001": 2,
"101010": 3,
"110101": 1,
"000000": 1,
"101100": 5,
"101101": 4,
"111100": 1,
"111111": 2,
"100011": 2,
"101011": 2,
"111011": 1,
"110000": 1,
"100010": 1,
"010010": 1
},
{
"001010": 2,
"001011": 5,
"001100": 3,
"011010": 2,
"000100": 5,
"010011": 1,
"011000": 3,
"011110": 2,
"000011": 5,
"001111": 5,
"100011": 1,
"000001": 4,
"010111": 1,
"011100": 2,
"000111": 3,
"000000": 2,
"000010": 1,
"000101": 2,
"101010": 1,
"011001": 2,
"010101": 2,
"001001": 3,
"001110": 2,
"010001": 1,
"000110": 1,
"010100": 2,
"001000": 1
},
{
"000111": 1,
"100101": 4,
"111011": 2,
"110100": 3,
"101001": 6,
"101111": 3,
"110010": 2,
"101000": 6,
"110000": 2,
"110001": 1,
"111010": 1,
"100010": 3,
"101110": 5,
"101011": 2,
"111101": 1,
"101100": 4,
"111000": 1,
"100100": 1,
"100111": 2,
"001000": 3,
"000000": 1,
"110011": 1,
"110110": 1,
"100000": 1,
"101010": 1,
"111001": 1,
"100011": 2,
"101101": 2,
"100001": 1
},
{
"101": 13,
"110": 16,
"100": 15,
"111": 14,
"001": 2,
"011": 2,
"010": 1,
"000": 1
},
{
"001": 19,
"011": 21,
"010": 11,
"000": 10,
"101": 2,
"111": 1
},
{
"101010": 3,
"111000": 3,
"111010": 4,
"101011": 2,
"110111": 5,
"101101": 1,
"110000": 3,
"100100": 3,
"010111": 1,
"110100": 2,
"110010": 2,
"111011": 1,
"100111": 1,
"110101": 2,
"110001": 2,
"011111": 1,
"111101": 5,
"101100": 2,
"110110": 1,
"001001": 1,
"111110": 4,
"111111": 3,
"111100": 1,
"101000": 1,
"100000": 1,
"100110": 1,
"111001": 1,
"110011": 2,
"011010": 1,
"101001": 2,
"011001": 1,
"010010": 1
},
{
"011": 10,
"101": 6,
"110": 4,
"010": 13,
"001": 13,
"111": 2,
"000": 14,
"100": 2
},
{
"100": 15,
"001": 3,
"011": 2,
"110": 9,
"111": 7,
"010": 4,
"101": 18,
"000": 6
},
{
"011000": 5,
"001001": 2,
"011111": 4,
"101011": 1,
"010110": 4,
"001100": 1,
"000110": 2,
"000011": 3,
"010011": 5,
"001111": 1,
"000010": 2,
"001110": 1,
"010001": 4,
"011001": 3,
"010100": 3,
"111011": 2,
"011010": 3,
"010010": 1,
"000000": 1,
"011101": 1,
"001101": 1,
"011011": 3,
"010101": 2,
"010000": 3,
"010111": 1,
"011110": 1,
"011100": 3,
"000100": 1
}
]correct
{
"0-": {
"A": 201,
"all": 201
},
"1-": {
"A": 210,
"all": 210
},
"-0": {
"B": 240,
"all": 240
},
"-1": {
"B": 231,
"all": 231
},
"00": {
"A": 203,
"B": 236,
"all": 188
},
"01": {
"A": 198,
"B": 236,
"all": 183
},
"10": {
"A": 180,
"B": 239,
"all": 168
},
"11": {
"A": 186,
"B": 238,
"all": 175
}
}contrasts
{
"A": {
"alone": 411,
"together": 767,
"difference": -0.0537109375,
"familywise_95_interval": [
-0.10186737645423458,
-0.002384036846726334
]
},
"B": {
"alone": 471,
"together": 949,
"difference": 0.0068359375,
"familywise_95_interval": [
-0.023899522287694094,
0.041959778333523004
]
}
}metrics
{
"caller": "qiskit",
"qiskit_version": "qiskit_ibm_runtime-0.52.1,qiskit-2.6.2*,qiskit_aer-0.17.2*",
"timestamps": {
"created": "2026-11-21T04:56:45.465403Z",
"finished": "2026-11-21T04:56:52.838262Z",
"running": "2026-11-21T04:56:46.930932Z"
},
"usage": {
"qpu_charge_time_seconds": 3,
"value": 0.038389,
"unit": "resource_units",
"status": "complete",
"details": [
{
"value": 0.038389,
"unit": "resource_units",
"metric": {
"id": "caffe3ca-729c-5750-8777-df63bbf8bfd9",
"value": 3
}
}
]
},
"circuits_execution_time_ns": 539251968
}Supporting records & original figures
- Mapomatic-Kingston-baseline.jsonWorkspace original · 2,036 bytes
- mapomatic-properties.jsonWorkspace / tmp · 852,140 bytes
- Neighbor-Kingston-map.pngWorkspace original · 139,670 bytes
Simulation & checks
These are the supplied simulator records and their preserved variants. Their model, seed, settings and results appear exactly as saved. Shared simulator references on fresh-map pages describe the ideal graph protocol, rather than a new hardware-matched calibration.
- Neighbor-simulator.jsonWorkspace original · 2,894 bytes
workspace/Neighbor-simulator.json · full record
{
"map_job": "dc0i902nj2vs73de2dg0",
"selection": {
"A": [
53,
54,
55
],
"B": [
74,
75,
59
],
"map_passes": [
[
241,
248,
249
],
[
249,
250,
250
]
],
"candidate_pairs": 484,
"score": 0.21261258749614076,
"criterion": "Disjoint triples, adjacent receiver qubits. Minimize summed negative log smoothed map pass fractions and CZ successes."
},
"counts": {
"0-": {
"000": 56,
"011": 51,
"001": 73,
"010": 76
},
"1-": {
"101": 54,
"100": 58,
"111": 84,
"110": 60
},
"-0": {
"011": 49,
"001": 65,
"010": 66,
"000": 76
},
"-1": {
"100": 58,
"110": 75,
"101": 57,
"111": 66
},
"00": {
"001100": 15,
"000011": 19,
"001001": 13,
"000001": 18,
"001010": 19,
"001110": 19,
"000110": 16,
"000111": 19,
"001101": 14,
"000101": 13,
"000100": 17,
"001000": 13,
"000000": 18,
"001111": 13,
"000010": 15,
"001011": 15
},
"01": {
"100101": 12,
"101110": 20,
"101111": 12,
"100110": 20,
"100111": 11,
"100000": 13,
"101010": 22,
"101101": 19,
"100011": 13,
"100010": 14,
"100100": 18,
"101011": 21,
"101000": 14,
"100001": 21,
"101100": 11,
"101001": 15
},
"10": {
"011100": 16,
"010011": 23,
"010001": 13,
"011001": 15,
"010111": 13,
"010000": 12,
"011000": 13,
"011110": 20,
"010010": 20,
"011011": 17,
"011010": 17,
"010110": 20,
"010101": 10,
"011101": 18,
"010100": 14,
"011111": 15
},
"11": {
"110100": 16,
"111101": 18,
"111000": 16,
"111011": 17,
"111100": 21,
"110011": 13,
"111110": 16,
"110101": 9,
"110001": 19,
"110110": 16,
"110010": 16,
"110000": 20,
"110111": 13,
"111111": 13,
"111010": 17,
"111001": 16
}
},
"shots_per_case": 256,
"correct": {
"0-": {
"A": 256,
"all": 256
},
"1-": {
"A": 256,
"all": 256
},
"-0": {
"B": 256,
"all": 256
},
"-1": {
"B": 256,
"all": 256
},
"00": {
"A": 256,
"B": 256,
"all": 256
},
"01": {
"A": 256,
"B": 256,
"all": 256
},
"10": {
"A": 256,
"B": 256,
"all": 256
},
"11": {
"A": 256,
"B": 256,
"all": 256
}
}
}Source code
Original experiment and verification programs are preserved byte for byte. These are historical listings; dependencies, authentication prompts and machine-specific input paths may need adjustment before a rerun.
- mapomatic_baseline.pyWorkspace original · 5,412 bytes
- mapomatic_job_inputs.pyWorkspace original · 2,093 bytes
- neighbor_map_figure.pyWorkspace original · 2,425 bytes
- neighboring_teleports.pyWorkspace original · 8,650 bytes
workspace/mapomatic_baseline.py · complete source
"""Score Kingston's original compiled teleport instructions with stock Mapomatic."""
import json
import math
from pathlib import Path
import sys
from types import SimpleNamespace
import warnings
from qiskit import QuantumCircuit
from qiskit_ibm_runtime.models import BackendProperties
ROOT=Path(__file__).resolve().parent
sys.path.insert(0,str(ROOT/"tmp/mapomatic-package"))
import mapomatic as mm
def read(path):
return json.loads((ROOT/path).read_bytes())
def run():
data=read("Neighbor-Kingston.json")
fresh=read("Neighbor-fresh-map.json")
raw=read("tmp/mapomatic-properties.json")
if (ROOT/"tmp/mapomatic-job-ops.json").exists():
ops=read("tmp/mapomatic-job-ops.json")
circuit_source="IBM job.inputs"
else:
# Recompile with the original experiment's physical layouts and seed.
from qiskit_ibm_runtime.fake_provider import FakeKingston
from neighboring_teleports import prepare,inputs
device=FakeKingston()
ops={}
for case,expected in data["native_counts"].items():
active=inputs(case)
paths=[data["selection"]["AB"[i]] for i,bit in active]
value=sum(bit<<j for j,(_,bit) in enumerate(active))
_,_,circs=prepare(device,paths,("teleport",),value)
circ=circs[0]
assert dict(circ.count_ops())==expected
ops[case]=[[i.operation.name,[circ.find_bit(q).index for q in i.qubits]]
for i in circ.data if i.operation.name!="barrier"]
circuit_source="Locally reconstructed using the original prepare routine, seed and verified physical paths; all 8 native gate tallies matched the recorded job."
props=BackendProperties.from_dict(raw)
backend=SimpleNamespace(properties=lambda:props,configuration=lambda:SimpleNamespace(basis_gates=["rz","sx","x","cz"]))
routes={r:tuple(data["selection"][r]) for r in "AB"}
edges={tuple(e) for e in fresh["geometry"]["edges"] if 0 <= props.gate_error("cz",e) < 1}
hits=fresh["analysis"]["correct_by_qubit"]
def template(case,route):
path=routes[route]
q=QuantumCircuit(3,3)
for gate,physical in ops[case]:
if not set(physical).intersection(path):
continue
assert set(physical)<=set(path)
wires=[path.index(w) for w in physical]
if gate=="measure":
q.measure(wires[0],wires[0])
elif gate in ("x","sx","cz"):
getattr(q,gate)(*wires)
else:
# These single-wire operations contribute no factor in stock default_cost.
assert gate in ("if_else","measure_2","rz") and len(wires)==1
return q
def scores(q,layouts):
return {tuple(p):cost for p,cost in mm.evaluate_layouts(q,[list(p) for p in layouts],backend)}
layouts=mm.matching_layouts(template("0-","A"),[list(e) for e in edges],strict_direction=False)
assert len(set(map(tuple,layouts)))==len(layouts)
per_route={}
ranked={}
solo_scores={}
for r in "AB":
cases=("0-","1-") if r=="A" else ("-0","-1")
by_bit=[scores(template(case,r),layouts) for case in cases]
avg={p:sum(s[p] for s in by_bit)/2 for p in by_bit[0]}
ranked[r]=avg
p=routes[r]
solo_scores[r]=[s[p] for s in by_bit]
joint_costs=[]
for case in ("00","01","10","11"):
x=scores(template(case,r),[p])[p]
assert math.isclose(x,solo_scores[r][int(case["AB".index(r)])],abs_tol=1e-12)
joint_costs.append(x)
per_route[r]=dict(path=p,solo_costs_0_1=solo_scores[r],joint_costs_00_01_10_11=joint_costs,
mean_cost=avg[p],rank=1+sum(cost<avg[p]-1e-12 for cost in avg.values()),
graph_pass_fraction=sum(hits[i] for i in p)/(3*256),
accuracy_alone=data["contrasts"][r]["alone"]/512,
accuracy_together=data["contrasts"][r]["together"]/1024)
pairs=[]
for a,ca in ranked["A"].items():
for b,cb in ranked["B"].items():
if (a[-1],b[-1]) in edges and set(a).isdisjoint(b):
pairs.append((1-(1-ca)*(1-cb),a,b))
pairs.sort()
assert len(pairs)==data["selection"]["candidate_pairs"]
paired=next(x for x in pairs if x[1:]==(routes["A"],routes["B"]))
best=pairs[0]
out=dict(package="mapomatic",version=mm.__version__,method="Stock evaluate_layouts default cost, equal weighting of inputs; scored projection of native instructions",
omitted="Stock cost ignores single-wire if_else, measure_2 and rz. No idle or simultaneous-neighbor error term.",
job=data["job_id"],running_utc=data["metrics"]["timestamps"]["running"],calibration=raw["last_update_date"],
circuit_source=circuit_source,calibration_source="IBM job.properties()",n_oriented_routes=len(layouts),
routes=per_route,n_adjacent_disjoint_pairs=len(pairs),original_pair_cost=paired[0],
original_pair_rank=1+sum(x[0]<paired[0]-1e-12 for x in pairs),
best_pair={"A":best[1],"B":best[2],"cost":best[0]})
(ROOT/"Mapomatic-Kingston-baseline.json").write_text(json.dumps(out,indent=2))
print(json.dumps(out,indent=2))
if __name__=="__main__":
warnings.filterwarnings("ignore",category=DeprecationWarning,module="mapomatic")
run()
workspace/mapomatic_job_inputs.py · complete source
"""Read only the saved job's calibration and compiled operation lists."""
import getpass
import json
import logging
from pathlib import Path
import traceback
from qiskit_ibm_runtime import QiskitRuntimeService
ROOT = Path(__file__).resolve().parent
jobrec = json.loads((ROOT/"Neighbor-Kingston.json").read_bytes())
def save(name, obj):
path = ROOT/"tmp"/name
tmp = path.with_suffix(".tmp")
tmp.write_text(json.dumps(obj,default=str),encoding="utf8")
tmp.replace(path)
def fetch():
save("mapomatic-status.json", {"stage":"waiting for key"})
key = getpass.getpass("IBM Cloud API key for READ-ONLY Kingston job lookup (hidden): ").strip()
if not key:
save("mapomatic-status.json",{"stage":"cancelled"})
return
service = QiskitRuntimeService(channel="ibm_quantum_platform",token=key,
region="us-east",plans_preference=["open"])
job = service.job(jobrec["job_id"])
save("mapomatic-status.json",{"stage":"retrieving calibration"})
props = job.properties()
if props is None:
raise RuntimeError("Job calibration unavailable")
save("mapomatic-properties.json",props.to_dict())
save("mapomatic-status.json",{"stage":"retrieving inputs"})
pubs = job.inputs["pubs"]
assert len(pubs)==len(jobrec["order"])
cases={}
for name,pub in zip(jobrec["order"],pubs,strict=True):
circ=pub.circuit if hasattr(pub,"circuit") else pub[0]
assert dict(circ.count_ops())==jobrec["native_counts"][name]
ops=[[i.operation.name,[circ.find_bit(q).index for q in i.qubits]] for i in circ.data if i.operation.name!="barrier"]
if name in cases:
assert cases[name]==ops
cases[name]=ops
save("mapomatic-job-ops.json",cases)
save("mapomatic-status.json",{"stage":"done"})
if __name__=="__main__":
logging.disable(logging.CRITICAL)
try:
fetch()
except Exception as exc:
save("mapomatic-status.json",{"stage":"error","type":type(exc).__name__,"frames":[f.name for f in traceback.extract_tb(exc.__traceback__)]})
workspace/neighbor_map_figure.py · complete source
"""Render the new Kingston graph-state map and the selected routes."""
import json
from pathlib import Path
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection
from matplotlib.colors import Normalize
import numpy as np
root=Path(__file__).resolve().parent
rec=json.loads((root/"Neighbor-fresh-map.json").read_bytes())
paths=json.loads((root/"Neighbor-simulator.json").read_bytes())["selection"]
xy=np.array(rec["coordinates"])
vals=np.array(rec["analysis"]["correct_by_qubit"])*100/256
edges=rec["geometry"]["edges"]
assert xy.shape==(156,2)
fig,(ax,zoom)=plt.subplots(1,2,figsize=(13.2,7.7),width_ratios=[2.15,1],layout="constrained")
def base(a):
a.add_collection(LineCollection([xy[[i,j]] for i,j in edges],color="#bdc8cc",linewidth=.95,zorder=1))
a.set_aspect("equal")
a.axis("off")
base(ax)
colors={"A":"#9A3670","B":"#154D91"}
norm=Normalize(np.floor(min(95,vals.min())/5)*5,100)
sc=ax.scatter(*xy.T,c=vals,s=86,norm=norm,cmap="viridis",zorder=2)
for name,k in colors.items():
arr=xy[paths[name]]
ax.plot(*arr.T,color=k,linewidth=3,zorder=3)
ax.scatter(*arr.T,s=124,facecolors="none",edgecolors=k,linewidths=1.9,zorder=4)
ax.set(xlim=(xy[:,0].min()-.6,xy[:,0].max()+.6),ylim=(xy[:,1].max()+.6,xy[:,1].min()-.6))
cb=fig.colorbar(sc,ax=ax,orientation="horizontal",shrink=.73,pad=.02)
cb.set_label("Neighbor predictions correct (%)")
ax.set_title("All 156 qubits",loc="left",fontweight="bold")
ids=paths["A"]+paths["B"]
box=xy[ids]
base(zoom)
line=xy[[paths["A"][-1],paths["B"][-1]]]
zoom.plot(*line.T,color="#38444b",linestyle="--",linewidth=2.5,zorder=2)
for name,k in colors.items():
arr=xy[paths[name]]
zoom.plot(*arr.T,color=k,linewidth=4,zorder=3)
zoom.scatter(*arr.T,color=k,s=640,zorder=4)
for i,(x,y) in zip(paths[name],arr):
zoom.text(x,y,str(i),color="white",ha="center",va="center",fontsize=9,zorder=5)
zoom.set(xlim=(box[:,0].min()-.65,box[:,0].max()+.65),ylim=(box[:,1].max()+.65,box[:,1].min()-.65))
zoom.set_title("Two disjoint teleport routes",fontweight="bold")
for i,(name,k) in enumerate(colors.items()):
zoom.text(.5,-.06-i*.08,f"{name} "+" → ".join(map(str,paths[name])),ha="center",transform=zoom.transAxes,color=k,fontweight="bold")
fig.suptitle("Kingston | Fresh graph-state map",fontsize=18,fontweight="bold")
fig.savefig(root/"Neighbor-Kingston-map.png",dpi=160)
workspace/neighboring_teleports.py · complete source
"""Compare two adjacent teleport receivers with the other channel idle or active."""
import getpass
import logging
import math
import random
import sys
import time
import traceback
from collections import Counter, defaultdict
from pathlib import Path
from qiskit_aer import AerSimulator
from qiskit_ibm_runtime import QiskitRuntimeService, SamplerV2
from scipy.stats import norm
OUT = Path(__file__).resolve().parent
PRIOR = Path.home() / "Documents/Codex/2026-11-19/tonight-we-will-be-doing-actual/outputs"
sys.path.insert(0, str(PRIOR))
import graph156
from graph156 import save
from run_switch_puzzles import compile_map, execute, load
from teleport_ascii_a import circuit, prepare
MAP = OUT / "Neighbor-fresh-map.json"
SIM = OUT / "Neighbor-simulator.json"
HW = OUT / "Neighbor-Kingston.json"
STATUS = OUT / "Neighbor-status.json"
TAG = "adjacent-receivers-20261120-v1"
CASES = ("0-", "1-", "-0", "-1", "00", "01", "10", "11")
BLOCKS, REPS, SEED = 4, 64, 35621
def fresh_map(service, backend):
rec = load(MAP)
native = []
if not rec:
geo, native = compile_map(backend)
ideal = AerSimulator(method="stabilizer").run(
graph156.circuits(geo), shots=256, seed_simulator=SEED).result().get_counts()
assert graph156.analyze(geo, ideal)["correct_by_qubit"] == [256]*156
rec = dict(backend=backend.name, geometry=geo, shots_per_setting=256,
ideal_checks_passed=True, coordinates=backend.configuration().coords)
rec = execute(service, backend, MAP, TAG+"-map", rec, lambda: native)
rec["analysis"] = graph156.analyze(rec["geometry"], rec["counts"])
save(MAP, rec)
return rec
def select(rec, backend):
hits = rec["analysis"]["correct_by_qubit"]
neighbors = defaultdict(set)
err = {}
for a,b in rec["geometry"]["edges"]:
gate = backend.target["cz"].get((a,b)) or backend.target["cz"].get((b,a))
if gate and gate.error is not None and 0 <= gate.error < 1:
neighbors[a].add(b)
neighbors[b].add(a)
err[a,b] = err[b,a] = gate.error
routes = defaultdict(list)
for end in neighbors:
for helper in neighbors[end]:
for source in neighbors[helper] - {end}:
path = (source, helper, end)
cost = -sum(math.log((hits[q]+0.5)/257) for q in path)
cost -= math.log1p(-err[source,helper]) + math.log1p(-err[helper,end])
routes[end].append((cost,path))
candidates = [(ca+cb,pa,pb) for a in neighbors for b in neighbors[a] if a<b
for ca,pa in routes[a] for cb,pb in routes[b] if set(pa).isdisjoint(pb)]
score,a,b = min(candidates)
return dict(A=a, B=b, map_passes=[[hits[q] for q in p] for p in (a,b)],
candidate_pairs=len(candidates), score=score,
criterion="Disjoint triples, adjacent receiver qubits. Minimize summed negative log smoothed map pass fractions and CZ successes.")
def inputs(case):
return [(i,int(ch)) for i,ch in enumerate(case) if ch!="-"]
def tally(case, counts):
active = inputs(case)
correct = Counter()
for s,n in counts.items():
assert len(s)==3*len(active)
bits = int(s,2) >> (2*len(active))
ok = [((bits>>j)&1)==value for j,(_,value) in enumerate(active)]
for (route,_),success in zip(active,ok):
correct["AB"[route]] += n*success
correct["all"] += n*all(ok)
return dict(correct)
def simulate(selected, output=SIM):
circuits = []
for case in CASES:
active = inputs(case)
value = sum(bit<<i for i,(_,bit) in enumerate(active))
circuits.append(circuit("teleport", value=value, width=len(active)))
res = AerSimulator(method="stabilizer").run(circuits, shots=256, seed_simulator=SEED).result()
counts = dict(zip(CASES, res.get_counts(),strict=True))
assert all(tally(k,v)["all"] == 256 for k,v in counts.items())
save(output, dict(map_job=load(MAP).get("job_id"),selection=selected,counts=counts,
shots_per_case=256,correct={k:tally(k,v) for k,v in counts.items()}))
def compare(service, backend, mapped, *, selection=None, result_path=HW, sim_path=SIM, tag=TAG):
rec = load(result_path)
if rec.get("stage")=="done":
return
if not rec:
if selection is None:
selection = select(mapped, backend)
simulate(selection, sim_path)
compiled = {}
native_counts = {}
for case in CASES:
active = inputs(case)
value = sum(bit<<i for i,(_,bit) in enumerate(active))
paths = [selection["AB"[idx]] for idx,_ in active]
_,_,circuits = prepare(backend, paths, ("teleport",), value)
compiled[case] = circuits[0]
native_counts[case] = dict(circuits[0].count_ops())
rec = dict(backend=backend.name, map_job=mapped["job_id"], selection=selection,
native_counts=native_counts, tag=tag)
else:
compiled = {}
run_blocks(service,backend,result_path,tag,rec,compiled,CASES,tally,contrasts)
def run_blocks(service,backend,result_path,tag,rec,compiled,cases,score,summarize):
if rec.get("stage")=="done":
return
if not rec.get("stage"):
rng = random.Random(SEED)
order = [case for _ in range(BLOCKS) for case in rng.sample(cases,len(cases))]
rec.update(stage="submitting", order=order, shots_per_block=REPS, shots_per_case=BLOCKS*REPS)
sampler=SamplerV2(mode=backend,options={"max_execution_time":30,"environment":{"job_tags":[tag]},
"twirling":{"enable_measure":False,"enable_gates":False},"dynamical_decoupling":{"enable":False}})
import json
with result_path.open("x") as f:
json.dump(rec,f,indent=2)
job = sampler.run([compiled[k] for k in order],shots=REPS)
elif rec.get("job_id"):
job = service.job(rec["job_id"])
else:
found = service.jobs(job_tags=[tag],limit=2)
if len(found)!=1:
raise RuntimeError("Reconcile pending submission")
job = found[0]
rec.update(stage="submitted",job_id=job.job_id())
save(result_path, rec)
pubs = job.result()
blocks = [pub.data.c.get_counts() for pub in pubs]
assert len(blocks)==len(cases)*BLOCKS and all(sum(v.values())==REPS for v in blocks)
counts = {k:Counter() for k in cases}
for k,v in zip(rec["order"],blocks,strict=True):
counts[k].update(v)
assert all(sum(v.values())==256 for v in counts.values())
rows = {k:score(k,v) for k,v in counts.items()}
rec.update(counts_by_block=blocks,correct=rows, contrasts=summarize(rows))
save(result_path, rec)
for _ in range(24):
metrics = job.metrics()
if metrics.get("usage",{}).get("status")=="complete":
break
time.sleep(5)
rec.update(stage="done",metrics=metrics)
save(result_path, rec)
def contrasts(rows):
# Balanced mixtures of input bits in both arms. Bonferroni for the two primary route comparisons.
z = norm.ppf(1-.05/4)
def wilson(p,n):
den=1+z*z/n
mid=(p+z*z/(2*n))/den
half=z*math.sqrt(p*(1-p)/n+z*z/(4*n*n))/den
return mid-half,mid+half
out={}
for route in "AB":
solo=sum(v.get(route,0) for k,v in rows.items() if "-" in k)
both=sum(v[route] for k,v in rows.items() if "-" not in k)
p,q=both/1024,solo/512
pl,ph=wilson(p,1024)
ql,qh=wilson(q,512)
d=p-q
out[route]=dict(alone=solo,together=both,difference=d,
familywise_95_interval=[d-math.hypot(p-pl,qh-q),d+math.hypot(ph-p,q-ql)])
return out
def run():
if load(HW).get("stage")=="done":
return
save(STATUS,{"stage":"waiting for key"})
key=getpass.getpass("IBM Cloud API key for Kingston map and path comparison (hidden): ").strip()
if not key:
save(STATUS,{"stage":"cancelled"})
return
save(STATUS,{"stage":"mapping"})
service=QiskitRuntimeService(channel="ibm_quantum_platform",token=key,plans_preference=["open"],region="us-east")
backend=service.backend("ibm_kingston")
mapped=fresh_map(service,backend)
save(STATUS,{"stage":"path selection and comparison"})
compare(service,backend,mapped)
save(STATUS,{"stage":"finished"})
if __name__=="__main__":
logging.disable(logging.CRITICAL)
try:
run()
except Exception as exc:
save(STATUS,{"stage":"error","type":type(exc).__name__,"frames":[f.name for f in traceback.extract_tb(exc.__traceback__)]})
raise SystemExit(1)
Personal comments
Personal comments will be added here.