add_as_grp

Given a class, dictionary, list or tuples instance ‘obj’, the routine adds it as a sub-group of name grpname to the parent group grpParent. An attribute _read_as, specifying the type of obj, is added to the group so as to allow reading correctly the h5 file.

Usage and Remarks:
  • if obj contains dictionaries, listes or tuples, these are automatically saved

  • if list only contains scalars or arrays of the same dimension, this will be saved as a numpy array

  • if obj contains classes, only those that are instances of the classes specified in ClassesToSave will be saved

  • If grpParent already contains a sub-group with name grpname, this will not be overwritten. However, pre-existing attributes of the sub-group will be overwritten if obj contains attrributes with the same names.

  • attributes belonging to SkipAttr will not be saved - This functionality needs improving

  • if compress_float is True, numpy arrays will be saved in single precisions.