class_docstr: State tests.
class_docstr_tok: ["State","tests","."]
docstr: Test the thermal state is correct.
docstr_tok: ["Test","the","thermal","state","is","correct","."]
code: def thermal_state(self, tol):
      """Test the thermal state is correct."""
      nbar = 0.5342
      cov, means = thermal_state(nbar, hbar=hbar)
      assert means == pytest.approx(np.zeros([2]), abs=tol)
      assert np.all((cov.diag * 2 / hbar - 1) / 2 == nbar)
  
imports: import numpy
  import numpy.random
  import pytest
  from scipy.linalg import block_diag
  from scipy.special import factorial
  import pennylane
  from pennylane import DeviceError
  from pennylane.devices.default_gaussian import fock_prob, rotation, squeezing, quadratic_phase, beamsplitter, two_mode_squeezing, controlled_addition, controlled_phase, vacuum_state, coherent_state, squeezed_state, displaced_squeezed_state, thermal_state
  from pennylane.wires import Wires
label_desc: Use image node_id 5 for calling the TestStates obj's underlying member method code with example usage: obj.thermal_state(tol) without return types