code: def cwt(data, wavelet, widths):
      """
      Continuous wavelet transform.
  
      Performs a continuous wavelet transform on `data`,
      using the `wavelet` function. A CWT performs a convolution
      with `data` using the `wavelet` function, which is characterized
      by a width parameter and length parameter.
  
      Parameters
      ----------
      data : (N,) ndarray
          data on which to perform the transform.
      wavelet : function
          Wavelet function, which should take 2 arguments.
          The first argument is the number of points that the returned vector
          will have (len(wavelet(length,width)) == length).
          The second is a width parameter, defining the size of the wavelet
          (e.g. standard deviation of a gaussian). See `ricker`, which
          satisfies these requirements.
      widths : (M,) sequence
          Widths to use for transform.
  
      Returns
      -------
      cwt: (M, N) ndarray
          Will have shape of (len(widths), len(data)).
  
      Notes
      -----
      ::
  
          length = min(10 * width[ii], len(data))
          cwt[ii,:] = cupyx.scipy.signal.convolve(data, wavelet(length,
                                      width[ii]), mode='same')
  
      Examples
      --------
      >>> import cupyx.scipy.signal
      >>> import cupy as cp
      >>> import matplotlib.pyplot as plt
      >>> t = cupy.linspace(-1, 1, 200, endpoint=False)
      >>> sig  = cupy.cos(2 * cupy.pi * 7 * t) + cupyx.scipy.signal.gausspulse(t - 0.4, fc=2)
      >>> widths = cupy.arange(1, 31)
      >>> cwtmatr = cupyx.scipy.signal.cwt(sig, cupyx.scipy.signal.ricker, widths)
      >>> plt.imshow(abs(cupy.asnumpy(cwtmatr)), extent=[-1, 1, 31, 1],
                     cmap='PRGn', aspect='auto', vmax=abs(cwtmatr).max(),
                     vmin=-abs(cwtmatr).max())
      >>> plt.show()
  
      """  # NOQA
      if cupy.asarray(wavelet(1, 1)).dtype.char in "FDG":
          dtype = cupy.complex128
      else:
          dtype = cupy.float64
  
      output = cupy.empty([len(widths), len(data)], dtype=dtype)
  
      for ind, width in enumerate(widths):
          N = np.min([10 * int(width), len(data)])
          wavelet_data = cupy.conj(wavelet(N, int(width)))[::-1]
          output[ind, :] = convolve(data, wavelet_data, mode="same")
      return output
  
imports: import cupy
  import numpy
  from cupyx.scipy.signal._signaltools import convolve
label_desc: Use image node_id 5 for calling a global function with example usage: cwt(data, wavelet, widths) and returns: output