fastga.command.api module
API.
- fastga.command.api.file_temporary_transfer(file_path: str)[source]
Put a copy of original python file into temporary directory and remove plugin registration from current file.
- fastga.command.api.retrieve_original_file(tmp_folder, file_path: str)[source]
Retrieve the original file.
- fastga.command.api.generate_variables_description(subpackage_path: str, overwrite: bool = False)[source]
Generates/append the variable descriptions file for a given subpackage.
To use it simply type: from fastga.command.api import generate_variables_description import my_package
generate_variables_description(my_package.__path__[0], overwrite=True).
- Parameters
subpackage_path – the path of the subpackage to explore
overwrite – if True, the file will be written, even if it already exists
- Raises
FastPathExistsError – if overwrite==False and subpackage_path already exists.
- fastga.command.api.generate_configuration_file(configuration_file_path: str, overwrite: bool = False)[source]
Generates a sample configuration file.
- Parameters
configuration_file_path – the path of the file to be written
overwrite – if True, the file will be written, even if it already exists
- Raises
FastPathExistsError – if overwrite==False and configuration_file_path already exists
- fastga.command.api.generate_xml_file(xml_file_path: str, overwrite: bool = False)[source]
Generates a sample XML file.
- Parameters
xml_file_path – the path of the file to be written
overwrite – if True, the file will be written, even if it already exists
- Raises
FastPathExistsError – if overwrite==False and configuration_file_path already exists
- fastga.command.api.write_needed_inputs(problem: fastoad.openmdao.problem.FASTOADProblem, xml_file_path: str, source_formatter: Optional[fastoad.io.formatter.IVariableIOFormatter] = None)[source]
Writes the input file of the problem with unconnected inputs of the configured problem. Written value of each variable will be taken:
from input_data if it contains the variable
from defined default values in component definitions
- Parameters
problem – problem we want to write the inputs of
xml_file_path – if provided, variable values will be read from it
source_formatter – the class that defines format of input file. if not provided, expected format will be the default one.
- fastga.command.api.list_ivc_outputs_name(local_system: Union[openmdao.core.explicitcomponent.ExplicitComponent, openmdao.core.implicitcomponent.ImplicitComponent, openmdao.core.group.Group])[source]
List all “root” components in the systems, meaning the components that don’t have any subcomponents.
- fastga.command.api.generate_block_analysis(local_system: Union[openmdao.core.explicitcomponent.ExplicitComponent, openmdao.core.implicitcomponent.ImplicitComponent, openmdao.core.group.Group, str], var_inputs: List, xml_file_path: str, options: Optional[dict] = None, overwrite: bool = False)[source]
Generates a function based on set of models and a set of variables that we want this functions to take.
- Parameters
local_system – the system the function is going to be based one, can be either an
OpenMDAO component (Implicit, Explicit or a Group), a registered FAST-OAD id, or the absolute path to a configuration file :param var_inputs: a list of variables name that we want the patched function to have as an input, it will be the list of keys expected as an input of the function :param xml_file_path: the path of the XML that contains the values of the variables necessary for the models but that are not inputs :param options: the options of the group, required if an id is provided :param overwrite: boolean to set whether or not the input XML file will be overwritten once the function runs
- Return patched_function
the function constructed based on the provided system which takes
var_inputs as inputs under the form of a dictionary {“var_name”: (var_value, var_units)}
- class fastga.command.api.VariableListLocal(iterable=(), /)[source]
Bases:
fastoad.openmdao.variables.variable_list.VariableList- classmethod from_system(local_system: openmdao.core.system.System) fastoad.openmdao.variables.variable_list.VariableList[source]
Creates a VariableList instance containing inputs and outputs of a an OpenMDAO System. The inputs (is_input=True) correspond to the variables of IndepVarComp components and all the unconnected variables.
Warning: setup() must NOT have been called.
In the case of a group, if variables are promoted, the promoted name will be used. Otherwise, the absolute name will be used.
- Parameters
local_system – OpenMDAO Component instance to inspect
- Returns
VariableList instance.
- fastga.command.api.list_variables(component: Union[openmdao.core.explicitcomponent.ExplicitComponent, openmdao.core.group.Group]) list[source]
Reads all variables from a component/problem and return as a list.
- fastga.command.api.list_inputs(component: Union[openmdao.core.explicitcomponent.ExplicitComponent, openmdao.core.group.Group]) list[source]
Reads all variables from a component/problem and returns inputs as a list.
- fastga.command.api.list_inputs_metadata(component: Union[openmdao.core.explicitcomponent.ExplicitComponent, openmdao.core.group.Group]) tuple[source]
Reads all variables from a component/problem and returns inputs name and metadata as a list.