def save_hdf(self, filename, path='<STR_LIT>', overwrite=False, append=False):
if os.path.exists(filename):<EOL><INDENT>with pd.HDFStore(filename) as store:<EOL><INDENT>if path in store:<EOL><INDENT>if overwrite:<EOL><INDENT>os.remove(filename)<EOL><DEDENT>elif not append:<EOL><INDENT>raise IOError('<STR_LIT>'.format(path,filename))<EOL><DEDENT><DEDENT><DEDENT><DEDENT>if self.samples is not None:<EOL><INDENT>self.samples.to_hdf(filename, path+'<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>pd.DataFrame().to_hdf(filename, path+'<STR_LIT>')<EOL><DEDENT>self.obs.save_hdf(filename, path+'<STR_LIT>', append=True)<EOL>with pd.HDFStore(filename) as store:<EOL><INDENT>attrs = store.get_storer('<STR_LIT>'.format(path)).attrs<EOL>attrs.ic_type = type(self.ic)<EOL>attrs.ic_bands = list(self.ic.bands)<EOL>attrs.use_emcee = self.use_emcee<EOL>if hasattr(self, '<STR_LIT>'):<EOL><INDENT>attrs._mnest_basename = self._mnest_basename<EOL><DEDENT>attrs._bounds = self._bounds<EOL>attrs._priors = self._priors<EOL>attrs.name = self.name<EOL>store.close()<EOL><DEDENT>
Saves object data to HDF file (only works if MCMC is run)

        Samples are saved to /samples location under given path,
        :class:`ObservationTree` is saved to /obs location under given path.

        :param filename:
            Name of file to save to.  Should be .h5 file.

        :param path: (optional)
            Path within HDF file structure to save to.

        :param overwrite: (optional)
            If ``True``, delete any existing file by the same name
            before writing.

        :param append: (optional)
            If ``True``, then if a file exists, then just the path
            within the file will be updated.