Module nom_client.results.numeric_model_result
Class to hold the model results.
Classes
class NumericModelResult (model_result_name='Unnamed', description='No description', project_name=None, username=None, tag=None, quantity=None, model_name='', data_format: str = 'dataset')-
Class/object to hold the model results.
Args
model_result_name:str- The name of the model result.
description:str- The description of the model result.
project_name:str- The project name.
quantity:str- The result quantity. (see lexicon)
model_name:str- The parent model name.
Ancestors
- nom_client.results.model_result.ModelResult
- builtins.dict
Static methods
def fromCSV(file_path=None)
Methods
def describe_variable(self, variable_name: str) ‑> Dict[~AnyStr, Dict]-
Describe a variable/column.
Args
variable_name- The variable name.
Returns
A description of the variable variable.
def divide_variable(self, variable_name: str, value: float)-
Divide a variable within the model result by a value.
:param variable_name: variable to divide :param value: value to divide
def get_all_data_values(self, format: str = 'list')-
Get all data values from variables in the given format.
:param format: The format in which the data values should be returned. Default is "list". Possible values are "list", "dict" or "full_metadata". :type format: str :return: All data values in the specified format. :rtype: np.array if format is "list" or dict otherwise :raises RuntimeError: If there is an error getting the data values.
def get_data_values(self, variable_list: List[~AnyStr] | None = None)-
Get all data values for a list of variable names, all data is returned if 'variable list' is not provided.
Args
variable_list- A variable name or list of variable name to get the data for.
Returns
The raw data values
def get_independent_variable(self) ‑> nom_client.variable.Variabledef get_metadata(self) ‑> Dict[str, Any]-
Return the meta data for the model result.
Returns
A dictionary of meta data.
def get_qualifiers(self)-
Return the model result qualifiers.
Return
The qualifiers for this model result.
def get_variable_axes(self, variable_name: str = None) ‑> Dict[~AnyStr, Dict]-
Returns the variable axes, e.g. {1: 'energy', 2: 'species'}
Args
variable_name:str- The name of the variable.
Returns
Dict[AnyStr, Dict]- The variable axes.
def get_variable_axis_data(self, axis_variable_name: str) ‑>-
Return the variable axis data.
Args
axis_variable_name- The name of the variable.
Returns
The axis data for the given variable name.
def get_variable_by_name(self, variable_name) ‑> nom_client.variable.Variable | None-
Get a variable by name. The variabe name can be determined by consulting the model documentation for this result.
Args
variable_name- the name of the variable.
Returns
Variable- the variable or None if variable not found.
def get_variable_by_quantity(self, quantity: str, **qualifiers)-
Get a variable by its quantity.
Args
quantity:str- The quantity. COnsult the model documentation pages for result quantities.
qualifiers:str- Any qualifier filter terms.
Return
List of variables
def get_variable_count(self) ‑> int-
Get the number of variables in the model result.
Returns
int- Count of variables in the result.
def get_variable_data(self, variable_name: str, to_units=None, **axes_indices)-
Get result values by name. If the variable has axes, you can specify a value to return for each axis (optional).
Args
variable_name- The name of the variable
to_units- Return in units (optional).
axes_indices- Specified axes value to return data for e.g. energy=4 etc (optional).
Returns
The array of data.
def get_variable_dimension(self, variable_name: str = None) ‑> Dict[~AnyStr, int]-
Returns the number of axes for a variable.
Args
variable_name- The name of the variable.
Returns
int- The number of data axes.
def get_variable_metadata(self, variable_name: str) ‑> Dict[~AnyStr, Dict]-
Get the meta data for a variable.
Args
variable_name- The variable name.
Returns
The variable meta data
def get_variable_names(self) ‑> list-
Return a list of variable names for this model result.
Return
A list of the variable names.
def get_variables(self, variable_names: str | List[str] = None, row_varying=None) ‑> List[nom_client.variable.Variable]-
Get a list of variables by name.
Args
variable_names:List[AnyStr]- A list of variable names.
row_varying:bool- Return row-varying or non-row variables.
Returns
List[Variable]- The list of variables.
def get_variables_with_axis(self, axis_name: str | list)def has_variable(self, variable_name: str) ‑> bool-
Is the variable with 'variable_name' present in this model result?
Args
variable_name- The variable name.
Returns
bool- Is the variable present?
def hydrate(self, model_result_dict)-
Create a ModelResult class from a dictionary representation :param model_result_dict: The dictionary representation :return: ModelResult class
def to_csv(self, file_path=None)