Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
skais
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Raphael Sturgis
skais
Commits
240ae0e0
Commit
240ae0e0
authored
2 years ago
by
Raphael
Browse files
Options
Downloads
Patches
Plain Diff
jit compiling for basic_features_operations.py
parent
4c9222b0
No related branches found
No related tags found
1 merge request
!13
Draft: Develop
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
skais/process/basic_features_operations.py
+27
-21
27 additions, 21 deletions
skais/process/basic_features_operations.py
with
27 additions
and
21 deletions
skais/process/basic_features_operations.py
+
27
−
21
View file @
240ae0e0
import
cmath
import
cmath
from
numba
import
jit
import
numpy
as
np
import
numpy
as
np
@jit
(
nopython
=
True
,
fastmath
=
True
)
def
angular_average_vector
(
angles
):
def
angular_average_vector
(
angles
):
n
=
len
(
angles
)
n
=
len
(
angles
)
x
=
np
.
sum
(
np
.
cos
(
angles
))
/
n
x
=
np
.
sum
(
np
.
cos
(
angles
))
/
n
...
@@ -11,11 +12,13 @@ def angular_average_vector(angles):
...
@@ -11,11 +12,13 @@ def angular_average_vector(angles):
return
np
.
array
([
x
,
y
])
return
np
.
array
([
x
,
y
])
@jit
(
nopython
=
True
,
fastmath
=
True
)
def
angular_dispersion
(
angles
):
def
angular_dispersion
(
angles
):
x
,
y
=
angular_average_vector
(
angles
)
x
,
y
=
angular_average_vector
(
angles
)
return
np
.
sqrt
(
x
**
2
+
y
**
2
)
return
np
.
sqrt
(
x
**
2
+
y
**
2
)
@jit
(
nopython
=
True
,
fastmath
=
True
)
def
angular_mean
(
angles
):
def
angular_mean
(
angles
):
x
,
y
=
angular_average_vector
(
angles
)
x
,
y
=
angular_average_vector
(
angles
)
theta
=
np
.
arctan
(
y
/
x
)
theta
=
np
.
arctan
(
y
/
x
)
...
@@ -28,10 +31,12 @@ def angular_mean(angles):
...
@@ -28,10 +31,12 @@ def angular_mean(angles):
return
2
*
np
.
pi
+
theta
return
2
*
np
.
pi
+
theta
@jit
(
nopython
=
True
,
fastmath
=
True
)
def
angular_std
(
angles
):
def
angular_std
(
angles
):
return
1
-
angular_dispersion
(
angles
)
return
1
-
angular_dispersion
(
angles
)
@jit
(
nopython
=
True
,
fastmath
=
True
)
def
angular_time_derivative
(
angle1
,
angle2
,
ts1
,
ts2
):
def
angular_time_derivative
(
angle1
,
angle2
,
ts1
,
ts2
):
z1
=
np
.
cos
(
angle1
)
+
np
.
sin
(
angle1
)
*
1j
z1
=
np
.
cos
(
angle1
)
+
np
.
sin
(
angle1
)
*
1j
z2
=
np
.
cos
(
angle2
)
+
np
.
sin
(
angle2
)
*
1j
z2
=
np
.
cos
(
angle2
)
+
np
.
sin
(
angle2
)
*
1j
...
@@ -40,5 +45,6 @@ def angular_time_derivative(angle1, angle2, ts1, ts2):
...
@@ -40,5 +45,6 @@ def angular_time_derivative(angle1, angle2, ts1, ts2):
return
cmath
.
polar
(
z
)[
1
]
/
(
ts2
-
ts1
)
return
cmath
.
polar
(
z
)[
1
]
/
(
ts2
-
ts1
)
@jit
(
nopython
=
True
,
fastmath
=
True
)
def
time_derivative
(
f1
,
f2
,
ts1
,
ts2
):
def
time_derivative
(
f1
,
f2
,
ts1
,
ts2
):
return
(
f2
-
f1
)
/
(
ts2
-
ts1
)
return
(
f2
-
f1
)
/
(
ts2
-
ts1
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment