Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
9.2.2023: Due to updates GitLab will be unavailable for some minutes between 9:00 and 11:00.
Open sidebar
vadere
vadere
Commits
3c3420a1
Commit
3c3420a1
authored
May 23, 2019
by
Benedikt Zoennchen
Browse files
Merge branch 'master' of
https://gitlab.lrz.de/vadere/vadere
parents
eb486382
afde08fe
Changes
5
Hide whitespace changes
Inline
Side-by-side
Tools/Notebooks/TrajectoryMetric.ipynb
View file @
3c3420a1
...
...
@@ -178,7 +178,59 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Helpler method to access parts of the trajectory"
"# Calculate evacution time"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Evacuation time = endTime - startTime"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Real data"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Sum up all measured time deltas of a pedestrian to get the final evacuation time\n",
"trajectoriesReal[\"timeDelta\"] = trajectoriesReal[\"endTime\"] - trajectoriesReal[\"startTime\"]\n",
"evacuation_time = trajectoriesReal.groupby([\"pedestrianId\"])[\"timeDelta\"].sum()\n",
"\n",
"print(\"Evacuation time (real data)\")\n",
"print(\"- mean: {:.2f} [s]\".format(evacuation_time.mean()))\n",
"print(\"- std: {:.2f} [s]\".format(evacuation_time.std()))\n",
"print(\"- min: {:.2f} [s]\".format(evacuation_time.min()))\n",
"print(\"- max: {:.2f} [s]\".format(evacuation_time.max()))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Simulation data"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"TODO: Use `PedestrianEvacuationTimeProcessor` to log evacuation time during simulation and analyze it here."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Helper method to access parts of the trajectory"
]
},
{
...
...
@@ -551,41 +603,6 @@
"pd.DataFrame([[1,2,3,4,5],[6,7,8,9,10]], columns=['pedestrianId','timeStep','x','y','time'])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
...
...
@@ -594,22 +611,6 @@
"source": [
"to_postVis(data)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"1 in [1,2,3]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
...
...
@@ -628,7 +629,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.
8
"
"version": "3.6.
7
"
}
},
"nbformat": 4,
...
...
%% Cell type:code id: tags:
```
python
# expand the cell of the notebook
import
json
import
numpy
as
np
import
pandas
as
pd
import
math
import
matplotlib.pyplot
as
plt
from
matplotlib.lines
import
Line2D
from
IPython.core.display
import
display
,
HTML
display
(
HTML
(
'<style>.container { width:100% !important; }</style>'
))
```
%% Cell type:markdown id: tags:
# Convert Vadere trajectories into a DataFrame
%% Cell type:code id: tags:
```
python
def
fs_append
(
pedestrianId
,
fs
,
llist
):
llist
.
append
([
pedestrianId
,
fs
[
'start'
][
'x'
],
fs
[
'start'
][
'y'
],
fs
[
'startTime'
],
fs
[
'end'
][
'x'
],
fs
[
'end'
][
'y'
],
fs
[
'endTime'
]])
def
trajectory_append
(
pedestrianId
,
trajectory
,
llist
):
for
fs
in
trajectory
:
fs_append
(
pedestrianId
,
fs
,
llist
)
def
trajectories_to_dataframe
(
trajectories
):
llist
=
[]
for
pedId
in
trajectories
:
trajectory_append
(
pedId
,
trajectories
[
pedId
],
llist
)
dataframe
=
pd
.
DataFrame
(
llist
,
columns
=
[
'pedestrianId'
,
'startX'
,
'startY'
,
'startTime'
,
'endX'
,
'endY'
,
'endTime'
])
return
dataframe
```
%% Cell type:code id: tags:
```
python
file
=
"./data/TrajectoryMetric/trajectories_simulation.txt"
f
=
open
(
file
,
"r"
)
header
=
f
.
readline
();
trajectories
=
dict
({});
for
row
in
f
:
s
=
row
.
split
(
" "
);
pedId
=
int
(
s
[
0
]);
footsteps
=
json
.
loads
(
s
[
1
]);
trajectories
[
pedId
]
=
footsteps
[
0
][
'footSteps'
];
ptrajectories
=
trajectories_to_dataframe
(
trajectories
)
ptrajectories
.
head
()
```
%% Cell type:markdown id: tags:
# Convert experiment data into a DataFrame
%% Cell type:code id: tags:
```
python
def
load_experiment
(
file
):
fps
=
16
pad
=
pd
.
DataFrame
([[
np
.
nan
,
np
.
nan
,
np
.
nan
,
np
.
nan
,
np
.
nan
]],
columns
=
[
'pedestrianId'
,
'timeStep'
,
'x'
,
'y'
,
'e'
])
data
=
pd
.
read_csv
(
file
,
sep
=
' '
,
names
=
[
'pedestrianId'
,
'timeStep'
,
'x'
,
'y'
,
'e'
],
index_col
=
False
,
header
=
None
,
skiprows
=
0
)
cc
=
pd
.
concat
([
pad
,
data
],
ignore_index
=
True
)
data
[
'endX'
]
=
data
[
'x'
]
/
100
+
18.7
data
[
'endY'
]
=
data
[
'y'
]
/
100
+
4.2
data
[
'startX'
]
=
cc
[
'x'
]
/
100
+
18.7
data
[
'startY'
]
=
cc
[
'y'
]
/
100
+
4.2
data
[
'startTime'
]
=
data
[
'timeStep'
]
/
fps
-
1
/
fps
data
[
'endTime'
]
=
data
[
'timeStep'
]
/
fps
data
=
data
.
drop
(
columns
=
[
'timeStep'
,
'x'
,
'y'
,
'e'
])
return
data
def
to_trajectories
(
data
):
trajectories
=
dict
({})
trajectory
=
[]
for
i
in
range
(
len
(
data
)
-
1
):
pedId
=
data
[
'pedestrianId'
][
i
]
if
pedId
==
data
[
'pedestrianId'
][
i
+
1
]:
pedId
=
data
[
'pedestrianId'
][
i
]
x1
=
data
[
'x'
][
i
]
y1
=
data
[
'y'
][
i
]
x2
=
data
[
'x'
][
i
+
1
]
y2
=
data
[
'y'
][
i
+
1
]
startTime
=
data
[
'timeStep'
][
i
]
endTime
=
data
[
'timeStep'
][
i
+
1
]
fs
=
{
'startTime'
:
startTime
,
'endTime'
:
endTime
,
'start'
:{
'x'
:
x1
,
'y'
:
y1
},
'end'
:{
'x'
:
x2
,
'y'
:
y2
}}
trajectory
.
append
(
fs
)
else
:
trajectories
[
pedId
]
=
trajectory
trajectory
=
[]
pedId
=
data
[
'pedestrianId'
][
i
]
return
trajectories
```
%% Cell type:code id: tags:
```
python
#times = np.linspace(4,10,10)
#euclid_d(get_trajectory(1), get_trajectory(1), times)
#to_trajectories(load_experiment(real_file))[1]
real_file
=
"./data/TrajectoryMetric/KO/ko-240-120-240/ko-240-120-240_combined_MB.txt"
trajectoriesReal
=
load_experiment
(
real_file
)
#trajectoriesReal = to_trajectories(data)
trajectoriesReal
.
query
(
'pedestrianId == 1'
).
head
()
```
%% Cell type:markdown id: tags:
# Convert DataFrame to postvis DataFrame
%% Cell type:code id: tags:
```
python
def
to_postVis
(
df
):
simTimeStep
=
0.4
fps
=
16
df
[
'timeStep'
]
=
np
.
ceil
(
df
[
'endTime'
]
/
(
1
/
fps
)).
astype
(
np
.
int
)
df
[
'x'
]
=
df
[
'endX'
]
df
[
'y'
]
=
df
[
'endY'
]
df
[
'simTime'
]
=
df
[
'endTime'
]
df
=
df
.
drop
(
columns
=
[
'startX'
,
'startY'
,
'endX'
,
'endY'
,
'startTime'
,
'endTime'
])
return
df
```
%% Cell type:code id: tags:
```
python
to_postVis
(
trajectoriesReal
).
to_csv
(
'expteriment_2.trajectories'
,
index
=
False
,
sep
=
' '
)
to_postVis
(
trajectoriesReal
).
head
(
10
)
```
%% Cell type:markdown id: tags:
# Helpler method to access parts of the trajectory
# Calculate evacution time
%% Cell type:markdown id: tags:
Evacuation time = endTime - startTime
%% Cell type:markdown id: tags:
## Real data
%% Cell type:code id: tags:
```
python
# Sum up all measured time deltas of a pedestrian to get the final evacuation time
trajectoriesReal
[
"timeDelta"
]
=
trajectoriesReal
[
"endTime"
]
-
trajectoriesReal
[
"startTime"
]
evacuation_time
=
trajectoriesReal
.
groupby
([
"pedestrianId"
])[
"timeDelta"
].
sum
()
print
(
"Evacuation time (real data)"
)
print
(
"- mean: {:.2f} [s]"
.
format
(
evacuation_time
.
mean
()))
print
(
"- std: {:.2f} [s]"
.
format
(
evacuation_time
.
std
()))
print
(
"- min: {:.2f} [s]"
.
format
(
evacuation_time
.
min
()))
print
(
"- max: {:.2f} [s]"
.
format
(
evacuation_time
.
max
()))
```
%% Cell type:markdown id: tags:
## Simulation data
%% Cell type:markdown id: tags:
TODO: Use
`PedestrianEvacuationTimeProcessor`
to log evacuation time during simulation and analyze it here.
%% Cell type:markdown id: tags:
# Helper method to access parts of the trajectory
%% Cell type:code id: tags:
```
python
def
get_trajectory
(
pedId
,
trajectories
):
"""returns a data frame containing the trajectory of one specific agent."""
query
=
'pedestrianId == '
+
str
(
pedId
)
return
trajectories
.
query
(
query
)
def
get_pedestrianIds
(
trajectories
):
return
trajectories
[
'pedestrianId'
].
unique
()
def
get_footstep
(
trajectory
,
i
):
"""returns the i-ths footstep."""
return
trajectory
.
iloc
[
i
];
def
get_footstep_by_time
(
trajectory
,
time
):
"""returns the footstep which happens at time or nothing (None)."""
query
=
'startTime <= '
+
str
(
time
)
+
' and '
+
str
(
time
)
+
' < endTime'
fs
=
trajectories
.
query
(
query
)
assert
len
(
fs
)
>=
1
return
fs
def
start_time
(
trajectory
):
"""returns the time of the first footstep of the trajectory."""
return
get_footstep
(
trajectory
,
0
)[
'startTime'
];
def
end_time
(
trajectory
):
return
get_footstep
(
trajectory
,
len
(
trajectory
)
-
1
)[
'endTime'
];
def
max_start_time
(
trajectories
):
"""returns the time of the first footstep of the trajectory which starts last."""
pedestrianIds
=
get_pedestrianIds
(
trajectories
)
return
max
(
map
(
lambda
pedId
:
start_time
(
get_trajectory
(
pedId
,
trajectories
)),
pedestrianIds
))
def
min_end_time
(
trajectories
):
"""returns the time of the last footstep of the trajectory which ends first."""
pedestrianIds
=
get_pedestrianIds
(
trajectories
)
return
min
(
map
(
lambda
pedId
:
end_time
(
get_trajectory
(
pedId
,
trajectories
)),
pedestrianIds
))
def
footstep_is_between
(
fs
,
time
):
"""true if the foostep and the intersection with time is not empty."""
startTime
=
fs
[
'startTime'
];
endTime
=
fs
[
'endTime'
];
return
startTime
<=
time
and
time
<
endTime
;
def
cut
(
trajectory
,
sTime
,
eTime
):
query
=
'startTime >= '
+
str
(
sTime
)
+
' and endTime < '
+
str
(
eTime
)
return
trajectory
.
query
(
query
)
def
cut_soft
(
trajectory
,
sTime
,
eTime
):
query
=
'endTime > '
+
str
(
sTime
)
+
' and startTime < '
+
str
(
eTime
)
return
trajectory
.
query
(
query
)
```
%% Cell type:markdown id: tags:
# Helper methods to compute different metrices
%% Cell type:code id: tags:
```
python
def
footstep_length
(
fs
):
"""Euclidean length of a footstep."""
x1
=
fs
[
'startX'
];
y1
=
fs
[
'startY'
];
x2
=
fs
[
'endX'
];
y2
=
fs
[
'endY'
];
dx
=
x1
-
x2
;
dy
=
y1
-
y2
;
return
np
.
sqrt
(
dx
*
dx
+
dy
*
dy
);
def
trajectory_length
(
trajectory
):
"""Euclidean length of a trajectory."""
dx
=
trajectory
[
'startX'
]
-
trajectory
[
'endX'
]
dy
=
trajectory
[
'startY'
]
-
trajectory
[
'endY'
]
return
np
.
sqrt
(
dx
*
dx
+
dy
*
dy
).
sum
();
def
footstep_direction
(
fs
):
"""Vector from start to end position."""
x1
=
fs
[
'startX'
];
y1
=
fs
[
'startY'
];
x2
=
fs
[
'endX'
];
y2
=
fs
[
'endY'
];
return
np
.
array
([
x2
-
x1
,
y2
-
y1
]);
def
footstep_duration
(
fs
):
"""Duration of a footstep."""
startTime
=
fs
[
'startTime'
];
endTime
=
fs
[
'endTime'
];
return
endTime
-
startTime
;
def
trajectory_duration
(
trajectory
):
"""Euclidean length of a trajectory."""
return
(
trajectory
[
'endTime'
]
-
trajectory
[
'startTime'
]).
sum
();
def
footstep_speed
(
fs
):
"""Speed of the footstep."""
return
footstep_length
(
fs
)
/
footstep_duration
(
fs
);
def
trajectory_speed
(
fs
):
"""Speed of the trajectory."""
return
trajectory_length
(
fs
)
/
trajectory_duration
(
fs
);
#def trajectory_positions(trajectory, times):
# mask = trajectory[['startTime', 'endTime']].mask(lambda x: x**2)
# (df['date'] > '2000-6-1') & (df['date'] <= '2000-6-10')
# duration = trajectory['endTime'] - trajectory['startTime']
# dx = trajectory['endX'] - trajectory['startX']
# dy = trajectory['endY'] - trajectory['startY']
# direction =
def
filter_trajectories
(
trajectories
,
times
):
"""Filters trajectory by times."""
rows
=
[]
for
row
in
trajectories
.
itertuples
():
if
len
(
list
(
filter
(
lambda
b
:
b
,
map
(
lambda
t
:
row
.
startTime
<=
t
and
t
<
row
.
endTime
,
times
))))
>
0
:
rows
.
append
(
row
)
return
pd
.
DataFrame
(
rows
)
def
trajectories_position
(
trajectories
,
times
):
"""Transforms trajectories into positions at each time in times such that each position is computed by linear interpolation."""
rows
=
[]
#print(trajectories)
for
row
in
trajectories
.
itertuples
():
llist
=
list
(
filter
(
lambda
t
:
row
.
startTime
<=
t
and
t
<
row
.
endTime
,
times
))
assert
len
(
llist
)
==
1
or
len
(
llist
)
==
0
if
len
(
llist
)
>
0
:
time
=
llist
[
0
]
dur
=
row
.
endTime
-
row
.
startTime
partial_dur
=
time
-
row
.
startTime
ratio
=
partial_dur
/
dur
direction
=
np
.
array
([
row
.
endX
-
row
.
startX
,
row
.
endY
-
row
.
startY
])
l
=
np
.
linalg
.
norm
(
direction
)
if
l
>
0
:
partial_l
=
l
*
ratio
;
v
=
direction
/
l
*
partial_l
;
pos
=
np
.
array
([
row
.
startX
,
row
.
startY
])
+
v
;
rows
.
append
([
row
.
pedestrianId
,
pos
[
0
],
pos
[
1
],
time
])
else
:
rows
.
append
([
row
.
pedestrianId
,
np
.
nan
,
np
.
nan
,
time
])
dataframe
=
pd
.
DataFrame
(
rows
,
columns
=
[
'pedestrianId'
,
'x'
,
'y'
,
'time'
])
return
dataframe
def
euclid_d
(
trajPos1
,
trajPos2
):
"""Computes the total (Euclidean) distance between two trajectories.
Assumption: trajectories are both cut acccordingly!
"""
assert
len
(
trajPos1
)
==
len
(
trajPos2
)
dx
=
trajPos1
[
'x'
]
-
trajPos2
[
'x'
]
dy
=
trajPos1
[
'y'
]
-
trajPos2
[
'y'
]
norm
=
np
.
sqrt
(
dx
**
2
+
dy
**
2
)
return
norm
.
sum
()
/
len
(
dx
)
def
euclid_path_length
(
trajPos1
,
trajPos2
):
"""Computes the total (Euclidean) path length difference between two trajectories.
Assumption: trajectories are both cut acccordingly!
"""
count
=
len
(
trajPos1
)
pad
=
pd
.
DataFrame
([[
np
.
nan
,
np
.
nan
,
np
.
nan
,
np
.
nan
]],
columns
=
[
'pedestrianId'
,
'x'
,
'y'
,
'time'
])
trajPos1Pad
=
pd
.
concat
([
pad
,
trajPos1
],
ignore_index
=
True
)
trajPos2Pad
=
pd
.
concat
([
pad
,
trajPos1
],
ignore_index
=
True
)
dx1
=
trajPos1
[
'x'
]
-
trajPos1Pad
[
'x'
]
dy1
=
trajPos1
[
'y'
]
-
trajPos1Pad
[
'y'
]
dx2
=
trajPos2
[
'x'
]
-
trajPos2Pad
[
'x'
]
dy2
=
trajPos2
[
'y'
]
-
trajPos2Pad
[
'y'
]
dx
=
dx1
-
dx2
dy
=
dy1
-
dy2
diff
=
np
.
sqrt
(
dx
**
2
+
dy
**
2
)
return
diff
.
sum
()
def
euclid_len
(
trajectory
,
sTime
,
eTime
):
"""Computes the total (Euclidean) length of the trajectory in between [sTime;eTime]."""
cut_traj
=
cut_soft
(
trajectory
,
sTime
,
eTime
);
return
trajectory_length
(
cut_traj
)
def
inter_agent_d
(
trajPos
):
"""Computes the inter agent (Euclidean) distance between all pairs of agents.
Assumption: the trajectory is cut accordingly, ie the time is equal for
each position.
"""
s
=
0
min_index
=
min
(
trajectories
.
keys
())
c
=
0
llen
=
len
(
trajPos
)
for
index1
,
row1
in
trajPos
.
iterrows
():
for
index2
,
row2
in
trajPos
.
tail
(
llen
-
1
-
index1
).
iterrows
():
x1
=
row1
[
'x'
]
y1
=
row1
[
'y'
]
x2
=
row2
[
'x'
]
y2
=
row2
[
'y'
]
dx
=
x1
-
x2
dy
=
y1
-
y2
s
=
s
+
np
.
sqrt
(
dx
**
2
+
dy
**
2
)
c
=
c
+
1
if
c
==
0
:
return
0
else
:
return
s
/
c
def
total_inter_agent
(
trajectories1
,
trajectories2
,
times
):
"""too expensive! TODO!"""
return
sum
(
map
(
lambda
t
:
inter_agent_d
(
trajectories_position
(
trajectories1
,
[
t
]))
-
inter_agent_d
(
trajectories_position
(
trajectories2
,
[
t
])),
times
))
/
len
(
times
)
```
%% Cell type:code id: tags:
```
python
#start_time(get_trajectory(1, ptrajectories))
#max_start_time(ptrajectories)
#end_time(get_trajectory(1, ptrajectories))
#foot_step_length(get_footstep(get_trajectory(1, ptrajectories), 0))
#trajectory_length(get_trajectory(1, ptrajectories))
#trajectory_speed(get_trajectory(1, ptrajectories))
cutTraj
=
cut
(
get_trajectory
(
1
,
ptrajectories
),
0.0
,
10.0
)[[
'startTime'
,
'endTime'
]]
#cutTraj.mask(cutTraj['startTime'] <= 4 and 4 > cutTraj['endTime'])
#start_time(get_trajectory(1, ptrajectories))
#trajectories_position(ptrajectories, [1,2,3,4]).head()
trajPos1
=
trajectories_position
(
get_trajectory
(
2
,
ptrajectories
),
[
1
,
2
,
3
,
4
,
5
,
6
,
8
,
9
,
10
,
11
,
12
,
13
])
trajPos2
=
trajectories_position
(
get_trajectory
(
7
,
ptrajectories
),
[
1
,
2
,
3
,
4
,
5
,
6
,
8
,
9
,
10
,
11
,
12
,
13
])
trajPos1
=
trajPos1
[
~
np
.
isnan
(
trajPos1
.
x
)]
trajPos2
=
trajPos2
[
~
np
.
isnan
(
trajPos2
.
x
)]
euclid_path_length
(
trajPos1
,
trajPos2
)
euclid_len
(
ptrajectories
,
0
,
10000
)
#print(total_inter_agent(ptrajectories, ptrajectories, [1,2]))
```
%% Cell type:code id: tags:
```
python
def
greedy_match
(
trajectories1
,
trajectories2
,
times
,
f
):
"""Computes a match of trajectories by using a greedy algorithm."""
assert
len
(
trajectories1
)
==
len
(
trajectories2
)
min_index1
=
min
(
trajectories1
.
keys
())
min_index2
=
min
(
trajectories2
.
keys
())
match
=
{}
indexSet
=
set
(
range
(
min_index2
,
len
(
trajectories2
)))
for
i
in
range
(
min_index1
,
len
(
trajectories1
)):
traj1
=
trajectories1
[
i
]
minVal
=
None
minIndex
=
None
for
j
in
indexSet
:
traj2
=
trajectories2
[
j
]
if
overlap
(
traj1
,
traj2
,
0.4
):
val
=
f
(
traj1
,
traj2
,
times
)
if
(
minVal
==
None
or
val
<
minVal
):
minIndex
=
j
minVal
=
val
match
[
i
]
=
minIndex
indexSet
.
remove
(
minIndex
)
return
match
```
%% Cell type:markdown id: tags:
# Plot trajectories
%% Cell type:code id: tags:
```
python
def
to_line
(
trajectory
,
xleft
):
"""Transforms a trajectory into a Line2D."""
x
=
trajectory
[
'endX'
].
values
y
=
trajectory
[
'endY'
].
values
if
x
[
0
]
<
xleft
:
c
=
current_palette
[
2
]
else
:
c
=
current_palette
[
0
]
return
x
,
y
,
Line2D
(
x
,
y
,
color
=
c
,
linewidth
=
0.2
)
def
add_lines
(
trajectories
,
xleft
,
ax
):
grouped
=
trajectories
.
groupby
([
'pedestrianId'
])
for
name
,
group
in
grouped
:
x
,
y
,
line
=
to_line
(
group
,
xleft
)
ax
.
add_line
(
line
)
```
%% Cell type:code id: tags:
```
python
import
seaborn
as
sns
sns
.
set
(
style
=
"ticks"
)
current_palette
=
sns
.
color_palette
()
x_vcenter
=
17.5
y_vcenter
=
5.2
fig1
=
plt
.
figure
(
figsize
=
(
10
,
10
))
ax1
=
fig1
.
add_subplot
(
111
)
add_lines
(
trajectoriesReal
,
14
,
ax1
)
ax1
.
set_xlim
(
x_vcenter
-
5
,
x_vcenter
+
5
)
ax1
.
set_ylim
(
y_vcenter
-
4
,
y_vcenter
+
4
)
ax1
.
set_aspect
(
1
)
fig2
=
plt
.
figure
(
figsize
=
(
10
,
10
))
ax2
=
fig2
.
add_subplot
(
111
)
add_lines
(
ptrajectories
,
14
,
ax2
)
ax2
.
set_xlim
(
x_vcenter
-
5
,
x_vcenter
+
5
)
ax2
.
set_ylim
(
y_vcenter
-
4
,
y_vcenter
+
4
)
ax2
.
set_aspect
(
1
)
plt
.
show
()
```
%% Cell type:code id: tags:
```
python
times
=
np
.
arange
(
0
,
80
,
2
)
y
=
list
(
map
(
lambda
t
:
inter_agent_d
(
trajectories
,
t
),
times
))
plt
.
plot
(
times
,
y
,
'o'
)
```
%% Cell type:code id: tags:
```
python
start_time
(
trajectories
[
1
])
print
(
max_start_time
(
trajectories
))
print
(
min_end_time
(
trajectories
))
```
%% Cell type:code id: tags:
```
python
print
(
position
(
map
(
lambda
traj
:
traj
[
"startTime"
],
trajectories
)[
1
],
0
))
```
%% Cell type:code id: tags:
```
python
pd
.
DataFrame
([[
1
,
2
,
3
,
4
,
5
],[
6
,
7
,
8
,
9
,
10
]],
columns
=
[
'pedestrianId'
,
'timeStep'
,
'x'
,
'y'
,
'time'
])
```
%% Cell type:code id: tags:
```
python
``
`
%%
Cell
type
:
code
id
:
tags
:
```
python
```
%% Cell type:code id: tags:
```
python
```
%% Cell type:code id: tags:
```
python
```
%% Cell type:code id: tags:
```
python
```
%% Cell type:code id: tags:
```
python
to_postVis
(
data
)
```
%% Cell type:code id: tags:
```
python
1 in [1,2,3]
```
%% Cell type:code id: tags:
```
python
```
...
...
VadereGui/resources/messages.properties
View file @
3c3420a1
...
...
@@ -234,6 +234,7 @@ SettingsDialog.chbShowTargets.text=Show Targets
SettingsDialog.chbShowSources.text
=
Show Sources
SettingsDialog.chbShowAbsorbingAreas.text
=
Show Absorbing Areas
SettingsDialog.chbShowStairs.text
=
Show Stairs
SettingsDialog.chbShowMeasurementAreas.text
=
Show Measurement Areas
ProjectView.btnSnapshot.tooltip
=
Snapshot
ProjectView.btnPNGSnapshot.tooltip
=
PNG Snapshot
ProjectView.btnSVGSnapshot.tooltip
=
SVG Snapshot
...
...
VadereGui/resources/messages_de_DE.properties
View file @
3c3420a1
...
...
@@ -229,6 +229,7 @@ SettingsDialog.chbShowObstacles.text=Hindernisse anzeigen
SettingsDialog.chbShowTargets.text
=
Ziele anzeigen
SettingsDialog.chbShowSources.text
=
Quellen anzeigen
SettingsDialog.chbShowAbsorbingAreas.text
=
Absorbierende Bereiche anzeigen
SettingsDialog.chbShowMeasurementAreas.text
=
Messbereich anzeigen
SettingsDialog.chbShowStairs.text
=
Treppen anzeigen
ProjectView.btnSnapshot.tooltip
=
Snapshot
ProjectView.btnPNGSnapshot.tooltip
=
PNG-Snapshot
...
...
VadereGui/src/org/vadere/gui/components/model/DefaultSimulationConfig.java
View file @
3c3420a1
...
...
@@ -118,6 +118,10 @@ public class DefaultSimulationConfig extends DefaultConfig {
return
showAbsorbingAreas
;
}
public
boolean
isShowMeasurementAreas
()
{
return
showMeasurementArea
;
}
public
void
setShowTargetPotentielFieldMesh
(
final
boolean
showTargetPotentielFieldMesh
)
{
this
.
showTargetPotentielFieldMesh
=
showTargetPotentielFieldMesh
;
setChanged
();
...
...
VadereGui/src/org/vadere/gui/components/view/SettingsDialog.java
View file @
3c3420a1
...
...
@@ -87,7 +87,7 @@ public class SettingsDialog extends JDialog {
// Layout definition for sub panels
FormLayout
additionalLayout
=
new
FormLayout
(
"5dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 5dlu"
,
// col
"5dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 5dlu"
);
// rows
"5dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref,
2dlu, pref,
5dlu"
);
// rows
FormLayout
colorLayout
=
new
FormLayout
(
"5dlu, pref, 2dlu, pref:grow, 2dlu, pref, 2dlu, pref, 5dlu"
,
// col
"5dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 5dlu"
);
// rows
colorLayeredPane
.
setLayout
(
colorLayout
);
...
...
@@ -107,6 +107,7 @@ public class SettingsDialog extends JDialog {
JCheckBox
chShowTargets
=
new
JCheckBox
((
Messages
.
getString
(
"SettingsDialog.chbShowTargets.text"
)));
JCheckBox
chShowSources
=
new
JCheckBox
((
Messages
.
getString
(
"SettingsDialog.chbShowSources.text"
)));
JCheckBox
chShowAbsorbingAreas
=
new
JCheckBox
((
Messages
.
getString
(
"SettingsDialog.chbShowAbsorbingAreas.text"
)));
JCheckBox
chShowMeasurementAreas
=
new
JCheckBox
((
Messages
.
getString
(
"SettingsDialog.chbShowMeasurementAreas.text"
)));
JCheckBox
chShowStairs
=
new
JCheckBox
((
Messages
.
getString
(
"SettingsDialog.chbShowStairs.text"
)));
JCheckBox
chShowPedIds
=
new
JCheckBox
((
Messages
.
getString
(
"SettingsDialog.chbShowPedestrianIds.text"
)));
...
...
@@ -147,6 +148,12 @@ public class SettingsDialog extends JDialog {
model
.
notifyObservers
();
});
chShowMeasurementAreas
.
setSelected
(
model
.
config
.
isShowMeasurementArea
());
chShowMeasurementAreas
.
addItemListener
(
e
->
{
model
.
config
.
setShowMeasurementArea
(!
model
.
config
.
isShowMeasurementArea
());
model
.
notifyObservers
();
});
chShowStairs
.
setSelected
(
model
.
config
.
isShowSources
());
chShowStairs
.
addItemListener
(
e
->
{
model
.
config
.
setShowStairs
(!
model
.
config
.
isShowStairs
());
...
...
@@ -263,7 +270,8 @@ public class SettingsDialog extends JDialog {
additionalLayeredPane
.
add
(
chShowSources
,
cc
.
xyw
(
2
,
8
,
5
));
additionalLayeredPane
.
add
(
chShowStairs
,
cc
.
xyw
(
2
,
10
,
5
));
additionalLayeredPane
.
add
(
chShowAbsorbingAreas
,
cc
.
xyw
(
2
,
12
,
5
));
additionalLayeredPane
.
add
(
chShowPedIds
,
cc
.
xyw
(
2
,
14
,
5
));
additionalLayeredPane
.
add
(
chShowMeasurementAreas
,
cc
.
xyw
(
2
,
14
,
5
));
additionalLayeredPane
.
add
(
chShowPedIds
,
cc
.
xyw
(
2
,
16
,
5
));
JCheckBox
chChowLogo
=
new
JCheckBox
(
Messages
.
getString
(
"SettingsDialog.chbLogo.text"
));
chChowLogo
.
setSelected
(
model
.
config
.
isShowLogo
());
...
...
@@ -271,19 +279,19 @@ public class SettingsDialog extends JDialog {
model
.
config
.
setShowLogo
(!
model
.
config
.
isShowLogo
());
model
.
notifyObservers
();
});
additionalLayeredPane
.
add
(
chChowLogo
,
cc
.
xyw
(
2
,
1
6
,
5
));
additionalLayeredPane
.
add
(
chChowLogo
,
cc
.
xyw
(
2
,
1
8
,
5
));
additionalLayeredPane
.
add
(
new
JLabel
(
Messages
.
getString
(
"SettingsDialog.lblSnapshotDir.text"
)
+
":"
),
cc
.
xy
(
2
,
18
));
cc
.
xy
(
2
,
20
));
JTextField
tSnapshotDir
=
new
JTextField
(
Preferences
.
userNodeForPackage
(
PostVisualisation
.
class
).
get
(
"SettingsDialog.snapshotDirectory.path"
,
"."
));
tSnapshotDir
.
setEditable
(
false
);
tSnapshotDir
.
setPreferredSize
(
new
Dimension
(
130
,
20
));
additionalLayeredPane
.
add
(
tSnapshotDir
,
cc
.
xy
(
4
,
18
));
additionalLayeredPane
.
add
(
tSnapshotDir
,
cc
.
xy
(
4
,
20
));
final
JButton
bSnapshotDir
=
new
JButton
(
Messages
.
getString
(
"SettingsDialog.btnEditSnapshot.text"
));
bSnapshotDir
.
addActionListener
(
new
ActionSetSnapshotDirectory
(
"Set Snapshot Directory"
,
model
,
tSnapshotDir
));
additionalLayeredPane
.
add
(
bSnapshotDir
,
cc
.
xy
(
6
,
18
));
additionalLayeredPane
.
add
(
bSnapshotDir
,
cc
.
xy
(
6
,
22
));
final
JSpinner
spinnerCellWidth
=
new
JSpinner
();
final
SpinnerNumberModel
sModelCellWidth
=
new
SpinnerNumberModel
(
model
.
config
.
getGridWidth
(),
...
...
@@ -296,8 +304,8 @@ public class SettingsDialog extends JDialog {
});
additionalLayeredPane
.
add
(
new
JLabel
(
Messages
.
getString
(
"SettingsDialog.lblCellWidth.text"
)
+
":"
),
cc
.
xy
(
2
,
2
0
));
additionalLayeredPane
.
add
(
spinnerCellWidth
,
cc
.
xy
(
4
,
2
0
));
cc
.
xy
(
2
,
2
2
));
additionalLayeredPane
.
add
(
spinnerCellWidth
,
cc
.
xy
(
4
,
2
2
));
mainPanel
.
add
(
getAdditionalOptionPanel
(),
cc
.
xy
(
2
,
6
));
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment