peng/wave_functions.py
def round(wave, decimals=0):
    r"""
    Round a waveform's dependent variable vector to a given number of decimal places.

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

    :param decimals: Number of decimals to round to
    :type  decimals: integer

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

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

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

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

    .. [[[end]]]
    """
    # pylint: disable=W0622
    pexdoc.exh.addex(
        TypeError,
        "Cannot convert complex to integer",
        wave._dep_vector.dtype.name.startswith("complex"),
    )
    ret = copy.copy(wave)
    ret.dep_name = "round({0}, {1})".format(ret.dep_name, decimals)
    ret._dep_vector = np.round(wave._dep_vector, decimals)
    return ret
def round(wave, decimals=0):
    r"""
    Round a waveform's dependent variable vector to a given number of decimal places.

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

    :param decimals: Number of decimals to round to
    :type  decimals: integer

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

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

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

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

    .. [[[end]]]
    """
    # pylint: disable=W0622
    pexdoc.exh.addex(
        TypeError,
        "Cannot convert complex to integer",
        wave._dep_vector.dtype.name.startswith("complex"),
    )
    ret = copy.copy(wave)
    ret.dep_name = "round({0}, {1})".format(ret.dep_name, decimals)
    ret._dep_vector = np.round(wave._dep_vector, decimals)
    return ret
def round ( wave , decimals = 0 ) : # pylint: disable=W0622 pexdoc . exh . addex ( TypeError , "Cannot convert complex to integer" , wave . _dep_vector . dtype . name . startswith ( "complex" ) , ) ret = copy . copy ( wave ) ret . dep_name = "round({0}, {1})" . format ( ret . dep_name , decimals ) ret . _dep_vector = np . round ( wave . _dep_vector , decimals ) return ret
r"""
    Round a waveform's dependent variable vector to a given number of decimal places.

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

    :param decimals: Number of decimals to round to
    :type  decimals: integer

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

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

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

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

    .. [[[end]]]
r Round a waveform s dependent variable vector to a given number of decimal places .