Skip to content

Commit cb46e1a

Browse files
authored
Make individual driven controls functions public (#117)
This way they can be properly documented, and will be more type-safe if we ever need different parameters for different functions. https://q-ctrl.atlassian.net/browse/QENG-1118
1 parent 797fcf5 commit cb46e1a

File tree

2 files changed

+44
-24
lines changed

2 files changed

+44
-24
lines changed

qctrlopencontrols/__init__.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,17 @@
2020

2121
from .driven_controls.driven_control import DrivenControl
2222
from .driven_controls.predefined import (
23+
new_bb1_control,
24+
new_corpse_control,
25+
new_corpse_in_bb1_control,
26+
new_corpse_in_scrofulous_control,
27+
new_corpse_in_sk1_control,
2328
new_modulated_gaussian_control,
2429
new_predefined_driven_control,
30+
new_primitive_control,
31+
new_scrofulous_control,
32+
new_sk1_control,
33+
new_wamf1_control,
2534
)
2635
from .dynamic_decoupling_sequences.dynamic_decoupling_sequence import (
2736
DynamicDecouplingSequence,
@@ -30,10 +39,19 @@
3039
from .dynamic_decoupling_sequences.predefined import new_predefined_dds
3140

3241
__all__ = [
42+
"DrivenControl",
43+
"DynamicDecouplingSequence",
3344
"convert_dds_to_driven_control",
34-
"new_predefined_dds",
45+
"new_bb1_control",
46+
"new_corpse_control",
47+
"new_corpse_in_bb1_control",
48+
"new_corpse_in_scrofulous_control",
49+
"new_corpse_in_sk1_control",
3550
"new_modulated_gaussian_control",
51+
"new_predefined_dds",
3652
"new_predefined_driven_control",
37-
"DrivenControl",
38-
"DynamicDecouplingSequence",
53+
"new_primitive_control",
54+
"new_scrofulous_control",
55+
"new_sk1_control",
56+
"new_wamf1_control",
3957
]

qctrlopencontrols/driven_controls/predefined.py

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ def new_predefined_driven_control(scheme: str = PRIMITIVE, **kwargs):
4343
"""
4444
Creates a new driven control based on the given scheme.
4545
46+
Equivalent to calling the corresponding ``new_<scheme>_control`` function.
47+
4648
Parameters
4749
----------
4850
scheme : string, optional
@@ -75,23 +77,23 @@ def new_predefined_driven_control(scheme: str = PRIMITIVE, **kwargs):
7577

7678
# Raise error if the input driven_control_type is not known
7779
if scheme == PRIMITIVE:
78-
driven_control = _new_primitive_control(**kwargs)
80+
driven_control = new_primitive_control(**kwargs)
7981
elif scheme == BB1:
80-
driven_control = _new_bb1_control(**kwargs)
82+
driven_control = new_bb1_control(**kwargs)
8183
elif scheme == SK1:
82-
driven_control = _new_sk1_control(**kwargs)
84+
driven_control = new_sk1_control(**kwargs)
8385
elif scheme == WAMF1:
84-
driven_control = _new_wamf1_control(**kwargs)
86+
driven_control = new_wamf1_control(**kwargs)
8587
elif scheme == CORPSE:
86-
driven_control = _new_corpse_control(**kwargs)
88+
driven_control = new_corpse_control(**kwargs)
8789
elif scheme == CORPSE_IN_BB1:
88-
driven_control = _new_corpse_in_bb1_control(**kwargs)
90+
driven_control = new_corpse_in_bb1_control(**kwargs)
8991
elif scheme == CORPSE_IN_SK1:
90-
driven_control = _new_corpse_in_sk1_control(**kwargs)
92+
driven_control = new_corpse_in_sk1_control(**kwargs)
9193
elif scheme == SCROFULOUS:
92-
driven_control = _new_scrofulous_control(**kwargs)
94+
driven_control = new_scrofulous_control(**kwargs)
9395
elif scheme == CORPSE_IN_SCROFULOUS:
94-
driven_control = _new_corpse_in_scrofulous_control(**kwargs)
96+
driven_control = new_corpse_in_scrofulous_control(**kwargs)
9597
else:
9698
raise ArgumentsValueError(
9799
"Unknown predefined pulse type. See help(new_predefined_driven_control) to display all"
@@ -208,7 +210,7 @@ def _derive_segments(
208210
return segments
209211

210212

211-
def _new_primitive_control(
213+
def new_primitive_control(
212214
rabi_rotation: float,
213215
azimuthal_angle: float = 0.0,
214216
maximum_rabi_rate: float = 2.0 * np.pi,
@@ -257,7 +259,7 @@ def _new_primitive_control(
257259
)
258260

259261

260-
def _new_bb1_control(
262+
def new_bb1_control(
261263
rabi_rotation: float,
262264
azimuthal_angle: float = 0.0,
263265
maximum_rabi_rate: float = 2.0 * np.pi,
@@ -336,7 +338,7 @@ def _new_bb1_control(
336338
)
337339

338340

339-
def _new_sk1_control(
341+
def new_sk1_control(
340342
rabi_rotation: float,
341343
azimuthal_angle: float = 0.0,
342344
maximum_rabi_rate: float = 2.0 * np.pi,
@@ -415,7 +417,7 @@ def _new_sk1_control(
415417
)
416418

417419

418-
def _new_scrofulous_control(
420+
def new_scrofulous_control(
419421
rabi_rotation: float,
420422
azimuthal_angle: float = 0.0,
421423
maximum_rabi_rate: float = 2.0 * np.pi,
@@ -539,7 +541,7 @@ def degrees_to_radians(angle_in_degrees):
539541
)
540542

541543

542-
def _new_corpse_control(
544+
def new_corpse_control(
543545
rabi_rotation: float,
544546
azimuthal_angle: float = 0.0,
545547
maximum_rabi_rate: float = 2.0 * np.pi,
@@ -621,7 +623,7 @@ def _new_corpse_control(
621623
)
622624

623625

624-
def _new_corpse_in_bb1_control(
626+
def new_corpse_in_bb1_control(
625627
rabi_rotation: float,
626628
azimuthal_angle: float = 0.0,
627629
maximum_rabi_rate: float = 2.0 * np.pi,
@@ -652,7 +654,7 @@ def _new_corpse_in_bb1_control(
652654
653655
See Also
654656
--------
655-
_new_corpse_control, _new_bb1_control
657+
new_corpse_control, new_bb1_control
656658
657659
Notes
658660
-----
@@ -727,7 +729,7 @@ def _new_corpse_in_bb1_control(
727729
)
728730

729731

730-
def _new_corpse_in_sk1_control(
732+
def new_corpse_in_sk1_control(
731733
rabi_rotation: float,
732734
azimuthal_angle: float = 0.0,
733735
maximum_rabi_rate: float = 2.0 * np.pi,
@@ -758,7 +760,7 @@ def _new_corpse_in_sk1_control(
758760
759761
See Also
760762
--------
761-
_new_corpse_control, _new_sk1_control
763+
new_corpse_control, new_sk1_control
762764
763765
Notes
764766
-----
@@ -828,7 +830,7 @@ def _new_corpse_in_sk1_control(
828830
)
829831

830832

831-
def _new_corpse_in_scrofulous_control(
833+
def new_corpse_in_scrofulous_control(
832834
rabi_rotation: float,
833835
azimuthal_angle: float = 0.0,
834836
maximum_rabi_rate: float = 2.0 * np.pi,
@@ -865,7 +867,7 @@ def _new_corpse_in_scrofulous_control(
865867
866868
See Also
867869
--------
868-
_new_corpse_control, _new_scrofulous_control
870+
new_corpse_control, new_scrofulous_control
869871
870872
Notes
871873
-----
@@ -992,7 +994,7 @@ def degrees_to_radians(angle_in_degrees):
992994
)
993995

994996

995-
def _new_wamf1_control(
997+
def new_wamf1_control(
996998
rabi_rotation: float,
997999
azimuthal_angle: float = 0.0,
9981000
maximum_rabi_rate: float = 2.0 * np.pi,

0 commit comments

Comments
 (0)