LogQuantity#
- class astropy.units.LogQuantity(value, unit=None, dtype=<class 'numpy.inexact'>, copy=True, order=None, subok=False, ndmin=0)[source]#
Bases:
FunctionQuantityA representation of a (scaled) logarithm of a number with a unit.
- Parameters:
- valuenumber,
Quantity,LogQuantity, or sequence of quantity-like. The numerical value of the logarithmic quantity. If a number or a
Quantitywith a logarithmic unit, it will be converted tounitand the physical unit will be inferred fromunit. If aQuantitywith just a physical unit, it will converted to the logarithmic unit, after, if necessary, converting it to the physical unit inferred fromunit.- unit
str,UnitBase, orFunctionUnitBase, optional For an
FunctionUnitBaseinstance, the physical unit will be taken from it; for other input, it will be inferred fromvalue. By default,unitis set by the subclass.- dtype
dtype, optional The
dtypeof the resulting Numpy array or scalar that will hold the value. If not provided, is is determined automatically from the input value.- copybool, optional
If
True(default), then the value is copied. Otherwise, a copy will only be made if__array__returns a copy, if value is a nested sequence, or if a copy is needed to satisfy an explicitly givendtype. (TheFalseoption is intended mostly for internal use, to speed up initialization where a copy is known to have been made. Use with care.)
- valuenumber,
Examples
Typically, use is made of an
FunctionQuantitysubclass, as in:>>> import astropy.units as u >>> u.Magnitude(-2.5) <Magnitude -2.5 mag> >>> u.Magnitude(10.*u.count/u.second) <Magnitude -2.5 mag(ct / s)> >>> u.Decibel(1.*u.W, u.DecibelUnit(u.mW)) <Decibel 30. dB(mW)>
Methods Summary
diff([n, axis])ediff1d([to_end, to_begin])ptp([axis, out, keepdims])Peak to peak (maximum - minimum) value along a given axis.
std([axis, dtype, out, ddof, keepdims, where])Returns the standard deviation of the array elements along given axis.
var([axis, dtype, out, ddof, keepdims, where])Returns the variance of the array elements, along given axis.
Methods Documentation
- ptp(axis=None, out=None, keepdims=False)[source]#
Peak to peak (maximum - minimum) value along a given axis.
Refer to
numpy.ptpfor full documentation.See also
numpy.ptpequivalent function