class_docstr: Tests for LAX-backed scipy.stats implementations
code: def testCsdWithSameParamAgainstNumpy(
      self,
      *,
      shape,
      dtype,
      fs,
      window,
      nperseg,
      noverlap,
      nfft,
      detrend,
      scaling,
      timeaxis,
      average,
  ):
      is_complex = dtypes.issubdtype(dtype, np.complexfloating)
      if is_complex and detrend is not None:
          self.skipTest(
              "Complex signal is not supported in lax-backed `signal.detrend`."
          )
  
      kwds = dict(
          fs=fs,
          window=window,
          nperseg=nperseg,
          noverlap=noverlap,
          nfft=nfft,
          detrend=detrend,
          return_onesided=not is_complex,
          scaling=scaling,
          axis=timeaxis,
          average=average,
      )
  
      def osp_fun(x, y):
          # When the identical parameters are given, jsp-version follows
          # the behavior with copied parameters.
          freqs, Pxy = osp_signal.csd(x, y.copy(), **kwds)
          # Make type-casting the same as JAX.
          return freqs.astype(_real_dtype(dtype)), Pxy.astype(
              _complex_dtype(dtype)
          )
  
      jsp_fun = partial(jsp_signal.csd, **kwds)
      tol = {
          np.float32: 1e-5,
          np.float64: 1e-12,
          np.complex64: 1e-5,
          np.complex128: 1e-12,
      }
      if jtu.test_device_matches(["tpu"]):
          tol = _TPU_FFT_TOL
  
      rng = jtu.rand_default(self.rng())
      args_maker = lambda: [rng(shape, dtype)] * 2
  
      self._CheckAgainstNumpy(
          osp_fun, jsp_fun, args_maker, rtol=tol, atol=tol
      )
      self._CompileAndCheck(jsp_fun, args_maker, rtol=tol, atol=tol)
  
imports: from functools import partial
  import unittest
  from absl.testing import absltest
  import numpy
  import scipy.signal
  from jax import lax
  import jax.numpy
  from jax._src import dtypes
  from jax._src import test_util
  import jax.scipy.signal
  from jax import config
label_desc: Use image node_id 7 for calling the LaxBackedScipySignalTests obj's underlying member method code with example usage: obj.testCsdWithSameParamAgainstNumpy() and returns: freqs,  Pxy