tardisbase.testing.regression_data.hdfwriter module

class tardisbase.testing.regression_data.hdfwriter.HDFWriterMixin(*args, **kwargs)[source]

Bases: object

static convert_to_snake_case(s)[source]
property full_hdf_properties
get_properties()[source]
to_hdf(file_path_or_buf, path='', name=None, overwrite=False)[source]
Parameters:
  • file_path_or_buf (str or pandas.io.pytables.HDFStore) – Path or buffer to the HDF file

  • path (str) – Path inside the HDF file to store the elements

  • name (str) – Group inside the HDF file to which the elements need to be saved

  • overwrite (bool) – If the HDF file path already exists, whether to overwrite it or not

static to_hdf_util(path_or_buf, path, elements, overwrite, complevel=9, complib='blosc')[source]

A function to uniformly store TARDIS data to an HDF file.

Scalars will be stored in a Series under path/scalars 1D arrays will be stored under path/property_name as distinct Series 2D arrays will be stored under path/property_name as distinct DataFrames

Units will be stored as their CGS value

Parameters:
  • path_or_buf (str or pandas.io.pytables.HDFStore) – Path or buffer to the HDF file

  • path (str) – Path inside the HDF file to store the elements

  • elements (dict) – A dict of property names and their values to be stored.

  • overwrite (bool) – If the HDF file path already exists, whether to overwrite it or not

Notes

overwrite option doesn’t have any effect when path_or_buf is an HDFStore because the user decides on the mode in which they have opened the HDFStore (‘r’, ‘w’ or ‘a’).