fastoad.gui.variable_viewer module¶
Defines the variable viewer for postprocessing
- class fastoad.gui.variable_viewer.VariableViewer[source]¶
Bases:
object
A class for interacting with FAST-OAD files. The file data is stored in a pandas DataFrame. The class built so that a modification of the DataFrame is instantly replicated on the file file. The interaction is achieved using a user interface built with widgets from ipywidgets and Sheets from ipysheet.
A classical usage of this class will be:
df = VariableViewer() # instantiation of dataframe file = AbstractOMFileIO('problem_outputs.file') # instantiation of file io df.load(file) # load the file df.display() # renders a ui for reading/modifying the file
- file¶
The path of the data file that will be viewed/edited
- dataframe¶
The dataframe which is the mirror of self.file
- load(file_path: str, file_formatter: Optional[fastoad.io.formatter.IVariableIOFormatter] = None)[source]¶
Loads the file and stores its data.
- Parameters
file_path – the path of file to interact with
file_formatter – the formatter that defines file format. If not provided, default format will be assumed.
- save(file_path: Optional[str] = None, file_formatter: Optional[fastoad.io.formatter.IVariableIOFormatter] = None)[source]¶
Save the dataframe to the file.
- Parameters
file_path – the path of file to save. If not given, the initially read file will be overwritten.
file_formatter – the formatter that defines file format. If not provided, default format will be assumed.
- load_variables(variables: fastoad.openmdao.variables.VariableList, attribute_to_column: Optional[Dict[str, str]] = None)[source]¶
Loads provided variable list and replace current data set.
- Parameters
variables – the variables to load
attribute_to_column – dictionary keys tell what variable attributes are kept and the values tell what name will be displayed. If not provided, default translation will apply.
- get_variables(column_to_attribute: Optional[Dict[str, str]] = None) → fastoad.openmdao.variables.VariableList[source]¶
- Parameters
column_to_attribute – dictionary keys tell what columns are kept and the values tell what variable attribute it corresponds to. If not provided, default translation will apply.
- Returns
a variable list from current data set