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
aac48af1
Commit
aac48af1
authored
3 years ago
by
Raphael Sturgis
Browse files
Options
Downloads
Patches
Plain Diff
rewrote average angle to correspond to article
parent
16c2a9b2
No related branches found
No related tags found
2 merge requests
!12
version 0.2a
,
!10
Resolve "Image creation bugs with 0 size windows"
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
skais/process/basic_features_operations.py
+6
-8
6 additions, 8 deletions
skais/process/basic_features_operations.py
skais/tests/process/test_basic_features_operations.py
+4
-4
4 additions, 4 deletions
skais/tests/process/test_basic_features_operations.py
with
10 additions
and
12 deletions
skais/process/basic_features_operations.py
+
6
−
8
View file @
aac48af1
...
@@ -18,16 +18,14 @@ def angular_dispersion(angles):
...
@@ -18,16 +18,14 @@ def angular_dispersion(angles):
def
angular_mean
(
angles
):
def
angular_mean
(
angles
):
x
,
y
=
angular_average_vector
(
angles
)
x
,
y
=
angular_average_vector
(
angles
)
theta
=
abs
(
np
.
arctan
2
(
x
,
y
)
)
theta
=
np
.
arctan
(
y
/
x
)
if
y
>
0
and
x
>
0
:
# first Q
if
y
>
0
and
x
>
0
:
return
theta
return
theta
if
y
>
0
>=
x
:
# Second Q
elif
x
<=
0
:
return
np
.
pi
/
2
+
theta
return
np
.
pi
+
theta
if
y
<=
0
<
x
:
# Fourth Q
else
:
return
np
.
pi
/
2
-
theta
return
2
*
np
.
pi
+
theta
else
:
# Third Q
return
-
theta
def
angular_std
(
angles
):
def
angular_std
(
angles
):
...
...
This diff is collapsed.
Click to expand it.
skais/tests/process/test_basic_features_operations.py
+
4
−
4
View file @
aac48af1
...
@@ -9,7 +9,7 @@ class TestAngular(unittest.TestCase):
...
@@ -9,7 +9,7 @@ class TestAngular(unittest.TestCase):
def
test_angular_mean_simple
(
self
):
def
test_angular_mean_simple
(
self
):
x
=
np
.
radians
(
np
.
array
([
1
,
359
]))
x
=
np
.
radians
(
np
.
array
([
1
,
359
]))
self
.
assertEqual
(
0.0
,
angular_mean
(
x
))
self
.
assertEqual
(
2
*
np
.
pi
,
angular_mean
(
x
))
def
test_angular_mean_simple_2
(
self
):
def
test_angular_mean_simple_2
(
self
):
x
=
np
.
radians
(
np
.
array
([
180
,
180
,
180
,
180
,
179
,
181
]))
x
=
np
.
radians
(
np
.
array
([
180
,
180
,
180
,
180
,
179
,
181
]))
...
@@ -19,7 +19,7 @@ class TestAngular(unittest.TestCase):
...
@@ -19,7 +19,7 @@ class TestAngular(unittest.TestCase):
def
test_angular_mean_simple_3
(
self
):
def
test_angular_mean_simple_3
(
self
):
x
=
np
.
radians
(
np
.
array
([
0
,
0
,
0
,
0
,
359
,
1
]))
x
=
np
.
radians
(
np
.
array
([
0
,
0
,
0
,
0
,
359
,
1
]))
self
.
assertEqual
(
0.0
,
angular_mean
(
x
))
self
.
assertEqual
(
2
*
np
.
pi
,
angular_mean
(
x
))
def
test_angular_mean_first_quadrant
(
self
):
def
test_angular_mean_first_quadrant
(
self
):
x
=
np
.
radians
(
np
.
array
([
43
,
44
,
45
,
46
,
47
]))
x
=
np
.
radians
(
np
.
array
([
43
,
44
,
45
,
46
,
47
]))
...
@@ -34,12 +34,12 @@ class TestAngular(unittest.TestCase):
...
@@ -34,12 +34,12 @@ class TestAngular(unittest.TestCase):
def
test_angular_mean_third_quadrant
(
self
):
def
test_angular_mean_third_quadrant
(
self
):
x
=
np
.
radians
(
np
.
array
([
223
,
224
,
225
,
226
,
227
]))
x
=
np
.
radians
(
np
.
array
([
223
,
224
,
225
,
226
,
227
]))
self
.
assertEqual
(
-
3
*
np
.
pi
/
4
,
angular_mean
(
x
))
self
.
assertEqual
(
5
*
np
.
pi
/
4
,
angular_mean
(
x
))
def
test_angular_mean_fourth_quadrant
(
self
):
def
test_angular_mean_fourth_quadrant
(
self
):
x
=
np
.
radians
(
np
.
array
([
313
,
314
,
315
,
316
,
317
]))
x
=
np
.
radians
(
np
.
array
([
313
,
314
,
315
,
316
,
317
]))
self
.
assertEqual
(
-
np
.
pi
/
4
,
angular_mean
(
x
))
self
.
assertEqual
(
7
*
np
.
pi
/
4
,
angular_mean
(
x
))
def
test_angular_std
(
self
):
def
test_angular_std
(
self
):
x
=
np
.
radians
(
np
.
array
([
0
,
0
,
0
,
0
]))
x
=
np
.
radians
(
np
.
array
([
0
,
0
,
0
,
0
]))
...
...
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