Closed hzovaro closed 9 months ago
Try:
A good solution may be to store the data using
store = pd.HDFStore(fname)
store.put("data", df_data)
store.get_storer("data").attrs.metadata = metadata
store.close()
and read it back in using
with pd.HDFStore(fname) as store:
df_data = store["data"]
metadata = store.get_storer("data").attrs.metadata
With this, we can store metadata directly paired with the data on-disk - much better than assuming metadata, e.g. settings, etc. at runtime and then manually adding them back in. We can still add the metadata as columns at runtime as we've been doing up until now.
To do:
Updated to-do list Feb 2024:
add_columns()
that add these params to the DataFrame._storage_improvements
from the filenamess_params
Series on load_df()? Perhaps return on an optional argument?output_path
arg from load_df()
Incidental changes:
__lzifu_ncomponents
, __use_lzifu_fits
or debug
in the DataFrame output by load_df()
as they are not really necessary. "ID", "x (projected, arcsec)", "y (projected, arcsec)"
to make it easier to parse contents. New philosophy for reading/writing HDF files:
Writing:
Reading:
New tasks (do this all in the testing environment to avoid accidentally overwriting stuff we might need):
make_df
to overwrite existing DataFrames with precisely matching parameters.load_df
to interactively list parameters for all matching files in case of multiple hits.ss_params
in make_df().
E.g. -