Skip to content
Snippets Groups Projects
Commit 240ae0e0 authored by Raphael's avatar Raphael
Browse files

jit compiling for basic_features_operations.py

parent 4c9222b0
Branches develop
No related tags found
1 merge request!13Draft: Develop
import cmath
from numba import jit
import numpy as np
@jit(nopython=True, fastmath=True)
def angular_average_vector(angles):
n = len(angles)
x = np.sum(np.cos(angles)) / n
......@@ -11,11 +12,13 @@ def angular_average_vector(angles):
return np.array([x, y])
@jit(nopython=True, fastmath=True)
def angular_dispersion(angles):
x, y = angular_average_vector(angles)
return np.sqrt(x ** 2 + y ** 2)
@jit(nopython=True, fastmath=True)
def angular_mean(angles):
x, y = angular_average_vector(angles)
theta = np.arctan(y / x)
......@@ -28,10 +31,12 @@ def angular_mean(angles):
return 2 * np.pi + theta
@jit(nopython=True, fastmath=True)
def angular_std(angles):
return 1 - angular_dispersion(angles)
@jit(nopython=True, fastmath=True)
def angular_time_derivative(angle1, angle2, ts1, ts2):
z1 = np.cos(angle1) + np.sin(angle1) * 1j
z2 = np.cos(angle2) + np.sin(angle2) * 1j
......@@ -40,5 +45,6 @@ def angular_time_derivative(angle1, angle2, ts1, ts2):
return cmath.polar(z)[1] / (ts2 - ts1)
@jit(nopython=True, fastmath=True)
def time_derivative(f1, f2, ts1, ts2):
return (f2 - f1) / (ts2 - ts1)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment