Commit 0983fcf8 authored by guido basten's avatar guido basten

last changes on the rimeatestscript, all test exits with success.

parent 92465862
Pipeline #21803 failed with stages
in 8 minutes and 48 seconds
......@@ -148,7 +148,7 @@ def generate_cover2(doc):
doc.append(NoEscape(r"\begin{center}"))
with doc.create(Figure(position='t')) as logo:
logo.add_image("./figures/logo.png")
logo.add_image("logo.png")
doc.append(NoEscape(r"\textsc{\LARGE J\"ulich Pedestrian Simulator}\\[1.5cm]"))
doc.append(NoEscape(r"\textsc{\small Forschungszentrum J\"ulich GmbH}\\[0.5cm]"))
......@@ -228,6 +228,30 @@ def generate_info_table(doc):
info_table.add_hline()
info_table.add_empty_row()
def get_diagrams(testnumber):
start_direc = os.getcwd()
direc = start_direc + '/test_' + str(testnumber)
os.chdir(direc)
data_list = os.listdir(direc)
i=0
arc=False
while i <= (len(data_list)-1) and arc!= True:
j = data_list[i].split('.')
if len(j) == 2:
if j[1] == 'png':
d_path = direc + '/' + str(j[0]) + '.png'
arc=True
title=j[0]
else:
arc=False
else:
arc=False
i=i+1
if arc == False:
d_path='_'
title='_'
os.chdir(start_direc)
return(d_path,arc,title)
def generate_info_list(doc, testnumber):
"""
......@@ -242,8 +266,9 @@ def generate_info_list(doc, testnumber):
if get_diagrams(testnumber)[1] == True:
with doc.create(Description()) as desc:
desc.add_item("\t Diagram name:", get_diagrams(testnumber)[2])
with doc.create(Figure(position='h', width=NoEscape(r'0.4\textwidth'))) as diagram:
diagram.add_image((get_diagrams(testnumber))[0])
print(get_diagrams(testnumber))
with doc.create(Figure(position='h')) as diagram:
diagram.add_image(get_diagrams(testnumber)[0], width=NoEscape('0.4\textwidth'))
with doc.create(Description()) as desc:
desc.add_item("\t", get_log(testnumber)[0])
desc.add_item("\t", get_log(testnumber)[1])
......@@ -263,7 +288,7 @@ def get_git_status():
## Get the commit, author und date name by `git show` command
git_status = str(subprocess.check_output(["git", "show", "--pretty=medium"]))
git_status = git_status.split('\n')
git_status = git_status.split("\\n")
commit = git_status[0].split(' ')[1]
author = git_status[1]
date = git_status[2]
......@@ -287,12 +312,12 @@ def get_tests_status(testnumber):
line):
status = "Succeed"
break
elif re.match(
r'^2019-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3} - INFO - runtest_rimea_\d{1}.py exits with SUCCESS$',
line):
status = "Succeed"
break
break
elif re.match(
......@@ -303,7 +328,7 @@ def get_tests_status(testnumber):
else:
status = "Failed"
return status
......@@ -318,31 +343,6 @@ def get_log(testnumber):
with open(log_name) as log:
return log.read().split("\n")[-3:-1]
def get_diagrams(testnumber):
start_direc = os.getcwd()
direc = start_direc + '/test_' + str(testnumber)
os.chdir(direc)
data_list = os.listdir(direc)
i=0
arc=False
while i <= (len(data_list)-1) and arc!= True:
j = data_list[i].split('.')
if len(j) == 2:
if j[1] == 'png':
d_path = direc + '/' + str(j[0]) + '.png'
arc=True
title=j[0]
else:
arc=False
else:
arc=False
i=i+1
if arc == False:
d_path='_'
title='_'
os.chdir(start_direc)
return(d_path,arc,title)
def get_exec_time(testnumber):
start_direc = os.getcwd()
direc = start_direc + '/test_' + str(testnumber)
......@@ -363,5 +363,3 @@ if __name__ == "__main__":
generate_info_report()
print('reportscript successful created')
# generate_eva_report()
......@@ -35,12 +35,12 @@ states = ["short", "long", "mixed"]
def run_rimea_test14(inifile, trajfile):
# Read data
data_short = np.loadtxt('trajectories/traj.xml_flow_exit_id_4.dat')
data_main = np.loadtxt('trajectories/traj.xml_flow_exit_id_1.dat')
data_short = np.loadtxt('flow_exit_id_4.txt')
data_main = np.loadtxt('flow_exit_id_1.txt')
# Cummulative number of peds using the right stair --> short way
num_short = data_short[-1,-1]
# Cummulative number of peds using the exit
# Minus
# Cummulative number of peds using the right stair --> long way
......
......@@ -5,35 +5,62 @@
<room id="0" caption="long">
<subroom id="0" closed="0" class="subroom">
<polygon caption="wall">
<vertex px="0.0" py="0.0"/>
<vertex px="0.0" py="81.4"/>
<vertex px="20.0" py="81.4"/>
<vertex px="20.0" py="0.0"/>
<vertex px="0" py="0"/>
<vertex px="0" py="81"/>
</polygon>
<polygon caption="wall">
<vertex px="0" py="81"/>
<vertex px="20" py="81"/>
</polygon>
<polygon caption="wall">
<vertex px="20" py="81"/>
<vertex px="20" py="0"/>
</polygon>
</subroom>
</room>
<room id="1" caption="short">
<subroom id="0" closed="0" class="subroom">
<polygon caption="wall">
<vertex px="21.0" py="0.0"/>
<vertex px="21.0" py="50.0"/>
<vertex px="41.0" py="50.0"/>
<vertex px="41.0" py="0.0"/>
<vertex px="21" py="0"/>
<vertex px="21" py="50"/>
</polygon>
<polygon caption="wall">
<vertex px="21" py="50"/>
<vertex px="41" py="50"/>
</polygon>
<polygon caption="wall">
<vertex px="41" py="50"/>
<vertex px="41" py="0"/>
</polygon>
</subroom>
</room>
<room id="2" caption="corner">
<subroom id="0" closed="0" class="subroom">
<polygon caption="wall">
<vertex px="72.0" py="0.0"/>
<vertex px="52.0" py="0.0"/>
<vertex px="42.0" py="10.0"/>
<vertex px="42.0" py="60.0"/>
<vertex px="62.0" py="60.0"/>
<vertex px="62.0" py="20.0"/>
<vertex px="72.0" py="20.0"/>
<vertex px="72" py="0"/>
<vertex px="52" py="0"/>
</polygon>
<polygon caption="wall">
<vertex px="52" py="0"/>
<vertex px="42" py="10"/>
</polygon>
<polygon caption="wall">
<vertex px="42" py="10"/>
<vertex px="42" py="60"/>
</polygon>
<polygon caption="wall">
<vertex px="42" py="60"/>
<vertex px="62" py="60"/>
</polygon>
<polygon caption="wall">
<vertex px="62" py="60"/>
<vertex px="62" py="20"/>
</polygon>
<polygon caption="wall">
<vertex px="62" py="20"/>
<vertex px="72" py="20"/>
</polygon>
</subroom>
</room>
......@@ -54,4 +81,4 @@
<vertex px="72.0" py="20.0" />
</transition>
</transitions>
</geometry>
\ No newline at end of file
</geometry>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<routing version="0.8" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xsd.jupedsim.org/jps_routing.xsd" unit="m">
<Hlines>
<Hline id="1000" room_id="2" subroom_id="0">
<vertex px="61.5" py="20"/>
<vertex px="43" py="20"/>
</Hline>
<Hline id="1001" room_id="2" subroom_id="0">
<vertex px="61" py="19"/>
<vertex px="48" py="6"/>
</Hline>
<Hline id="1002" room_id="2" subroom_id="0">
<vertex px="62" py="19"/>
<vertex px="62" py="2"/>
</Hline>
</Hlines>
<Hlines>
<Hline id="1000" room_id="2" subroom_id="0">
<vertex px="62" py="50"/>
<vertex px="42" py="50"/>
</Hline>
<Hline id="1001" room_id="2" subroom_id="0">
<vertex px="62" py="40"/>
<vertex px="42" py="40"/>
</Hline>
<Hline id="1002" room_id="2" subroom_id="0">
<vertex px="62" py="30"/>
<vertex px="42" py="30"/>
</Hline>
<Hline id="1003" room_id="2" subroom_id="0">
<vertex px="62" py="20"/>
<vertex px="42" py="20"/>
</Hline>
<Hline id="1004" room_id="2" subroom_id="0">
<vertex px="62" py="20"/>
<vertex px="47" py="5"/>
</Hline>
<Hline id="1005" room_id="2" subroom_id="0">
<vertex px="62" py="0"/>
<vertex px="62" py="20"/>
</Hline>
</Hlines>
</routing>
......@@ -5,16 +5,16 @@
<!-- seed used for initialising random generator -->
<seed>1254</seed>
<max_sim_time>1000</max_sim_time>
<!-- geometry file -->
<geometry>../geometry.xml</geometry>
<!-- trajectories file and format -->
<trajectories format="xml-plain" fps="8">
<file location="RiMEATest15_traj.xml" />
<!--<socket hostname="127.0.0.1" port="8989"/> -->
</trajectories>
<!-- where to store the logs -->
<!--<logfile>log.txt</logfile> -->
<show_statistics>true</show_statistics>
......@@ -116,14 +116,15 @@
</operational_models>
<route_choice_models>
<router router_id="2" description="global_shortest">
<parameters>
<router router_id="1" description="ff_global_shortest"/>
<router router_id="2" description="global_shortest">
<parameters>
<!-- extra routing information -->
<navigation_lines file="../geometry_routing.xml" />
</parameters>
</router>
</parameters>
</router>
</route_choice_models>
</JuPedSim>
......@@ -36,17 +36,17 @@ import matplotlib.pyplot as plt
import os
def run_rimea_test15(inifile, trajfile):
# Read data
data_long = np.loadtxt('trajectories/traj.xml_flow_exit_id_0.dat')
data_short = np.loadtxt('trajectories/traj.xml_flow_exit_id_1.dat')
data_corner = np.loadtxt('trajectories/traj.xml_flow_exit_id_2.dat')
data_long = np.loadtxt('flow_exit_id_0.txt')
data_short = np.loadtxt('flow_exit_id_1.txt')
data_corner = np.loadtxt('flow_exit_id_2.txt')
# Evac times
evac_long = data_long[-1,0]
evac_short = data_short[-1,0]
evac_corner = data_corner[-1,0]
if evac_long < evac_corner or evac_short > evac_corner:
logging.info("%s exits with FAILURE" % (argv[0]))
logging.info("Corner evac_time not in between long and short corridor evac_time")
......@@ -54,14 +54,14 @@ def run_rimea_test15(inifile, trajfile):
logging.info("Short corridor evac_time: %f", evac_short)
logging.info("Corner evac_time: %f", evac_corner)
exit(FAILURE)
logging.info("Long corridor evac_time: %f", evac_long)
logging.info("Short corridor evac_time: %f", evac_short)
logging.info("Corner evac_time: %f", evac_corner)
def get_data (number):
time=[]
textfile=open("traj.xml_flow_exit_id_"+str(number)+".dat")
textfile=open("flow_exit_id_"+str(number)+".txt")
for i in range(3):
textfile.readline()
for line in textfile:
......@@ -72,7 +72,7 @@ def get_data (number):
def get_dia_data (number):
time=[]
textfile=open("traj.xml_flow_exit_id_"+str(number)+".dat")
textfile=open("flow_exit_id_"+str(number)+".txt")
for i in range(3):
textfile.readline()
for line in textfile:
......@@ -82,8 +82,6 @@ def get_dia_data (number):
return time
def create_dia (peds):
direc=os.getcwd()
os.chdir(direc+'/trajectories')
x=range(1,peds+1,1)
......@@ -99,10 +97,9 @@ def create_dia (peds):
plt.grid()
plt.xlim(0,peds)
plt.legend(loc=0)
os.chdir(direc)
plt.savefig('dia_test_15.png', dpi=100)
print ("diagram created")
return
return ('none')
if __name__ == "__main__":
start_time=time.time()
......
......@@ -23,7 +23,7 @@ Use new dedicated python console if you run this code with spyder
2. The ped-ped repulsive forces are intentionally set to zero, since in this
test we are only interested in the desired velocies.
---> Overlapping-error to be considered
3. Script Gauss.py checks that the means and sigmas are in accordance with the min-max values.
This test produces two files
......@@ -76,9 +76,9 @@ def run_rimea_test7(inifile, trajfile):
# Take only data of ped i
ptraj = traj[traj[:, 0] == ped]
# Only when ped i moves
ptraj2=np.delete(ptraj,1,0) #Das letzte Element entfernt
ptraj2=np.delete(ptraj,1,0) #Das letzte Element entfernt
# ptraj = ptraj[np.diff(ptraj[:, 2]) != 0] (Orginalfunktion)
ptraj=ptraj2[np.diff(ptraj[:, 2]) != 0] #Neue Funktion
ptraj=ptraj2[np.diff(ptraj[:, 2]) != 0] #Neue Funktion
# Distance
dx = np.sqrt(np.sum((ptraj[0, 2:] - ptraj[-1, 2:])**2))
# Time
......@@ -89,18 +89,19 @@ def run_rimea_test7(inifile, trajfile):
id_velocity = np.vstack((peds, velocities))
np.savetxt(csv_file, id_velocity.T, delimiter=',', fmt=["%d", "%f"])
# Plotting
i = 0
j = 1 # Subplot index
logging.info("Ploting distributions...")
for (mu, sigma, c) in zip(means, sigmas, colors):
P.subplot("41%d"%j)
numPedsGr = int(numPedsGr)
n, bins, patches = P.hist(velocities[i:i+numPedsGr-1],50, normed=1,histtype='bar',facecolor='%s'%c, alpha=0.7)
y = P.normpdf(bins, mu, sigma)
P.plot(bins, y, 'k--',linewidth=1.5,label=r"$\mathcal{N}(%.2f, %.2f)$"%(mu, sigma))
P.legend()
i += numPedsGr
i = int(i + numPedsGr)
j += 1
P.tight_layout()
......
......@@ -40,22 +40,22 @@ import time
def run_rimea_test9(inifile, trajfile):
# Read data:
left_room_0 = np.loadtxt('trajectories/traj.xml_flow_exit_id_0.dat')
left_room_1 = np.loadtxt('trajectories/traj.xml_flow_exit_id_1.dat')
left_room_2 = np.loadtxt('trajectories/traj.xml_flow_exit_id_2.dat')
left_room_3 = np.loadtxt('trajectories/traj.xml_flow_exit_id_3.dat')
right_room_0 = np.loadtxt('trajectories/traj.xml_flow_exit_id_6.dat')
right_room_1 = np.loadtxt('trajectories/traj.xml_flow_exit_id_7.dat')
left_room_0 = np.loadtxt('flow_exit_id_0.txt')
left_room_1 = np.loadtxt('flow_exit_id_1.txt')
left_room_2 = np.loadtxt('flow_exit_id_2.txt')
left_room_3 = np.loadtxt('flow_exit_id_3.txt')
right_room_0 = np.loadtxt('flow_exit_id_6.txt')
right_room_1 = np.loadtxt('flow_exit_id_7.txt')
# Evac times for each scenario:
evac_time_left = np.max([left_room_0[-1,0], left_room_1[-1,0], left_room_2[-1,0], left_room_3[-1,0]])
evac_time_right = np.max([right_room_0[-1,0], right_room_1[-1,0]])
logging.info("Evac_time_4_door: %f, Evac_time_2_door: %f", evac_time_left, evac_time_right)
factor = evac_time_right/evac_time_left
if 1.6 <= factor <= 2.4:
logging.info("Evac_time_2door divided by Evac_time_4door is in between:")
logging.info("1.6 <= %f <= 2.4", factor)
......@@ -71,13 +71,3 @@ if __name__ == "__main__":
test.run_test(testfunction=run_rimea_test9)
logging.info("%s exits with SUCCESS\nExecution time %.3f seconds." % (argv[0],time.time()-start_time))
exit(SUCCESS)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment