deeptrack.elementwise Module#
Classes that apply functions to features elementwise.
This module provides the elementwise DeepTrack2 classes which work as a handle to apply various NumPy functions to Feature objects elementwise.
Key Features#
Extends NumPy Functions
The convenience of NumPy functions are extended with this module such that they can be applied elementwise to a DeepTrack Feature object.
- Trigonometric Functions
The elementary trigonometric functions: Sin, Cos, Tan.
- Hyperbolic Functions
The trigonometric hyperbolic functions: Sinh, Cosh, Tanh.
- Rounding Functions
Common rounding functions: nearest integer rounding Round, nearest lowest integer Floor, nearest highest integer Ceil.
- Exponents And Logarithm Functions
Includes Exponential (exp) function, Natural Logarithm function, Logarithm function with base 10, and Logarithm function with base 2.
- Complex Number Functions
Functions to get various values from a complex number: Angle, Absolute value, Real value, Imaginary value, Conjugate
- Miscellaneous Functions
Contains Square root, Square, Sign function.
Module Structure#
Classes:
- ElementwiseFeature
Forms the base from which other classes inherit from.
Sin
Cos
Tan
ArcSin
Arccos
ArcTan
Sinh
Cosh
Tanh
ArcSinh
Arccosh
ArcTanh
Round
Floor
Ceil
Exp
Log
Log10
Log2
Angle
Real
Imag
Abs
Conjugate
Sqrt
Square
Sign
Examples#
Apply cosine elementwise to a Feature:
>>> import numpy as np
>>> from deeptrack import Feature, elementwise
>>> class TestFeature(Feature):
>>> __distributed__ = False
>>> def get(self, image, **kwargs):
>>> output = np.array([[np.pi, 0],
... [np.pi / 4, 0]])
>>> return output
>>> test_feature = TestFeature()
>>> elementwise_cosine = test_feature >> elementwise.Cos()
[[-1. 1. ]
[ 0.70710678 1. ]]
Classes#
|
Applies the absolute value function elementwise. |
|
Applies the angle function elementwise. |
|
Applies the arccosine function elementwise. |
|
Applies the hyperbolic arccosine function elementwise. |
|
Applies the arcsine function elementwise. |
|
Applies the hyperbolic arcsine function elementwise. |
|
Applies the arctangent function elementwise. |
|
Applies the hyperbolic arctangent function elementwise. |
|
Applies the ceil function elementwise. |
|
Applies the conjugate function elementwise. |
|
Applies the cosine function elementwise. |
|
Applies the hyperbolic cosine function elementwise. |
|
Base class for applying NumPy functions elementwise. |
|
Applies the exponential function elementwise. |
|
Base feature class. |
|
Applies the floor function elementwise. |
|
Applies the imaginary function elementwise. |
|
Applies the natural logarithm function elementwise. |
|
Applies the logarithm function with base 10 elementwise. |
|
Applies the logarithm function with base 2 elementwise. |
|
Applies the real function elementwise. |
|
Applies the round function elementwise. |
|
Applies the sign function elementwise. |
|
Applies the sine function elementwise. |
|
Applies the hyperbolic sine function elementwise. |
|
Applies the square root function elementwise. |
|
Applies the square function elementwise. |
|
Applies the tangent function elementwise. |
|
Applies the hyperbolic tangent function elementwise. |