Skip to content

Commit

Permalink
Update tests with complex amp pulses (#1217)
Browse files Browse the repository at this point in the history
### Summary

This PR removes complex amplitudes from pulses in tests after
Qiskit/qiskit#10357.
  • Loading branch information
coruscating authored Jul 7, 2023
1 parent e0467f1 commit ad8aa79
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions test/calibration/test_calibrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -1007,9 +1007,7 @@ def setUp(self):
self.cals.add_schedule(tcp, num_qubits=2)

self.cals.add_parameter_value(ParameterValue(40, self.date_time), "σ", schedule="xp")
self.cals.add_parameter_value(
ParameterValue(0.1 + 0.01j, self.date_time), "amp", (3,), "xp"
)
self.cals.add_parameter_value(ParameterValue(0.1, self.date_time), "amp", (3,), "xp")
self.cals.add_parameter_value(ParameterValue(0.3, self.date_time), "amp", (3, 2), "cr")
self.cals.add_parameter_value(ParameterValue(0.2, self.date_time), "amp_rot", (3, 2), "cr")
self.cals.add_parameter_value(ParameterValue(0.8, self.date_time), "amp", (3, 2), "tcp")
Expand Down Expand Up @@ -1049,11 +1047,11 @@ def test_get_schedule(self):
with pulse.align_left():
pulse.play(GaussianSquare(640, 0.2, 40, 20), DriveChannel(2)) # Rotary tone
pulse.play(GaussianSquare(640, 0.3, 40, 20), ControlChannel(10)) # CR tone.
pulse.play(Gaussian(160, 0.1 + 0.01j, 40), DriveChannel(3))
pulse.play(Gaussian(160, 0.1, 40), DriveChannel(3))
with pulse.align_left():
pulse.play(GaussianSquare(640, -0.2, 40, 20), DriveChannel(2)) # Rotary tone
pulse.play(GaussianSquare(640, -0.3, 40, 20), ControlChannel(10)) # CR tone.
pulse.play(Gaussian(160, 0.1 + 0.01j, 40), DriveChannel(3))
pulse.play(Gaussian(160, 0.1, 40), DriveChannel(3))

# We inline to make the schedules comparable with the construction directly above.
schedule = self.cals.get_schedule("cr", (3, 2))
Expand Down Expand Up @@ -1624,7 +1622,7 @@ def test_save_load_parameter_values(self):

with self.assertWarns(DeprecationWarning):
self.cals.save("csv", overwrite=True, file_prefix=self._prefix)
self.assertEqual(self.cals.get_parameter_value("amp", (3,), "xp"), 0.1 + 0.01j)
self.assertEqual(self.cals.get_parameter_value("amp", (3,), "xp"), 0.1)

self.cals._params = defaultdict(list)

Expand All @@ -1636,8 +1634,7 @@ def test_save_load_parameter_values(self):
self.cals.load_parameter_values(self._prefix + "parameter_values.csv")

val = self.cals.get_parameter_value("amp", (3,), "xp")
self.assertEqual(val, 0.1 + 0.01j)
self.assertTrue(isinstance(val, complex))
self.assertEqual(val, 0.1)

val = self.cals.get_parameter_value("σ", (3,), "xp")
self.assertEqual(val, 40)
Expand Down

0 comments on commit ad8aa79

Please sign in to comment.