Commit 842b9f7d authored by Jayant Khatkar's avatar Jayant Khatkar
Browse files

add animated plot to show progress of contour order

parent 7bed2ab7
......@@ -20,7 +20,7 @@ tdfast = tempdecay(215, 25, 0.08)
### LOAD IN DATA
obj = "/Users/jayant/phd/tempaware/models/" * "M5"
contours = clean_contour.(contour.(JSON.parse(open(obj * "contours.json"))))
cdata = contourdata(contours, 20, 5) # contour data
cdata = contourdata(contours, 40, 5) # contour data
@time vd = voxdata(obj * "_voxels.csv", cdata)
#stress_multiplier!(vd.voxels, 10)
rl = random_rollout(cdata)
......@@ -101,3 +101,7 @@ histogram!(sort(data, rev=true)[1:4000]) # vast majority of voxels near 0 stress
plot(vd, 46, cdata)
plot(Vector(1:length(rl)), cdata)
plot(rl, cdata)
rl = random_rollout(cdata)
rl = Vector(1:length(rl))
@time plot_animate(rl, cdata)
\ No newline at end of file
......@@ -9,6 +9,7 @@ using LinearAlgebra
using PlotlyJS
import PlotlyJS: plot
using Colors
using Plots
struct material
......@@ -623,3 +624,21 @@ function plot(rl::Vector{Int}, cdata::contourdata)
end
plot(traces, layout)
end
function plot_animate(rl::Vector{Int}, cdata::contourdata)
i=1
p=Plots.plot3d(cdata.contours[rl[i]].pos[:,1],
cdata.contours[rl[i]].pos[:,2],
cdata.contours[rl[i]].pos[:,3]
)
return @gif for i in 2:length(rl)
plot3d!(p,
cdata.contours[rl[i]].pos[:,1],
cdata.contours[rl[i]].pos[:,2],
cdata.contours[rl[i]].pos[:,3],
legend=false
)
end
end
\ No newline at end of file
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