class_docstr: Default Gaussian device for PennyLane.
  
  Args:
      wires (int, Iterable[Number, str]): Number of subsystems represented by the device,
          or iterable that contains unique labels for the subsystems as numbers (i.e., ``[-1, 0, 2]``)
          or strings (``['ancilla', 'q1', 'q2']``). Default 1 if not specified.
      shots (None, int): How many times the circuit should be evaluated (or sampled) to estimate
          the expectation values. If ``None``, the results are analytically computed and hence deterministic.
      hbar (float): (default 2) the value of :math:`\hbar` in the commutation
          relation :math:`[\x,\p]=i\hbar`
class_docstr_tok: ["Default","Gaussian","device","for","PennyLane",".","Args",":","wires","(","int",",","Iterable","[","Number",",","str","]",")",":","Number","of","subsystems","represented","by","the","device",",","or","iterable","that","contains","unique","labels","for","the","subsystems","as","numbers","(","i.e.",",","``","[","-1",",","0",",","2","]","``",")","or","strings","(","``","[","'ancilla","'",",","'q1","'",",","'q2","'","]","``",")",".","Default","1","if","not","specified",".","shots","(","None",",","int",")",":","How","many","times","the","circuit","should","be","evaluated","(","or","sampled",")","to","estimate","the","expectation","values",".","If","``","None","``",",","the","results","are","analytically","computed","and","hence","deterministic",".","hbar","(","float",")",":","(","default","2",")","the","value","of",":","math",":","`","\\hbar","`","in","the","commutation","relation",":","math",":","`","[","\\x",",","\\p","]","=i\\hbar","`"]
docstr: Return a sample of an observable.
  
  .. note::
  
      The ``default.gaussian`` plugin only supports sampling
      from :class:`~.X`, :class:`~.P`, and :class:`~.QuadOperator`
      observables.
  
  Args:
      observable (str): name of the observable
      wires (Wires): wires the observable is to be measured on
      par (tuple): parameters for the observable
  
  Returns:
      array[float]: samples in an array of dimension ``(n, num_wires)``
docstr_tok: ["Return","a","sample","of","an","observable",".","..","note",":",":","The","``","default.gaussian","``","plugin","only","supports","sampling","from",":","class",":","`","~.X","`",",",":","class",":","`","~.P","`",",","and",":","class",":","`","~.QuadOperator","`","observables",".","Args",":","observable","(","str",")",":","name","of","the","observable","wires","(","Wires",")",":","wires","the","observable","is","to","be","measured","on","par","(","tuple",")",":","parameters","for","the","observable","Returns",":","array","[","float","]",":","samples","in","an","array","of","dimension","``","(","n",",","num_wires",")","``"]
code: def sample(self, observable, wires, par):
      """Return a sample of an observable.
  
      .. note::
  
          The ``default.gaussian`` plugin only supports sampling
          from :class:`~.X`, :class:`~.P`, and :class:`~.QuadOperator`
          observables.
  
      Args:
          observable (str): name of the observable
          wires (Wires): wires the observable is to be measured on
          par (tuple): parameters for the observable
  
      Returns:
          array[float]: samples in an array of dimension ``(n, num_wires)``
      """
  
      if len(wires) != 1:
          raise ValueError("Only one mode can be measured in homodyne.")
  
      if observable == "QuadX":
          phi = 0.0
      elif observable == "QuadP":
          phi = np.pi / 2
      elif observable == "QuadOperator":
          phi = par[0]
      else:
          raise NotImplementedError(
              f"default.gaussian does not support sampling {observable}"
          )
  
      cov, mu = self.reduced_state(wires)
      rot = rotation(phi)
  
      muphi = rot.T @ mu
      covphi = rot.T @ cov @ rot
  
      stdphi = math.sqrt(covphi[0, 0])
      meanphi = muphi[0]
      return np.random.normal(meanphi, stdphi, self.shots)
  
imports: import math
  import cmath
  import numpy
  from scipy.special import factorial
  import pennylane
  from pennylane.ops import Identity
  from pennylane import Device
  from .._version import __version__
label_desc: Use image node_id 8 for calling the DefaultGaussian obj's underlying member method code with example usage: obj.sample(observable, wires, par) and returns: np