Skip to content

Commit d1b4b85

Browse files
authored
misc: Use positive in error messages (#234)
- Uses positive instead of greater than zero in error messages.
1 parent 9b79212 commit d1b4b85

File tree

4 files changed

+32
-32
lines changed

4 files changed

+32
-32
lines changed

qctrlopencontrols/driven_controls/driven_control.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class DrivenControl:
4545
of segments.
4646
rabi_rates : np.ndarray, optional
4747
The Rabi rates :math:`\{\Omega_n\}` for each segment, in units of radians per second. Every
48-
element must be non-negative. Represented as a 1D array of length :math:`N`, where :math:`N`
48+
element must be nonnegative. Represented as a 1D array of length :math:`N`, where :math:`N`
4949
is number of segments. You can omit this field if the Rabi rate is zero on all segments.
5050
azimuthal_angles : np.ndarray, optional
5151
The azimuthal angles :math:`\{\phi_n\}` for each segment. Represented as a 1D array of
@@ -107,7 +107,7 @@ def __init__(
107107
# check if all the durations are greater than zero
108108
check_arguments(
109109
all(durations > 0),
110-
"Duration of driven control segments must all be greater than zero.",
110+
"Duration of driven control segments must all be positive.",
111111
{"durations": durations},
112112
)
113113

@@ -144,10 +144,10 @@ def __init__(
144144
azimuthal_angles = np.asarray(azimuthal_angles, dtype=float)
145145
detunings = np.asarray(detunings, dtype=float)
146146

147-
# check if all the rabi_rates are greater than zero
147+
# check if all the rabi_rates are nonnegative
148148
check_arguments(
149149
all(rabi_rates >= 0.0),
150-
"All Rabi rates must be greater than zero.",
150+
"All Rabi rates must be nonnegative.",
151151
{"rabi_rates": rabi_rates},
152152
)
153153

qctrlopencontrols/driven_controls/predefined.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def _validate_rabi_parameters(rabi_rotation: float, maximum_rabi_rate: float) ->
4242

4343
check_arguments(
4444
maximum_rabi_rate > 0,
45-
"Maximum Rabi angular frequency should be greater than zero.",
45+
"Maximum Rabi angular frequency must be positive.",
4646
{"maximum_rabi_rate": maximum_rabi_rate},
4747
)
4848

@@ -1040,19 +1040,19 @@ def new_gaussian_control(
10401040

10411041
check_arguments(
10421042
duration > 0.0,
1043-
"Pulse duration must be greater than zero.",
1043+
"Pulse duration must be positive.",
10441044
{"duration": duration},
10451045
)
10461046

10471047
check_arguments(
10481048
segment_count > 0,
1049-
"Segment count must be greater than zero.",
1049+
"Segment count must be positive.",
10501050
{"segment_count": segment_count},
10511051
)
10521052

10531053
check_arguments(
10541054
width > 0.0,
1055-
"Width of ideal Gaussian pulse must be greater than zero.",
1055+
"Width of ideal Gaussian pulse must be positive.",
10561056
{"width": width},
10571057
)
10581058

@@ -1124,13 +1124,13 @@ def new_modulated_gaussian_control(
11241124

11251125
check_arguments(
11261126
maximum_rabi_rate > 0.0,
1127-
"Maximum Rabi rate must be greater than zero.",
1127+
"Maximum Rabi rate must be positive.",
11281128
{"maximum_rabi_rate": maximum_rabi_rate},
11291129
)
11301130

11311131
check_arguments(
11321132
minimum_segment_duration > 0.0,
1133-
"Minimum segment duration must be greater than zero.",
1133+
"Minimum segment duration must be positive.",
11341134
{"minimum_segment_duration": minimum_segment_duration},
11351135
)
11361136

@@ -1289,19 +1289,19 @@ def new_drag_control(
12891289

12901290
check_arguments(
12911291
duration > 0.0,
1292-
"Pulse duration must be greater than zero.",
1292+
"Pulse duration must be positive.",
12931293
{"duration": duration},
12941294
)
12951295

12961296
check_arguments(
12971297
segment_count > 0,
1298-
"Segment count must be greater than zero.",
1298+
"Segment count must be positive.",
12991299
{"segment_count": segment_count},
13001300
)
13011301

13021302
check_arguments(
13031303
width > 0.0,
1304-
"Width of ideal Gaussian pulse must be greater than zero.",
1304+
"Width of ideal Gaussian pulse must be positive.",
13051305
{"width": width},
13061306
)
13071307

qctrlopencontrols/dynamic_decoupling_sequences/dynamic_decoupling_sequence.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def __init__(
9898
rabi_rotations = np.asarray(rabi_rotations, dtype=float)
9999
check_arguments(
100100
np.all(rabi_rotations >= 0),
101-
"Rabi rotations must be non-negative.",
101+
"Rabi rotations must be nonnegative.",
102102
{"rabi_rotations": rabi_rotations},
103103
)
104104

qctrlopencontrols/dynamic_decoupling_sequences/predefined.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def new_ramsey_sequence(duration, pre_post_rotation=False, name=None):
173173
"""
174174
check_arguments(
175175
duration > 0,
176-
"Sequence duration must be greater than zero.",
176+
"Sequence duration must be positive.",
177177
{"duration": duration},
178178
)
179179

@@ -230,7 +230,7 @@ def new_spin_echo_sequence(duration, pre_post_rotation=False, name=None):
230230

231231
check_arguments(
232232
duration > 0,
233-
"Sequence duration must be greater than zero.",
233+
"Sequence duration must be positive.",
234234
{"duration": duration},
235235
)
236236

@@ -305,12 +305,12 @@ def new_carr_purcell_sequence(
305305

306306
check_arguments(
307307
duration > 0,
308-
"Sequence duration must be greater than zero.",
308+
"Sequence duration must be positive.",
309309
{"duration": duration},
310310
)
311311
check_arguments(
312312
offset_count >= 1,
313-
"Number of offsets must be greater than zero.",
313+
"Number of offsets must be positive.",
314314
{"offset_count": offset_count},
315315
)
316316

@@ -388,12 +388,12 @@ def new_cpmg_sequence(duration, offset_count, pre_post_rotation=False, name=None
388388

389389
check_arguments(
390390
duration > 0,
391-
"Sequence duration must be greater than zero.",
391+
"Sequence duration must be positive.",
392392
{"duration": duration},
393393
)
394394
check_arguments(
395395
offset_count >= 1,
396-
"Number of offsets must be greater than zero.",
396+
"Number of offsets must be positive.",
397397
{"offset_count": offset_count},
398398
)
399399

@@ -467,12 +467,12 @@ def new_uhrig_sequence(duration, offset_count, pre_post_rotation=False, name=Non
467467

468468
check_arguments(
469469
duration > 0,
470-
"Sequence duration must be greater than zero.",
470+
"Sequence duration must be positive.",
471471
{"duration": duration},
472472
)
473473
check_arguments(
474474
offset_count >= 1,
475-
"Number of offsets must be greater than zero.",
475+
"Number of offsets must be positive.",
476476
{"offset_count": offset_count},
477477
)
478478

@@ -546,12 +546,12 @@ def new_periodic_sequence(duration, offset_count, pre_post_rotation=False, name=
546546

547547
check_arguments(
548548
duration > 0,
549-
"Sequence duration must be greater than zero.",
549+
"Sequence duration must be positve.",
550550
{"duration": duration},
551551
)
552552
check_arguments(
553553
offset_count >= 1,
554-
"Number of offsets must be greater than zero.",
554+
"Number of offsets must be positive.",
555555
{"offset_count": offset_count},
556556
)
557557

@@ -649,7 +649,7 @@ def new_walsh_sequence(duration, paley_order, pre_post_rotation=False, name=None
649649

650650
check_arguments(
651651
duration > 0,
652-
"Sequence duration must be greater than zero.",
652+
"Sequence duration must be positive.",
653653
{"duration": duration},
654654
)
655655
check_arguments(
@@ -771,17 +771,17 @@ def new_quadratic_sequence(
771771

772772
check_arguments(
773773
duration > 0,
774-
"Sequence duration must be greater than zero.",
774+
"Sequence duration must be positive.",
775775
{"duration": duration},
776776
)
777777
check_arguments(
778778
inner_offset_count >= 1,
779-
"Number of offsets of inner pulses must be greater than zero.",
779+
"Number of offsets of inner pulses must be positive.",
780780
{"inner_offset_count": inner_offset_count},
781781
)
782782
check_arguments(
783783
outer_offset_count >= 1,
784-
"Number of offsets of outer pulses must be greater than zero.",
784+
"Number of offsets of outer pulses must be positive.",
785785
{"outer_offset_count": outer_offset_count},
786786
)
787787

@@ -893,12 +893,12 @@ def new_x_concatenated_sequence(
893893

894894
check_arguments(
895895
duration > 0,
896-
"Sequence duration must be greater than zero.",
896+
"Sequence duration must be positive.",
897897
{"duration": duration},
898898
)
899899
check_arguments(
900900
concatenation_order >= 1,
901-
"Concatenation oder must be greater than zero.",
901+
"Concatenation order must be positive.",
902902
{"concatenation_order": concatenation_order},
903903
)
904904

@@ -998,12 +998,12 @@ def new_xy_concatenated_sequence(
998998

999999
check_arguments(
10001000
duration > 0,
1001-
"Sequence duration must be greater than zero.",
1001+
"Sequence duration must be positive.",
10021002
{"duration": duration},
10031003
)
10041004
check_arguments(
10051005
concatenation_order >= 1,
1006-
"Concatenation oder must be greater than zero.",
1006+
"Concatenation order must be positive.",
10071007
{"concatenation_order": concatenation_order},
10081008
)
10091009

0 commit comments

Comments
 (0)