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
5b5a2d32
Commit
5b5a2d32
authored
2 years ago
by
Raphael Sturgis
Browse files
Options
Downloads
Patches
Plain Diff
added tests and function prototype for getting time stamps' for label changes
parent
58ca07aa
No related branches found
Branches containing commit
No related tags found
Tags containing commit
3 merge requests
!12
version 0.2a
,
!10
Resolve "Image creation bugs with 0 size windows"
,
!8
Resolve "Get time windows for labels"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
skais/ais/ais_trajectory.py
+3
-0
3 additions, 0 deletions
skais/ais/ais_trajectory.py
skais/tests/ais/test_ais_trajectory.py
+46
-1
46 additions, 1 deletion
skais/tests/ais/test_ais_trajectory.py
with
49 additions
and
1 deletion
skais/ais/ais_trajectory.py
+
3
−
0
View file @
5b5a2d32
...
...
@@ -214,3 +214,6 @@ class AISTrajectory(AISPoints):
return
self
else
:
return
AISTrajectory
(
new_df
,
mmsi
=
self
.
mmsi
)
def
get_time_per_label_shift
(
self
):
pass
\ No newline at end of file
This diff is collapsed.
Click to expand it.
skais/tests/ais/test_ais_trajectory.py
+
46
−
1
View file @
5b5a2d32
...
...
@@ -333,4 +333,49 @@ class TestAISTrajectory(unittest.TestCase):
expected
=
np
.
array
([
2
,
2
,
2
,
2
,
2
])
np
.
testing
.
assert_equal
(
result
,
expected
)
\ No newline at end of file
np
.
testing
.
assert_equal
(
result
,
expected
)
def
test_get_time_per_label_shift_single_label
(
self
):
trajectory
=
AISTrajectory
(
pd
.
DataFrame
(
{
"
label
"
:
[
1
for
_
in
range
(
0
,
101
,
10
)],
"
ts_sec
"
:
[
i
for
i
in
range
(
0
,
6001
,
600
)]
}
)
)
result
=
trajectory
.
get_time_per_label_shift
()
expected
=
[(
0
,
1
)]
self
.
assertListEqual
(
result
,
expected
)
def
test_get_time_per_label_shift_label_switch_1
(
self
):
trajectory
=
AISTrajectory
(
pd
.
DataFrame
(
{
"
label
"
:
[
1
for
_
in
range
(
0
,
101
,
10
)]
+
[
2
for
_
in
range
(
0
,
101
,
10
)],
"
ts_sec
"
:
[
i
for
i
in
range
(
0
,
12001
,
600
)]
}
)
)
result
=
trajectory
.
get_time_per_label_shift
()
expected
=
[(
0
,
1
),
(
6600
,
2
)]
self
.
assertListEqual
(
result
,
expected
)
def
test_get_time_per_label_shift_label_switch_2
(
self
):
trajectory
=
AISTrajectory
(
pd
.
DataFrame
(
{
"
label
"
:
[
1
for
_
in
range
(
0
,
101
,
10
)]
+
[
2
for
_
in
range
(
0
,
101
,
10
)]
+
[
1
for
_
in
range
(
0
,
101
,
10
)],
"
ts_sec
"
:
[
i
for
i
in
range
(
0
,
18001
,
600
)]
}
)
)
result
=
trajectory
.
get_time_per_label_shift
()
expected
=
[(
0
,
1
),
(
6600
,
2
),
(
12600
,
1
)]
self
.
assertListEqual
(
result
,
expected
)
\ No newline at end of file
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