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) ...@@ -20,7 +20,7 @@ tdfast = tempdecay(215, 25, 0.08)
### LOAD IN DATA ### LOAD IN DATA
obj = "/Users/jayant/phd/tempaware/models/" * "M5" obj = "/Users/jayant/phd/tempaware/models/" * "M5"
contours = clean_contour.(contour.(JSON.parse(open(obj * "contours.json")))) 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) @time vd = voxdata(obj * "_voxels.csv", cdata)
#stress_multiplier!(vd.voxels, 10) #stress_multiplier!(vd.voxels, 10)
rl = random_rollout(cdata) rl = random_rollout(cdata)
...@@ -100,4 +100,8 @@ histogram!(sort(data, rev=true)[1:4000]) # vast majority of voxels near 0 stress ...@@ -100,4 +100,8 @@ histogram!(sort(data, rev=true)[1:4000]) # vast majority of voxels near 0 stress
### Visualise voxmap ### Visualise voxmap
plot(vd, 46, cdata) plot(vd, 46, cdata)
plot(Vector(1:length(rl)), cdata) plot(Vector(1:length(rl)), cdata)
plot(rl, cdata) plot(rl, cdata)
\ No newline at end of file
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 ...@@ -9,6 +9,7 @@ using LinearAlgebra
using PlotlyJS using PlotlyJS
import PlotlyJS: plot import PlotlyJS: plot
using Colors using Colors
using Plots
struct material struct material
...@@ -622,4 +623,22 @@ function plot(rl::Vector{Int}, cdata::contourdata) ...@@ -622,4 +623,22 @@ function plot(rl::Vector{Int}, cdata::contourdata)
)) ))
end end
plot(traces, layout) 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 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