andes.core.param.BaseParam#
- class andes.core.param.BaseParam(default: Optional[Union[float, str, int]] = None, name: Optional[str] = None, tex_name: Optional[str] = None, info: Optional[str] = None, unit: Optional[str] = None, mandatory: bool = False, export: bool = True, iconvert: Optional[Callable] = None, oconvert: Optional[Callable] = None)[source]#
The base parameter class.
This class provides the basic data structure and interfaces for all types of parameters. Parameters are from input files and in general constant once initialized.
Subclasses should overload the n() method for the total count of elements in the value array.
- Parameters
- defaultstr or float, optional
The default value of this parameter if None is provided
- namestr, optional
Parameter name. If not provided, it will be automatically set to the attribute name defined in the owner model.
- tex_namestr, optional
LaTeX-formatted parameter name. If not provided, tex_name will be assigned the same as name.
- infostr, optional
Descriptive information of parameter
- mandatorybool
True if this parameter is mandatory
- exportbool
True if the parameter will be exported when dumping data into files. True for most parameters. False for
BackRef
.
- Other Parameters
- iconvertCallable
Converter to be applied to input data when a device is being added.
- oconvertcallable
Converter to be applied to internal data when outputting.
Warning
The most distinct feature of BaseParam, DataParam and IdxParam is that values are stored in a list without conversion to array. BaseParam, DataParam or IdxParam are not allowed in equations.
- Attributes
- vlist
A list holding all the values. The
BaseParam
class does not convert thev
attribute into NumPy arrays.- propertydict
A dict containing the truth values of the model properties.
- __init__(default: Optional[Union[float, str, int]] = None, name: Optional[str] = None, tex_name: Optional[str] = None, info: Optional[str] = None, unit: Optional[str] = None, mandatory: bool = False, export: bool = True, iconvert: Optional[Callable] = None, oconvert: Optional[Callable] = None)[source]#
Methods
add
([value])Add a new parameter value (from a new device of the owner model) to the
v
list.Return
self.name
in a list.get_property
(property_name)Check the boolean value of the given property.
set
(pos, attr, value)Set attributes of the BaseParam class to new values at the given positions.
set_all
(attr, value)Set attributes of the BaseParam class to new values for all positions.
Attributes
Return the class name.
Return the count of elements in the value array.