Skip to content

Commit 7699a44

Browse files
author
Rajib Chakravorty
committed
Merge branch 'lazy-loading' of github.com:qctrl/python-open-controls into lazy-loading
2 parents 3c9a7ae + f329aeb commit 7699a44

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

qctrlopencontrols/qiskit/quantum_circuit.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ def convert_dds_to_qiskit_quantum_circuit(
165165

166166
if offset_distance < 0:
167167
raise ArgumentsValueError(
168-
"Offsets cannot be placed properly. Spacing between the rotations "
169-
"is smaller than the time required to perform the rotation. Provide "
168+
"Offsets cannot be placed properly. Spacing between the rotations"
169+
"is smaller than the time required to perform the rotation. Provide"
170170
"a longer dynamic decoupling sequence or shorted gate time.",
171171
{'dynamic_decoupling_sequence': dynamic_decoupling_sequence,
172172
'gate_time': gate_time})
@@ -177,11 +177,14 @@ def convert_dds_to_qiskit_quantum_circuit(
177177
quantum_circuit.barrier(quantum_registers[qubit]) # pylint: disable=no-member
178178
time_covered += gate_time
179179

180-
rotations = np.array([rabi_rotation * np.cos(azimuthal_angle),
181-
rabi_rotation * np.sin(azimuthal_angle),
182-
detuning_rotation])
183-
zero_pulse_count = np.sum(np.isclose(rotations, 0.0).astype(np.int))
184-
if zero_pulse_count < 2:
180+
x_rotation = rabi_rotation * np.cos(azimuthal_angle)
181+
y_rotation = rabi_rotation * np.sin(azimuthal_angle)
182+
z_rotation = detuning_rotation
183+
184+
rotations = np.array([x_rotation, y_rotation, z_rotation])
185+
zero_pulses = np.isclose(rotations, 0.0).astype(np.int)
186+
nonzero_pulse_counts = 3 - np.sum(zero_pulses)
187+
if nonzero_pulse_counts > 1:
185188
raise ArgumentsValueError(
186189
'Open Controls support a sequence with one '
187190
'valid rotation at any offset. Found a sequence '
@@ -194,7 +197,7 @@ def convert_dds_to_qiskit_quantum_circuit(
194197
)
195198

196199
for qubit in target_qubits:
197-
if zero_pulse_count == 3:
200+
if nonzero_pulse_counts == 0:
198201
quantum_circuit.u3(
199202
0., 0., 0., # pylint: disable=no-member
200203
quantum_registers[qubit])

0 commit comments

Comments
 (0)