Skip to content

Commit

Permalink
Updating stable/0.4 docs and tests due to external dependency updates (
Browse files Browse the repository at this point in the history
  • Loading branch information
DanPuzzuoli authored Mar 18, 2024
1 parent 91427d8 commit 04773a9
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 9 deletions.
12 changes: 6 additions & 6 deletions docs/tutorials/dynamics_backend.rst
Original file line number Diff line number Diff line change
Expand Up @@ -386,10 +386,10 @@ experiments.
from qiskit_experiments.library.calibration import RoughXSXAmplitudeCal

# rabi experiments for qubit 0
rabi0 = RoughXSXAmplitudeCal(0, cals, backend=backend, amplitudes=np.linspace(-0.2, 0.2, 27))
rabi0 = RoughXSXAmplitudeCal([0], cals, backend=backend, amplitudes=np.linspace(-0.2, 0.2, 27))

# rabi experiments for qubit 1
rabi1 = RoughXSXAmplitudeCal(1, cals, backend=backend, amplitudes=np.linspace(-0.2, 0.2, 27))
rabi1 = RoughXSXAmplitudeCal([1], cals, backend=backend, amplitudes=np.linspace(-0.2, 0.2, 27))

Run the Rabi experiments.

Expand Down Expand Up @@ -425,8 +425,8 @@ as above.

from qiskit_experiments.library.calibration import RoughDragCal

cal_drag0 = RoughDragCal(0, cals, backend=backend, betas=np.linspace(-20, 20, 15))
cal_drag1 = RoughDragCal(1, cals, backend=backend, betas=np.linspace(-20, 20, 15))
cal_drag0 = RoughDragCal([0], cals, backend=backend, betas=np.linspace(-20, 20, 15))
cal_drag1 = RoughDragCal([1], cals, backend=backend, betas=np.linspace(-20, 20, 15))

cal_drag0.set_experiment_options(reps=[3, 5, 7])
cal_drag1.set_experiment_options(reps=[3, 5, 7])
Expand Down Expand Up @@ -477,8 +477,8 @@ values for the single qubit gates calibrated above.
from qiskit_experiments.library import CrossResonanceHamiltonian

cr_ham_experiment = CrossResonanceHamiltonian(
qubits=(0, 1),
flat_top_widths=np.linspace(0, 5000, 17),
physical_qubits=(0, 1),
durations=np.linspace(1e-7, 1e-6, 17),
backend=backend
)

Expand Down
3 changes: 3 additions & 0 deletions docs/tutorials/optimizing_pulse_sequence.rst
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,9 @@ entry on :ref:`JAX-compatible pulse schedules <how-to use pulse schedules for ja
)
)

# we need to set disable_validation True to enable jax-jitting.
pulse.ScalableSymbolicPulse.disable_validation = True

return pulse.ScalableSymbolicPulse(
pulse_type="GaussianSquare",
duration=230,
Expand Down
3 changes: 3 additions & 0 deletions docs/userguide/how_to_use_pulse_schedule_for_jax_jit.rst
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ JAX-compiled (or more generally, JAX-transformed).
_amp * sym.exp(sym.I * _angle) * lifted_gaussian(_t, _center, _duration + 1, _sigma)
)

# we need to set disable_validation True to enable jax-jitting.
pulse.ScalableSymbolicPulse.disable_validation = True

gaussian_pulse = pulse.ScalableSymbolicPulse(
pulse_type="Gaussian",
duration=160,
Expand Down
2 changes: 1 addition & 1 deletion test/dynamics/backend/test_qiskit_experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def test_RoughFrequencyCal_calibration(self):
frequencies = np.linspace(freq_estimate - 1e-2, freq_estimate + 1e-2, 51)

self.simple_backend.set_options(seed_simulator=5243234)
spec = RoughFrequencyCal(0, cals, frequencies, backend=self.simple_backend)
spec = RoughFrequencyCal([0], cals, frequencies, backend=self.simple_backend)
spec.set_experiment_options(amp=0.05, sigma=80, duration=320)

spec_data = spec.run().block_for_results()
Expand Down
6 changes: 4 additions & 2 deletions test/dynamics/pulse/test_pulse_to_signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,9 @@ def jit_func_instruction_to_signals(amp):
(1, sym.And(_time >= 0, _time <= _duration)), (0, True)
)
valid_amp_conditions_expr = sym.Abs(_amp) <= 1.0
# we can use only SymbolicPulse when jax-jitting
# bacause jax-jitting doesn't correspond to validate_parameters in qiskit.pulse.
# we need to set disable_validation True to enable jax-jitting.
pulse.SymbolicPulse.disable_validation = True

instance = pulse.SymbolicPulse(
pulse_type="Constant",
duration=5,
Expand Down Expand Up @@ -407,6 +408,7 @@ def jit_func_symbolic_pulse(amp):
(1, sym.And(_time >= 0, _time <= _duration)), (0, True)
)
valid_amp_conditions_expr = sym.Abs(_amp) <= 1.0
pulse.SymbolicPulse.disable_validation = True
instance = pulse.SymbolicPulse(
pulse_type="Constant",
duration=5,
Expand Down
2 changes: 2 additions & 0 deletions test/dynamics/solvers/test_solver_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1304,6 +1304,8 @@ def constant_pulse(amp):
(1, sym.And(_time >= 0, _time <= _duration)), (0, True)
)
valid_amp_conditions_expr = sym.Abs(_amp) <= 1.0
# we need to set disable_validation True to enable jax-jitting.
pulse.SymbolicPulse.disable_validation = True
return pulse.SymbolicPulse(
pulse_type="Constant",
duration=5,
Expand Down

0 comments on commit 04773a9

Please sign in to comment.