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
fe57f69e
Commit
fe57f69e
authored
2 years ago
by
Raphael Sturgis
Browse files
Options
Downloads
Patches
Plain Diff
implementation of generate_array_from_positions
parent
1df048b1
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"
,
!9
Resolve "Creation of images from AIS"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
skais/ais/ais_trajectory.py
+20
-2
20 additions, 2 deletions
skais/ais/ais_trajectory.py
with
20 additions
and
2 deletions
skais/ais/ais_trajectory.py
+
20
−
2
View file @
fe57f69e
...
...
@@ -41,7 +41,7 @@ def apply_func_on_window(dat, func, radius, on_edge='copy'):
return
result
elif
on_edge
==
'
ignore
'
:
for
i
in
range
(
0
,
dat
.
shape
[
0
]):
lower_bound
=
max
(
0
,
i
-
radius
)
lower_bound
=
max
(
0
,
i
-
radius
)
upper_bound
=
min
(
dat
.
shape
[
0
],
i
+
radius
+
1
)
data
=
dat
[
lower_bound
:
upper_bound
]
result
[
i
]
=
func
(
data
)
...
...
@@ -222,4 +222,22 @@ class AISTrajectory(AISPoints):
if
current_label
!=
row
[
label_column
]:
current_label
=
row
[
label_column
]
result
.
append
((
row
[
'
ts_sec
'
],
current_label
))
return
result
\ No newline at end of file
return
result
def
generate_array_from_positions
(
self
,
height
=
256
,
width
=
256
,
link
=
True
,
bounding_box
=
'
fit
'
,
features
=
None
):
nb_channels
=
1
if
features
is
not
None
:
nb_channels
=
len
(
features
)
data
=
np
.
zeros
((
height
,
width
,
nb_channels
),
dtype
=
np
.
uint8
)
if
link
:
raise
ValueError
(
"
feature not implemented
"
)
if
bounding_box
!=
'
fit
'
:
raise
ValueError
(
"
feature not implemented
"
)
positions
=
self
.
df
[[
'
longitude
'
,
'
latitude
'
]].
to_numpy
()
range_longitude
=
(
min
(
positions
[
0
,
:]),
max
(
positions
[
0
,
:]))
range_latitude
=
(
min
(
positions
[
1
,
:]),
max
(
positions
[
1
,
:]))
for
longitude
,
latitude
in
positions
:
x_coord
=
width
*
(
longitude
-
range_longitude
[
0
])
/
(
range_longitude
[
1
]
-
range_longitude
[
0
])
y_coord
=
height
*
(
longitude
-
range_latitude
[
0
])
/
(
range_latitude
[
1
]
-
range_latitude
[
0
])
data
[
x_coord
,
y_coord
,
:]
=
1
return
data
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