Skip to content

Commit

Permalink
creating compatibility tests for cirq_google JSON files
Browse files Browse the repository at this point in the history
  • Loading branch information
balopat committed Apr 19, 2021
1 parent 5de9bda commit a9768d8
Show file tree
Hide file tree
Showing 42 changed files with 933 additions and 25 deletions.
2 changes: 1 addition & 1 deletion cirq/google/json_test_data/Bristlecone.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"cirq_type": "_NamedConstantXmonDevice",
"constant": "cirq.google.Bristlecone"
"constant": "cirq_google.Bristlecone"
}
2 changes: 1 addition & 1 deletion cirq/google/json_test_data/Bristlecone.repr
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cirq.google.Bristlecone
cirq_google.Bristlecone
72 changes: 72 additions & 0 deletions cirq/google/json_test_data/Calibration.json_inward
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"cirq_type": "Calibration",
"metrics": {
"metrics": [
{
"name": "xeb",
"targets": [
"0_0",
"0_1"
],
"values": [
{
"doubleVal": 0.9999
}
]
},
{
"name": "xeb",
"targets": [
"0_0",
"1_0"
],
"values": [
{
"doubleVal": 0.9998
}
]
},
{
"name": "t1",
"targets": [
"0_0"
],
"values": [
{
"int64Val": "321"
}
]
},
{
"name": "t1",
"targets": [
"0_1"
],
"values": [
{
"int64Val": "911"
}
]
},
{
"name": "t1",
"targets": [
"1_0"
],
"values": [
{
"int64Val": "505"
}
]
},
{
"name": "globalMetric",
"values": [
{
"strVal": "abcd"
}
]
}
]
}
}
2 changes: 1 addition & 1 deletion cirq/google/json_test_data/Calibration.repr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cirq.google.Calibration(
cirq_google.Calibration(
metrics={
'xeb': {
(cirq.GridQubit(0, 0), cirq.GridQubit(0, 1)): [0.9999],
Expand Down
13 changes: 13 additions & 0 deletions cirq/google/json_test_data/Calibration.repr_inward
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cirq.google.Calibration(
metrics={
'xeb': {
(cirq.GridQubit(0, 0), cirq.GridQubit(0, 1)): [0.9999],
(cirq.GridQubit(0, 0), cirq.GridQubit(1, 0)): [0.9998]
},
't1': {
(cirq.GridQubit(0, 0),): [321],
(cirq.GridQubit(0, 1),): [911],
(cirq.GridQubit(1, 0),): [505]},
'globalMetric': {(): ['abcd']}
}
)
34 changes: 34 additions & 0 deletions cirq/google/json_test_data/CalibrationLayer.json_inward
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"cirq_type": "CalibrationLayer",
"calibration_type": "xeb",
"program": {
"cirq_type": "Circuit",
"moments": [
{
"cirq_type": "Moment",
"operations": [
{
"cirq_type": "SingleQubitPauliStringGateOperation",
"pauli": {
"cirq_type": "_PauliX",
"exponent": 1.0,
"global_shift": 0.0
},
"qubit": {
"cirq_type": "GridQubit",
"row": 1,
"col": 1
}
}
]
}
],
"device": {
"cirq_type": "_UnconstrainedDevice"
}
},
"args": {
"type": "full",
"samples": 100
}
}
2 changes: 1 addition & 1 deletion cirq/google/json_test_data/CalibrationLayer.repr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cirq.google.CalibrationLayer(
cirq_google.CalibrationLayer(
calibration_type='xeb',
program=cirq.Circuit([
cirq.Moment(
Expand Down
8 changes: 8 additions & 0 deletions cirq/google/json_test_data/CalibrationLayer.repr_inward
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cirq.google.CalibrationLayer(
calibration_type='xeb',
program=cirq.Circuit([
cirq.Moment(
cirq.X(cirq.GridQubit(1, 1)),
),
]),
args={'type': 'full', 'samples': 100})
79 changes: 79 additions & 0 deletions cirq/google/json_test_data/CalibrationResult.json_inward
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"cirq_type": "CalibrationResult",
"code": 1,
"error_message": "a",
"token": "b",
"utc_valid_until": 1606319984.041021,
"metrics": {
"cirq_type": "Calibration",
"metrics": {
"metrics": [
{
"name": "xeb",
"targets": [
"0_0",
"0_1"
],
"values": [
{
"doubleVal": 0.9999
}
]
},
{
"name": "xeb",
"targets": [
"0_0",
"1_0"
],
"values": [
{
"doubleVal": 0.9998
}
]
},
{
"name": "t1",
"targets": [
"0_0"
],
"values": [
{
"int64Val": "321"
}
]
},
{
"name": "t1",
"targets": [
"0_1"
],
"values": [
{
"int64Val": "911"
}
]
},
{
"name": "t1",
"targets": [
"1_0"
],
"values": [
{
"int64Val": "505"
}
]
},
{
"name": "globalMetric",
"values": [
{
"strVal": "abcd"
}
]
}
]
}
}
}
4 changes: 2 additions & 2 deletions cirq/google/json_test_data/CalibrationResult.repr
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
cirq.google.CalibrationResult(
cirq_google.CalibrationResult(
code=1,
error_message='a',
token='b',
valid_until=datetime.datetime(2020, 11, 25, 15, 59, 44, 41021),
metrics=cirq.google.Calibration(
metrics=cirq_google.Calibration(
metrics={
'xeb': {
(cirq.GridQubit(0, 0), cirq.GridQubit(0, 1)): [0.9999],
Expand Down
18 changes: 18 additions & 0 deletions cirq/google/json_test_data/CalibrationResult.repr_inward
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
cirq.google.CalibrationResult(
code=1,
error_message='a',
token='b',
valid_until=datetime.datetime(2020, 11, 25, 15, 59, 44, 41021),
metrics=cirq.google.Calibration(
metrics={
'xeb': {
(cirq.GridQubit(0, 0), cirq.GridQubit(0, 1)): [0.9999],
(cirq.GridQubit(0, 0), cirq.GridQubit(1, 0)): [0.9998]},
't1': {
(cirq.GridQubit(0, 0),): [321],
(cirq.GridQubit(0, 1),): [911],
(cirq.GridQubit(1, 0),): [505]},
'globalMetric': {(): ['abcd']}
}
)
)
4 changes: 4 additions & 0 deletions cirq/google/json_test_data/CalibrationTag.json_inward
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"cirq_type": "CalibrationTag",
"token": "xeb"
}
2 changes: 1 addition & 1 deletion cirq/google/json_test_data/CalibrationTag.repr
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cirq.google.CalibrationTag('xeb')
cirq_google.CalibrationTag('xeb')
1 change: 1 addition & 0 deletions cirq/google/json_test_data/CalibrationTag.repr_inward
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cirq.google.CalibrationTag('xeb')
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"cirq_type": "FloquetPhasedFSimCalibrationOptions",
"characterize_theta": true,
"characterize_zeta": true,
"characterize_chi": false,
"characterize_gamma": true,
"characterize_phi": false
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cirq.google.FloquetPhasedFSimCalibrationOptions(characterize_theta=True, characterize_zeta=True, characterize_chi=False, characterize_gamma=True, characterize_phi=False)
cirq_google.FloquetPhasedFSimCalibrationOptions(characterize_theta=True, characterize_zeta=True, characterize_chi=False, characterize_gamma=True, characterize_phi=False)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cirq.google.FloquetPhasedFSimCalibrationOptions(characterize_theta=True, characterize_zeta=True, characterize_chi=False, characterize_gamma=True, characterize_phi=False)
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"cirq_type": "FloquetPhasedFSimCalibrationRequest",
"pairs": [
[
{
"cirq_type": "GridQubit",
"row": 0,
"col": 0
},
{
"cirq_type": "GridQubit",
"row": 0,
"col": 1
}
],
[
{
"cirq_type": "GridQubit",
"row": 0,
"col": 2
},
{
"cirq_type": "GridQubit",
"row": 0,
"col": 3
}
]
],
"gate": {
"cirq_type": "FSimGate",
"theta": 0.7853981633974483,
"phi": 0.0
},
"options": {
"cirq_type": "FloquetPhasedFSimCalibrationOptions",
"characterize_theta": true,
"characterize_zeta": true,
"characterize_chi": false,
"characterize_gamma": false,
"characterize_phi": true
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cirq.google.FloquetPhasedFSimCalibrationRequest(
cirq_google.FloquetPhasedFSimCalibrationRequest(
gate=cirq.FSimGate(theta=0.7853981633974483, phi=0.0),
pairs=((cirq.GridQubit(0,0), cirq.GridQubit(0,1)), (cirq.GridQubit(0,2), cirq.GridQubit(0,3))),
options=cirq.google.FloquetPhasedFSimCalibrationOptions(
options=cirq_google.FloquetPhasedFSimCalibrationOptions(
characterize_theta=True,
characterize_zeta=True,
characterize_chi=False,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cirq.google.FloquetPhasedFSimCalibrationRequest(
gate=cirq.FSimGate(theta=0.7853981633974483, phi=0.0),
pairs=((cirq.GridQubit(0,0), cirq.GridQubit(0,1)), (cirq.GridQubit(0,2), cirq.GridQubit(0,3))),
options=cirq.google.FloquetPhasedFSimCalibrationOptions(
characterize_theta=True,
characterize_zeta=True,
characterize_chi=False,
characterize_gamma=False,
characterize_phi=True,
),
)
2 changes: 1 addition & 1 deletion cirq/google/json_test_data/Foxtail.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"cirq_type": "_NamedConstantXmonDevice",
"constant": "cirq.google.Foxtail"
"constant": "cirq_google.Foxtail"
}
2 changes: 1 addition & 1 deletion cirq/google/json_test_data/Foxtail.repr
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cirq.google.Foxtail
cirq_google.Foxtail
Loading

0 comments on commit a9768d8

Please sign in to comment.