-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: test that similar calibrations with different sites are not fi…
…ltered (#268) * wip: test that similar calibrations with different sites are not de-duplicated * use snapshot testing, rstest file globbing
- Loading branch information
Showing
13 changed files
with
493 additions
and
8 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
use std::fs::read_to_string; | ||
use std::path::PathBuf; | ||
use std::str::FromStr; | ||
|
||
use insta::assert_snapshot; | ||
use rstest::rstest; | ||
|
||
use quil_rs::program::Program; | ||
|
||
/// A test to ensure that a Program doesn't incorrectly filter out calibrations | ||
/// when it is parsed. | ||
#[rstest] | ||
fn test_calibration_filtering(#[files("tests/programs/calibration_*.quil")] path: PathBuf) { | ||
let program_text = | ||
read_to_string(&path).unwrap_or_else(|_| panic!("Should be able to load file: {:?}", path)); | ||
let program = Program::from_str(&program_text).expect("Should be able to parse test program."); | ||
|
||
assert_snapshot!(path.file_name().unwrap().to_str(), program.to_string()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
DEFCAL CZ 110 111: | ||
FENCE | ||
NONBLOCKING PULSE 110 111 "cz" q110_q111_cz/CZ | ||
DELAY 110 "rf" 1.6e-07 | ||
SHIFT-PHASE 110 "rf" 0.6 | ||
DELAY 111 "rf" 1.6e-07 | ||
SHIFT-PHASE 111 "rf" 0.4 | ||
FENCE | ||
SHIFT-PHASE 110 111 "xy" 0.3 | ||
SHIFT-PHASE 110 117 "xy" 0.3 | ||
SHIFT-PHASE 110 111 "xy" -0.2 | ||
SHIFT-PHASE 111 112 "xy" -0.2 | ||
SHIFT-PHASE 111 126 "xy" -0.2 | ||
|
||
DEFCAL CZ 111 110: | ||
FENCE | ||
NONBLOCKING PULSE 110 111 "cz" q110_q111_cz/CZ | ||
DELAY 110 "rf" 1.6e-07 | ||
SHIFT-PHASE 110 "rf" 0.6 | ||
DELAY 111 "rf" 1.6e-07 | ||
SHIFT-PHASE 111 "rf" 0.4 | ||
FENCE | ||
SHIFT-PHASE 110 111 "xy" 0.3 | ||
SHIFT-PHASE 110 117 "xy" 0.3 | ||
SHIFT-PHASE 110 111 "xy" -0.2 | ||
SHIFT-PHASE 111 112 "xy" -0.2 | ||
SHIFT-PHASE 111 126 "xy" -0.2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
DEFCAL CZ 110 111: | ||
FENCE | ||
NONBLOCKING PULSE 110 111 "cz" q110_q111_cz/CZ | ||
DELAY 110 "rf" 1.6e-07 | ||
SHIFT-PHASE 110 "rf" 0.6 | ||
DELAY 111 "rf" 1.6e-07 | ||
SHIFT-PHASE 111 "rf" 0.4 | ||
FENCE | ||
SHIFT-PHASE 110 111 "xy" 0.3 | ||
SHIFT-PHASE 110 117 "xy" 0.3 | ||
SHIFT-PHASE 110 111 "xy" -0.2 | ||
SHIFT-PHASE 111 112 "xy" -0.2 | ||
SHIFT-PHASE 111 126 "xy" -0.2 | ||
|
||
DEFCAL CZ 111 110: | ||
FENCE | ||
NONBLOCKING PULSE 110 111 "cz" q110_q111_cz/CZ | ||
DELAY 110 "rf" 1.6e-07 | ||
SHIFT-PHASE 110 "rf" 0.6 | ||
DELAY 111 "rf" 1.6e-07 | ||
SHIFT-PHASE 111 "rf" 0.4 | ||
FENCE | ||
SHIFT-PHASE 110 111 "xy" 0.3 | ||
SHIFT-PHASE 110 117 "xy" 0.3 | ||
SHIFT-PHASE 110 111 "xy" -0.2 | ||
SHIFT-PHASE 111 112 "xy" -0.2 | ||
SHIFT-PHASE 111 126 "xy" -0.2 | ||
|
||
DEFCAL CPHASE(%theta) 110 111: | ||
FENCE | ||
NONBLOCKING PULSE 110 111 "cphase" q110_q111_cphase/sqrtCPHASE | ||
SHIFT-PHASE 110 111 "cphase" -1.2 + 0.5*%theta | ||
NONBLOCKING PULSE 110 111 "cphase" q110_q111_cphase/sqrtCPHASE | ||
SHIFT-PHASE 110 111 "cphase" -1*(-1.2 + 0.5*%theta) | ||
DELAY 110 "rf" 3.2e-07 | ||
SHIFT-PHASE 110 "rf" 2.2 | ||
DELAY 111 "rf" 3.2e-07 | ||
SHIFT-PHASE 111 "rf" 1.2 | ||
FENCE | ||
SHIFT-PHASE 110 111 "xy" 1.1 | ||
SHIFT-PHASE 110 117 "xy" 1.1 | ||
SHIFT-PHASE 110 111 "xy" -0.6 | ||
SHIFT-PHASE 111 112 "xy" -0.6 | ||
SHIFT-PHASE 111 126 "xy" -0.6 | ||
|
||
DEFCAL CPHASE(%theta) 111 110: | ||
FENCE | ||
NONBLOCKING PULSE 110 111 "cphase" q110_q111_cphase/sqrtCPHASE | ||
SHIFT-PHASE 110 111 "cphase" -1.2 + 0.5*%theta | ||
NONBLOCKING PULSE 110 111 "cphase" q110_q111_cphase/sqrtCPHASE | ||
SHIFT-PHASE 110 111 "cphase" -1*(-1.2 + 0.5*%theta) | ||
DELAY 110 "rf" 3.2e-07 | ||
SHIFT-PHASE 110 "rf" 2.2 | ||
DELAY 111 "rf" 3.2e-07 | ||
SHIFT-PHASE 111 "rf" 1.2 | ||
FENCE | ||
SHIFT-PHASE 110 111 "xy" 1.1 | ||
SHIFT-PHASE 110 117 "xy" 1.1 | ||
SHIFT-PHASE 110 111 "xy" -0.6 | ||
SHIFT-PHASE 111 112 "xy" -0.6 | ||
SHIFT-PHASE 111 126 "xy" -0.6 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
DEFCAL MEASURE 0 addr: | ||
FENCE 0 | ||
DECLARE q0_unclassified REAL[2] | ||
PULSE 0 "rf_f12" gaussian(duration: 6e-08, fwhm: 1.6e-08, t0: 3e-08, scale: 0.5, phase: 0.0, detuning: 0.0) | ||
NONBLOCKING PULSE 0 "ro_tx" flat(duration: 1.6e-06, iq: 1.0, scale: 0.1, phase: 0.0, detuning: 0.0) | ||
NONBLOCKING CAPTURE 0 "ro_rx" boxcar_kernel(duration: 1.6e-06, scale: 1.0, phase: 0.0, detuning: 0.0) q0_unclassified[0] | ||
PRAGMA FILTER-NODE q0_unclassified "{'module':'standard.filters.io','filter_type':'DataBuffer','source':'q0_ro_rx/filter','publish':true,'params':{},'_type':'FilterNode'}" | ||
PRAGMA LOAD-MEMORY q0_unclassified "q0_unclassified[0]" | ||
PRAGMA FILTER-NODE q0_classified "{'module':'standard.filters.classifiers','filter_type':'SingleQLinear','source':'q0_ro_rx/filter','publish':false,'params':{'a':[1.0,0.0],'threshold':0.01},'_type':'FilterNode'}" | ||
PRAGMA FILTER-NODE q0 "{'module':'standard.filters.io','filter_type':'DataBuffer','source':'q0_classified','publish':true,'params':{},'_type':'FilterNode'}" | ||
PRAGMA LOAD-MEMORY q0 "addr" | ||
FENCE 0 | ||
|
||
DEFCAL MEASURE 10 addr: | ||
FENCE 10 | ||
DECLARE q10_unclassified REAL[2] | ||
PULSE 10 "rf_f12" gaussian(duration: 7e-08, fwhm: 1.7e-08, t0: 3e-08, scale: 0.5, phase: 0.0, detuning: 0.0) | ||
NONBLOCKING PULSE 10 "ro_tx" flat(duration: 1.6e-06, iq: 1.0, scale: 0.1, phase: 0.0, detuning: 0.0) | ||
NONBLOCKING CAPTURE 10 "ro_rx" boxcar_kernel(duration: 1.6e-06, scale: 1.0, phase: 0.0, detuning: 0.0) q10_unclassified[0] | ||
PRAGMA FILTER-NODE q10_unclassified "{'module':'standard.filters.io','filter_type':'DataBuffer','source':'q10_ro_rx/filter','publish':true,'params':{},'_type':'FilterNode'}" | ||
PRAGMA LOAD-MEMORY q10_unclassified "q10_unclassified[0]" | ||
PRAGMA FILTER-NODE q10_classified "{'module':'standard.filters.classifiers','filter_type':'SingleQLinear','source':'q10_ro_rx/filter','publish':false,'params':{'a':[1.0,0.0],'threshold':0.01},'_type':'FilterNode'}" | ||
PRAGMA FILTER-NODE q10 "{'module':'standard.filters.io','filter_type':'DataBuffer','source':'q10_classified','publish':true,'params':{},'_type':'FilterNode'}" | ||
PRAGMA LOAD-MEMORY q10 "addr" | ||
FENCE 10 | ||
|
||
DEFCAL MEASURE 100 addr: | ||
FENCE 100 | ||
DECLARE q100_unclassified REAL[2] | ||
PULSE 100 "rf_f12" gaussian(duration: 8e-08, fwhm: 1.8e-08, t0: 3e-08, scale: 0.5, phase: 0.0, detuning: 0.0) | ||
NONBLOCKING PULSE 100 "ro_tx" flat(duration: 1.6e-06, iq: 1.0, scale: 0.1, phase: 0.0, detuning: 0.0) | ||
NONBLOCKING CAPTURE 100 "ro_rx" boxcar_kernel(duration: 1.6e-06, scale: 1.0, phase: 0.0, detuning: 0.0) q100_unclassified[0] | ||
PRAGMA FILTER-NODE q100_unclassified "{'module':'standard.filters.io','filter_type':'DataBuffer','source':'q100_ro_rx/filter','publish':true,'params':{},'_type':'FilterNode'}" | ||
PRAGMA LOAD-MEMORY q100_unclassified "q100_unclassified[0]" | ||
PRAGMA FILTER-NODE q100_classified "{'module':'standard.filters.classifiers','filter_type':'SingleQLinear','source':'q10_ro_rx/filter','publish':false,'params':{'a':[1.0,0.0],'threshold':0.01},'_type':'FilterNode'}" | ||
PRAGMA FILTER-NODE q100 "{'module':'standard.filters.io','filter_type':'DataBuffer','source':'q100_classified','publish':true,'params':{},'_type':'FilterNode'}" | ||
PRAGMA LOAD-MEMORY q100 "addr" | ||
FENCE 100 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
DEFCAL RX(pi/2) 0: | ||
FENCE 0 | ||
NONBLOCKING PULSE 0 "rf" drag_gaussian(duration: 1e-08, fwhm: 1e-08, t0: 1e-08, anh: -100000000.0, alpha: -0.1, scale: 0.1, phase: 0.0, detuning: 0.0) | ||
FENCE 0 | ||
|
||
DEFCAL RX(-pi/2) 0: | ||
FENCE 0 | ||
NONBLOCKING PULSE 0 "rf" drag_gaussian(duration: 1e-08, fwhm: 1e-08, t0: 1e-08, anh: -100000000.0, alpha: -0.2, scale: 0.2, phase: 0.0, detuning: 0.0) | ||
FENCE 0 | ||
|
||
DEFCAL RX(pi) 0: | ||
FENCE 0 | ||
NONBLOCKING PULSE 0 "rf" drag_gaussian(duration: 1e-08, fwhm: 1e-08, t0: 1e-08, anh: -100000000.0, alpha: -0.3, scale: 0.3, phase: 0.0, detuning: 0.0) | ||
FENCE 0 | ||
|
||
DEFCAL RX(-pi) 0: | ||
FENCE 0 | ||
NONBLOCKING PULSE 0 "rf" drag_gaussian(duration: 1e-08, fwhm: 1e-08, t0: 1e-08, anh: -100000000.0, alpha: -0.4, scale: 0.4, phase: 0.0, detuning: 0.0) | ||
FENCE 0 | ||
|
||
DEFCAL RX(pi/2) 3: | ||
FENCE 3 | ||
NONBLOCKING PULSE 3 "rf" drag_gaussian(duration: 2e-08, fwhm: 1e-08, t0: 1e-08, anh: -100000000.0, alpha: -0.1, scale: 0.1, phase: 0.0, detuning: 0.0) | ||
FENCE 3 | ||
|
||
DEFCAL RX(-pi/2) 3: | ||
FENCE 3 | ||
NONBLOCKING PULSE 3 "rf" drag_gaussian(duration: 2e-08, fwhm: 1e-08, t0: 1e-08, anh: -100000000.0, alpha: -0.2, scale: 0.2, phase: 0.0, detuning: 0.0) | ||
FENCE 3 | ||
|
||
DEFCAL RX(pi) 3: | ||
FENCE 3 | ||
NONBLOCKING PULSE 3 "rf" drag_gaussian(duration: 2e-08, fwhm: 1e-08, t0: 1e-08, anh: -100000000.0, alpha: -0.3, scale: 0.3, phase: 0.0, detuning: 0.0) | ||
FENCE 3 | ||
|
||
DEFCAL RX(-pi) 3: | ||
FENCE 3 | ||
NONBLOCKING PULSE 3 "rf" drag_gaussian(duration: 2e-08, fwhm: 1e-08, t0: 1e-08, anh: -100000000.0, alpha: -0.4, scale: 0.4, phase: 0.0, detuning: 0.0) | ||
FENCE 3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
DEFCAL XY(%theta) 110 111: | ||
FENCE | ||
SHIFT-PHASE 110 111 "xy" 0.4 | ||
NONBLOCKING PULSE 110 111 "xy" q110_q111_xy/sqrtiSWAP | ||
SHIFT-PHASE 110 111 "xy" -0.4 | ||
SHIFT-PHASE 110 111 "xy" 1.8 + -0.5*%theta | ||
NONBLOCKING PULSE 110 111 "xy" q110_q111_xy/sqrtiSWAP | ||
SHIFT-PHASE 110 111 "xy" -1*(1.8 + -0.5*%theta) | ||
DELAY 110 "rf" 1.2e-07 | ||
SHIFT-PHASE 110 "rf" 0.8 | ||
DELAY 111 "rf" 1.2e-07 | ||
SHIFT-PHASE 111 "rf" 0.4 | ||
SHIFT-PHASE 111 "rf" 0.5*%theta | ||
SHIFT-PHASE 110 "rf" -0.5*%theta | ||
FENCE | ||
SHIFT-PHASE 110 111 "xy" 0.4 | ||
SHIFT-PHASE 110 117 "xy" 0.4 | ||
SHIFT-PHASE 110 111 "xy" -0.2 | ||
SHIFT-PHASE 111 112 "xy" -0.2 | ||
SHIFT-PHASE 111 126 "xy" -0.2 | ||
SHIFT-PHASE 110 111 "xy" -0.25*%theta | ||
SHIFT-PHASE 111 112 "xy" -0.25*%theta | ||
SHIFT-PHASE 111 126 "xy" -0.25*%theta | ||
SHIFT-PHASE 110 111 "xy" -0.25*%theta | ||
SHIFT-PHASE 110 117 "xy" -0.25*%theta | ||
|
||
DEFCAL XY(%theta) 111 110: | ||
FENCE | ||
SHIFT-PHASE 110 111 "xy" 0.4 | ||
NONBLOCKING PULSE 110 111 "xy" q110_q111_xy/sqrtiSWAP | ||
SHIFT-PHASE 110 111 "xy" -0.4 | ||
SHIFT-PHASE 110 111 "xy" 1.8 + -0.5*%theta | ||
NONBLOCKING PULSE 110 111 "xy" q110_q111_xy/sqrtiSWAP | ||
SHIFT-PHASE 110 111 "xy" -1*(1.8 + -0.5*%theta) | ||
DELAY 110 "rf" 1.2e-07 | ||
SHIFT-PHASE 110 "rf" 0.8 | ||
DELAY 111 "rf" 1.2e-07 | ||
SHIFT-PHASE 111 "rf" 0.4 | ||
SHIFT-PHASE 111 "rf" 0.5*%theta | ||
SHIFT-PHASE 110 "rf" -0.5*%theta | ||
FENCE | ||
SHIFT-PHASE 110 111 "xy" 0.4 | ||
SHIFT-PHASE 110 117 "xy" 0.4 | ||
SHIFT-PHASE 110 111 "xy" -0.2 | ||
SHIFT-PHASE 111 112 "xy" -0.2 | ||
SHIFT-PHASE 111 126 "xy" -0.2 | ||
SHIFT-PHASE 110 111 "xy" -0.25*%theta | ||
SHIFT-PHASE 111 112 "xy" -0.25*%theta | ||
SHIFT-PHASE 111 126 "xy" -0.25*%theta | ||
SHIFT-PHASE 110 111 "xy" -0.25*%theta | ||
SHIFT-PHASE 110 117 "xy" -0.25*%theta | ||
|
31 changes: 31 additions & 0 deletions
31
quil-rs/tests/snapshots/calibration_test__calibration_cz.quil.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
source: quil-rs/tests/calibration_test.rs | ||
expression: program.to_string() | ||
--- | ||
DEFCAL CZ 110 111: | ||
FENCE | ||
NONBLOCKING PULSE 110 111 "cz" q110_q111_cz/CZ | ||
DELAY 110 "rf" 1.6e-7 | ||
SHIFT-PHASE 110 "rf" 0.6 | ||
DELAY 111 "rf" 1.6e-7 | ||
SHIFT-PHASE 111 "rf" 0.4 | ||
FENCE | ||
SHIFT-PHASE 110 111 "xy" 0.3 | ||
SHIFT-PHASE 110 117 "xy" 0.3 | ||
SHIFT-PHASE 110 111 "xy" -0.2 | ||
SHIFT-PHASE 111 112 "xy" -0.2 | ||
SHIFT-PHASE 111 126 "xy" -0.2 | ||
DEFCAL CZ 111 110: | ||
FENCE | ||
NONBLOCKING PULSE 110 111 "cz" q110_q111_cz/CZ | ||
DELAY 110 "rf" 1.6e-7 | ||
SHIFT-PHASE 110 "rf" 0.6 | ||
DELAY 111 "rf" 1.6e-7 | ||
SHIFT-PHASE 111 "rf" 0.4 | ||
FENCE | ||
SHIFT-PHASE 110 111 "xy" 0.3 | ||
SHIFT-PHASE 110 117 "xy" 0.3 | ||
SHIFT-PHASE 110 111 "xy" -0.2 | ||
SHIFT-PHASE 111 112 "xy" -0.2 | ||
SHIFT-PHASE 111 126 "xy" -0.2 | ||
|
Oops, something went wrong.