class_docstr: Represents a measurement process occurring at the end of a
  quantum variational circuit.
  
  Args:
      obs (Union[.Operator, .MeasurementValue, Sequence[.MeasurementValue]]): The observable that
          is to be measured as part of the measurement process. Not all measurement processes
          require observables (for example ``Probability``); this argument is optional.
      wires (.Wires): The wires the measurement process applies to.
          This can only be specified if an observable was not provided.
      eigvals (array): A flat array representing the eigenvalues of the measurement.
          This can only be specified if an observable was not provided.
      id (str): custom label given to a measurement instance, can be useful for some applications
          where the instance has to be identified
class_docstr_tok: ["Represents","a","measurement","process","occurring","at","the","end","of","a","quantum","variational","circuit",".","Args",":","obs","(","Union","[",".Operator",",",".MeasurementValue",",","Sequence","[",".MeasurementValue","]","]",")",":","The","observable","that","is","to","be","measured","as","part","of","the","measurement","process",".","Not","all","measurement","processes","require","observables","(","for","example","``","Probability","``",")",";","this","argument","is","optional",".","wires","(",".Wires",")",":","The","wires","the","measurement","process","applies","to",".","This","can","only","be","specified","if","an","observable","was","not","provided",".","eigvals","(","array",")",":","A","flat","array","representing","the","eigenvalues","of","the","measurement",".","This","can","only","be","specified","if","an","observable","was","not","provided",".","id","(","str",")",":","custom","label","given","to","a","measurement","instance",",","can","be","useful","for","some","applications","where","the","instance","has","to","be","identified"]
docstr: Expand the measurement of an observable to a unitary
  rotation and a measurement in the computational basis.
  
  Returns:
      .QuantumTape: a quantum tape containing the operations
      required to diagonalize the observable
  
  **Example:**
  
  Consider a measurement process consisting of the expectation
  value of an Hermitian observable:
  
  >>> H = np.array([[1, 2], [2, 4]])
  >>> obs = qml.Hermitian(H, wires=['a'])
  >>> m = MeasurementProcess(Expectation, obs=obs)
  
  Expanding this out:
  
  >>> tape = m.expand()
  
  We can see that the resulting tape has the qubit unitary applied,
  and a measurement process with no observable, but the eigenvalues
  specified:
  
  >>> print(tape.operations)
  [QubitUnitary(array([[-0.89442719,  0.4472136 ],
        [ 0.4472136 ,  0.89442719]]), wires=['a'])]
  >>> print(tape.measurements[0].eigvals())
  [0. 5.]
  >>> print(tape.measurements[0].obs)
  None
code: def expand(self):
      """Expand the measurement of an observable to a unitary
      rotation and a measurement in the computational basis.
  
      Returns:
          .QuantumTape: a quantum tape containing the operations
          required to diagonalize the observable
  
      **Example:**
  
      Consider a measurement process consisting of the expectation
      value of an Hermitian observable:
  
      >>> H = np.array([[1, 2], [2, 4]])
      >>> obs = qml.Hermitian(H, wires=['a'])
      >>> m = MeasurementProcess(Expectation, obs=obs)
  
      Expanding this out:
  
      >>> tape = m.expand()
  
      We can see that the resulting tape has the qubit unitary applied,
      and a measurement process with no observable, but the eigenvalues
      specified:
  
      >>> print(tape.operations)
      [QubitUnitary(array([[-0.89442719,  0.4472136 ],
            [ 0.4472136 ,  0.89442719]]), wires=['a'])]
      >>> print(tape.measurements[0].eigvals())
      [0. 5.]
      >>> print(tape.measurements[0].obs)
      None
      """
      if self.obs is None:
          raise qml.operation.DecompositionUndefinedError
  
      with qml.queuing.AnnotatedQueue() as q:
          self.obs.diagonalizing_gates()
          self.__class__(
              wires=self.obs.wires, eigvals=self.obs.eigvals()
          )
  
      return qml.tape.QuantumScript.from_queue(q)
  
imports: import copy
  import functools
  from warnings import warn
  from abc import ABC, abstractmethod
  from enum import Enum
  from typing import Sequence, Tuple, Optional, Union
  import pennylane
  from pennylane.operation import Operator, DecompositionUndefinedError, EigvalsUndefinedError
  from pennylane.pytrees import register_pytree
  from pennylane.typing import TensorLike
  from pennylane.wires import Wires
  from .shots import Shots
label_desc: Use image node_id 21 for calling the MeasurementProcess obj's underlying member method code with example usage: obj.expand() and returns: qml