module pixeltable.functions.math
Pixeltable UDFs for mathematical operations. Example:udf abs()
Signature
builtins.abs().
udf acos()
Signature
[0, pi].
Equivalent to Python math.acos().
Raises an error if the input is outside the range [-1, 1].
udf asin()
Signature
[-pi/2, pi/2].
Equivalent to Python math.asin().
Raises an error if the input is outside the range [-1, 1].
udf atan()
Signature
(-pi/2, pi/2).
Equivalent to Python math.atan().
udf bitwise_and()
Signature
self & other.
udf bitwise_or()
Signature
self | other.
udf bitwise_xor()
Signature
self ^ other.
udf ceil()
Signature
float(math.ceil(self)) if self
is finite, or self itself if self is infinite. (This is slightly different from the default behavior of
math.ceil(self), which always returns an int and raises an error if self is infinite. The behavior in
Pixeltable generalizes the Python operator and is chosen to align with the SQL standard.)
udf cos()
Signature
self, an angle in radians.
Equivalent to Python math.cos(). Raises an error for
infinity.
For an angle in degrees, apply radians() first, as in
t.x.radians().cos().
udf degrees()
Signature
radians().
Equivalent to Python math.degrees().
udf exp()
Signature
e raised to the power of the given number.
Equivalent to Python math.exp().
udf floor()
Signature
float(math.floor(self)) if self
is finite, or self itself if self is infinite. (This is slightly different from the default behavior of
math.floor(self), which always returns an int and raises an error if self is infinite. The behavior of
Pixeltable generalizes the Python operator and is chosen to align with the SQL standard.)
udf log()
Signature
math.log().
udf log10()
Signature
math.log10().
udf pow()
Signature
self to the power of other.
Equivalent to Python builtins.pow().
udf radians()
Signature
degrees().
Equivalent to Python math.radians().
udf round()
Signature
builtins.round(self, digits or 0).
Note that if digits is not specified, the behavior matches builtins.round(self, 0) rather than
builtins.round(self); this ensures that the return type is always float (as in SQL) rather than int.
udf sign()
Signature
-1.0 if it is negative, 1.0 if it is positive, and 0.0 if it is zero.
Equivalent to numpy.sign(). NaN is returned
unchanged.
udf sin()
Signature
self, an angle in radians.
Equivalent to Python math.sin(). Raises an error for
infinity.
For an angle in degrees, apply radians() first, as in
t.x.radians().sin().
udf sqrt()
Signature
math.sqrt().
udf tan()
Signature
self, an angle in radians.
Equivalent to Python math.tan(). Raises an error for
infinity.
For an angle in degrees, apply radians() first, as in
t.x.radians().tan().
udf to_float()
Signature
float(self).
udf to_int()
Signature
int(self). Raises an error for
infinity, NaN, and values outside the range of Int.
To round down, up or to the nearest integer instead, apply floor(),
ceil() or round() first, as in
t.x.floor().to_int().