How to use the quantities.decorators.with_doc function in quantities

To help you get started, we’ve selected a few quantities examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github python-quantities / python-quantities / quantities / umath.py View on Github external
@with_doc(np.cosh)
def cosh(x, out=None):
    """
    Raises a ValueError if input cannot be rescaled to a dimensionless
    quantity.
    """
    if not isinstance(x, Quantity):
        return np.cosh(x, out)

    return Quantity(
        np.cosh(x.rescale(dimensionless).magnitude, out),
        dimensionless,
        copy=False
    )
github python-quantities / python-quantities / quantities / quantity.py View on Github external
    @with_doc(np.nanargmax)
    def nanargmax(self,axis=None, out=None):
        return np.nanargmax(self.magnitude)
github python-quantities / python-quantities / quantities / quantity.py View on Github external
    @with_doc(np.ndarray.__lt__)
    @wrap_comparison
    def __lt__(self, other):
        return self.magnitude < other
github python-quantities / python-quantities / quantities / umath.py View on Github external
@with_doc(np.cumsum)
def cumsum(a,axis=None, dtype=None, out=None):
    return a.cumsum(axis, dtype, out)
github python-quantities / python-quantities / quantities / unitquantity.py View on Github external
    @with_doc(Quantity.__truediv__, use_header=False)
    def __truediv__(self, other):
        return self.view(Quantity).__truediv__(other)
github python-quantities / python-quantities / quantities / uncertainquantity.py View on Github external
    @with_doc(Quantity.__rtruediv__, use_header=False)
    def __rtruediv__(self, other):
        temp = UncertainQuantity(
            1/self.magnitude, self.dimensionality**-1,
            self.relative_uncertainty/self.magnitude, copy=False
        )
        return other * temp
github python-quantities / python-quantities / quantities / uncertainquantity.py View on Github external
    @with_doc(np.ndarray.min)
    def min(self, axis=None, out=None):
        idx = np.unravel_index(np.argmin(self.magnitude), self.shape)
        return self[idx]
github python-quantities / python-quantities / quantities / quantity.py View on Github external
    @with_doc(np.ndarray.__ge__)
    @wrap_comparison
    def __ge__(self, other):
        return self.magnitude >= other
github python-quantities / python-quantities / quantities / quantity.py View on Github external
    @with_doc(np.nansum)
    def nansum(self, axis=None, dtype=None, out=None):
        import numpy as np
        return Quantity(
            np.nansum(self.magnitude, axis, dtype, out),
            self.dimensionality,
            copy=False
        )
github python-quantities / python-quantities / quantities / umath.py View on Github external
@with_doc(np.sinh)
def sinh(x, out=None):
    """
    Raises a ValueError if input cannot be rescaled to a dimensionless
    quantity.
    """
    if not isinstance(x, Quantity):
        return np.sinh(x, out)

    return Quantity(
        np.sinh(x.rescale(dimensionless).magnitude, out),
        dimensionless,
        copy=False
    )