invenia / JLSO.jl

Julia Serialized Object (JLSO) file format for storing checkpoint data.
MIT License
90 stars 5 forks source link

More detailed examples in the documentation on how to use JLSO.save? #88

Open CosmoProf opened 3 years ago

CosmoProf commented 3 years ago

Hi, what is the syntax needed to use JLSO.save to save other objects, like arrays , ODEsolutions, etc.? And how does one save using different options, like format=:julia_serialize, etc.?

There is only one example in the documentation, JLSO.save("breakfast.jlso", "food" => "☕️🥓🍳", "cost" => 11.95, "time" => Time(9, 0)) , and this does not clarify the general syntax for how to save data structures.

Thanks for any info.

rofinn commented 3 years ago

It's the same syntax regardless of the object being saved. JLSO doesn't really care about what the objects are as long as the underlying serialization format can handle it (e.g., :bson vs :julia_serialization). The save options are just keywords as you'd expect. Here's an example of how we generate our test files for each new JLSO file format version released.

https://github.com/invenia/JLSO.jl/blob/master/test/test_data_setup.jl#L34

In that case, we're passing a dict cause that's more convenient, but pairs will also work.