code: def sweep_poly(t, poly, phi=0):
      """
      Frequency-swept cosine generator, with a time-dependent frequency.
  
      This function generates a sinusoidal function whose instantaneous
      frequency varies with time.  The frequency at time `t` is given by
      the `poly` array.
  
      Parameters
      ----------
      t : ndarray
          Times at which to evaluate the waveform.
      poly : 1-D array_like or instance of numpy.poly1d
          The desired frequency expressed as a polynomial.  If `poly` is
          a list or ndarray of length n, then the elements of `poly` are
          the coefficients of the polynomial, and the instantaneous
          frequency is
  
            ``f(t) = poly[0]*t**(n-1) + poly[1]*t**(n-2) + ... + poly[n-1]``
  
          If `poly` is an instance of cupy.poly1d, then the
          instantaneous frequency is
  
            ``f(t) = poly(t)``
  
      phi : float, optional
          Phase offset, in degrees, Default: 0.
  
      Returns
      -------
      sweep_poly : ndarray
          A numpy array containing the signal evaluated at `t` with the
          requested time-varying frequency.  More precisely, the function
          returns ``cos(phase + (pi/180)*phi)``, where `phase` is the integral
          (from 0 to t) of ``2 * pi * f(t)``; ``f(t)`` is defined above.
  
      See Also
      --------
      scipy.signal.sweep_poly
      chirp
  
      Notes
      -----
  
      If `poly` is an ndarray of length `n`, then the elements of
      `poly` are the coefficients of the polynomial, and the instantaneous
      frequency is:
  
          ``f(t) = poly[0]*t**(n-1) + poly[1]*t**(n-2) + ... + poly[n-1]``
  
      If `poly` is an instance of `numpy.poly1d`, then the instantaneous
      frequency is:
  
            ``f(t) = poly(t)``
  
      Finally, the output `s` is:
  
          ``cos(phase + (pi/180)*phi)``
  
      where `phase` is the integral from 0 to `t` of ``2 * pi * f(t)``,
      ``f(t)`` as defined above.
      """
      # 'phase' is computed in _sweep_poly_phase, to make testing easier.
      phase = _sweep_poly_phase(t, poly)
      # Convert to radians.
      phi *= cupy.pi / 180
      return cupy.cos(phase + phi)
  
file_path: cupy/cupyx/scipy/signal/_waveforms.py
imports: import cupy
  from cupy._core._scalar import get_typename
  from cupy_backends.cuda.api import runtime
  import numpy
label_desc: Use image node_id 7 for calling a global function with example usage: sweep_poly(t, poly, phi) and returns: cupy