You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm developing
and encountered a weird warning message.
I wonder if
it has a potential error that might cause data loss.
there is a way of resolving this warning.
Reproducing this error
Sorry for no MWE. It can be reproduced by running test/sim_and_save.jl and, at a new session, test/load_and_plot.jl in this commit.
brief code
test/sim_and_save.jl
using FlightSims
using Plots
# using Pipe: @pipeusing JLD2, FileIO
functionmain()
dir_log ="data/sim_and_save"mkpath(dir_log)
env =TwoDimensionalNonlinearPolynomialEnv()
x0 =State(env)()
# simulation and data processing
prob, sol =sim(env, x0, apply_inputs(dynamics!(env); u=FlightSims.optimal_input(env)); tf=10.0)
df =process(env)(prob, sol)
# df = @pipe sim(env; tf=10.0) |> process(env)(_...) # shorthand# save (for stable data saving, one may save raw data). Here, raw data means e.g. t = 0, 0.01, 0.02, ...
FlightSims.save(joinpath(dir_log, "test.jld2"), env, prob, sol)
# to load it, see `main/example_load.jl`end
test/load_and_plot.jl
using JLD2
using FlightSims, OrdinaryDiffEq, ComponentArrays # for data re-constructionusing UnPack
using Plots
function_load()
# run it in a new session. Be careful for loading packages for re-construction.
saved_data =load("test.jld2")
# @unpack env, prob, sol = saved_data# df = process(env)(prob, sol)# plot(df.times, hcat(df.states...)')nothingend
Warning message
julia>_load()
┌ Warning: some parameters could not be resolved for type ODEFunction{true,FlightSims.#5#6{TwoDimensionalNonlinearPolynomialEnv},LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,typeof(SciMLBase.DEFAULT_OBSERVED),Nothing}; reconstructing
└ @ JLD2 ~/.julia/packages/JLD2/fAkkN/src/data/reconstructing_datatypes.jl:440
The text was updated successfully, but these errors were encountered:
If you really want to store the full function / problem / solution structures, you could consider using the stdlib Serialization. Note that the resulting files are generally not portable, though.
Alternatively, you could consider extracting the relevant information from these structures and store those using JLD2.
@JonasIsensee
Thank you for your explanation. Yes, you understood correctly.
How's the outlook of JLD2? Would it support serialising anonymous functions in the near future?
I'm developing
and encountered a weird warning message.
I wonder if
Reproducing this error
Sorry for no MWE. It can be reproduced by running
test/sim_and_save.jl
and, at a new session,test/load_and_plot.jl
in this commit.brief code
test/sim_and_save.jl
test/load_and_plot.jl
Warning message
The text was updated successfully, but these errors were encountered: