qiskit 1.1.2__cp38-abi3-win32.whl → 1.2.0rc1__cp38-abi3-win32.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.pyd +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 +1 -1
- 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 +392 -384
- 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 +41 -127
- 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 +32 -24
- qiskit/providers/fake_provider/fake_backend.py +10 -3
- qiskit/providers/fake_provider/fake_openpulse_2q.py +154 -146
- qiskit/providers/fake_provider/fake_openpulse_3q.py +226 -217
- qiskit/providers/fake_provider/fake_qasm_backend.py +5 -1
- qiskit/providers/fake_provider/generic_backend_v2.py +80 -50
- qiskit/providers/models/__init__.py +11 -0
- 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 +578 -481
- 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/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 +14 -16
- 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 +82 -63
- 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 +11 -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 +1 -1
- 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 +11 -11
- 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 +117 -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 +19 -67
- 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 +5 -12
- 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.0rc1.dist-info}/METADATA +26 -26
- {qiskit-1.1.2.dist-info → qiskit-1.2.0rc1.dist-info}/RECORD +340 -338
- {qiskit-1.1.2.dist-info → qiskit-1.2.0rc1.dist-info}/WHEEL +1 -1
- {qiskit-1.1.2.dist-info → qiskit-1.2.0rc1.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.0rc1.dist-info}/LICENSE.txt +0 -0
- {qiskit-1.1.2.dist-info → qiskit-1.2.0rc1.dist-info}/top_level.txt +0 -0
@@ -112,6 +112,8 @@ class GenericBackendV2(BackendV2):
|
|
112
112
|
calibrate_instructions: bool | InstructionScheduleMap | None = None,
|
113
113
|
dtm: float | None = None,
|
114
114
|
seed: int | None = None,
|
115
|
+
pulse_channels: bool = True,
|
116
|
+
noise_info: bool = True,
|
115
117
|
):
|
116
118
|
"""
|
117
119
|
Args:
|
@@ -159,6 +161,10 @@ class GenericBackendV2(BackendV2):
|
|
159
161
|
None by default.
|
160
162
|
|
161
163
|
seed: Optional seed for generation of default values.
|
164
|
+
|
165
|
+
pulse_channels: If true, sets default pulse channel information on the backend.
|
166
|
+
|
167
|
+
noise_info: If true, associates gates and qubits with default noise information.
|
162
168
|
"""
|
163
169
|
|
164
170
|
super().__init__(
|
@@ -175,6 +181,10 @@ class GenericBackendV2(BackendV2):
|
|
175
181
|
self._control_flow = control_flow
|
176
182
|
self._calibrate_instructions = calibrate_instructions
|
177
183
|
self._supported_gates = get_standard_gate_name_mapping()
|
184
|
+
self._noise_info = noise_info
|
185
|
+
|
186
|
+
if calibrate_instructions and not noise_info:
|
187
|
+
raise QiskitError("Must set parameter noise_info when calibrating instructions.")
|
178
188
|
|
179
189
|
if coupling_map is None:
|
180
190
|
self._coupling_map = CouplingMap().from_full(num_qubits)
|
@@ -198,7 +208,10 @@ class GenericBackendV2(BackendV2):
|
|
198
208
|
self._basis_gates.append(name)
|
199
209
|
|
200
210
|
self._build_generic_target()
|
201
|
-
|
211
|
+
if pulse_channels:
|
212
|
+
self._build_default_channels()
|
213
|
+
else:
|
214
|
+
self.channels_map = {}
|
202
215
|
|
203
216
|
@property
|
204
217
|
def target(self):
|
@@ -253,27 +266,36 @@ class GenericBackendV2(BackendV2):
|
|
253
266
|
# Note that the calibration pulses are different for
|
254
267
|
# 1q gates vs 2q gates vs measurement instructions.
|
255
268
|
if inst == "measure":
|
256
|
-
|
257
|
-
PulseQobjInstruction
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
269
|
+
with warnings.catch_warnings():
|
270
|
+
# The class PulseQobjInstruction is deprecated
|
271
|
+
warnings.filterwarnings("ignore", category=DeprecationWarning, module="qiskit")
|
272
|
+
sequence = [
|
273
|
+
PulseQobjInstruction(
|
274
|
+
name="acquire",
|
275
|
+
duration=1792,
|
276
|
+
t0=0,
|
277
|
+
qubits=qargs,
|
278
|
+
memory_slot=qargs,
|
279
|
+
)
|
280
|
+
] + [
|
281
|
+
PulseQobjInstruction(name=pulse_library[1].name, ch=f"m{i}", t0=0)
|
282
|
+
for i in qargs
|
283
|
+
]
|
265
284
|
return sequence
|
266
|
-
|
285
|
+
with warnings.catch_warnings():
|
286
|
+
# The class PulseQobjInstruction is deprecated
|
287
|
+
warnings.filterwarnings("ignore", category=DeprecationWarning, module="qiskit")
|
288
|
+
if num_qubits == 1:
|
289
|
+
return [
|
290
|
+
PulseQobjInstruction(name="fc", ch=f"u{qargs[0]}", t0=0, phase="-P0"),
|
291
|
+
PulseQobjInstruction(name=pulse_library[0].name, ch=f"d{qargs[0]}", t0=0),
|
292
|
+
]
|
267
293
|
return [
|
268
|
-
PulseQobjInstruction(name=
|
269
|
-
PulseQobjInstruction(name=pulse_library[
|
294
|
+
PulseQobjInstruction(name=pulse_library[1].name, ch=f"d{qargs[0]}", t0=0),
|
295
|
+
PulseQobjInstruction(name=pulse_library[2].name, ch=f"u{qargs[0]}", t0=0),
|
296
|
+
PulseQobjInstruction(name=pulse_library[1].name, ch=f"d{qargs[1]}", t0=0),
|
297
|
+
PulseQobjInstruction(name="fc", ch=f"d{qargs[1]}", t0=0, phase=2.1),
|
270
298
|
]
|
271
|
-
return [
|
272
|
-
PulseQobjInstruction(name=pulse_library[1].name, ch=f"d{qargs[0]}", t0=0),
|
273
|
-
PulseQobjInstruction(name=pulse_library[2].name, ch=f"u{qargs[0]}", t0=0),
|
274
|
-
PulseQobjInstruction(name=pulse_library[1].name, ch=f"d{qargs[1]}", t0=0),
|
275
|
-
PulseQobjInstruction(name="fc", ch=f"d{qargs[1]}", t0=0, phase=2.1),
|
276
|
-
]
|
277
299
|
|
278
300
|
def _generate_calibration_defaults(self) -> PulseDefaults:
|
279
301
|
"""Generate pulse calibration defaults as specified with `self._calibrate_instructions`.
|
@@ -340,22 +362,31 @@ class GenericBackendV2(BackendV2):
|
|
340
362
|
"""
|
341
363
|
# the qubit properties are sampled from default ranges
|
342
364
|
properties = _QUBIT_PROPERTIES
|
343
|
-
self.
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
365
|
+
if not self._noise_info:
|
366
|
+
self._target = Target(
|
367
|
+
description=f"Generic Target with {self._num_qubits} qubits",
|
368
|
+
num_qubits=self._num_qubits,
|
369
|
+
dt=properties["dt"],
|
370
|
+
qubit_properties=None,
|
371
|
+
concurrent_measurements=[list(range(self._num_qubits))],
|
372
|
+
)
|
373
|
+
else:
|
374
|
+
self._target = Target(
|
375
|
+
description=f"Generic Target with {self._num_qubits} qubits",
|
376
|
+
num_qubits=self._num_qubits,
|
377
|
+
dt=properties["dt"],
|
378
|
+
qubit_properties=[
|
379
|
+
QubitProperties(
|
380
|
+
t1=self._rng.uniform(properties["t1"][0], properties["t1"][1]),
|
381
|
+
t2=self._rng.uniform(properties["t2"][0], properties["t2"][1]),
|
382
|
+
frequency=self._rng.uniform(
|
383
|
+
properties["frequency"][0], properties["frequency"][1]
|
384
|
+
),
|
385
|
+
)
|
386
|
+
for _ in range(self._num_qubits)
|
387
|
+
],
|
388
|
+
concurrent_measurements=[list(range(self._num_qubits))],
|
389
|
+
)
|
359
390
|
|
360
391
|
# Generate instruction schedule map with calibrations to add to target.
|
361
392
|
calibration_inst_map = None
|
@@ -380,8 +411,13 @@ class GenericBackendV2(BackendV2):
|
|
380
411
|
f"Provided basis gate {name} needs more qubits than {self.num_qubits}, "
|
381
412
|
f"which is the size of the backend."
|
382
413
|
)
|
383
|
-
|
384
|
-
|
414
|
+
if self._noise_info:
|
415
|
+
noise_params = self._get_noise_defaults(name, gate.num_qubits)
|
416
|
+
self._add_noisy_instruction_to_target(gate, noise_params, calibration_inst_map)
|
417
|
+
else:
|
418
|
+
qarg_set = self._coupling_map if gate.num_qubits > 1 else range(self.num_qubits)
|
419
|
+
props = {(qarg,) if isinstance(qarg, int) else qarg: None for qarg in qarg_set}
|
420
|
+
self._target.add_instruction(gate, properties=props, name=name)
|
385
421
|
|
386
422
|
if self._control_flow:
|
387
423
|
self._target.add_instruction(IfElseOp, name="if_else")
|
@@ -501,8 +537,8 @@ class GenericBackendV2(BackendV2):
|
|
501
537
|
pulse_job = False
|
502
538
|
if pulse_job is None: # submitted job is invalid
|
503
539
|
raise QiskitError(
|
504
|
-
"Invalid input object
|
505
|
-
"QuantumCircuit, Schedule, or a list of either"
|
540
|
+
f"Invalid input object {circuits}, must be either a "
|
541
|
+
"QuantumCircuit, Schedule, or a list of either"
|
506
542
|
)
|
507
543
|
if pulse_job: # pulse job
|
508
544
|
raise QiskitError("Pulse simulation is currently not supported for V2 backends.")
|
@@ -531,18 +567,12 @@ class GenericBackendV2(BackendV2):
|
|
531
567
|
|
532
568
|
@classmethod
|
533
569
|
def _default_options(cls) -> Options:
|
534
|
-
|
535
|
-
|
536
|
-
"ignore",
|
537
|
-
category=DeprecationWarning,
|
538
|
-
message=".+abstract Provider and ProviderV1.+",
|
539
|
-
)
|
540
|
-
if _optionals.HAS_AER:
|
541
|
-
from qiskit_aer import AerSimulator
|
570
|
+
if _optionals.HAS_AER:
|
571
|
+
from qiskit_aer import AerSimulator
|
542
572
|
|
543
|
-
|
544
|
-
|
545
|
-
|
573
|
+
return AerSimulator._default_options()
|
574
|
+
else:
|
575
|
+
return BasicSimulator._default_options()
|
546
576
|
|
547
577
|
def drive_channel(self, qubit: int):
|
548
578
|
drive_channels_map = getattr(self, "channels_map", {}).get("drive", {})
|
@@ -38,6 +38,7 @@ Classes
|
|
38
38
|
GateProperties
|
39
39
|
Nduv
|
40
40
|
"""
|
41
|
+
import warnings
|
41
42
|
|
42
43
|
from .backendconfiguration import (
|
43
44
|
BackendConfiguration,
|
@@ -50,3 +51,13 @@ from .backendproperties import BackendProperties, GateProperties, Nduv
|
|
50
51
|
from .backendstatus import BackendStatus
|
51
52
|
from .jobstatus import JobStatus
|
52
53
|
from .pulsedefaults import PulseDefaults, Command
|
54
|
+
|
55
|
+
|
56
|
+
warnings.warn(
|
57
|
+
"qiskit.providers.models is deprecated since Qiskit 1.2 and will be removed in Qiskit 2.0."
|
58
|
+
"With the removal of Qobj, there is no need for these schema-conformant objects. If you still need"
|
59
|
+
"to use them, it could be because you are using a BackendV1, which is also deprecated in favor"
|
60
|
+
"of BackendV2",
|
61
|
+
DeprecationWarning,
|
62
|
+
2,
|
63
|
+
)
|
@@ -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
|