peng/wave_functions.py
def db(wave):
    r"""
    Return a waveform's dependent variable vector expressed in decibels.

    :param wave: Waveform
    :type  wave: :py:class:`peng.eng.Waveform`

    :rtype: :py:class:`peng.eng.Waveform`

    .. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
    .. Auto-generated exceptions documentation for peng.wave_functions.db

    :raises:
     * RuntimeError (Argument \`wave\` is not valid)

     * ValueError (Math domain error)

    .. [[[end]]]
    """
    pexdoc.exh.addex(
        ValueError, "Math domain error", bool((np.min(np.abs(wave._dep_vector)) <= 0))
    )
    ret = copy.copy(wave)
    ret.dep_units = "dB"
    ret.dep_name = "db({0})".format(ret.dep_name)
    ret._dep_vector = 20.0 * np.log10(np.abs(ret._dep_vector))
    return ret
def db(wave):
    r"""
    Return a waveform's dependent variable vector expressed in decibels.

    :param wave: Waveform
    :type  wave: :py:class:`peng.eng.Waveform`

    :rtype: :py:class:`peng.eng.Waveform`

    .. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
    .. Auto-generated exceptions documentation for peng.wave_functions.db

    :raises:
     * RuntimeError (Argument \`wave\` is not valid)

     * ValueError (Math domain error)

    .. [[[end]]]
    """
    pexdoc.exh.addex(
        ValueError, "Math domain error", bool((np.min(np.abs(wave._dep_vector)) <= 0))
    )
    ret = copy.copy(wave)
    ret.dep_units = "dB"
    ret.dep_name = "db({0})".format(ret.dep_name)
    ret._dep_vector = 20.0 * np.log10(np.abs(ret._dep_vector))
    return ret
r"""
    Return a waveform's dependent variable vector expressed in decibels.

    :param wave: Waveform
    :type  wave: :py:class:`peng.eng.Waveform`

    :rtype: :py:class:`peng.eng.Waveform`

    .. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
    .. Auto-generated exceptions documentation for peng.wave_functions.db

    :raises:
     * RuntimeError (Argument \`wave\` is not valid)

     * ValueError (Math domain error)

    .. [[[end]]]