YamboParser
Class to perform the parsing of a Yambo o- file(s).
- class mppi.Parsers.YamboParser.YamboParser(files, verbose=False, extendOut=True)[source]
Bases:
dict- classmethod from_path(path, verbose=False, extendOut=True)[source]
Init the a YamboParser instance using all the ‘o-’ files found inside the path.
- Parameters
path (
string) – name of the folder that contains the ‘o-’ filesverbose (
boolean) – Determine the amount of information provided on terminalextendOut (
boolean) – Determine which dictionary is used as reference for the names of the variables
- parseYamboOutput(file, suffix, extendOut)[source]
Read the data from the o- file. Data of the file are stored as key : values in the self[suffix] dictionary. The names of the keys are taken from the reference_column_names or from the reference_column_names_extendOut (depending on the value of the boolean extendOut), if the suffix is recognized.
- mppi.Parsers.YamboParser.build_columns(lines)[source]
Split each line of the output of file_to_list into a list and convert its elements to float. The procedure deletes the values that cannot be converted to float, for istance the string that specifies the high-symmetry points in the ypp bands_interpolated post-processing. Then transpose the array so that each element is a column of the data of the file.
- mppi.Parsers.YamboParser.file_to_list(filename, skip='#')[source]
Read the filename and append all the lines that do not start with the skip string, to a list.
- Parameters
filename (str) – name of the file
skip (str) – first elements of the skipped lines
- mppi.Parsers.YamboParser.files_from_folder(path)[source]
Scan the files in the folder and build a list with the names of all the files that contain the ‘o-’ term in their name.
- Parameters
path (string) – name of the folder
- mppi.Parsers.YamboParser.make_dict(columns, suffix, extendOut)[source]
Create a dictionary from the columns array. If the suffix is found in the ref dictionary attribute to the keys the associated names, otherwise associate string value ‘col’+str(ind), where ind is the column index starting from zero. The choice of the ref dictionary depends on the value of extendOut.
- Parameters
columns (
array) – array with the data sorted in columnssuffix (string) – specifies the run level
extendOut (bool) – specifies which dictionary has to be used as reference values of the columns names