Skip to content

Commit

Permalink
Test with parameters with exact decimal representation
Browse files Browse the repository at this point in the history
  • Loading branch information
pavoljuhas committed Oct 6, 2022
1 parent ff86325 commit 6148c40
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
12 changes: 5 additions & 7 deletions cirq-google/cirq_google/calibration/phased_fsim_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import re

from typing import cast
from unittest import mock
Expand Down Expand Up @@ -223,12 +222,14 @@ def test_floquet_to_calibration_layer_with_measure_qubits():

def test_xeb_to_calibration_layer():
q_00, q_01, q_02, q_03 = [cirq.GridQubit(0, index) for index in range(4)]
gate = cirq.FSimGate(theta=np.pi / 4, phi=0.0)
gate = cirq.FSimGate(theta=0.75, phi=0.0)
request = XEBPhasedFSimCalibrationRequest(
gate=gate,
pairs=((q_00, q_01), (q_02, q_03)),
options=XEBPhasedFSimCalibrationOptions(
n_library_circuits=22,
fatol=0.0078125,
xatol=0.0078125,
fsim_options=XEBPhasedFSimCharacterizationOptions(
characterize_theta=True,
characterize_zeta=True,
Expand All @@ -246,8 +247,8 @@ def test_xeb_to_calibration_layer():
'n_library_circuits': 22,
'n_combinations': 10,
'cycle_depths': '5_25_50_100_200_300',
'fatol': 5e-3,
'xatol': 5e-3,
'fatol': 0.0078125,
'xatol': 0.0078125,
'characterize_theta': True,
'characterize_zeta': True,
'characterize_chi': False,
Expand All @@ -267,9 +268,6 @@ def test_xeb_to_calibration_layer():
desired_textproto = f.read()

layer_str = str(new_layer)
# Fix precision issues
layer_str = re.sub(r'0.004999\d+', '0.005', layer_str)
layer_str = re.sub(r'\b0.78539818\d*', '0.7853982', layer_str)
assert layer_str == desired_textproto


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ layer {
qubit_constant_index: 1
fsimgate {
theta {
float_value: 0.7853982
float_value: 0.75
}
phi {
float_value: 0.0
Expand All @@ -24,7 +24,7 @@ layer {
qubit_constant_index: 3
fsimgate {
theta {
float_value: 0.7853982
float_value: 0.75
}
phi {
float_value: 0.0
Expand Down Expand Up @@ -106,7 +106,7 @@ args {
key: "fatol"
value {
arg_value {
float_value: 0.005
float_value: 0.0078125
}
}
}
Expand All @@ -130,7 +130,7 @@ args {
key: "xatol"
value {
arg_value {
float_value: 0.005
float_value: 0.0078125
}
}
}

0 comments on commit 6148c40

Please sign in to comment.