tfep.utils.plumed.io.read_table

tfep.utils.plumed.io.read_table(file_path, col_names=None, as_array=False, remove_duplicates=True, row_filter_func=None, dtype=None, ordering_col_name=None)[source]

Read one or more columns from a PLUMED output file.

Parameters:
  • file_path (str) – The path to the PLUMED output file to read.

  • col_names (List[str], optional) – A list of column names to read. These names correspond to those provided in the initial ‘#! FIELDS …’ header record. If not given, the function reads all the columns.

  • as_array (bool, optional) – If True, the data is returned as a single array of shape (n_rows, n_cols). Otherwise, the table is returned in dict format with one column for each key. Default is False.

  • remove_duplicates (bool, optional) – In some cases, the first and second rows of the PLUMED file are duplicates. If True (default) the first record is not loaded.

  • row_filter_func (Callable[[str], bool], optional) – Rows for which this function returns False will be skipped.

  • dtype (type, optional) – The type of the returned array. Otherwise, the type is inferred from the data.

  • ordering_col_name (str, optional) – If given, rows are re-ordered in increasing order of the value of this column.

Returns:

data – If as_array == False, data[col_name][i] is the value in the i-th record of column col_name of the table in the output file. Otherwise, data[col_names.index(col_name)][i] is the corresponding value.

Return type:

numpy.ndarray or Dict[str, numpy.ndarray]