Files
thesis/julia/test/plotting.jl
2021-10-10 20:53:14 -06:00

57 lines
1.7 KiB
Julia

@testset "Plotting" begin
println("Testing plotting features")
using PlotlyJS: savefig, SyncPlot
# Generate a couple of useful paths
T = rand(year : hour : 4year)
tof = 4year
n = 4_000
start = gen_orbit(T, 12_000.)
thrust = spiral(0.9, n, start, bepi, tof)
spiral_path = prop(thrust, start, bepi, tof)[1]
no_thrust_path = prop(zeros(n,3), start, bepi, tof)[1]
paths = [ spiral_path, no_thrust_path ]
# First let's plot a single basic path
p = plot(spiral_path)
savefig(p,"../plots/plot_test_path.html")
@test typeof(p) == SyncPlot
# Next I just want to plot a planet both not moving...
p = plot(Jupiter, Dates.now(), title="Jupiter")
savefig(p,"../plots/plot_test_planet_nomove.html")
@test typeof(p) == SyncPlot
# ...and moving
p = plot(Venus, Dates.now(), 0.95period(Venus), title="Venus")
savefig(p,"../plots/plot_test_planet_move.html")
@test typeof(p) == SyncPlot
# Next I want to plot the entire solar system
p = plot([Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune, Pluto],
Dates.now(),
title="The Solar System")
savefig(p,"../plots/plot_test_solar_system.html")
@test typeof(p) == SyncPlot
# Next I want to plot a vector of states
p = plot(paths,
labels = ["No Thrust Orbit","Thrust Spiral"],
title = "Vector of Paths Plot Test")
savefig(p,"../plots/plot_test_paths.html")
@test typeof(p) == SyncPlot
# And finally, I'd like to plot a mission guess...
p = plot(test_mg)
savefig(p,"../plots/plot_test_mission_guess.html")
@test typeof(p) == SyncPlot
# ...and a mission
p = plot(Mission(test_mg))
savefig(p,"../plots/plot_test_mission.html")
@test typeof(p) == SyncPlot
end