@@ -222,55 +222,54 @@ def test_floquet_to_calibration_layer_with_measure_qubits():
222
222
223
223
224
224
def test_xeb_to_calibration_layer ():
225
- with cirq .testing .assert_deprecated ('SerializableGateSet' , deadline = 'v0.16' , count = None ):
226
- q_00 , q_01 , q_02 , q_03 = [cirq .GridQubit (0 , index ) for index in range (4 )]
227
- gate = cirq .FSimGate (theta = np .pi / 4 , phi = 0.0 )
228
- request = XEBPhasedFSimCalibrationRequest (
229
- gate = gate ,
230
- pairs = ((q_00 , q_01 ), (q_02 , q_03 )),
231
- options = XEBPhasedFSimCalibrationOptions (
232
- n_library_circuits = 22 ,
233
- fsim_options = XEBPhasedFSimCharacterizationOptions (
234
- characterize_theta = True ,
235
- characterize_zeta = True ,
236
- characterize_chi = False ,
237
- characterize_gamma = False ,
238
- characterize_phi = True ,
239
- ),
225
+ q_00 , q_01 , q_02 , q_03 = [cirq .GridQubit (0 , index ) for index in range (4 )]
226
+ gate = cirq .FSimGate (theta = np .pi / 4 , phi = 0.0 )
227
+ request = XEBPhasedFSimCalibrationRequest (
228
+ gate = gate ,
229
+ pairs = ((q_00 , q_01 ), (q_02 , q_03 )),
230
+ options = XEBPhasedFSimCalibrationOptions (
231
+ n_library_circuits = 22 ,
232
+ fsim_options = XEBPhasedFSimCharacterizationOptions (
233
+ characterize_theta = True ,
234
+ characterize_zeta = True ,
235
+ characterize_chi = False ,
236
+ characterize_gamma = False ,
237
+ characterize_phi = True ,
240
238
),
241
- )
242
- layer = request .to_calibration_layer ()
243
- assert layer == cirq_google .CalibrationLayer (
244
- calibration_type = 'xeb_phased_fsim_characterization' ,
245
- program = cirq .Circuit ([gate .on (q_00 , q_01 ), gate .on (q_02 , q_03 )]),
246
- args = {
247
- 'n_library_circuits' : 22 ,
248
- 'n_combinations' : 10 ,
249
- 'cycle_depths' : '5_25_50_100_200_300' ,
250
- 'fatol' : 5e-3 ,
251
- 'xatol' : 5e-3 ,
252
- 'characterize_theta' : True ,
253
- 'characterize_zeta' : True ,
254
- 'characterize_chi' : False ,
255
- 'characterize_gamma' : False ,
256
- 'characterize_phi' : True ,
257
- },
258
- )
239
+ ),
240
+ )
241
+ layer = request .to_calibration_layer ()
242
+ assert layer == cirq_google .CalibrationLayer (
243
+ calibration_type = 'xeb_phased_fsim_characterization' ,
244
+ program = cirq .Circuit ([gate .on (q_00 , q_01 ), gate .on (q_02 , q_03 )]),
245
+ args = {
246
+ 'n_library_circuits' : 22 ,
247
+ 'n_combinations' : 10 ,
248
+ 'cycle_depths' : '5_25_50_100_200_300' ,
249
+ 'fatol' : 5e-3 ,
250
+ 'xatol' : 5e-3 ,
251
+ 'characterize_theta' : True ,
252
+ 'characterize_zeta' : True ,
253
+ 'characterize_chi' : False ,
254
+ 'characterize_gamma' : False ,
255
+ 'characterize_phi' : True ,
256
+ },
257
+ )
259
258
260
- # Serialize to proto
261
- calibration = v2 .calibration_pb2 .FocusedCalibration ()
262
- new_layer = calibration .layers .add ()
263
- new_layer .calibration_type = layer .calibration_type
264
- for arg in layer .args :
265
- arg_to_proto (layer .args [arg ], out = new_layer .args [arg ])
266
- cirq_google .SQRT_ISWAP_GATESET .serialize (layer .program , msg = new_layer .layer )
267
- with open (os .path .dirname (__file__ ) + '/test_data/xeb_calibration_layer.textproto' ) as f :
268
- desired_textproto = f .read ()
269
-
270
- layer_str = str (new_layer )
271
- # Fix precision issues
272
- layer_str = re .sub (r'0.004999\d+' , '0.005' , layer_str )
273
- assert layer_str == desired_textproto
259
+ # Serialize to proto
260
+ calibration = v2 .calibration_pb2 .FocusedCalibration ()
261
+ new_layer = calibration .layers .add ()
262
+ new_layer .calibration_type = layer .calibration_type
263
+ for arg in layer .args :
264
+ arg_to_proto (layer .args [arg ], out = new_layer .args [arg ])
265
+ cirq_google .CIRCUIT_SERIALIZER .serialize (layer .program , msg = new_layer .layer )
266
+ with open (os .path .dirname (__file__ ) + '/test_data/xeb_calibration_layer.textproto' ) as f :
267
+ desired_textproto = f .read ()
268
+
269
+ layer_str = str (new_layer )
270
+ # Fix precision issues
271
+ layer_str = re .sub (r'0.004999\d+' , '0.005' , layer_str )
272
+ assert layer_str == desired_textproto
274
273
275
274
276
275
def test_from_moment ():
0 commit comments