utils¶
Scheduling utility functions.
Functions
|
Return a mapping from qubit label to measurement group given the nested list meas_map returned by a backend configuration. |
|
Return a schedule which measures the requested qubits according to the given instruction mapping and measure map, or by using the defaults provided by the backend. |
|
Return a Schedule which measures all qubits of the given backend. |
- format_meas_map(meas_map)[source]¶
Return a mapping from qubit label to measurement group given the nested list meas_map returned by a backend configuration. (Qubits can not always be measured independently.) Sorts the measurement group for consistency.
- Parameters
meas_map (
List
[List
[int
]]) – Groups of qubits that get measured together, for example: [[0, 1], [2, 3, 4]]- Return type
Dict
[int
,List
[int
]]- Returns
Measure map in map format
- measure(qubits, backend=None, inst_map=None, meas_map=None, qubit_mem_slots=None, measure_name='measure')[source]¶
Return a schedule which measures the requested qubits according to the given instruction mapping and measure map, or by using the defaults provided by the backend.
By default, the measurement results for each qubit are trivially mapped to the qubit index. This behavior is overridden by qubit_mem_slots. For instance, to measure qubit 0 into MemorySlot(1), qubit_mem_slots can be provided as {0: 1}.
- Parameters
qubits (
List
[int
]) – List of qubits to be measured.backend (BaseBackend) – A backend instance, which contains hardware-specific data required for scheduling.
inst_map (
Optional
[InstructionScheduleMap
]) – Mapping of circuit operations to pulse schedules. If None, defaults to theinstruction_schedule_map
ofbackend
.meas_map (
Union
[List
[List
[int
]],Dict
[int
,List
[int
]],None
]) – List of sets of qubits that must be measured together. If None, defaults to themeas_map
ofbackend
.qubit_mem_slots (
Optional
[Dict
[int
,int
]]) – Mapping of measured qubit index to classical bit index.measure_name (
str
) – Name of the measurement schedule.
- Return type
- Returns
A measurement schedule corresponding to the inputs provided.
- Raises
PulseError – If both
inst_map
ormeas_map
, andbackend
is None.
- measure_all(backend)[source]¶
Return a Schedule which measures all qubits of the given backend.
- Parameters
backend (BaseBackend) – A backend instance, which contains hardware-specific data required for scheduling.
- Return type
- Returns
A schedule corresponding to the inputs provided.