MeasurementBasis¶
- class MeasurementBasis(name)[source]¶
- Abstract base class for a tomography measurement basis. - Subclasses should implement the following abstract methods to define a preparation basis: - The - circuit()method which returns the logical measurement- QuantumCircuitfor basis element index on the specified physical qubits. This circuit should be a logical circuit on the specified number of qubits and will be remapped to the corresponding physical qubits during transpilation. It should include classical bits and the measure instructions for the basis measurement storing the outcome value in these bits.
- The - matrix()method which returns the POVM element corresponding to the basis element index and measurement outcome on the specified qubits. This should return either a- Statevectorfor a PVM element, or- DensityMatrixfor a general POVM element.
- The - index_shape()method which returns the shape of allowed basis indices for the specified qubits, and their values.
- The - matrix_shape()method which returns the shape of subsystem dimensions of the POVM element matrices on the specified qubits.
- The - outcome_shape()method which returns the shape of allowed outcome values for a measurement of specified qubits.
 - Initialize a basis. - Parameters:
- name (str) – the name for the basis. 
 - Attributes - name¶
- Return the basis name 
 - Methods - abstract circuit(index, qubits=None)¶
- Return the basis preparation circuit. - Parameters:
- index (Sequence[int]) – a list of basis elements to tensor together. 
- qubits (Sequence[int] | None) – Optional, the physical qubit subsystems for the index. If None this will be set to - (0, ..., N-1)for a length N index.
 
- Returns:
- The logical basis circuit for the specified index and qubits. 
- Return type:
 - Note - This returns a logical circuit on the specified number of qubits and should be remapped to the corresponding physical qubits during experiment transpilation. 
 - abstract index_shape(qubits)¶
- Return the shape for the specified number of indices. - Parameters:
- qubits (Sequence[int]) – the basis subsystems to return the index shape for. 
- Returns:
- The shape of allowed values for the index on the specified qubits. 
- Return type:
- Tuple[int, …] 
 
 - abstract matrix(index, outcome, qubits=None)[source]¶
- Return the POVM element for the basis index and outcome. - This POVM element is used by tomography fitters for reconstruction and should correspond to the target measurement effect for the corresponding measurement - circuit()and outcome.- Parameters:
- index (Sequence[int]) – a list of subsystem basis indices. 
- outcome (int) – the composite system measurement outcome. 
- qubits (Sequence[int] | None) – Optional, the physical qubit subsystems for the index. If None this will be set to - (0, ..., N-1)for a length N index.
 
- Returns:
- The POVM matrix for the specified index and qubits. 
- Return type:
- ndarray