From 04773a9e648f88784d849a588755ad0c1fa43f25 Mon Sep 17 00:00:00 2001 From: Daniel Puzzuoli Date: Mon, 18 Mar 2024 11:57:13 -0700 Subject: [PATCH] Updating stable/0.4 docs and tests due to external dependency updates (#346) --- docs/tutorials/dynamics_backend.rst | 12 ++++++------ docs/tutorials/optimizing_pulse_sequence.rst | 3 +++ .../how_to_use_pulse_schedule_for_jax_jit.rst | 3 +++ test/dynamics/backend/test_qiskit_experiments.py | 2 +- test/dynamics/pulse/test_pulse_to_signals.py | 6 ++++-- test/dynamics/solvers/test_solver_classes.py | 2 ++ 6 files changed, 19 insertions(+), 9 deletions(-) diff --git a/docs/tutorials/dynamics_backend.rst b/docs/tutorials/dynamics_backend.rst index c9b6f2c27..f178c35c1 100644 --- a/docs/tutorials/dynamics_backend.rst +++ b/docs/tutorials/dynamics_backend.rst @@ -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. @@ -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]) @@ -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 ) diff --git a/docs/tutorials/optimizing_pulse_sequence.rst b/docs/tutorials/optimizing_pulse_sequence.rst index 6ad577253..bbc25951c 100644 --- a/docs/tutorials/optimizing_pulse_sequence.rst +++ b/docs/tutorials/optimizing_pulse_sequence.rst @@ -312,6 +312,9 @@ entry on :ref:`JAX-compatible pulse schedules = 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, @@ -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, diff --git a/test/dynamics/solvers/test_solver_classes.py b/test/dynamics/solvers/test_solver_classes.py index f45507a6e..97f1b4371 100644 --- a/test/dynamics/solvers/test_solver_classes.py +++ b/test/dynamics/solvers/test_solver_classes.py @@ -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,