@@ -133,95 +133,55 @@ def test_sequence_plot():
133133 _azimuthal_angle = np .array ([0 , 0 , 0 , 0 , 0 ])
134134 _detuning_rotations = np .array ([0 , 0 , 0 , 0 , 0 ])
135135
136- _plot_times = np .array ([0 , 0 , 0 ,
137- 0.25 , 0.25 , 0.25 ,
138- 0.5 , 0.5 , 0.5 ,
139- 0.75 , 0.75 , 0.75 ,
140- 1. , 1. , 1. ])
141- _plot_rabi_rotations = np .array ([0 , 0 , 0 ,
142- 0 , np .pi , 0 ,
143- 0 , 0 , 0 ,
144- 0 , np .pi , 0 ,
145- 0 , 0 , 0 ])
146- _plot_azimuthal_angles = np .array ([0 , 0 , 0 ,
147- 0 , 0 , 0 ,
148- 0 , 0 , 0 ,
149- 0 , 0 , 0 ,
150- 0 , 0 , 0 ])
151-
152- _plot_detuning_rotations = np .array ([0 , 0 , 0 ,
153- 0 , 0 , 0 ,
154- 0 , 0 , 0 ,
155- 0 , 0 , 0 ,
156- 0 , 0 , 0 ])
157-
158136 seq = DynamicDecouplingSequence (
159137 duration = 1.0 ,
160138 offsets = _offsets ,
161139 rabi_rotations = _rabi_rotations ,
162140 azimuthal_angles = _azimuthal_angle ,
163141 detuning_rotations = _detuning_rotations )
164142
165- plot_data = seq .get_plot_formatted_arrays ()
166- plot_rabi , plot_azimuthal , plot_detuning , plot_times = (
167- plot_data ['rabi_rotations' ],
168- plot_data ['azimuthal_angles' ],
169- plot_data ['detuning_rotations' ],
170- plot_data ['times' ]
171- )
143+ plot_data = seq .export ()
144+
145+ _plot_rabi_offsets = [pulse ['offset' ] for pulse in plot_data ['Rabi' ]]
146+ _plot_detuning_offsets = [pulse ['offset' ] for pulse in plot_data ['Detuning' ]]
147+ _plot_rabi_rotations = [pulse ['rotation' ] for pulse in plot_data ['Rabi' ]]
148+ _plot_detuning_rotations = [pulse ['rotation' ] for pulse in plot_data ['Detuning' ]]
149+
150+ assert np .allclose (_plot_rabi_offsets , _offsets )
151+ assert np .allclose (_plot_detuning_offsets , _offsets )
152+
153+ assert np .allclose (np .abs (_plot_rabi_rotations ), _rabi_rotations )
154+ assert np .allclose (np .angle (_plot_rabi_rotations ), _azimuthal_angle )
172155
173- assert np .allclose (_plot_rabi_rotations , plot_rabi )
174- assert np .allclose (_plot_azimuthal_angles , plot_azimuthal )
175- assert np .allclose (_plot_detuning_rotations , plot_detuning )
176- assert np .allclose (_plot_times , plot_times )
156+ assert np .allclose (_plot_detuning_rotations , _detuning_rotations )
177157
178158 # with both X and Y pi
179159 _offsets = np .array ([0 , 0.25 , 0.5 , 0.75 , 1.00 ])
180160 _rabi_rotations = np .array ([0 , np .pi , 0 , np .pi , 0 ])
181161 _azimuthal_angle = np .array ([0 , np .pi / 2 , 0 , np .pi / 2 , 0 ])
182162 _detuning_rotations = np .array ([0 , 0 , 0 , 0 , 0 ])
183163
184- _plot_rabi_rotations = np .array ([0 , 0 , 0 ,
185- 0 , np .pi , 0 ,
186- 0 , 0 , 0 ,
187- 0 , np .pi , 0 ,
188- 0 , 0 , 0 ])
189- _plot_azimuthal_angles = np .array ([0 , 0 , 0 ,
190- 0 , np .pi / 2 , 0 ,
191- 0 , 0 , 0 ,
192- 0 , np .pi / 2 , 0 ,
193- 0 , 0 , 0 ])
194-
195- _plot_detuning_rotations = np .array ([0 , 0 , 0 ,
196- 0 , 0 , 0 ,
197- 0 , 0 , 0 ,
198- 0 , 0 , 0 ,
199- 0 , 0 , 0 ])
200-
201- _plot_times = np .array ([0 , 0 , 0 ,
202- 0.25 , 0.25 , 0.25 ,
203- 0.5 , 0.5 , 0.5 ,
204- 0.75 , 0.75 , 0.75 ,
205- 1. , 1. , 1. ])
206164 seq = DynamicDecouplingSequence (
207165 duration = 1.0 ,
208166 offsets = _offsets ,
209167 rabi_rotations = _rabi_rotations ,
210168 azimuthal_angles = _azimuthal_angle ,
211169 detuning_rotations = _detuning_rotations )
212170
213- plot_data = seq .get_plot_formatted_arrays ()
214- plot_rabi , plot_azimuthal , plot_detuning , plot_times = (
215- plot_data ['rabi_rotations' ],
216- plot_data ['azimuthal_angles' ],
217- plot_data ['detuning_rotations' ],
218- plot_data ['times' ]
219- )
171+ plot_data = seq .export ()
172+
173+ _plot_rabi_offsets = [pulse ['offset' ] for pulse in plot_data ['Rabi' ]]
174+ _plot_detuning_offsets = [pulse ['offset' ] for pulse in plot_data ['Detuning' ]]
175+ _plot_rabi_rotations = [pulse ['rotation' ] for pulse in plot_data ['Rabi' ]]
176+ _plot_detuning_rotations = [pulse ['rotation' ] for pulse in plot_data ['Detuning' ]]
177+
178+ assert np .allclose (_plot_rabi_offsets , _offsets )
179+ assert np .allclose (_plot_detuning_offsets , _offsets )
180+
181+ assert np .allclose (np .abs (_plot_rabi_rotations ), _rabi_rotations )
182+ assert np .allclose (np .angle (_plot_rabi_rotations ), _azimuthal_angle )
220183
221- assert np .allclose (_plot_rabi_rotations , plot_rabi )
222- assert np .allclose (_plot_azimuthal_angles , plot_azimuthal )
223- assert np .allclose (_plot_detuning_rotations , plot_detuning )
224- assert np .allclose (_plot_times , plot_times )
184+ assert np .allclose (_plot_detuning_rotations , _detuning_rotations )
225185
226186
227187def test_pretty_string_format ():
0 commit comments