Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
JPSreport
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
JuPedSim
JPSreport
Commits
6fa459ad
Commit
6fa459ad
authored
May 03, 2018
by
Mohcine Chraibi
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
polygon plot scripts consider new format
Format is now a string: "id | polygon"
parent
74d8e5b1
Pipeline
#9307
canceled with stages
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
21 deletions
+28
-21
scripts/_Plot_cell_rho.py
scripts/_Plot_cell_rho.py
+9
-1
scripts/_Plot_cell_v.py
scripts/_Plot_cell_v.py
+19
-20
No files found.
scripts/_Plot_cell_rho.py
View file @
6fa459ad
...
@@ -181,7 +181,10 @@ def main():
...
@@ -181,7 +181,10 @@ def main():
# TODO use os.path.join
# TODO use os.path.join
polys
=
open
(
"%s/polygon%s.dat"
%
(
filepath
,
namefile
)).
readlines
()
polys
=
open
(
"%s/polygon%s.dat"
%
(
filepath
,
namefile
)).
readlines
()
for
poly
in
polys
:
for
poly
in
polys
:
exec
(
"p = %s"
%
poly
)
poly
=
poly
.
split
(
"|"
)
poly_index
=
poly
[
0
].
strip
()
Poly
=
poly
[
1
].
strip
()
exec
(
"p = %s"
%
Poly
)
pp
=
locals
()[
'p'
]
pp
=
locals
()[
'p'
]
polygons
.
append
(
pp
)
polygons
.
append
(
pp
)
xx
=
1.0
/
pol
.
Polygon
(
pp
).
area
()
xx
=
1.0
/
pol
.
Polygon
(
pp
).
area
()
...
@@ -201,6 +204,11 @@ def main():
...
@@ -201,6 +204,11 @@ def main():
sm
.
set_clim
(
vmin
=
0
,
vmax
=
5
)
sm
.
set_clim
(
vmin
=
0
,
vmax
=
5
)
for
j
,
poly
in
enumerate
(
polys
):
for
j
,
poly
in
enumerate
(
polys
):
ax1
.
add_patch
(
pgon
(
polygons
[
j
],
facecolor
=
sm
.
to_rgba
(
density_orig
[
j
]),
edgecolor
=
'white'
,
linewidth
=
2
))
ax1
.
add_patch
(
pgon
(
polygons
[
j
],
facecolor
=
sm
.
to_rgba
(
density_orig
[
j
]),
edgecolor
=
'white'
,
linewidth
=
2
))
ax1
.
text
(
polygons
[
j
].
center
()[
0
],
polygons
[
j
].
center
()[
1
],
poly_index
,
horizontalalignment
=
'center'
,
verticalalignment
=
'center'
,
fontsize
=
20
,
color
=
'red'
,
transform
=
ax1
.
transAxes
)
if
(
trajType
==
"xml"
):
if
(
trajType
==
"xml"
):
fps
,
N
,
Trajdata
=
parse_xml_traj_file
(
trajFile
)
fps
,
N
,
Trajdata
=
parse_xml_traj_file
(
trajFile
)
...
...
scripts/_Plot_cell_v.py
View file @
6fa459ad
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
from
numpy
import
*
from
numpy
import
*
import
matplotlib.pyplot
as
plt
import
matplotlib.pyplot
as
plt
from
matplotlib.patches
import
Polygon
as
pgon
from
matplotlib.patches
import
Polygon
as
pgon
from
Polygon
import
*
from
Polygon
import
*
import
matplotlib.cm
as
cm
import
matplotlib.cm
as
cm
import
pylab
import
pylab
from
mpl_toolkits.axes_grid1
import
make_axes_locatable
from
mpl_toolkits.axes_grid1
import
make_axes_locatable
...
@@ -13,13 +13,13 @@ from _Plot_cell_rho import *
...
@@ -13,13 +13,13 @@ from _Plot_cell_rho import *
def
getParserArgs
():
def
getParserArgs
():
parser
=
argparse
.
ArgumentParser
(
description
=
'Combine French data to one file'
)
parser
=
argparse
.
ArgumentParser
(
description
=
'Combine French data to one file'
)
parser
.
add_argument
(
"-f"
,
"--filepath"
,
default
=
"./"
,
help
=
'give the path of source file'
)
parser
.
add_argument
(
"-f"
,
"--filepath"
,
default
=
"./"
,
help
=
'give the path of source file'
)
parser
.
add_argument
(
"-n"
,
"--namefile"
,
help
=
'give the name of the source file'
)
parser
.
add_argument
(
"-n"
,
"--namefile"
,
help
=
'give the name of the source file'
)
parser
.
add_argument
(
"-g"
,
"--geoname"
,
help
=
'give the name of the geometry file'
)
parser
.
add_argument
(
"-g"
,
"--geoname"
,
help
=
'give the name of the geometry file'
)
parser
.
add_argument
(
"-p"
,
"--trajpath"
,
help
=
'give the path of the trajectory file'
)
parser
.
add_argument
(
"-p"
,
"--trajpath"
,
help
=
'give the path of the trajectory file'
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
return
args
return
args
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
@@ -51,7 +51,7 @@ if __name__ == '__main__':
...
@@ -51,7 +51,7 @@ if __name__ == '__main__':
tick
.
set_markersize
(
6
)
tick
.
set_markersize
(
6
)
ax1
.
set_aspect
(
"equal"
)
ax1
.
set_aspect
(
"equal"
)
plot_geometry
(
geoFile
)
plot_geometry
(
geoFile
)
velocity
=
array
([])
velocity
=
array
([])
polys
=
open
(
"%s/polygon%s.dat"
%
(
filepath
,
namefile
)).
readlines
()
polys
=
open
(
"%s/polygon%s.dat"
%
(
filepath
,
namefile
)).
readlines
()
velocity
=
loadtxt
(
"%s/speed%s.dat"
%
(
filepath
,
namefile
))
velocity
=
loadtxt
(
"%s/speed%s.dat"
%
(
filepath
,
namefile
))
...
@@ -61,18 +61,21 @@ if __name__ == '__main__':
...
@@ -61,18 +61,21 @@ if __name__ == '__main__':
sm
.
set_clim
(
vmin
=
0
,
vmax
=
1.5
)
sm
.
set_clim
(
vmin
=
0
,
vmax
=
1.5
)
index
=
0
index
=
0
for
poly
in
polys
:
for
poly
in
polys
:
exec
(
"p = %s"
%
poly
)
poly
=
poly
.
split
(
"|"
)
xx
=
velocity
[
index
]
poly_index
=
poly
[
0
].
strip
()
index
+=
1
Poly
=
poly
[
1
].
strip
()
ax1
.
add_patch
(
pgon
(
p
,
facecolor
=
sm
.
to_rgba
(
xx
),
edgecolor
=
'white'
,
linewidth
=
2
))
exec
(
"p = %s"
%
Poly
)
xx
=
velocity
[
index
]
index
+=
1
ax1
.
add_patch
(
pgon
(
p
,
facecolor
=
sm
.
to_rgba
(
xx
),
edgecolor
=
'white'
,
linewidth
=
2
))
if
(
trajType
==
"xml"
):
if
(
trajType
==
"xml"
):
fps
,
N
,
Trajdata
=
parse_xml_traj_file
(
trajFile
)
fps
,
N
,
Trajdata
=
parse_xml_traj_file
(
trajFile
)
elif
(
trajType
==
"txt"
):
elif
(
trajType
==
"txt"
):
Trajdata
=
loadtxt
(
trajFile
)
Trajdata
=
loadtxt
(
trajFile
)
Trajdata
=
Trajdata
[
Trajdata
[:,
1
]
==
frameNr
]
Trajdata
=
Trajdata
[
Trajdata
[:,
1
]
==
frameNr
]
ax1
.
plot
(
Trajdata
[:,
2
],
Trajdata
[:,
3
],
"bo"
,
markersize
=
20
,
markeredgewidth
=
2
)
ax1
.
plot
(
Trajdata
[:,
2
],
Trajdata
[:,
3
],
"bo"
,
markersize
=
20
,
markeredgewidth
=
2
)
ax1
.
set_xlim
(
geominX
-
0.2
,
geomaxX
+
0.2
)
ax1
.
set_xlim
(
geominX
-
0.2
,
geomaxX
+
0.2
)
ax1
.
set_ylim
(
geominY
-
0.2
,
geomaxY
+
0.2
)
ax1
.
set_ylim
(
geominY
-
0.2
,
geomaxY
+
0.2
)
plt
.
xlabel
(
"x [m]"
)
plt
.
xlabel
(
"x [m]"
)
...
@@ -81,10 +84,6 @@ if __name__ == '__main__':
...
@@ -81,10 +84,6 @@ if __name__ == '__main__':
divider
=
make_axes_locatable
(
ax1
)
divider
=
make_axes_locatable
(
ax1
)
cax
=
divider
.
append_axes
(
"right"
,
size
=
"2.5%"
,
pad
=
0.2
)
cax
=
divider
.
append_axes
(
"right"
,
size
=
"2.5%"
,
pad
=
0.2
)
cb
=
fig
.
colorbar
(
sm
,
ax
=
ax1
,
cax
=
cax
,
format
=
'%.1f'
)
cb
=
fig
.
colorbar
(
sm
,
ax
=
ax1
,
cax
=
cax
,
format
=
'%.1f'
)
cb
.
set_label
(
'Velocity [$m/s$]'
)
cb
.
set_label
(
'Velocity [$m/s$]'
)
plt
.
savefig
(
"%s/v_%s.png"
%
(
filepath
,
namefile
))
plt
.
savefig
(
"%s/v_%s.png"
%
(
filepath
,
namefile
))
plt
.
close
()
plt
.
close
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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