def __init__(self, datafile, path='<STR_LIT>', nparams=dict(), attr_params=dict(),<EOL>mode='<STR_LIT:r>'):
if isinstance(datafile, Path):<EOL><INDENT>self.filepath = datafile<EOL><DEDENT>else:<EOL><INDENT>if not Path(path).exists():<EOL><INDENT>raise ValueError('<STR_LIT>' % path)<EOL><DEDENT>self.filepath = Path(path, datafile)<EOL><DEDENT>self.h5file = tables.open_file(str(self.filepath), mode=mode)<EOL>self.filename = str(self.filepath)<EOL>if mode == '<STR_LIT:w>':<EOL><INDENT>self.h5file.title = "<STR_LIT>"<EOL>self.h5file.create_group('<STR_LIT:/>', '<STR_LIT>', '<STR_LIT>')<EOL>self.set_sim_params(nparams, attr_params)<EOL><DEDENT>
Return a new HDF5 file to store simulation results.

        The HDF5 file has two groups:
        '/parameters'
            containing all the simulation numeric-parameters

        If `mode='w'`, `datafile` will be overwritten (if exists).