qiskit 1.1.2__cp38-abi3-macosx_10_9_universal2.whl → 1.2.0__cp38-abi3-macosx_10_9_universal2.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- qiskit/VERSION.txt +1 -1
- qiskit/__init__.py +27 -24
- qiskit/_accelerate.abi3.so +0 -0
- qiskit/_numpy_compat.py +1 -1
- qiskit/assembler/assemble_circuits.py +107 -64
- qiskit/assembler/assemble_schedules.py +5 -12
- qiskit/assembler/disassemble.py +10 -1
- qiskit/circuit/__init__.py +6 -3
- qiskit/circuit/_classical_resource_map.py +5 -5
- qiskit/circuit/_utils.py +0 -13
- qiskit/circuit/add_control.py +1 -1
- qiskit/circuit/annotated_operation.py +23 -1
- qiskit/circuit/classical/expr/expr.py +4 -4
- qiskit/circuit/classical/expr/visitors.py +1 -1
- qiskit/circuit/classical/types/__init__.py +1 -1
- qiskit/circuit/classical/types/types.py +2 -2
- qiskit/circuit/classicalfunction/boolean_expression.py +1 -1
- qiskit/circuit/classicalfunction/classical_function_visitor.py +5 -5
- qiskit/circuit/classicalfunction/utils.py +1 -1
- qiskit/circuit/classicalregister.py +1 -1
- qiskit/circuit/commutation_checker.py +83 -35
- qiskit/circuit/controlflow/_builder_utils.py +1 -1
- qiskit/circuit/controlflow/builder.py +10 -6
- qiskit/circuit/controlflow/if_else.py +2 -2
- qiskit/circuit/controlflow/switch_case.py +1 -1
- qiskit/circuit/delay.py +1 -1
- qiskit/circuit/duration.py +2 -2
- qiskit/circuit/equivalence.py +5 -7
- qiskit/circuit/gate.py +11 -8
- qiskit/circuit/instruction.py +31 -13
- qiskit/circuit/instructionset.py +2 -5
- qiskit/circuit/library/__init__.py +2 -1
- qiskit/circuit/library/arithmetic/linear_amplitude_function.py +1 -1
- qiskit/circuit/library/arithmetic/linear_pauli_rotations.py +1 -1
- qiskit/circuit/library/arithmetic/piecewise_chebyshev.py +1 -1
- qiskit/circuit/library/arithmetic/piecewise_linear_pauli_rotations.py +1 -1
- qiskit/circuit/library/arithmetic/piecewise_polynomial_pauli_rotations.py +3 -3
- qiskit/circuit/library/arithmetic/polynomial_pauli_rotations.py +1 -1
- qiskit/circuit/library/basis_change/__init__.py +1 -1
- qiskit/circuit/library/basis_change/qft.py +40 -6
- qiskit/circuit/library/blueprintcircuit.py +3 -5
- qiskit/circuit/library/data_preparation/__init__.py +9 -2
- qiskit/circuit/library/data_preparation/initializer.py +8 -0
- qiskit/circuit/library/data_preparation/state_preparation.py +98 -178
- qiskit/circuit/library/generalized_gates/isometry.py +8 -8
- qiskit/circuit/library/generalized_gates/linear_function.py +3 -2
- qiskit/circuit/library/generalized_gates/mcg_up_to_diagonal.py +4 -4
- qiskit/circuit/library/generalized_gates/permutation.py +8 -9
- qiskit/circuit/library/generalized_gates/uc.py +3 -3
- qiskit/circuit/library/generalized_gates/uc_pauli_rot.py +2 -2
- qiskit/circuit/library/generalized_gates/unitary.py +13 -11
- qiskit/circuit/library/graph_state.py +1 -1
- qiskit/circuit/library/hamiltonian_gate.py +1 -2
- qiskit/circuit/library/hidden_linear_function.py +1 -1
- qiskit/circuit/library/n_local/evolved_operator_ansatz.py +3 -2
- qiskit/circuit/library/n_local/n_local.py +4 -5
- qiskit/circuit/library/n_local/pauli_two_design.py +1 -1
- qiskit/circuit/library/n_local/qaoa_ansatz.py +6 -8
- qiskit/circuit/library/n_local/two_local.py +1 -1
- qiskit/circuit/library/overlap.py +11 -5
- qiskit/circuit/library/pauli_evolution.py +7 -3
- qiskit/circuit/library/standard_gates/dcx.py +3 -0
- qiskit/circuit/library/standard_gates/ecr.py +3 -0
- qiskit/circuit/library/standard_gates/global_phase.py +3 -0
- qiskit/circuit/library/standard_gates/h.py +13 -5
- qiskit/circuit/library/standard_gates/i.py +3 -0
- qiskit/circuit/library/standard_gates/iswap.py +3 -0
- qiskit/circuit/library/standard_gates/multi_control_rotation_gates.py +19 -10
- qiskit/circuit/library/standard_gates/p.py +14 -9
- qiskit/circuit/library/standard_gates/r.py +3 -0
- qiskit/circuit/library/standard_gates/rx.py +21 -6
- qiskit/circuit/library/standard_gates/rxx.py +40 -1
- qiskit/circuit/library/standard_gates/ry.py +21 -6
- qiskit/circuit/library/standard_gates/ryy.py +40 -1
- qiskit/circuit/library/standard_gates/rz.py +22 -6
- qiskit/circuit/library/standard_gates/rzx.py +40 -1
- qiskit/circuit/library/standard_gates/rzz.py +41 -2
- qiskit/circuit/library/standard_gates/s.py +77 -0
- qiskit/circuit/library/standard_gates/swap.py +12 -5
- qiskit/circuit/library/standard_gates/sx.py +14 -5
- qiskit/circuit/library/standard_gates/t.py +5 -0
- qiskit/circuit/library/standard_gates/u.py +22 -7
- qiskit/circuit/library/standard_gates/u1.py +8 -3
- qiskit/circuit/library/standard_gates/u2.py +3 -0
- qiskit/circuit/library/standard_gates/u3.py +22 -7
- qiskit/circuit/library/standard_gates/x.py +156 -92
- qiskit/circuit/library/standard_gates/xx_minus_yy.py +40 -1
- qiskit/circuit/library/standard_gates/xx_plus_yy.py +52 -11
- qiskit/circuit/library/standard_gates/y.py +6 -1
- qiskit/circuit/library/standard_gates/z.py +8 -1
- qiskit/circuit/operation.py +1 -1
- qiskit/circuit/parameter.py +9 -10
- qiskit/circuit/parameterexpression.py +16 -13
- qiskit/circuit/parametertable.py +1 -190
- qiskit/circuit/parametervector.py +1 -1
- qiskit/circuit/quantumcircuit.py +395 -387
- qiskit/circuit/quantumcircuitdata.py +3 -5
- qiskit/circuit/quantumregister.py +1 -1
- qiskit/circuit/random/__init__.py +1 -1
- qiskit/circuit/random/utils.py +175 -26
- qiskit/circuit/register.py +5 -7
- qiskit/circuit/singleton.py +3 -3
- qiskit/circuit/tools/pi_check.py +4 -4
- qiskit/compiler/assembler.py +95 -24
- qiskit/compiler/scheduler.py +2 -2
- qiskit/compiler/transpiler.py +42 -128
- qiskit/converters/circuit_to_dag.py +4 -6
- qiskit/converters/circuit_to_gate.py +4 -8
- qiskit/converters/circuit_to_instruction.py +5 -17
- qiskit/converters/dag_to_circuit.py +2 -6
- qiskit/dagcircuit/collect_blocks.py +2 -2
- qiskit/dagcircuit/dagcircuit.py +190 -187
- qiskit/dagcircuit/dagdependency.py +4 -4
- qiskit/dagcircuit/dagdependency_v2.py +4 -4
- qiskit/dagcircuit/dagdepnode.py +1 -1
- qiskit/dagcircuit/dagnode.py +66 -157
- qiskit/passmanager/flow_controllers.py +1 -1
- qiskit/passmanager/passmanager.py +3 -3
- qiskit/primitives/__init__.py +1 -5
- qiskit/primitives/backend_estimator.py +25 -15
- qiskit/primitives/backend_estimator_v2.py +31 -7
- qiskit/primitives/backend_sampler.py +21 -12
- qiskit/primitives/backend_sampler_v2.py +12 -3
- qiskit/primitives/base/base_estimator.py +31 -4
- qiskit/primitives/base/base_primitive.py +2 -2
- qiskit/primitives/base/base_result.py +2 -2
- qiskit/primitives/base/base_sampler.py +26 -2
- qiskit/primitives/base/estimator_result.py +2 -2
- qiskit/primitives/base/sampler_result.py +2 -2
- qiskit/primitives/containers/__init__.py +0 -1
- qiskit/primitives/containers/bindings_array.py +2 -2
- qiskit/primitives/containers/bit_array.py +108 -10
- qiskit/primitives/containers/shape.py +3 -3
- qiskit/primitives/estimator.py +9 -2
- qiskit/primitives/primitive_job.py +1 -1
- qiskit/primitives/sampler.py +10 -3
- qiskit/primitives/statevector_estimator.py +5 -3
- qiskit/primitives/statevector_sampler.py +11 -5
- qiskit/primitives/utils.py +16 -0
- qiskit/providers/backend.py +15 -6
- qiskit/providers/backend_compat.py +7 -4
- qiskit/providers/basic_provider/basic_provider_tools.py +1 -1
- qiskit/providers/basic_provider/basic_simulator.py +33 -25
- qiskit/providers/fake_provider/fake_backend.py +10 -3
- qiskit/providers/fake_provider/fake_openpulse_2q.py +157 -149
- qiskit/providers/fake_provider/fake_openpulse_3q.py +228 -220
- qiskit/providers/fake_provider/fake_pulse_backend.py +2 -1
- qiskit/providers/fake_provider/fake_qasm_backend.py +7 -2
- qiskit/providers/fake_provider/generic_backend_v2.py +514 -68
- qiskit/providers/models/__init__.py +48 -11
- qiskit/providers/models/backendconfiguration.py +50 -4
- qiskit/providers/models/backendproperties.py +13 -2
- qiskit/providers/models/pulsedefaults.py +10 -11
- qiskit/providers/options.py +13 -13
- qiskit/providers/providerutils.py +3 -1
- qiskit/pulse/configuration.py +8 -12
- qiskit/pulse/instruction_schedule_map.py +3 -5
- qiskit/pulse/instructions/acquire.py +7 -8
- qiskit/pulse/instructions/instruction.py +2 -3
- qiskit/pulse/library/samplers/decorators.py +5 -9
- qiskit/pulse/library/symbolic_pulses.py +4 -7
- qiskit/pulse/library/waveform.py +2 -5
- qiskit/pulse/macros.py +11 -6
- qiskit/pulse/parser.py +8 -10
- qiskit/pulse/schedule.py +9 -17
- qiskit/pulse/transforms/alignments.py +1 -3
- qiskit/pulse/utils.py +1 -2
- qiskit/qasm/libs/stdgates.inc +35 -28
- qiskit/qasm2/__init__.py +7 -7
- qiskit/qasm2/export.py +5 -9
- qiskit/qasm2/parse.py +1 -1
- qiskit/qasm3/ast.py +9 -25
- qiskit/qasm3/exporter.py +582 -479
- qiskit/qasm3/printer.py +7 -16
- qiskit/qobj/common.py +10 -0
- qiskit/qobj/converters/lo_config.py +9 -0
- qiskit/qobj/converters/pulse_instruction.py +13 -6
- qiskit/qobj/pulse_qobj.py +69 -15
- qiskit/qobj/qasm_qobj.py +72 -20
- qiskit/qobj/utils.py +9 -0
- qiskit/qpy/__init__.py +1 -1
- qiskit/qpy/binary_io/circuits.py +8 -5
- qiskit/qpy/binary_io/schedules.py +1 -1
- qiskit/qpy/binary_io/value.py +3 -3
- qiskit/qpy/interface.py +3 -2
- qiskit/qpy/type_keys.py +2 -2
- qiskit/quantum_info/operators/channel/quantum_channel.py +3 -6
- qiskit/quantum_info/operators/channel/superop.py +2 -2
- qiskit/quantum_info/operators/channel/transformations.py +1 -1
- qiskit/quantum_info/operators/dihedral/dihedral.py +3 -4
- qiskit/quantum_info/operators/dihedral/dihedral_circuits.py +1 -3
- qiskit/quantum_info/operators/dihedral/random.py +6 -3
- qiskit/quantum_info/operators/measures.py +2 -2
- qiskit/quantum_info/operators/op_shape.py +12 -20
- qiskit/quantum_info/operators/operator.py +14 -21
- qiskit/quantum_info/operators/predicates.py +1 -0
- qiskit/quantum_info/operators/symplectic/base_pauli.py +7 -11
- qiskit/quantum_info/operators/symplectic/clifford.py +1 -1
- qiskit/quantum_info/operators/symplectic/pauli.py +3 -3
- qiskit/quantum_info/operators/symplectic/pauli_list.py +9 -10
- qiskit/quantum_info/operators/symplectic/random.py +1 -1
- qiskit/quantum_info/operators/symplectic/sparse_pauli_op.py +15 -17
- qiskit/quantum_info/quaternion.py +1 -1
- qiskit/quantum_info/states/densitymatrix.py +5 -8
- qiskit/quantum_info/states/stabilizerstate.py +128 -37
- qiskit/quantum_info/states/statevector.py +4 -8
- qiskit/result/counts.py +2 -2
- qiskit/result/mitigation/correlated_readout_mitigator.py +2 -2
- qiskit/result/mitigation/local_readout_mitigator.py +2 -2
- qiskit/result/mitigation/utils.py +1 -3
- qiskit/result/models.py +17 -16
- qiskit/result/result.py +15 -20
- qiskit/scheduler/lowering.py +2 -2
- qiskit/synthesis/__init__.py +2 -1
- qiskit/synthesis/clifford/__init__.py +1 -1
- qiskit/synthesis/clifford/clifford_decompose_ag.py +2 -2
- qiskit/synthesis/clifford/clifford_decompose_bm.py +10 -240
- qiskit/synthesis/clifford/clifford_decompose_greedy.py +9 -303
- qiskit/synthesis/clifford/clifford_decompose_layers.py +25 -23
- qiskit/synthesis/cnotdihedral/cnotdihedral_decompose_full.py +1 -1
- qiskit/synthesis/cnotdihedral/cnotdihedral_decompose_general.py +1 -1
- qiskit/synthesis/discrete_basis/generate_basis_approximations.py +1 -1
- qiskit/synthesis/discrete_basis/solovay_kitaev.py +2 -2
- qiskit/synthesis/evolution/evolution_synthesis.py +4 -2
- qiskit/synthesis/evolution/lie_trotter.py +46 -19
- qiskit/synthesis/evolution/product_formula.py +111 -55
- qiskit/synthesis/evolution/qdrift.py +40 -10
- qiskit/synthesis/evolution/suzuki_trotter.py +43 -33
- qiskit/synthesis/linear/__init__.py +1 -0
- qiskit/synthesis/linear/cnot_synth.py +22 -96
- qiskit/synthesis/linear/linear_depth_lnn.py +8 -8
- qiskit/synthesis/linear/linear_matrix_utils.py +13 -161
- qiskit/synthesis/linear_phase/cnot_phase_synth.py +1 -1
- qiskit/synthesis/linear_phase/cx_cz_depth_lnn.py +3 -3
- qiskit/synthesis/linear_phase/cz_depth_lnn.py +1 -1
- qiskit/synthesis/one_qubit/one_qubit_decompose.py +29 -29
- qiskit/synthesis/permutation/permutation_full.py +5 -29
- qiskit/synthesis/permutation/permutation_lnn.py +2 -24
- qiskit/synthesis/permutation/permutation_utils.py +2 -59
- qiskit/synthesis/qft/__init__.py +1 -0
- qiskit/synthesis/qft/qft_decompose_full.py +79 -0
- qiskit/synthesis/qft/qft_decompose_lnn.py +17 -9
- qiskit/synthesis/stabilizer/stabilizer_circuit.py +6 -6
- qiskit/synthesis/stabilizer/stabilizer_decompose.py +2 -2
- qiskit/synthesis/two_qubit/local_invariance.py +8 -38
- qiskit/synthesis/two_qubit/two_qubit_decompose.py +48 -129
- qiskit/synthesis/unitary/aqc/cnot_structures.py +1 -1
- qiskit/synthesis/unitary/qsd.py +5 -3
- qiskit/transpiler/__init__.py +1 -0
- qiskit/transpiler/basepasses.py +1 -1
- qiskit/transpiler/coupling.py +3 -3
- qiskit/transpiler/instruction_durations.py +1 -2
- qiskit/transpiler/layout.py +3 -3
- qiskit/transpiler/passes/__init__.py +2 -0
- qiskit/transpiler/passes/basis/basis_translator.py +84 -64
- qiskit/transpiler/passes/basis/translate_parameterized.py +3 -5
- qiskit/transpiler/passes/basis/unroll_3q_or_more.py +1 -1
- qiskit/transpiler/passes/basis/unroll_custom_definitions.py +10 -10
- qiskit/transpiler/passes/calibration/rx_builder.py +3 -3
- qiskit/transpiler/passes/calibration/rzx_builder.py +3 -3
- qiskit/transpiler/passes/layout/apply_layout.py +13 -3
- qiskit/transpiler/passes/layout/sabre_layout.py +10 -8
- qiskit/transpiler/passes/layout/sabre_pre_layout.py +4 -1
- qiskit/transpiler/passes/layout/set_layout.py +2 -2
- qiskit/transpiler/passes/layout/vf2_layout.py +1 -1
- qiskit/transpiler/passes/layout/vf2_utils.py +3 -3
- qiskit/transpiler/passes/optimization/__init__.py +1 -0
- qiskit/transpiler/passes/optimization/collect_multiqubit_blocks.py +2 -2
- qiskit/transpiler/passes/optimization/commutation_analysis.py +7 -10
- qiskit/transpiler/passes/optimization/commutative_cancellation.py +35 -19
- qiskit/transpiler/passes/optimization/consolidate_blocks.py +17 -8
- qiskit/transpiler/passes/optimization/inverse_cancellation.py +6 -6
- qiskit/transpiler/passes/optimization/optimize_1q_decomposition.py +64 -41
- qiskit/transpiler/passes/optimization/optimize_1q_gates.py +1 -1
- qiskit/transpiler/passes/optimization/split_2q_unitaries.py +83 -0
- qiskit/transpiler/passes/optimization/template_matching/backward_match.py +1 -1
- qiskit/transpiler/passes/optimization/template_matching/forward_match.py +2 -2
- qiskit/transpiler/passes/optimization/template_matching/template_substitution.py +1 -1
- qiskit/transpiler/passes/routing/commuting_2q_gate_routing/commuting_2q_gate_router.py +3 -2
- qiskit/transpiler/passes/routing/commuting_2q_gate_routing/swap_strategy.py +1 -1
- qiskit/transpiler/passes/routing/layout_transformation.py +2 -1
- qiskit/transpiler/passes/routing/sabre_swap.py +35 -26
- qiskit/transpiler/passes/routing/star_prerouting.py +80 -105
- qiskit/transpiler/passes/routing/stochastic_swap.py +1 -3
- qiskit/transpiler/passes/scheduling/alap.py +1 -2
- qiskit/transpiler/passes/scheduling/alignments/__init__.py +2 -2
- qiskit/transpiler/passes/scheduling/alignments/check_durations.py +1 -1
- qiskit/transpiler/passes/scheduling/alignments/pulse_gate_validation.py +2 -2
- qiskit/transpiler/passes/scheduling/alignments/reschedule.py +1 -1
- qiskit/transpiler/passes/scheduling/asap.py +1 -2
- qiskit/transpiler/passes/scheduling/base_scheduler.py +5 -5
- qiskit/transpiler/passes/scheduling/dynamical_decoupling.py +3 -3
- qiskit/transpiler/passes/scheduling/padding/base_padding.py +1 -1
- qiskit/transpiler/passes/scheduling/padding/dynamical_decoupling.py +20 -14
- qiskit/transpiler/passes/scheduling/scheduling/base_scheduler.py +7 -6
- qiskit/transpiler/passes/scheduling/time_unit_conversion.py +4 -3
- qiskit/transpiler/passes/synthesis/high_level_synthesis.py +211 -36
- qiskit/transpiler/passes/synthesis/plugin.py +2 -2
- qiskit/transpiler/passes/synthesis/unitary_synthesis.py +80 -40
- qiskit/transpiler/passes/utils/__init__.py +0 -1
- qiskit/transpiler/passes/utils/check_gate_direction.py +4 -4
- qiskit/transpiler/passes/utils/check_map.py +3 -6
- qiskit/transpiler/passes/utils/convert_conditions_to_if_ops.py +3 -4
- qiskit/transpiler/passes/utils/error.py +2 -2
- qiskit/transpiler/passes/utils/fixed_point.py +3 -3
- qiskit/transpiler/passes/utils/gate_direction.py +1 -1
- qiskit/transpiler/passes/utils/gates_basis.py +1 -2
- qiskit/transpiler/passmanager.py +7 -6
- qiskit/transpiler/preset_passmanagers/__init__.py +4 -228
- qiskit/transpiler/preset_passmanagers/builtin_plugins.py +73 -18
- qiskit/transpiler/preset_passmanagers/common.py +3 -6
- qiskit/transpiler/preset_passmanagers/generate_preset_pass_manager.py +518 -0
- qiskit/transpiler/preset_passmanagers/level0.py +1 -1
- qiskit/transpiler/target.py +27 -8
- qiskit/user_config.py +29 -6
- qiskit/utils/classtools.py +3 -3
- qiskit/utils/deprecation.py +3 -2
- qiskit/utils/lazy_tester.py +2 -2
- qiskit/utils/optionals.py +8 -8
- qiskit/visualization/bloch.py +18 -23
- qiskit/visualization/circuit/_utils.py +34 -10
- qiskit/visualization/circuit/circuit_visualization.py +23 -16
- qiskit/visualization/circuit/latex.py +29 -27
- qiskit/visualization/circuit/matplotlib.py +4 -2
- qiskit/visualization/circuit/qcstyle.py +2 -2
- qiskit/visualization/circuit/text.py +9 -15
- qiskit/visualization/dag_visualization.py +2 -2
- qiskit/visualization/pulse_v2/core.py +1 -1
- qiskit/visualization/pulse_v2/events.py +1 -1
- qiskit/visualization/pulse_v2/generators/frame.py +3 -4
- qiskit/visualization/pulse_v2/generators/waveform.py +5 -9
- qiskit/visualization/pulse_v2/layouts.py +1 -5
- qiskit/visualization/pulse_v2/plotters/matplotlib.py +1 -2
- qiskit/visualization/state_visualization.py +5 -6
- qiskit/visualization/timeline/plotters/matplotlib.py +1 -2
- qiskit/visualization/transition_visualization.py +7 -2
- {qiskit-1.1.2.dist-info → qiskit-1.2.0.dist-info}/METADATA +12 -12
- {qiskit-1.1.2.dist-info → qiskit-1.2.0.dist-info}/RECORD +342 -340
- {qiskit-1.1.2.dist-info → qiskit-1.2.0.dist-info}/entry_points.txt +3 -0
- qiskit/transpiler/passes/utils/block_to_matrix.py +0 -47
- {qiskit-1.1.2.dist-info → qiskit-1.2.0.dist-info}/LICENSE.txt +0 -0
- {qiskit-1.1.2.dist-info → qiskit-1.2.0.dist-info}/WHEEL +0 -0
- {qiskit-1.1.2.dist-info → qiskit-1.2.0.dist-info}/top_level.txt +0 -0
@@ -38,15 +38,52 @@ Classes
|
|
38
38
|
GateProperties
|
39
39
|
Nduv
|
40
40
|
"""
|
41
|
+
# pylint: disable=undefined-all-variable
|
42
|
+
__all__ = [
|
43
|
+
"BackendConfiguration",
|
44
|
+
"PulseBackendConfiguration",
|
45
|
+
"QasmBackendConfiguration",
|
46
|
+
"UchannelLO",
|
47
|
+
"GateConfig",
|
48
|
+
"BackendProperties",
|
49
|
+
"GateProperties",
|
50
|
+
"Nduv",
|
51
|
+
"BackendStatus",
|
52
|
+
"JobStatus",
|
53
|
+
"PulseDefaults",
|
54
|
+
"Command",
|
55
|
+
]
|
41
56
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
57
|
+
import importlib
|
58
|
+
import warnings
|
59
|
+
|
60
|
+
|
61
|
+
_NAME_MAP = {
|
62
|
+
# public object name mapped to containing module
|
63
|
+
"BackendConfiguration": "qiskit.providers.models.backendconfiguration",
|
64
|
+
"PulseBackendConfiguration": "qiskit.providers.models.backendconfiguration",
|
65
|
+
"QasmBackendConfiguration": "qiskit.providers.models.backendconfiguration",
|
66
|
+
"UchannelLO": "qiskit.providers.models.backendconfiguration",
|
67
|
+
"GateConfig": "qiskit.providers.models.backendconfiguration",
|
68
|
+
"BackendProperties": "qiskit.providers.models.backendproperties",
|
69
|
+
"GateProperties": "qiskit.providers.models.backendproperties",
|
70
|
+
"Nduv": "qiskit.providers.models.backendproperties",
|
71
|
+
"BackendStatus": "qiskit.providers.models.backendstatus",
|
72
|
+
"JobStatus": "qiskit.providers.models.jobstatus",
|
73
|
+
"PulseDefaults": "qiskit.providers.models.pulsedefaults",
|
74
|
+
"Command": "qiskit.providers.models.pulsedefaults",
|
75
|
+
}
|
76
|
+
|
77
|
+
|
78
|
+
def __getattr__(name):
|
79
|
+
if (module_name := _NAME_MAP.get(name)) is not None:
|
80
|
+
warnings.warn(
|
81
|
+
"qiskit.providers.models is deprecated since Qiskit 1.2 and will be "
|
82
|
+
"removed in Qiskit 2.0. With the removal of Qobj, there is no need for these "
|
83
|
+
"schema-conformant objects. If you still need to use them, it could be because "
|
84
|
+
"you are using a BackendV1, which is also deprecated in favor of BackendV2.",
|
85
|
+
DeprecationWarning,
|
86
|
+
stacklevel=2,
|
87
|
+
)
|
88
|
+
return getattr(importlib.import_module(module_name), name)
|
89
|
+
raise AttributeError(f"module 'qiskit.providers.models' has no attribute '{name}'")
|
@@ -26,6 +26,7 @@ from qiskit.pulse.channels import (
|
|
26
26
|
DriveChannel,
|
27
27
|
MeasureChannel,
|
28
28
|
)
|
29
|
+
from qiskit.utils import deprecate_func
|
29
30
|
|
30
31
|
|
31
32
|
class GateConfig:
|
@@ -38,6 +39,15 @@ class GateConfig:
|
|
38
39
|
and CX.
|
39
40
|
"""
|
40
41
|
|
42
|
+
@deprecate_func(
|
43
|
+
since="1.2",
|
44
|
+
removal_timeline="in the 2.0 release",
|
45
|
+
additional_msg="The models in ``qiskit.providers.models`` are part "
|
46
|
+
"of the deprecated `BackendV1` workflow and no longer necessary for `BackendV2`. If a user "
|
47
|
+
"workflow requires these representations it likely relies on deprecated functionality and "
|
48
|
+
"should be updated to use `BackendV2`.",
|
49
|
+
stacklevel=3,
|
50
|
+
)
|
41
51
|
def __init__(
|
42
52
|
self,
|
43
53
|
name,
|
@@ -141,6 +151,14 @@ class UchannelLO:
|
|
141
151
|
scale: Scale factor for qubit frequency.
|
142
152
|
"""
|
143
153
|
|
154
|
+
@deprecate_func(
|
155
|
+
since="1.2",
|
156
|
+
removal_timeline="in the 2.0 release",
|
157
|
+
additional_msg="The models in ``qiskit.providers.models`` are part "
|
158
|
+
"of the deprecated `BackendV1` workflow and no longer necessary for `BackendV2`. If a user "
|
159
|
+
"workflow requires these representations it likely relies on deprecated functionality and "
|
160
|
+
"should be updated to use `BackendV2`.",
|
161
|
+
)
|
144
162
|
def __init__(self, q, scale):
|
145
163
|
"""Initialize a UchannelLOSchema object
|
146
164
|
|
@@ -211,6 +229,15 @@ class QasmBackendConfiguration:
|
|
211
229
|
|
212
230
|
_data = {}
|
213
231
|
|
232
|
+
@deprecate_func(
|
233
|
+
since="1.2",
|
234
|
+
removal_timeline="in the 2.0 release",
|
235
|
+
additional_msg="The models in ``qiskit.providers.models`` are part "
|
236
|
+
"of the deprecated `BackendV1` workflow and no longer necessary for `BackendV2`. If a user "
|
237
|
+
"workflow requires these representations it likely relies on deprecated functionality and "
|
238
|
+
"should be updated to use `BackendV2`.",
|
239
|
+
stacklevel=3,
|
240
|
+
)
|
214
241
|
def __init__(
|
215
242
|
self,
|
216
243
|
backend_name,
|
@@ -491,9 +518,19 @@ class QasmBackendConfiguration:
|
|
491
518
|
|
492
519
|
|
493
520
|
class BackendConfiguration(QasmBackendConfiguration):
|
494
|
-
"""Backwards
|
521
|
+
"""Backwards compatibility shim representing an abstract backend configuration."""
|
495
522
|
|
496
|
-
|
523
|
+
@deprecate_func(
|
524
|
+
since="1.2",
|
525
|
+
removal_timeline="in the 2.0 release",
|
526
|
+
additional_msg="The models in ``qiskit.providers.models`` are part "
|
527
|
+
"of the deprecated `BackendV1` workflow and no longer necessary for `BackendV2`. If a user "
|
528
|
+
"workflow requires these representations it likely relies on deprecated functionality and "
|
529
|
+
"should be updated to use `BackendV2`.",
|
530
|
+
stacklevel=3,
|
531
|
+
)
|
532
|
+
def __init__(self, *args, **kwargs):
|
533
|
+
super().__init__(*args, **kwargs)
|
497
534
|
|
498
535
|
|
499
536
|
class PulseBackendConfiguration(QasmBackendConfiguration):
|
@@ -501,6 +538,15 @@ class PulseBackendConfiguration(QasmBackendConfiguration):
|
|
501
538
|
about the set up of the device which can be useful for building Pulse programs.
|
502
539
|
"""
|
503
540
|
|
541
|
+
@deprecate_func(
|
542
|
+
since="1.2",
|
543
|
+
removal_timeline="in the 2.0 release",
|
544
|
+
additional_msg="The models in ``qiskit.providers.models`` are part "
|
545
|
+
"of the deprecated `BackendV1` workflow and no longer necessary for `BackendV2`. If a user "
|
546
|
+
"workflow requires these representations it likely relies on deprecated functionality and "
|
547
|
+
"should be updated to use `BackendV2`.",
|
548
|
+
stacklevel=3,
|
549
|
+
)
|
504
550
|
def __init__(
|
505
551
|
self,
|
506
552
|
backend_name: str,
|
@@ -892,9 +938,9 @@ class PulseBackendConfiguration(QasmBackendConfiguration):
|
|
892
938
|
channels = set()
|
893
939
|
try:
|
894
940
|
if isinstance(qubit, int):
|
895
|
-
for key in self._qubit_channel_map.
|
941
|
+
for key, value in self._qubit_channel_map.items():
|
896
942
|
if qubit in key:
|
897
|
-
channels.update(
|
943
|
+
channels.update(value)
|
898
944
|
if len(channels) == 0:
|
899
945
|
raise KeyError
|
900
946
|
elif isinstance(qubit, list):
|
@@ -18,6 +18,7 @@ from typing import Any, Iterable, Tuple, Union, Dict
|
|
18
18
|
import dateutil.parser
|
19
19
|
|
20
20
|
from qiskit.providers.exceptions import BackendPropertyError
|
21
|
+
from qiskit.utils import deprecate_func
|
21
22
|
from qiskit.utils.units import apply_prefix
|
22
23
|
|
23
24
|
PropertyT = Tuple[Any, datetime.datetime]
|
@@ -172,6 +173,15 @@ class BackendProperties:
|
|
172
173
|
|
173
174
|
_data = {}
|
174
175
|
|
176
|
+
@deprecate_func(
|
177
|
+
since="1.2",
|
178
|
+
removal_timeline="in the 2.0 release",
|
179
|
+
additional_msg="The models in ``qiskit.providers.models`` and related objects are part "
|
180
|
+
"of the deprecated `BackendV1` workflow, and no longer necessary for `BackendV2`. If a user "
|
181
|
+
"workflow requires these representations it likely relies on deprecated functionality and "
|
182
|
+
"should be updated to use `BackendV2`.",
|
183
|
+
stacklevel=3,
|
184
|
+
)
|
175
185
|
def __init__(
|
176
186
|
self, backend_name, backend_version, last_update_date, qubits, gates, general, **kwargs
|
177
187
|
):
|
@@ -248,6 +258,7 @@ class BackendProperties:
|
|
248
258
|
qubits.append(nduvs)
|
249
259
|
gates = [GateProperties.from_dict(x) for x in in_data.pop("gates")]
|
250
260
|
general = [Nduv.from_dict(x) for x in in_data.pop("general")]
|
261
|
+
|
251
262
|
return cls(
|
252
263
|
backend_name, backend_version, last_update_date, qubits, gates, general, **in_data
|
253
264
|
)
|
@@ -404,9 +415,9 @@ class BackendProperties:
|
|
404
415
|
if name is not None:
|
405
416
|
result = result[name]
|
406
417
|
except KeyError as ex:
|
418
|
+
formatted_name = "y '" + name + "'" if name else "ies"
|
407
419
|
raise BackendPropertyError(
|
408
|
-
"Couldn't find the propert{
|
409
|
-
"{qubit}.".format(name="y '" + name + "'" if name else "ies", qubit=qubit)
|
420
|
+
f"Couldn't find the propert{formatted_name} for qubit {qubit}."
|
410
421
|
) from ex
|
411
422
|
return result
|
412
423
|
|
@@ -12,6 +12,7 @@
|
|
12
12
|
|
13
13
|
|
14
14
|
"""Model and schema for pulse defaults."""
|
15
|
+
import warnings
|
15
16
|
from typing import Any, Dict, List
|
16
17
|
|
17
18
|
from qiskit.pulse.instruction_schedule_map import InstructionScheduleMap, PulseQobjDef
|
@@ -271,7 +272,7 @@ class PulseDefaults:
|
|
271
272
|
PulseDefaults: The PulseDefaults from the input dictionary.
|
272
273
|
"""
|
273
274
|
schema = {
|
274
|
-
"pulse_library": PulseLibraryItem,
|
275
|
+
"pulse_library": PulseLibraryItem, # The class PulseLibraryItem is deprecated
|
275
276
|
"cmd_def": Command,
|
276
277
|
"meas_kernel": MeasurementKernel,
|
277
278
|
"discriminator": Discriminator,
|
@@ -282,10 +283,13 @@ class PulseDefaults:
|
|
282
283
|
in_data = {}
|
283
284
|
for key, value in data.items():
|
284
285
|
if key in schema:
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
286
|
+
with warnings.catch_warnings():
|
287
|
+
# The class PulseLibraryItem is deprecated
|
288
|
+
warnings.filterwarnings("ignore", category=DeprecationWarning, module="qiskit")
|
289
|
+
if isinstance(value, list):
|
290
|
+
in_data[key] = list(map(schema[key].from_dict, value))
|
291
|
+
else:
|
292
|
+
in_data[key] = schema[key].from_dict(value)
|
289
293
|
else:
|
290
294
|
in_data[key] = value
|
291
295
|
|
@@ -296,9 +300,4 @@ class PulseDefaults:
|
|
296
300
|
meas_freqs = [freq / 1e9 for freq in self.meas_freq_est]
|
297
301
|
qfreq = f"Qubit Frequencies [GHz]\n{qubit_freqs}"
|
298
302
|
mfreq = f"Measurement Frequencies [GHz]\n{meas_freqs} "
|
299
|
-
return "<{
|
300
|
-
name=self.__class__.__name__,
|
301
|
-
insts=str(self.instruction_schedule_map),
|
302
|
-
qfreq=qfreq,
|
303
|
-
mfreq=mfreq,
|
304
|
-
)
|
303
|
+
return f"<{self.__class__.__name__}({str(self.instruction_schedule_map)}{qfreq}\n{mfreq})>"
|
qiskit/providers/options.py
CHANGED
@@ -116,7 +116,7 @@ class Options(Mapping):
|
|
116
116
|
def __setitem__(self, key, value):
|
117
117
|
self.update_options(**{key: value})
|
118
118
|
|
119
|
-
# backwards-
|
119
|
+
# backwards-compatibility with Qiskit Experiments:
|
120
120
|
|
121
121
|
@property
|
122
122
|
def __dict__(self):
|
@@ -154,7 +154,7 @@ class Options(Mapping):
|
|
154
154
|
|
155
155
|
The returned option and validator values are shallow copies of the originals.
|
156
156
|
"""
|
157
|
-
out = self.__new__(type(self))
|
157
|
+
out = self.__new__(type(self)) # pylint:disable=no-value-for-parameter
|
158
158
|
out.__setstate__((self._fields.copy(), self.validator.copy()))
|
159
159
|
return out
|
160
160
|
|
@@ -170,7 +170,7 @@ class Options(Mapping):
|
|
170
170
|
|
171
171
|
def __repr__(self):
|
172
172
|
items = (f"{k}={v!r}" for k, v in self._fields.items())
|
173
|
-
return "{
|
173
|
+
return f"{type(self).__name__}({', '.join(items)})"
|
174
174
|
|
175
175
|
def __eq__(self, other):
|
176
176
|
if isinstance(self, Options) and isinstance(other, Options):
|
@@ -211,7 +211,7 @@ class Options(Mapping):
|
|
211
211
|
"""
|
212
212
|
|
213
213
|
if field not in self._fields:
|
214
|
-
raise KeyError("Field '
|
214
|
+
raise KeyError(f"Field '{field}' is not present in this options object")
|
215
215
|
if isinstance(validator_value, tuple):
|
216
216
|
if len(validator_value) != 2:
|
217
217
|
raise ValueError(
|
@@ -229,28 +229,28 @@ class Options(Mapping):
|
|
229
229
|
f"{type(validator_value)} is not a valid validator type, it "
|
230
230
|
"must be a tuple, list, or class/type"
|
231
231
|
)
|
232
|
-
self.validator[field] = validator_value
|
232
|
+
self.validator[field] = validator_value # pylint: disable=unsupported-assignment-operation
|
233
233
|
|
234
234
|
def update_options(self, **fields):
|
235
235
|
"""Update options with kwargs"""
|
236
|
-
for field in fields:
|
237
|
-
field_validator = self.validator.get(
|
236
|
+
for field_name, field in fields.items():
|
237
|
+
field_validator = self.validator.get(field_name, None)
|
238
238
|
if isinstance(field_validator, tuple):
|
239
|
-
if
|
239
|
+
if field > field_validator[1] or field < field_validator[0]:
|
240
240
|
raise ValueError(
|
241
|
-
f"Specified value for '{
|
241
|
+
f"Specified value for '{field_name}' is not a valid value, "
|
242
242
|
f"must be >={field_validator[0]} or <={field_validator[1]}"
|
243
243
|
)
|
244
244
|
elif isinstance(field_validator, list):
|
245
|
-
if
|
245
|
+
if field not in field_validator:
|
246
246
|
raise ValueError(
|
247
|
-
f"Specified value for {
|
247
|
+
f"Specified value for {field_name} is not a valid choice, "
|
248
248
|
f"must be one of {field_validator}"
|
249
249
|
)
|
250
250
|
elif isinstance(field_validator, type):
|
251
|
-
if not isinstance(
|
251
|
+
if not isinstance(field, field_validator):
|
252
252
|
raise TypeError(
|
253
|
-
f"Specified value for {
|
253
|
+
f"Specified value for {field_name} is not of required type {field_validator}"
|
254
254
|
)
|
255
255
|
|
256
256
|
self._fields.update(fields)
|
@@ -21,7 +21,9 @@ from qiskit.providers.backend import Backend
|
|
21
21
|
logger = logging.getLogger(__name__)
|
22
22
|
|
23
23
|
|
24
|
-
def filter_backends(
|
24
|
+
def filter_backends(
|
25
|
+
backends: list[Backend], filters: Callable[[Backend], bool] | None = None, **kwargs
|
26
|
+
) -> list[Backend]:
|
25
27
|
"""Return the backends matching the specified filtering.
|
26
28
|
|
27
29
|
Filter the `backends` list by their `configuration` or `status`
|
qiskit/pulse/configuration.py
CHANGED
@@ -55,11 +55,9 @@ class Kernel:
|
|
55
55
|
self.params = params
|
56
56
|
|
57
57
|
def __repr__(self):
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
", ".join(f"{str(k)}={str(v)}" for k, v in self.params.items()),
|
62
|
-
)
|
58
|
+
name_repr = "'" + self.name + "', "
|
59
|
+
params_repr = ", ".join(f"{str(k)}={str(v)}" for k, v in self.params.items())
|
60
|
+
return f"{self.__class__.__name__}({name_repr}{params_repr})"
|
63
61
|
|
64
62
|
def __eq__(self, other):
|
65
63
|
if isinstance(other, Kernel):
|
@@ -83,11 +81,9 @@ class Discriminator:
|
|
83
81
|
self.params = params
|
84
82
|
|
85
83
|
def __repr__(self):
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
", ".join(f"{str(k)}={str(v)}" for k, v in self.params.items()),
|
90
|
-
)
|
84
|
+
name_repr = "'" + self.name + "', " or ""
|
85
|
+
params_repr = ", ".join(f"{str(k)}={str(v)}" for k, v in self.params.items())
|
86
|
+
return f"{self.__class__.__name__}({name_repr}{params_repr})"
|
91
87
|
|
92
88
|
def __eq__(self, other):
|
93
89
|
if isinstance(other, Discriminator):
|
@@ -184,7 +180,7 @@ class LoConfig:
|
|
184
180
|
self.check_lo(channel, freq)
|
185
181
|
self._m_lo_freq[channel] = freq
|
186
182
|
else:
|
187
|
-
raise PulseError("Specified channel
|
183
|
+
raise PulseError(f"Specified channel {channel.name} cannot be configured.")
|
188
184
|
|
189
185
|
def add_lo_range(
|
190
186
|
self, channel: DriveChannel | MeasureChannel, lo_range: LoRange | tuple[int, int]
|
@@ -236,7 +232,7 @@ class LoConfig:
|
|
236
232
|
if channel in self.meas_los:
|
237
233
|
return self.meas_los[channel]
|
238
234
|
|
239
|
-
raise PulseError("Channel
|
235
|
+
raise PulseError(f"Channel {channel} is not configured")
|
240
236
|
|
241
237
|
@property
|
242
238
|
def qubit_los(self) -> dict[DriveChannel, float]:
|
@@ -169,10 +169,8 @@ class InstructionScheduleMap:
|
|
169
169
|
if not self.has(instruction, _to_tuple(qubits)):
|
170
170
|
if instruction in self._map:
|
171
171
|
raise PulseError(
|
172
|
-
"Operation '{
|
173
|
-
"{
|
174
|
-
inst=instruction, qubits=self.qubits_with_instruction(instruction)
|
175
|
-
)
|
172
|
+
f"Operation '{instruction}' exists, but is only defined for qubits "
|
173
|
+
f"{self.qubits_with_instruction(instruction)}."
|
176
174
|
)
|
177
175
|
raise PulseError(f"Operation '{instruction}' is not defined for this system.")
|
178
176
|
|
@@ -250,7 +248,7 @@ class InstructionScheduleMap:
|
|
250
248
|
|
251
249
|
# validation of target qubit
|
252
250
|
qubits = _to_tuple(qubits)
|
253
|
-
if qubits
|
251
|
+
if not qubits:
|
254
252
|
raise PulseError(f"Cannot add definition {instruction} with no target qubits.")
|
255
253
|
|
256
254
|
# generate signature
|
@@ -138,12 +138,11 @@ class Acquire(Instruction):
|
|
138
138
|
return isinstance(self.duration, ParameterExpression) or super().is_parameterized()
|
139
139
|
|
140
140
|
def __repr__(self) -> str:
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
",
|
147
|
-
",
|
148
|
-
", " + str(self.discriminator) if self.discriminator else "",
|
141
|
+
mem_slot_repr = str(self.mem_slot) if self.mem_slot else ""
|
142
|
+
reg_slot_repr = str(self.reg_slot) if self.reg_slot else ""
|
143
|
+
kernel_repr = str(self.kernel) if self.kernel else ""
|
144
|
+
discriminator_repr = str(self.discriminator) if self.discriminator else ""
|
145
|
+
return (
|
146
|
+
f"{self.__class__.__name__}({self.duration}, {str(self.channel)}, "
|
147
|
+
f"{mem_slot_repr}, {reg_slot_repr}, {kernel_repr}, {discriminator_repr})"
|
149
148
|
)
|
@@ -264,6 +264,5 @@ class Instruction(ABC):
|
|
264
264
|
|
265
265
|
def __repr__(self) -> str:
|
266
266
|
operands = ", ".join(str(op) for op in self.operands)
|
267
|
-
|
268
|
-
|
269
|
-
)
|
267
|
+
name_repr = f", name='{self.name}'" if self.name else ""
|
268
|
+
return f"{self.__class__.__name__}({operands}{name_repr})"
|
@@ -182,9 +182,9 @@ def _update_docstring(discretized_pulse: Callable, sampler_inst: Callable) -> Ca
|
|
182
182
|
header, body = wrapped_docstring.split("\n", 1)
|
183
183
|
body = textwrap.indent(body, " ")
|
184
184
|
wrapped_docstring = header + body
|
185
|
-
updated_ds = """
|
186
|
-
Discretized continuous pulse function: `{
|
187
|
-
sampler: `{
|
185
|
+
updated_ds = f"""
|
186
|
+
Discretized continuous pulse function: `{discretized_pulse.__name__}` using
|
187
|
+
sampler: `{sampler_inst.__name__}`.
|
188
188
|
|
189
189
|
The first argument (time) of the continuous pulse function has been replaced with
|
190
190
|
a discretized `duration` of type (int).
|
@@ -198,12 +198,8 @@ def _update_docstring(discretized_pulse: Callable, sampler_inst: Callable) -> Ca
|
|
198
198
|
|
199
199
|
Sampled continuous function:
|
200
200
|
|
201
|
-
{
|
202
|
-
"""
|
203
|
-
continuous_name=discretized_pulse.__name__,
|
204
|
-
sampler_name=sampler_inst.__name__,
|
205
|
-
continuous_doc=wrapped_docstring,
|
206
|
-
)
|
201
|
+
{wrapped_docstring}
|
202
|
+
"""
|
207
203
|
|
208
204
|
discretized_pulse.__doc__ = updated_ds
|
209
205
|
return discretized_pulse
|
@@ -570,11 +570,8 @@ class SymbolicPulse(Pulse):
|
|
570
570
|
|
571
571
|
def __repr__(self) -> str:
|
572
572
|
param_repr = ", ".join(f"{p}={v}" for p, v in self.parameters.items())
|
573
|
-
|
574
|
-
|
575
|
-
param_repr,
|
576
|
-
f", name='{self.name}'" if self.name is not None else "",
|
577
|
-
)
|
573
|
+
name_repr = f", name='{self.name}'" if self.name is not None else ""
|
574
|
+
return f"{self._pulse_type}({param_repr}{name_repr})"
|
578
575
|
|
579
576
|
__hash__ = None
|
580
577
|
|
@@ -677,8 +674,8 @@ class ScalableSymbolicPulse(SymbolicPulse):
|
|
677
674
|
if not np.isclose(complex_amp1, complex_amp2):
|
678
675
|
return False
|
679
676
|
|
680
|
-
for key in self.parameters:
|
681
|
-
if key not in ["amp", "angle"] and
|
677
|
+
for key, value in self.parameters.items():
|
678
|
+
if key not in ["amp", "angle"] and value != other.parameters[key]:
|
682
679
|
return False
|
683
680
|
|
684
681
|
return True
|
qiskit/pulse/library/waveform.py
CHANGED
@@ -130,8 +130,5 @@ class Waveform(Pulse):
|
|
130
130
|
opt = np.get_printoptions()
|
131
131
|
np.set_printoptions(threshold=50)
|
132
132
|
np.set_printoptions(**opt)
|
133
|
-
|
134
|
-
|
135
|
-
repr(self.samples),
|
136
|
-
f", name='{self.name}'" if self.name is not None else "",
|
137
|
-
)
|
133
|
+
name_repr = f", name='{self.name}'" if self.name is not None else ""
|
134
|
+
return f"{self.__class__.__name__}({repr(self.samples)}{name_repr})"
|
qiskit/pulse/macros.py
CHANGED
@@ -124,16 +124,21 @@ def _measure_v1(
|
|
124
124
|
for qubit in qubits:
|
125
125
|
measure_groups.add(tuple(meas_map[qubit]))
|
126
126
|
for measure_group_qubits in measure_groups:
|
127
|
-
|
128
|
-
|
127
|
+
|
128
|
+
unused_mem_slots = (
|
129
|
+
set()
|
130
|
+
if qubit_mem_slots is None
|
131
|
+
else set(measure_group_qubits) - set(qubit_mem_slots.values())
|
132
|
+
)
|
133
|
+
|
129
134
|
try:
|
130
135
|
default_sched = inst_map.get(measure_name, measure_group_qubits)
|
131
136
|
except exceptions.PulseError as ex:
|
132
137
|
raise exceptions.PulseError(
|
133
|
-
"We could not find a default measurement schedule called '{}'. "
|
138
|
+
f"We could not find a default measurement schedule called '{measure_name}'. "
|
134
139
|
"Please provide another name using the 'measure_name' keyword "
|
135
140
|
"argument. For assistance, the instructions which are defined are: "
|
136
|
-
"{
|
141
|
+
f"{inst_map.instructions}"
|
137
142
|
) from ex
|
138
143
|
for time, inst in default_sched.instructions:
|
139
144
|
if inst.channel.index not in qubits:
|
@@ -198,10 +203,10 @@ def _measure_v2(
|
|
198
203
|
schedule += _schedule_remapping_memory_slot(default_sched, qubit_mem_slots)
|
199
204
|
except KeyError as ex:
|
200
205
|
raise exceptions.PulseError(
|
201
|
-
"We could not find a default measurement schedule called '{}'. "
|
206
|
+
f"We could not find a default measurement schedule called '{measure_name}'. "
|
202
207
|
"Please provide another name using the 'measure_name' keyword "
|
203
208
|
"argument. For assistance, the instructions which are defined are: "
|
204
|
-
"{
|
209
|
+
f"{target.instructions}"
|
205
210
|
) from ex
|
206
211
|
return schedule
|
207
212
|
|
qiskit/pulse/parser.py
CHANGED
@@ -120,17 +120,15 @@ class PulseExpression(ast.NodeTransformer):
|
|
120
120
|
if kwargs:
|
121
121
|
for key, val in kwargs.items():
|
122
122
|
if key in self.params:
|
123
|
-
if key not in self._locals_dict
|
123
|
+
if key not in self._locals_dict:
|
124
124
|
self._locals_dict[key] = val
|
125
125
|
else:
|
126
126
|
raise PulseError(
|
127
|
-
"
|
128
|
-
% (self.__class__.__name__, key)
|
127
|
+
f"{self.__class__.__name__} got multiple values for argument '{key}'"
|
129
128
|
)
|
130
129
|
else:
|
131
130
|
raise PulseError(
|
132
|
-
"
|
133
|
-
% (self.__class__.__name__, key)
|
131
|
+
f"{self.__class__.__name__} got an unexpected keyword argument '{key}'"
|
134
132
|
)
|
135
133
|
|
136
134
|
expr = self.visit(self._tree)
|
@@ -139,7 +137,7 @@ class PulseExpression(ast.NodeTransformer):
|
|
139
137
|
if self._partial_binding:
|
140
138
|
return PulseExpression(expr, self._partial_binding)
|
141
139
|
else:
|
142
|
-
raise PulseError("Parameters
|
140
|
+
raise PulseError(f"Parameters {self.params} are not all bound.")
|
143
141
|
return expr.body.value
|
144
142
|
|
145
143
|
@staticmethod
|
@@ -160,7 +158,7 @@ class PulseExpression(ast.NodeTransformer):
|
|
160
158
|
for op_type, op_func in opr_dict.items():
|
161
159
|
if isinstance(opr, op_type):
|
162
160
|
return op_func(*args)
|
163
|
-
raise PulseError("Operator
|
161
|
+
raise PulseError(f"Operator {opr.__class__.__name__} is not supported.")
|
164
162
|
|
165
163
|
def visit_Expression(self, node: ast.Expression) -> ast.Expression:
|
166
164
|
"""Evaluate children nodes of expression.
|
@@ -272,8 +270,8 @@ class PulseExpression(ast.NodeTransformer):
|
|
272
270
|
node = copy.copy(node)
|
273
271
|
node.args = [self.visit(arg) for arg in node.args]
|
274
272
|
if all(isinstance(arg, ast.Constant) for arg in node.args):
|
275
|
-
if node.func.id not in self._math_ops
|
276
|
-
raise PulseError("Function
|
273
|
+
if node.func.id not in self._math_ops:
|
274
|
+
raise PulseError(f"Function {node.func.id} is not supported.")
|
277
275
|
_args = [arg.value for arg in node.args]
|
278
276
|
_val = self._math_ops[node.func.id](*_args)
|
279
277
|
if not _val.imag:
|
@@ -283,7 +281,7 @@ class PulseExpression(ast.NodeTransformer):
|
|
283
281
|
return node
|
284
282
|
|
285
283
|
def generic_visit(self, node):
|
286
|
-
raise PulseError("Unsupported node:
|
284
|
+
raise PulseError(f"Unsupported node: {node.__class__.__name__}")
|
287
285
|
|
288
286
|
|
289
287
|
def parse_string_expr(source: str, partial_binding: bool = False) -> PulseExpression:
|