Skip to content

Commit 81bffae

Browse files
committed
Linting
1 parent 6b103bc commit 81bffae

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

tests/test_dynamical_decoupling.py

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -142,20 +142,24 @@ def test_sequence_plot():
142142

143143
plot_data = seq.export()
144144

145-
assert np.allclose([pulse['offset'] for pulse in plot_data['Rabi']], _offsets)
146-
assert np.allclose([pulse['offset'] for pulse in plot_data['Detuning']], _offsets)
145+
_plot_offsets = [pulse['offset'] for pulse in plot_data['Rabi']]
146+
_plot_rabi_rotations = [pulse['rotation'] for pulse in plot_data['Rabi']]
147+
_plot_detuning_rotations = [pulse['rotation'] for pulse in plot_data['Detuning']]
147148

148-
assert np.allclose(np.abs([pulse['rotation'] for pulse in plot_data['Rabi']]), _rabi_rotations)
149-
assert np.allclose(np.angle([pulse['rotation'] for pulse in plot_data['Rabi']]), _azimuthal_angle)
149+
assert np.allclose(_plot_offsets, _offsets)
150+
assert np.allclose(_plot_offsets, _offsets)
150151

151-
assert np.allclose([pulse['rotation'] for pulse in plot_data['Detuning']], _detuning_rotations)
152+
assert np.allclose(np.abs(_plot_rabi_rotations), _rabi_rotations)
153+
assert np.allclose(np.angle(_plot_rabi_rotations), _azimuthal_angle)
154+
155+
assert np.allclose(_plot_detuning_rotations, _detuning_rotations)
152156

153157
# with both X and Y pi
154158
_offsets = np.array([0, 0.25, 0.5, 0.75, 1.00])
155159
_rabi_rotations = np.array([0, np.pi, 0, np.pi, 0])
156160
_azimuthal_angle = np.array([0, np.pi/2, 0, np.pi/2, 0])
157161
_detuning_rotations = np.array([0, 0, 0, 0, 0])
158-
162+
159163
seq = DynamicDecouplingSequence(
160164
duration=1.0,
161165
offsets=_offsets,
@@ -165,13 +169,17 @@ def test_sequence_plot():
165169

166170
plot_data = seq.export()
167171

168-
assert np.allclose([pulse['offset'] for pulse in plot_data['Rabi']], _offsets)
169-
assert np.allclose([pulse['offset'] for pulse in plot_data['Detuning']], _offsets)
172+
_plot_offsets = [pulse['offset'] for pulse in plot_data['Rabi']]
173+
_plot_rabi_rotations = [pulse['rotation'] for pulse in plot_data['Rabi']]
174+
_plot_detuning_rotations = [pulse['rotation'] for pulse in plot_data['Detuning']]
175+
176+
assert np.allclose(_plot_offsets, _offsets)
177+
assert np.allclose(_plot_offsets, _offsets)
170178

171-
assert np.allclose(np.abs([pulse['rotation'] for pulse in plot_data['Rabi']]), _rabi_rotations)
172-
assert np.allclose(np.angle([pulse['rotation'] for pulse in plot_data['Rabi']]), _azimuthal_angle)
179+
assert np.allclose(np.abs(_plot_rabi_rotations), _rabi_rotations)
180+
assert np.allclose(np.angle(_plot_rabi_rotations), _azimuthal_angle)
173181

174-
assert np.allclose([pulse['rotation'] for pulse in plot_data['Detuning']], _detuning_rotations)
182+
assert np.allclose(_plot_detuning_rotations, _detuning_rotations)
175183

176184

177185
def test_pretty_string_format():

0 commit comments

Comments
 (0)