Commit 5f80dd44 authored by Benedikt Zoennchen's avatar Benedikt Zoennchen
Browse files

change name of processors.

parent 17ab47c0
Pipeline #78747 failed with stages
in 104 minutes and 43 seconds
%% Cell type:code id: tags:
``` python
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from vadere_analysis_tool import ScenarioOutput, VadereProject
sns.set(style="darkgrid")
def plotVelocityTime(vproject, ending, axes):
dataFrames = []
for outStr in project.output_dirs :
out = project.output_dirs[outStr]
for fileStr in out.files :
if fileStr.endswith(ending) :
ndf = pd.DataFrame();
df = out.files[fileStr]()
#df = df[df.velocity > 0]
ndf['velocity'] = df.velocity.astype(float)
ndf['timeStep'] = df.timeStep.astype(int)
ndf['scenario'] = [out.scenario['name']] * len(df.velocity)
dataFrames.append(ndf)
concatFrames = pd.concat(dataFrames)
return sns.lineplot(x="timeStep", y="velocity", data=concatFrames, ax=axes)
def plotDensityTime(vproject, ending, axes):
dataFrames = []
for outStr in project.output_dirs :
out = project.output_dirs[outStr]
for fileStr in out.files :
if fileStr.endswith(ending) :
ndf = pd.DataFrame();
df = out.files[fileStr]()
#df = df[df.velocity > 0]
ndf['density'] = df.density.astype(float)
ndf['timeStep'] = df.timeStep.astype(int)
ndf['scenario'] = [out.scenario['name']] * len(df.density)
dataFrames.append(ndf)
concatFrames = pd.concat(dataFrames)
return sns.lineplot(x="timeStep", y="density", data=concatFrames, ax=axes)
#plt.show()
def plotFundamentalDiagram(vproject, ending):
dataFrames = []
for outStr in project.output_dirs :
out = project.output_dirs[outStr]
for fileStr in out.files :
if fileStr.endswith(ending) :
ndf = pd.DataFrame();
df = out.files[fileStr]()
df = df[df.velocity > 0]
ndf['density'] = df.density.astype(float)
ndf['velocity'] = df.velocity.astype(float)
ndf['scenario'] = [out.scenario['name']] * len(df.velocity)
dataFrames.append(ndf)
concatFrames = pd.concat(dataFrames)
sns.relplot(x="density", y="velocity", hue="scenario", data=concatFrames)
```
%% Cell type:markdown id: tags:
# Load the Vadere project
%% Cell type:code id: tags:
``` python
projectFolder = "./../../../../VadereModelTests/TestOSM_zhang-2011/"
projectFolder = "./../../../../VadereModelTests/TestOSM_calibration/"
project = VadereProject(projectFolder)
#out = project.named_output.C_050_180_180_2018_11_26_16_30_29_355()
```
%% Output
loaded 1 out of 1 output directories.
%% Cell type:markdown id: tags:
## Method A Plots
%% Cell type:code id: tags:
``` python
# transform data frame
plotFundamentalDiagram(project, "aTimeStep.fundamentalDiagram")
```
%% Output
%% Cell type:markdown id: tags:
## Method B Plots
%% Cell type:code id: tags:
``` python
plotFundamentalDiagram(project, "bPedestrian.fundamentalDiagram")
```
%% Output
%% Cell type:markdown id: tags:
## Method C Plots (classical density)
%% Cell type:code id: tags:
``` python
plt.figure(figsize=(30,8))
axes=plt.axes()
axes.set_yticks([0.4,0.8,2.5,3,4,5])
#axes.set_xticks(np.linspace(0, 199, num=5).tolist())
plotDensityTime(project, "cTimeStep.fundamentalDiagram", axes)
plotDensityTime(project, "dTimeStep.fundamentalDiagram", axes)
plotDensityTime(project, "eTimeStep.fundamentalDiagram", axes)
#axes.set_yticks([0.4,1.4,2.5,3,4,5])
#axes.set_xticks(np.linspace(0, 200, num=201).tolist())
```
%% Output
<matplotlib.axes._subplots.AxesSubplot at 0x1a1d4549e8>
%% Cell type:code id: tags:
``` python
plotFundamentalDiagram(project, "cTimeStep.fundamentalDiagram")
```
%% Output
%% Cell type:markdown id: tags:
## Method D Plots (voronoi density)
%% Cell type:code id: tags:
``` python
plotFundamentalDiagram(project, "eTimeStep.fundamentalDiagram")
```
%% Output
%% Cell type:code id: tags:
``` python
np.linspace(0, 200, num=201).tolist()
```
%% Output
[0.0,
1.0,
2.0,
3.0,
4.0,
5.0,
6.0,
7.0,
8.0,
9.0,
10.0,
11.0,
12.0,
13.0,
14.0,
15.0,
16.0,
17.0,
18.0,
19.0,
20.0,
21.0,
22.0,
23.0,
24.0,
25.0,
26.0,
27.0,
28.0,
29.0,
30.0,
31.0,
32.0,
33.0,
34.0,
35.0,
36.0,
37.0,
38.0,
39.0,
40.0,
41.0,
42.0,
43.0,
44.0,
45.0,
46.0,
47.0,
48.0,
49.0,
50.0,
51.0,
52.0,
53.0,
54.0,
55.0,
56.0,
57.0,
58.0,
59.0,
60.0,
61.0,
62.0,
63.0,
64.0,
65.0,
66.0,
67.0,
68.0,
69.0,
70.0,
71.0,
72.0,
73.0,
74.0,
75.0,
76.0,
77.0,
78.0,
79.0,
80.0,
81.0,
82.0,
83.0,
84.0,
85.0,
86.0,
87.0,
88.0,
89.0,
90.0,
91.0,
92.0,
93.0,
94.0,
95.0,
96.0,
97.0,
98.0,
99.0,
100.0,
101.0,
102.0,
103.0,
104.0,
105.0,
106.0,
107.0,
108.0,
109.0,
110.0,
111.0,
112.0,
113.0,
114.0,
115.0,
116.0,
117.0,
118.0,
119.0,
120.0,
121.0,
122.0,
123.0,
124.0,
125.0,
126.0,
127.0,
128.0,
129.0,
130.0,
131.0,
132.0,
133.0,
134.0,
135.0,
136.0,
137.0,
138.0,
139.0,
140.0,
141.0,
142.0,
143.0,
144.0,
145.0,
146.0,
147.0,
148.0,
149.0,
150.0,
151.0,
152.0,
153.0,
154.0,
155.0,
156.0,
157.0,
158.0,
159.0,
160.0,
161.0,
162.0,
163.0,
164.0,
165.0,
166.0,
167.0,
168.0,
169.0,
170.0,
171.0,
172.0,
173.0,
174.0,
175.0,
176.0,
177.0,
178.0,
179.0,
180.0,
181.0,
182.0,
183.0,
184.0,
185.0,
186.0,
187.0,
188.0,
189.0,
190.0,
191.0,
192.0,
193.0,
194.0,
195.0,
196.0,
197.0,
198.0,
199.0,
200.0]
%% Cell type:code id: tags:
``` python
import matplotlib.pyplot as plt
coord1 = [[23.926582253991363,11.311616564587455],[24.526824188631515,11.346725287186784],[24.52439283212948,11.89],[23.80719398422859,11.89]]
coord1.append(coord1[0])
coord2 = [[22.0,10.1], [24.0,10.1], [24.0,11.9], [22.0,11.9], [22.0,10.1]]
coord2.append(coord2[0])
cap = [[23.926582253991363,11.311616564587455],[24.000000000000014,11.315910838495633],[24.000000000000025,11.889999999999956],[23.80719398422859,11.89]]
cap.append(cap[0])
xs1, ys1 = zip(*coord1) #create lists of x and y values
xs2, ys2 = zip(*coord2)
xs3, ys3 = zip(*cap)
plt.figure(figsize=(10,10))
plt.plot(xs1,ys1)
plt.plot(xs2,ys2)
plt.plot(xs3,ys3)
plt.show() # if you need...
```
%% Output
%% Cell type:code id: tags:
``` python
import matplotlib.pyplot as plt
coord = [[1,1], [2,1], [2,2], [1,2], [0.5,1.5]]
coord.append(coord[0]) #repeat the first point to create a 'closed loop'
xs, ys = zip(*coord) #create lists of x and y values
plt.figure()
plt.plot(xs,ys)
plt.show() # if you need..
```
%% Output
%% Cell type:code id: tags:
``` python
```
......
......@@ -3,23 +3,145 @@
"description" : "",
"release" : "0.6",
"processWriters" : {
"files" : [ ],
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
"filename" : "postvis.trajectories",
"processors" : [ 1, 2, 5 ]
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOverlapOutputFile",
"filename" : "overlaps.csv",
"processors" : [ 3 ]
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.NoDataKeyOutputFile",
"filename" : "overlapCount.txt",
"processors" : [ 4 ]
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepOutputFile",
"filename" : "aTimeStep.fundamentalDiagram",
"processors" : [ 6 ]
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.PedestrianIdOutputFile",
"filename" : "bPedestrian.fundamentalDiagram",
"processors" : [ 9 ]
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepOutputFile",
"filename" : "cTimeStep.fundamentalDiagram",
"processors" : [ 11 ]
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepOutputFile",
"filename" : "dTimeStep.fundamentalDiagram",
"processors" : [ 12 ]
} ],
"processors" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianOverlapProcessor",
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianPositionProcessor",
"id" : 1
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.MaxOverlapProcessor",
"id" : 2,
"attributesType" : "org.vadere.state.attributes.processor.AttributesMaxOverlapProcessor",
"attributes" : {
"pedestrianOverlapProcessorId" : 1
}
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianTargetIdProcessor",
"id" : 2
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianOverlapProcessor",
"id" : 3
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.NumberOverlapsProcessor",
"id" : 3,
"id" : 4,
"attributesType" : "org.vadere.state.attributes.processor.AttributesNumberOverlapsProcessor",
"attributes" : {
"pedestrianOverlapProcessorId" : 1
"pedestrianOverlapProcessorId" : 3
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianFootStepProcessor",
"id" : 5
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.FundamentalDiagramAProcessor",
"id" : 6,
"attributesType" : "org.vadere.state.attributes.processor.AttributesFundamentalDiagramAProcessor",
"attributes" : {
"pedestrianLineCrossProcessorId" : 8,
"pedestrianVelocityProcessorId" : 7,
"deltaTime" : 10.0
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianVelocityProcessor",
"id" : 7,
"attributesType" : "org.vadere.state.attributes.processor.AttributesPedestrianVelocityProcessor",
"attributes" : {
"pedestrianPositionProcessorId" : 1,
"backSteps" : 1
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianLineCrossProcessor",
"id" : 8,
"attributesType" : "org.vadere.state.attributes.processor.AttributesPedestrianLineCrossProcessor",
"attributes" : {
"p1" : {
"x" : 25.0,
"y" : 11.9
},
"p2" : {
"x" : 25.0,
"y" : 10.1
}
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.FundamentalDiagramBProcessor",
"id" : 9,
"attributesType" : "org.vadere.state.attributes.processor.AttributesFundamentalDiagramBProcessor",
"attributes" : {
"pedestrianTrajectoryProcessorId" : 10,
"measurementArea" : {
"x" : 22.0,
"y" : 10.1,
"width" : 2.0,
"height" : 1.8,
"type" : "RECTANGLE"
}
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianTrajectoryProcessor",
"id" : 10,
"attributesType" : "org.vadere.state.attributes.processor.AttributesPedestrianLineCrossProcessor",
"attributes" : {
"p1" : {
"x" : 0.0,
"y" : 0.0
},
"p2" : {
"x" : 1.0,
"y" : 0.0
}
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.FundamentalDiagramCProcessor",
"id" : 11,
"attributesType" : "org.vadere.state.attributes.processor.AttributesFundamentalDiagramCProcessor",
"attributes" : {
"measurementArea" : {
"x" : 22.0,
"y" : 10.1,
"width" : 2.0,
"height" : 1.8,
"type" : "RECTANGLE"
}
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.FundamentalDiagramDProcessor",
"id" : 12,
"attributesType" : "org.vadere.state.attributes.processor.AttributesFundamentalDiagramDProcessor",
"attributes" : {
"measurementArea" : {
"x" : 22.0,
"y" : 10.1,
"width" : 2.0,
"height" : 1.8,
"type" : "RECTANGLE"
},
"voronoiArea" : {
"x" : 17.0,
"y" : 10.1,
"width" : 12.0,
"height" : 1.8,
"type" : "RECTANGLE"
}
}
} ],
"isTimestamped" : true
......@@ -52,7 +174,7 @@
"stepLengthSlopeSpeed" : 0.2345,
"stepLengthSD" : 0.036,
"movementThreshold" : 0.0,
"optimizationType" : "DISCRETE",
"optimizationType" : "NELDER_MEAD",
"movementType" : "ARBITRARY",
"dynamicStepLength" : false,
"updateType" : "EVENT_DRIVEN",
......
......@@ -3,23 +3,145 @@
"description" : "",
"release" : "0.6",
"processWriters" : {
"files" : [ ],
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
"filename" : "postvis.trajectories",
"processors" : [ 1, 2, 5 ]
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOverlapOutputFile",
"filename" : "overlaps.csv",
"processors" : [ 3 ]
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.NoDataKeyOutputFile",
"filename" : "overlapCount.txt",
"processors" : [ 4 ]
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepOutputFile",
"filename" : "aTimeStep.fundamentalDiagram",
"processors" : [ 6 ]
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.PedestrianIdOutputFile",
"filename" : "bPedestrian.fundamentalDiagram",
"processors" : [ 9 ]
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepOutputFile",
"filename" : "cTimeStep.fundamentalDiagram",
"processors" : [ 11 ]
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepOutputFile",
"filename" : "dTimeStep.fundamentalDiagram",
"processors" : [ 12 ]
} ],
"processors" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianOverlapProcessor",
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianPositionProcessor",
"id" : 1
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.MaxOverlapProcessor",
"id" : 2,
"attributesType" : "org.vadere.state.attributes.processor.AttributesMaxOverlapProcessor",
"attributes" : {
"pedestrianOverlapProcessorId" : 1
}
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianTargetIdProcessor",
"id" : 2
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianOverlapProcessor",
"id" : 3
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.NumberOverlapsProcessor",
"id" : 3,
"id" : 4,
"attributesType" : "org.vadere.state.attributes.processor.AttributesNumberOverlapsProcessor",
"attributes" : {
"pedestrianOverlapProcessorId" : 1
"pedestrianOverlapProcessorId" : 3
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianFootStepProcessor",
"id" : 5
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.FundamentalDiagramAProcessor",
"id" : 6,
"attributesType" : "org.vadere.state.attributes.processor.AttributesFundamentalDiagramAProcessor",
"attributes" : {
"pedestrianLineCrossProcessorId" : 8,
"pedestrianVelocityProcessorId" : 7,
"deltaTime" : 10.0
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianVelocityProcessor",
"id" : 7,
"attributesType" : "org.vadere.state.attributes.processor.AttributesPedestrianVelocityProcessor",
"attributes" : {
"pedestrianPositionProcessorId" : 1,
"backSteps" : 1
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianLineCrossProcessor",
"id" : 8,
"attributesType" : "org.vadere.state.attributes.processor.AttributesPedestrianLineCrossProcessor",
"attributes" : {
"p1" : {
"x" : 25.0,
"y" : 11.9
},
"p2" : {
"x" : 25.0,
"y" : 10.1
}
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.FundamentalDiagramBProcessor",
"id" : 9,
"attributesType" : "org.vadere.state.attributes.processor.AttributesFundamentalDiagramBProcessor",
"attributes" : {
"pedestrianTrajectoryProcessorId" : 10,
"measurementArea" : {
"x" : 22.0,
"y" : 10.1,
"width" : 2.0,