schrodinger.application.matsci.hdfutils module

Contains functionality related to hdf files

Copyright Schrodinger, LLC. All rights reserved.

class schrodinger.application.matsci.hdfutils.HDFIO

Bases: object

Class describing HDF5 input and output methods

readHDF(filename, key)

Reads a HDF file

Parameters
  • filename (str) – The filename

  • key (str) – The key to read

Return type

pandas.core.frame.DataFrame

Returns

Pandas data frame stored in the passed key

getKeys(filename, clean_text=None)

Gets the keys in HDF file

Parameters

filename – The filename

Return type

list

Returns

list of keys in the file

setData(filename, data)

Puts the pandas dataframes in the HDF file.

Parameters
  • filename (str) – The filename

  • data (dict) – The dictionary where the key is the key for the values of pandas dataframe

class schrodinger.application.matsci.hdfutils.HDFProxyPickleIO

Bases: object

Class describing pickle input and output methods which act as a proxy for HDF5 file

readHDF(filename, key)

Reads a pickle file

Parameters
  • filename (str) – The filename

  • key (str) – The key to read

Return type

pandas.core.frame.DataFrame

Returns

Pandas data frame stored in the passed key

getKeys(filename, clean_text=None)

Gets the keys of data stored in the pickle file

Parameters

filename – The filename

Return type

list

Returns

list of keys in the file

setData(filename, data)

Puts the pandas dataframes in the HDF file.

Parameters
  • filename (str) – The filename

  • data (dict) – The dictionary where the key is the key for the values of pandas dataframe

schrodinger.application.matsci.hdfutils.generate_hierarchial_key(*args)

Generates a hierarchial key for a hdf file

Parameters

args (list) – the list of strings which will form the key

Return type

str

Returns

the hierarchial key

schrodinger.application.matsci.hdfutils.get_filename(basename)

Gets the filename with proper extension

Parameters

basename (str) – The basename

Returns

The filename

Return type

str

schrodinger.application.matsci.hdfutils.get_hdf_io(filename)

Gets the i/o class associated with the extension of the filename

Parameters

filename (str) – The filename

Returns

The i/o class

Return type

HDFIO or HDFProxyPickleIO

schrodinger.application.matsci.hdfutils.get_hdf_keys(filename, clean_text=None)

Gets the keys of data stored in the file

Parameters
  • filename (str) – The filename

  • clean_text (str or NoneType) – The str used to replace KEY_SEPARATOR in keys

Return type

list

Returns

list of keys in the file

schrodinger.application.matsci.hdfutils.read_hdf(filename, key)

Reads the data in the file associated with the key

Parameters
  • filename (str) – The filename

  • key (str) – The key to read

Return type

pandas.core.frame.DataFrame

Returns

Pandas data frame stored in the passed key

schrodinger.application.matsci.hdfutils.HDFStore(filename, mode='w')

Context manager for hdf/hdf proxy file.

Parameters
  • filename (str) – The filename

  • mode (str) – The mode for opening the file. Only writing is supported.