load_hdf5 should load metadata in addition to just the traces and ifo struct
You can currently save any metadata along with the budget traces and ifo struct with io.save_hdf5
like
traces = budget.run()
metadata = {
"gps_time": 123,
"other_stuf": "blah blah",
}
io.save_hdf5(traces, path, ifo=budget.ifo, **extra_metadata)
This does save extra_metadata
in attrs
, however load_hdf5
only loads the traces and ifo back (in SCHEMA_VERSION 2).
Furthermore, it adds the ifo struct to traces, which I don't like. I propose doing something like returning traces, ifo, and everything in attrs except ifo
(and maybe not SCHEMA
or SCHEMA_VERSION
either). Or maybe make a SCHEMA 3 which saves any metadata to a separate metadata dict in attrs. Something like
traces = io.load_hdf5(file_name) # if only the traces were saved
traces, ifo = io.load_hdf5(file_name) # if traces and ifo were saved
traces, ifo, metadata = io.load_hdf5(file_name) # if all three were saved
The one problem being knowing how many variables to expect, but maybe that's not so bad.
This kind of thing would be very useful for the LHO noise budget, for example. Right now I have them saving any extra metadata that they want as I did in the example above. If the conclusion is to move to some other slightly different SCHEMA where the metadata is saved in some other way in the hdf5 file, it will be trivial to manually fix the few budgets that they've saved as in the above example to work with whatever we eventually decide.