trace_load
Builtin index · Signal processing
trace_load(path)
Input: path · Output: no output
What it is
Reads a .csv or .npz trace and returns a record with one Vec per signal, in the order they were saved, whichever format it came from. Refuses a file that is not a trace (a text column, an archive member that is not a real 1-d array, signals of unequal length) and says which signal is at fault; use read_csv / read_npz for general files.
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
trace_load(path) | path Vecnot documented yet | not documented yet | Reads a .csv or .npz trace and returns a record with one Vec per signal, in the order they were saved, whichever format it came from. Refuses a file that is not a trace (a text column, an archive member that is not a real 1-d array, signals of unequal length) and says which signal is at fault; use read_csv / read_npz for general files. |
Examples
From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.
function sho(t, y)
return [y[1], -y[0]]
end function
te = linspace(0, 5, 51)
r = ode45("sho", [0, 5], [1, 0], t_eval=te, rtol=1e-10, atol=1e-12)
trace_save("reference.npz", {t = r.t, y = r.y[:, 0]})
ref = trace_load("reference.npz")
c = ode23("sho", [0, 5], [1, 0], t_eval=te) # the run under test
d = trace_diff(ref, {t = c.t, y = c.y[:, 0]}, rtol=1e-6, atol=1e-6)
print(d.ok) # false
print(d.worst_signal) # y
print(d.max_abs) # 2.652263e-6, at sample d.worst_index (32)
output
false y 2.652263e-6
from signal-processing