ams.core.service.VarSelect#
- class ams.core.service.VarSelect(u: Callable, indexer: str, gamma: str = None, name: str = None, tex_name: str = None, unit: str = None, info: str = None, vtype: Type = None, rfun: Callable = None, rargs: dict = None, array_out: bool = True, no_parse: bool = False, sparse: bool = False, **kwargs)[source]#
A numerical matrix to select a subset of a 2D variable,
u.v[:, idx]
.For example, if nned to select Energy Storage output power from StaticGen pg, following definition can be used:
`python class RTED: ... self.ce = VarSelect(u=self.pg, indexer='genE') ... `
- Parameters:
- uCallable
The input matrix variable.
- indexer: str
The name of the indexer source.
- gammastr, optional
The name of the indexer gamma.
- namestr, optional
The name of the instance.
- tex_namestr, optional
The TeX name for the instance.
- unitstr, optional
The unit of the output.
- infostr, optional
A description of the operation.
- vtypeType, optional
The variable type.
- rfunCallable, optional
Function to apply to the output of
fun
.- rargsdict, optional
Keyword arguments to pass to
rfun
.- array_outbool, optional
Whether to force the output to be an array.
- sparse: bool, optional
True to return output as scipy csr_matrix.
- __init__(u: Callable, indexer: str, gamma: str = None, name: str = None, tex_name: str = None, unit: str = None, info: str = None, vtype: Type = None, rfun: Callable = None, rargs: dict = None, array_out: bool = True, no_parse: bool = False, sparse: bool = False, **kwargs)[source]#
Methods
Assign memory for
self.v
and set the array to zero.Return name in a list
parse
()Parse the parameter.
update
()Update the Parameter value.
Attributes
Return the class name
Return the count of values in
self.v
.Return the shape of the service.
Return the size.
Value of the service.