Skip to content

Commit fb4abca

Browse files
author
Rajib Chakravorty
committed
error messages updated
1 parent e484741 commit fb4abca

File tree

3 files changed

+42
-27
lines changed

3 files changed

+42
-27
lines changed

qctrlopencontrols/cirq/circuit.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,16 +127,21 @@ def convert_dds_to_cirq_circuit(
127127
time_covered = 0
128128
circuit = cirq.Circuit()
129129
for offset, rabi_rotation, azimuthal_angle, detuning_rotation in zip(
130-
list(offsets), list(rabi_rotations), list(azimuthal_angles), list(detuning_rotations)):
130+
list(offsets), list(rabi_rotations),
131+
list(azimuthal_angles), list(detuning_rotations)):
131132

132133
offset_distance = offset - time_covered
133134

134135
if np.isclose(offset_distance, 0.0):
135136
offset_distance = 0.0
136137

137138
if offset_distance < 0:
138-
raise ArgumentsValueError("Offsets cannot be placed properly",
139-
{'sequence_operations': str(dynamic_decoupling_sequence)})
139+
raise ArgumentsValueError(
140+
"Offsets cannot be placed properly. Spacing between the rotations"
141+
"is smaller than the time required to perform the rotation. Provide"
142+
"a longer dynamic decoupling sequence or shorted gate time.",
143+
{'dynamic_decoupling_sequence': dynamic_decoupling_sequence,
144+
'gate_time': gate_time})
140145

141146
while (time_covered+gate_time) <= offset:
142147
gate_list = []
@@ -155,13 +160,13 @@ def convert_dds_to_cirq_circuit(
155160
if nonzero_pulse_counts > 1:
156161
raise ArgumentsValueError(
157162
'Open Controls support a sequence with one '
158-
'valid pulse at any offset. Found sequence '
163+
'valid rotation at any offset. Found a sequence '
159164
'with multiple rotation operations at an offset.',
160-
{'dynamic_decoupling_sequence': str(dynamic_decoupling_sequence),
161-
'offset': offset,
162-
'rabi_rotation': rabi_rotation,
163-
'azimuthal_angle': azimuthal_angle,
164-
'detuning_rotaion': detuning_rotation}
165+
{'dynamic_decoupling_sequence': dynamic_decoupling_sequence},
166+
extras={'offset': offset,
167+
'rabi_rotation': rabi_rotation,
168+
'azimuthal_angle': azimuthal_angle,
169+
'detuning_rotation': detuning_rotation}
165170
)
166171

167172
gate_list = []

qctrlopencontrols/pyquil/program.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,21 @@ def convert_dds_to_pyquil_program(
134134
program += Pragma('PRESERVE_BLOCK')
135135

136136
for offset, rabi_rotation, azimuthal_angle, detuning_rotation in zip(
137-
list(offsets), list(rabi_rotations), list(azimuthal_angles), list(detuning_rotations)):
137+
list(offsets), list(rabi_rotations),
138+
list(azimuthal_angles), list(detuning_rotations)):
138139

139140
offset_distance = offset - time_covered
140141

141142
if np.isclose(offset_distance, 0.0):
142143
offset_distance = 0.0
143144

144145
if offset_distance < 0:
145-
raise ArgumentsValueError("Offsets cannot be placed properly",
146-
{'sequence_operations': str(dynamic_decoupling_sequence)})
146+
raise ArgumentsValueError(
147+
"Offsets cannot be placed properly. Spacing between the rotations"
148+
"is smaller than the time required to perform the rotation. Provide"
149+
"a longer dynamic decoupling sequence or shorted gate time.",
150+
{'dynamic_decoupling_sequence': dynamic_decoupling_sequence,
151+
'gate_time': gate_time})
147152

148153
while (time_covered+gate_time) <= offset:
149154
for qubit in target_qubits:
@@ -160,13 +165,13 @@ def convert_dds_to_pyquil_program(
160165
if nonzero_pulse_counts > 1:
161166
raise ArgumentsValueError(
162167
'Open Controls support a sequence with one '
163-
'valid pulse at any offset. Found sequence '
168+
'valid rotation at any offset. Found a sequence '
164169
'with multiple rotation operations at an offset.',
165-
{'dynamic_decoupling_sequence': str(dynamic_decoupling_sequence),
166-
'offset': offset,
167-
'rabi_rotation': rabi_rotation,
168-
'azimuthal_angle': azimuthal_angle,
169-
'detuning_rotaion': detuning_rotation}
170+
{'dynamic_decoupling_sequence': dynamic_decoupling_sequence},
171+
extras={'offset': offset,
172+
'rabi_rotation': rabi_rotation,
173+
'azimuthal_angle': azimuthal_angle,
174+
'detuning_rotation': detuning_rotation}
170175
)
171176

172177
for qubit in target_qubits:

qctrlopencontrols/qiskit/quantum_circuit.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -155,16 +155,21 @@ def convert_dds_to_qiskit_quantum_circuit(
155155

156156
time_covered = 0
157157
for offset, rabi_rotation, azimuthal_angle, detuning_rotation in zip(
158-
list(offsets), list(rabi_rotations), list(azimuthal_angles), list(detuning_rotations)):
158+
list(offsets), list(rabi_rotations),
159+
list(azimuthal_angles), list(detuning_rotations)):
159160

160161
offset_distance = offset - time_covered
161162

162163
if np.isclose(offset_distance, 0.0):
163164
offset_distance = 0.0
164165

165166
if offset_distance < 0:
166-
raise ArgumentsValueError("Offsets cannot be placed properly",
167-
{'sequence_operations': str(dynamic_decoupling_sequence)})
167+
raise ArgumentsValueError(
168+
"Offsets cannot be placed properly. Spacing between the rotations"
169+
"is smaller than the time required to perform the rotation. Provide"
170+
"a longer dynamic decoupling sequence or shorted gate time.",
171+
{'dynamic_decoupling_sequence': dynamic_decoupling_sequence,
172+
'gate_time': gate_time})
168173

169174
while (time_covered+gate_time) <= offset:
170175
for qubit in target_qubits:
@@ -182,13 +187,13 @@ def convert_dds_to_qiskit_quantum_circuit(
182187
if nonzero_pulse_counts > 1:
183188
raise ArgumentsValueError(
184189
'Open Controls support a sequence with one '
185-
'valid pulse at any offset. Found sequence '
190+
'valid rotation at any offset. Found a sequence '
186191
'with multiple rotation operations at an offset.',
187-
{'dynamic_decoupling_sequence': str(dynamic_decoupling_sequence),
188-
'offset': offset,
189-
'rabi_rotation': rabi_rotation,
190-
'azimuthal_angle': azimuthal_angle,
191-
'detuning_rotaion': detuning_rotation}
192+
{'dynamic_decoupling_sequence': dynamic_decoupling_sequence},
193+
extras={'offset': offset,
194+
'rabi_rotation': rabi_rotation,
195+
'azimuthal_angle': azimuthal_angle,
196+
'detuning_rotation': detuning_rotation}
192197
)
193198

194199
for qubit in target_qubits:

0 commit comments

Comments
 (0)