16
16
Module for defining commonly used dynamical decoupling sequences.
17
17
"""
18
18
19
- from typing import Tuple
19
+ from __future__ import annotations
20
20
21
21
import numpy as np
22
22
@@ -30,7 +30,7 @@ def _add_pre_post_rotations(
30
30
rabi_rotations : np .ndarray ,
31
31
azimuthal_angles : np .ndarray ,
32
32
detuning_rotations : np .ndarray ,
33
- ) -> Tuple [np .ndarray , np .ndarray , np .ndarray , np .ndarray ]:
33
+ ) -> tuple [np .ndarray , np .ndarray , np .ndarray , np .ndarray ]:
34
34
"""
35
35
Adds a pre and post X rotation at the start and end of the sequence.
36
36
@@ -44,15 +44,15 @@ def _add_pre_post_rotations(
44
44
45
45
Parameters
46
46
----------
47
- duration: float
47
+ duration : float
48
48
The duration of the sequence
49
- offsets : numpy .ndarray
49
+ offsets : np .ndarray
50
50
Offsets of the sequence.
51
- rabi_rotations: numpy .ndarray
51
+ rabi_rotations : np .ndarray
52
52
Rabi rotations at each of the offsets.
53
- azimuthal_angles : numpy .ndarray
53
+ azimuthal_angles : np .ndarray
54
54
Azimuthal angles at each of the offsets.
55
- detuning_rotations: numpy .ndarray
55
+ detuning_rotations : np .ndarray
56
56
Detuning rotations at each of the offsets
57
57
58
58
Returns
@@ -140,7 +140,9 @@ def _add_pre_post_rotations(
140
140
return offsets , rabi_rotations , azimuthal_angles , detuning_rotations
141
141
142
142
143
- def new_ramsey_sequence (duration , pre_post_rotation = False , name = None ):
143
+ def new_ramsey_sequence (
144
+ duration , pre_post_rotation = False , name = None
145
+ ) -> DynamicDecouplingSequence :
144
146
r"""
145
147
Creates the Ramsey sequence.
146
148
@@ -198,7 +200,9 @@ def new_ramsey_sequence(duration, pre_post_rotation=False, name=None):
198
200
)
199
201
200
202
201
- def new_spin_echo_sequence (duration , pre_post_rotation = False , name = None ):
203
+ def new_spin_echo_sequence (
204
+ duration , pre_post_rotation = False , name = None
205
+ ) -> DynamicDecouplingSequence :
202
206
r"""
203
207
Creates the spin echo sequence.
204
208
@@ -261,7 +265,7 @@ def new_spin_echo_sequence(duration, pre_post_rotation=False, name=None):
261
265
262
266
def new_carr_purcell_sequence (
263
267
duration , offset_count , pre_post_rotation = False , name = None
264
- ):
268
+ ) -> DynamicDecouplingSequence :
265
269
r"""
266
270
Creates the Carr-Purcell sequence.
267
271
@@ -344,7 +348,9 @@ def new_carr_purcell_sequence(
344
348
)
345
349
346
350
347
- def new_cpmg_sequence (duration , offset_count , pre_post_rotation = False , name = None ):
351
+ def new_cpmg_sequence (
352
+ duration , offset_count , pre_post_rotation = False , name = None
353
+ ) -> DynamicDecouplingSequence :
348
354
r"""
349
355
Creates the Carr-Purcell-Meiboom-Gill sequence.
350
356
@@ -428,7 +434,9 @@ def new_cpmg_sequence(duration, offset_count, pre_post_rotation=False, name=None
428
434
)
429
435
430
436
431
- def new_uhrig_sequence (duration , offset_count , pre_post_rotation = False , name = None ):
437
+ def new_uhrig_sequence (
438
+ duration , offset_count , pre_post_rotation = False , name = None
439
+ ) -> DynamicDecouplingSequence :
432
440
r"""
433
441
Creates the Uhrig sequence.
434
442
@@ -507,7 +515,9 @@ def new_uhrig_sequence(duration, offset_count, pre_post_rotation=False, name=Non
507
515
)
508
516
509
517
510
- def new_periodic_sequence (duration , offset_count , pre_post_rotation = False , name = None ):
518
+ def new_periodic_sequence (
519
+ duration , offset_count , pre_post_rotation = False , name = None
520
+ ) -> DynamicDecouplingSequence :
511
521
r"""
512
522
Creates the periodic sequence.
513
523
@@ -586,7 +596,9 @@ def new_periodic_sequence(duration, offset_count, pre_post_rotation=False, name=
586
596
)
587
597
588
598
589
- def new_walsh_sequence (duration , paley_order , pre_post_rotation = False , name = None ):
599
+ def new_walsh_sequence (
600
+ duration , paley_order , pre_post_rotation = False , name = None
601
+ ) -> DynamicDecouplingSequence :
590
602
r"""
591
603
Creates the Walsh sequence.
592
604
@@ -709,7 +721,7 @@ def new_walsh_sequence(duration, paley_order, pre_post_rotation=False, name=None
709
721
710
722
def new_quadratic_sequence (
711
723
duration , inner_offset_count , outer_offset_count , pre_post_rotation = False , name = None
712
- ):
724
+ ) -> DynamicDecouplingSequence :
713
725
r"""
714
726
Creates the quadratic sequence.
715
727
@@ -842,7 +854,7 @@ def new_quadratic_sequence(
842
854
843
855
def new_x_concatenated_sequence (
844
856
duration , concatenation_order , pre_post_rotation = False , name = None
845
- ):
857
+ ) -> DynamicDecouplingSequence :
846
858
r"""
847
859
Creates the :math:`X`-concatenated sequence.
848
860
@@ -945,7 +957,7 @@ def new_x_concatenated_sequence(
945
957
946
958
def new_xy_concatenated_sequence (
947
959
duration , concatenation_order , pre_post_rotation = False , name = None
948
- ):
960
+ ) -> DynamicDecouplingSequence :
949
961
r"""
950
962
Creates the :math:`XY`-concatenated sequence.
951
963
@@ -1138,7 +1150,7 @@ def _carr_purcell_meiboom_gill_offsets(
1138
1150
1139
1151
Returns
1140
1152
-------
1141
- numpy .ndarray
1153
+ np .ndarray
1142
1154
The offset values.
1143
1155
"""
1144
1156
@@ -1166,7 +1178,7 @@ def _uhrig_single_axis_offsets(duration: float, offset_count: int) -> np.ndarray
1166
1178
1167
1179
Returns
1168
1180
-------
1169
- numpy .ndarray
1181
+ np .ndarray
1170
1182
The offset values.
1171
1183
"""
1172
1184
@@ -1192,7 +1204,7 @@ def _concatenation_x(concatenation_sequence: int) -> np.ndarray:
1192
1204
1193
1205
Returns
1194
1206
-------
1195
- numpy .ndarray
1207
+ np .ndarray
1196
1208
The offset values.
1197
1209
"""
1198
1210
@@ -1222,7 +1234,7 @@ def _concatenation_xy(concatenation_sequence) -> np.ndarray:
1222
1234
1223
1235
Returns
1224
1236
-------
1225
- numpy .ndarray
1237
+ np .ndarray
1226
1238
The offset values.
1227
1239
"""
1228
1240
0 commit comments