How to make your data portable?
After an equation-of-state-fitting, for instance, you want to save the data to share with a colleague or for future use. Julia provides several ways to do this. Below I will list one recommended way: saving it to a JLD format by JLD2.jl
package.
JLD is a specific "dialect" of HDF5, a cross-platform, multi-language data storage format most frequently used for scientific data.
Install
JLD2.jl
andFileIO.jl
packages.using Pkg Pkg.add("FileIO") Pkg.add("JLD2")
Create some
EquationsOfStateOfSolids
s:using EquationsOfStateOfSolids, Unitful, UnitfulAtomic m = Murnaghan(224.501825, 0.00060479524074699499, 3.723835, -323.417686) bm = BirchMurnaghan3rd(224.4445656763778u"bohr^3", 9.194980249913018u"GPa", 3.7403684211716297, -161.70885710742223u"hartree")
Save them to file
"eos.jld2"
:using JLD2, FileIO @save "eos.jld2" m bm
On another computer, or some days later, load them into REPL:
using EquationsOfStateOfSolids, Unitful, UnitfulAtomic @load "eos.jld2" m bm
Now variables
m
andbm
represent the originalParameters
:m.b0 m.b′0 bm.v0 bm.b0
For more details on the JLD format, please refer to JLD.jl
's doc, JLD2.jl
's doc or this discussion.