Skip to content

Commit

Permalink
Merge 5263d8c into 65582b2
Browse files Browse the repository at this point in the history
  • Loading branch information
raunakbh92 committed May 21, 2020
2 parents 65582b2 + 5263d8c commit 0466b1e
Show file tree
Hide file tree
Showing 8 changed files with 1,113 additions and 397 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ test/media/
# media files generated by scripts
scripts/media/

# ipynb checkpoints in pythonscripts
scripts/pythonscripts/.ipynb_checkpoints

# idm acc trace files stored in lmfit
scripts/lmfit/

# Files generated by invoking Julia with --code-coverage
*.jl.cov
*.jl.*.cov
Expand Down
64 changes: 42 additions & 22 deletions scripts/experiments.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,25 @@ for i in 1:length(s)
JLD.save("media/upper_$i.jld","m",m,"p",p,"md",md,"veh_id_list",veh_id_list,"ts",ts,"te",te)
end

#*****************Generate idm params for lmfit************
s = scenarios_upper
f = FilteringEnvironment()
name = "upper"

for i in 1:length(s)
veh_id_list = s[i][1]
ts = s[i][2][1]
te = s[i][2][2]
filename = "media/upper_$i.jld";
id_list,ts,te = JLD.load(filename,"veh_id_list","ts","te");
scene_list_true = replay_scenelist(f,id_list=id_list,ts=ts,te=te);

dirname = "$(name)_$(i)"
mkdir("lmfit/$(dirname)")
feat_dict = scenelist2idmfeatures(f,scene_list_true,id_list=id_list,
scenario_name=name,scenario_number=i);
end


#************Docstring example code from multiscenarios_pf in helpers.jl*****
# USEFUL to keep around for making tikz plots later on by rerunning this script
Expand Down Expand Up @@ -87,30 +106,31 @@ coll_mat_list = [coll_mat_idm,coll_mat_cidm,coll_mat_lmidm,coll_mat_pf];
coll_barchart(coll_mat_list,filename = "media/coll_barchart_upper.svg");


#********************Train upper test lower******************
# We need to show a variability in the generated scenarios
# So we need to combine the particle sets of different vehicles together
# And then for the same set of vehicles in the lower merge i.e. test domain
# We show significantly different driving behavior by sampling from the particle set
#***********Histogram plot****************
# Full example in docstring of Filtering/metrics.jl vel_distribution
a = PGFPlots.Axis([veh_hist_true,v_hist_idm,v_hist_cidm,v_hist_lmidm,v_hist_pf,
Plots.Command(raw"\legend{true,idm,cidm,lmidm,pf}")
]);

aidm = PGFPlots.Axis([veh_hist_true,v_hist_idm,Plots.Command(raw"\legend{true,idm}")],
xlabel="velocity",ylabel="density",title="True vs IDM");

acidm = PGFPlots.Axis([veh_hist_true,v_hist_cidm,Plots.Command(raw"\legend{true,c-idm}")],
xlabel="velocity",ylabel="density",title="True vs C-IDM");

#************LsqFit failed experimentation***************
# model(t, p) = p[1] * exp.(-p[2] * t)
# tdata = range(0,stop=10,length=20)
# ydata = model(tdata, [1.0 2.0]) + 0.01*randn(length(tdata))
# p0 = [0.5,0.5]
# fit = curve_fit(model, tdata, ydata, p0)
almidm = PGFPlots.Axis([veh_hist_true,v_hist_lmidm,Plots.Command(raw"\legend{true,lm-idm}")],
xlabel="velocity",ylabel="density",title="True vs LM-IDM");

# function test_lmfit(d,p)
# print("test_lmfit called\n")
# print("says:d=$d\n")
# t = d["t"]
# return p[1]*exp.(-p[2]*t)
# end
apf = PGFPlots.Axis([veh_hist_true,v_hist_pf,Plots.Command(raw"\legend{true,pf}")],
xlabel="velocity",ylabel="density",title="True vs pf");

# test_tdata = []
# for t in tdata
# push!(test_tdata,Dict("t"=>t))
# end
PGFPlots.save("media/vhist_idm.svg",aidm)
PGFPlots.save("media/vhist_cidm.svg",acidm)
PGFPlots.save("media/vhist_lmidm.svg",almidm)
PGFPlots.save("media/vhist_pf.svg",apf)

# curve_fit(test_lmfit,test_tdata,ydata,[0.5,0.5])
#********************Train upper test lower******************
# We need to show a variability in the generated scenarios
# So we need to combine the particle sets of different vehicles together
# And then for the same set of vehicles in the lower merge i.e. test domain
# We show significantly different driving behavior by sampling from the particle set
Loading

0 comments on commit 0466b1e

Please sign in to comment.