Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions examples/paper_runs/paper_05/01_build_syndrome_circuits.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPT_DIR}/common.sh"

OUT_DIR="$(paper_results_dir "01_build_syndrome_circuits")"
PY_BIN="$(paper_python_bin)"
paper_prepare_plot_env

if [ -z "${PY_BIN}" ]; then
echo "Error: python3 not found." >&2
exit 1
fi

"${PY_BIN}" "${SCRIPT_DIR}/scripts/build_repetition_syndrome.py" \
--out-dir "${OUT_DIR}" \
--n-data "${LIDMAS_P5_N_DATA:-5}" \
--targets "${LIDMAS_P5_TARGETS:-all}"

echo "paper_05 step 01 complete: ${OUT_DIR}"
25 changes: 25 additions & 0 deletions examples/paper_runs/paper_05/02_run_local_simulation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPT_DIR}/common.sh"

OUT_DIR="$(paper_results_dir "02_local_simulation")"
PY_BIN="$(paper_python_bin)"
paper_prepare_plot_env

if [ -z "${PY_BIN}" ]; then
echo "Error: python3 not found." >&2
exit 1
fi

"${PY_BIN}" "${SCRIPT_DIR}/scripts/run_local_repetition_sampler.py" \
--out-dir "${OUT_DIR}" \
--n-data "${LIDMAS_P5_N_DATA:-5}" \
--targets "${LIDMAS_P5_TARGETS:-all}" \
--shots "${LIDMAS_P5_SHOTS:-256}" \
--measurement-error-rate "${LIDMAS_P5_LOCAL_MEAS_ERROR:-0.02}" \
--background-data-error-rate "${LIDMAS_P5_LOCAL_DATA_ERROR:-0.0}" \
--seed "${LIDMAS_P5_SEED:-20260705}"

echo "paper_05 step 02 complete: ${OUT_DIR}"
37 changes: 37 additions & 0 deletions examples/paper_runs/paper_05/03_fetch_ibm_runtime_results.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPT_DIR}/common.sh"

OUT_DIR="$(paper_results_dir "03_ibm_runtime")"
SUBMISSION_JSON="${OUT_DIR}/ibm_runtime_submission.json"
RESULT_JSON="${OUT_DIR}/ibm_repetition_results.json"
PY_BIN="$(paper_python_bin)"
paper_prepare_plot_env

if [ -z "${PY_BIN}" ]; then
echo "Error: python3 not found." >&2
exit 1
fi
if [ ! -f "${SUBMISSION_JSON}" ]; then
echo "Error: ${SUBMISSION_JSON} not found. Submit the IBM job first." >&2
exit 1
fi

fetch_args=()
if [ "${LIDMAS_P5_IBM_STATUS_ONLY:-0}" = "1" ]; then
fetch_args+=(--status-only)
fi

"${PY_BIN}" "${SCRIPT_DIR}/scripts/fetch_ibm_repetition_results.py" \
--submission-json "${SUBMISSION_JSON}" \
--out-json "${RESULT_JSON}" \
--result-timeout "${LIDMAS_P5_IBM_RESULT_TIMEOUT:-300}" \
${fetch_args[@]+"${fetch_args[@]}"}

if [ "${LIDMAS_P5_IBM_STATUS_ONLY:-0}" = "1" ]; then
echo "paper_05 IBM status check complete."
else
echo "paper_05 IBM result fetch complete: ${RESULT_JSON}"
fi
38 changes: 38 additions & 0 deletions examples/paper_runs/paper_05/03_submit_ibm_runtime.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPT_DIR}/common.sh"

OUT_DIR="$(paper_results_dir "03_ibm_runtime")"
PY_BIN="$(paper_python_bin)"
paper_prepare_plot_env

if [ -z "${PY_BIN}" ]; then
echo "Error: python3 not found." >&2
exit 1
fi

backend_args=()
if [ -n "${LIDMAS_P5_IBM_BACKEND:-}" ]; then
backend_args+=(--backend "${LIDMAS_P5_IBM_BACKEND}")
fi
if [ -n "${IBM_QUANTUM_INSTANCE:-}" ]; then
backend_args+=(--instance "${IBM_QUANTUM_INSTANCE}")
fi
if [ "${LIDMAS_P5_IBM_WAIT:-1}" = "0" ]; then
backend_args+=(--no-wait)
fi
if [ -n "${LIDMAS_P5_IBM_RESULT_TIMEOUT:-}" ]; then
backend_args+=(--result-timeout "${LIDMAS_P5_IBM_RESULT_TIMEOUT}")
fi

"${PY_BIN}" "${SCRIPT_DIR}/scripts/submit_ibm_repetition_sampler.py" \
--out-dir "${OUT_DIR}" \
--n-data "${LIDMAS_P5_N_DATA:-5}" \
--targets "${LIDMAS_P5_TARGETS:-all}" \
--shots "${LIDMAS_P5_IBM_SHOTS:-${LIDMAS_P5_SHOTS:-256}}" \
--optimization-level "${LIDMAS_P5_OPTIMIZATION_LEVEL:-1}" \
${backend_args[@]+"${backend_args[@]}"}

echo "paper_05 step 03 complete: ${OUT_DIR}"
35 changes: 35 additions & 0 deletions examples/paper_runs/paper_05/04_ingest_results.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPT_DIR}/common.sh"

OUT_DIR="$(paper_results_dir "04_ingest_results")"
LOCAL_JSON="$(paper_results_dir "02_local_simulation")/local_repetition_results.json"
IBM_JSON="$(paper_results_dir "03_ibm_runtime")/ibm_repetition_results.json"
PY_BIN="$(paper_python_bin)"
paper_prepare_plot_env

if [ -z "${PY_BIN}" ]; then
echo "Error: python3 not found." >&2
exit 1
fi

raw_args=()
if [ -f "${LOCAL_JSON}" ]; then
raw_args+=(--raw-json "${LOCAL_JSON}")
fi
if [ -f "${IBM_JSON}" ]; then
raw_args+=(--raw-json "${IBM_JSON}")
fi

if [ "${#raw_args[@]}" -eq 0 ]; then
echo "Error: no raw paper_05 result JSON files found." >&2
exit 1
fi

"${PY_BIN}" "${SCRIPT_DIR}/scripts/ingest_repetition_results.py" \
--out-dir "${OUT_DIR}" \
"${raw_args[@]}"

echo "paper_05 step 04 complete: ${OUT_DIR}"
25 changes: 25 additions & 0 deletions examples/paper_runs/paper_05/05_decode_live_syndromes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPT_DIR}/common.sh"

IN_DIR="$(paper_results_dir "04_ingest_results")"
OUT_DIR="$(paper_results_dir "05_decode_live_syndromes")"
PY_BIN="$(paper_python_bin)"
paper_prepare_plot_env

if [ -z "${PY_BIN}" ]; then
echo "Error: python3 not found." >&2
exit 1
fi

if ! ls "${IN_DIR}"/decoder_requests_*.ndjson >/dev/null 2>&1; then
"${SCRIPT_DIR}/04_ingest_results.sh"
fi

"${PY_BIN}" "${SCRIPT_DIR}/scripts/decode_repetition_syndromes.py" \
--in-dir "${IN_DIR}" \
--out-dir "${OUT_DIR}"

echo "paper_05 step 05 complete: ${OUT_DIR}"
26 changes: 26 additions & 0 deletions examples/paper_runs/paper_05/06_analyze_and_plot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPT_DIR}/common.sh"

IN_DIR="$(paper_results_dir "05_decode_live_syndromes")"
OUT_DIR="$(paper_results_dir "06_analysis")"
PY_BIN="$(paper_python_bin)"
paper_prepare_plot_env

if [ -z "${PY_BIN}" ]; then
echo "Error: python3 not found." >&2
exit 1
fi

if [ ! -f "${IN_DIR}/decoded_shots.csv" ]; then
"${SCRIPT_DIR}/05_decode_live_syndromes.sh"
fi

"${PY_BIN}" "${SCRIPT_DIR}/scripts/analyze_live_repetition.py" \
--decoded-csv "${IN_DIR}/decoded_shots.csv" \
--out-dir "${OUT_DIR}" \
--manuscript-dir "${OUT_DIR}/manuscript_figures"

echo "paper_05 step 06 complete: ${OUT_DIR}"
20 changes: 20 additions & 0 deletions examples/paper_runs/paper_05/11_build_qldpc_syndrome_circuits.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPT_DIR}/common.sh"

OUT_DIR="$(paper_results_dir "11_build_qldpc_syndrome_circuits")"
PY_BIN="$(paper_python_bin)"
paper_prepare_plot_env

if [ -z "${PY_BIN}" ]; then
echo "Error: python3 not found." >&2
exit 1
fi

"${PY_BIN}" "${SCRIPT_DIR}/scripts/build_css_ldpc_syndrome.py" \
--out-dir "${OUT_DIR}" \
--targets "${LIDMAS_P5_QLDPC_TARGETS:-all}"

echo "paper_05 qLDPC step 11 complete: ${OUT_DIR}"
24 changes: 24 additions & 0 deletions examples/paper_runs/paper_05/12_run_qldpc_local_simulation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPT_DIR}/common.sh"

OUT_DIR="$(paper_results_dir "12_qldpc_local_simulation")"
PY_BIN="$(paper_python_bin)"
paper_prepare_plot_env

if [ -z "${PY_BIN}" ]; then
echo "Error: python3 not found." >&2
exit 1
fi

"${PY_BIN}" "${SCRIPT_DIR}/scripts/run_local_css_ldpc_sampler.py" \
--out-dir "${OUT_DIR}" \
--targets "${LIDMAS_P5_QLDPC_TARGETS:-all}" \
--shots "${LIDMAS_P5_QLDPC_SHOTS:-${LIDMAS_P5_SHOTS:-256}}" \
--measurement-error-rate "${LIDMAS_P5_QLDPC_LOCAL_MEAS_ERROR:-0.02}" \
--background-data-error-rate "${LIDMAS_P5_QLDPC_LOCAL_DATA_ERROR:-0.0}" \
--seed "${LIDMAS_P5_QLDPC_SEED:-20260705}"

echo "paper_05 qLDPC step 12 complete: ${OUT_DIR}"
37 changes: 37 additions & 0 deletions examples/paper_runs/paper_05/13_fetch_qldpc_ibm_runtime_results.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPT_DIR}/common.sh"

OUT_DIR="$(paper_results_dir "13_qldpc_ibm_runtime")"
SUBMISSION_JSON="${OUT_DIR}/ibm_css_ldpc_submission.json"
RESULT_JSON="${OUT_DIR}/ibm_css_ldpc_results.json"
PY_BIN="$(paper_python_bin)"
paper_prepare_plot_env

if [ -z "${PY_BIN}" ]; then
echo "Error: python3 not found." >&2
exit 1
fi
if [ ! -f "${SUBMISSION_JSON}" ]; then
echo "Error: ${SUBMISSION_JSON} not found. Submit the IBM qLDPC job first." >&2
exit 1
fi

fetch_args=()
if [ "${LIDMAS_P5_QLDPC_IBM_STATUS_ONLY:-${LIDMAS_P5_IBM_STATUS_ONLY:-0}}" = "1" ]; then
fetch_args+=(--status-only)
fi

"${PY_BIN}" "${SCRIPT_DIR}/scripts/fetch_ibm_css_ldpc_results.py" \
--submission-json "${SUBMISSION_JSON}" \
--out-json "${RESULT_JSON}" \
--result-timeout "${LIDMAS_P5_QLDPC_IBM_RESULT_TIMEOUT:-${LIDMAS_P5_IBM_RESULT_TIMEOUT:-300}}" \
${fetch_args[@]+"${fetch_args[@]}"}

if [ "${LIDMAS_P5_QLDPC_IBM_STATUS_ONLY:-${LIDMAS_P5_IBM_STATUS_ONLY:-0}}" = "1" ]; then
echo "paper_05 qLDPC IBM status check complete."
else
echo "paper_05 qLDPC IBM result fetch complete: ${RESULT_JSON}"
fi
37 changes: 37 additions & 0 deletions examples/paper_runs/paper_05/13_submit_qldpc_ibm_runtime.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPT_DIR}/common.sh"

OUT_DIR="$(paper_results_dir "13_qldpc_ibm_runtime")"
PY_BIN="$(paper_python_bin)"
paper_prepare_plot_env

if [ -z "${PY_BIN}" ]; then
echo "Error: python3 not found." >&2
exit 1
fi

backend_args=()
if [ -n "${LIDMAS_P5_QLDPC_IBM_BACKEND:-${LIDMAS_P5_IBM_BACKEND:-}}" ]; then
backend_args+=(--backend "${LIDMAS_P5_QLDPC_IBM_BACKEND:-${LIDMAS_P5_IBM_BACKEND:-}}")
fi
if [ -n "${IBM_QUANTUM_INSTANCE:-}" ]; then
backend_args+=(--instance "${IBM_QUANTUM_INSTANCE}")
fi
if [ "${LIDMAS_P5_QLDPC_IBM_WAIT:-${LIDMAS_P5_IBM_WAIT:-1}}" = "0" ]; then
backend_args+=(--no-wait)
fi
if [ -n "${LIDMAS_P5_QLDPC_IBM_RESULT_TIMEOUT:-${LIDMAS_P5_IBM_RESULT_TIMEOUT:-}}" ]; then
backend_args+=(--result-timeout "${LIDMAS_P5_QLDPC_IBM_RESULT_TIMEOUT:-${LIDMAS_P5_IBM_RESULT_TIMEOUT:-}}")
fi

"${PY_BIN}" "${SCRIPT_DIR}/scripts/submit_ibm_css_ldpc_sampler.py" \
--out-dir "${OUT_DIR}" \
--targets "${LIDMAS_P5_QLDPC_TARGETS:-all}" \
--shots "${LIDMAS_P5_QLDPC_IBM_SHOTS:-${LIDMAS_P5_QLDPC_SHOTS:-${LIDMAS_P5_SHOTS:-256}}}" \
--optimization-level "${LIDMAS_P5_QLDPC_OPTIMIZATION_LEVEL:-${LIDMAS_P5_OPTIMIZATION_LEVEL:-1}}" \
${backend_args[@]+"${backend_args[@]}"}

echo "paper_05 qLDPC step 13 submit complete: ${OUT_DIR}"
35 changes: 35 additions & 0 deletions examples/paper_runs/paper_05/14_ingest_qldpc_results.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPT_DIR}/common.sh"

OUT_DIR="$(paper_results_dir "14_ingest_qldpc_results")"
LOCAL_JSON="$(paper_results_dir "12_qldpc_local_simulation")/local_css_ldpc_results.json"
IBM_JSON="$(paper_results_dir "13_qldpc_ibm_runtime")/ibm_css_ldpc_results.json"
PY_BIN="$(paper_python_bin)"
paper_prepare_plot_env

if [ -z "${PY_BIN}" ]; then
echo "Error: python3 not found." >&2
exit 1
fi

raw_args=()
if [ -f "${LOCAL_JSON}" ]; then
raw_args+=(--raw-json "${LOCAL_JSON}")
fi
if [ -f "${IBM_JSON}" ]; then
raw_args+=(--raw-json "${IBM_JSON}")
fi

if [ "${#raw_args[@]}" -eq 0 ]; then
echo "Error: no raw paper_05 qLDPC result JSON files found." >&2
exit 1
fi

"${PY_BIN}" "${SCRIPT_DIR}/scripts/ingest_css_ldpc_results.py" \
--out-dir "${OUT_DIR}" \
"${raw_args[@]}"

echo "paper_05 qLDPC step 14 complete: ${OUT_DIR}"
21 changes: 21 additions & 0 deletions examples/paper_runs/paper_05/15_decode_qldpc_syndromes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPT_DIR}/common.sh"

IN_DIR="$(paper_results_dir "14_ingest_qldpc_results")"
OUT_DIR="$(paper_results_dir "15_decode_qldpc_syndromes")"
PY_BIN="$(paper_python_bin)"
paper_prepare_plot_env

if [ -z "${PY_BIN}" ]; then
echo "Error: python3 not found." >&2
exit 1
fi

"${PY_BIN}" "${SCRIPT_DIR}/scripts/decode_css_ldpc_syndromes.py" \
--in-dir "${IN_DIR}" \
--out-dir "${OUT_DIR}"

echo "paper_05 qLDPC step 15 complete: ${OUT_DIR}"
Loading
Loading