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 need 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.
- no_parse: bool, optional
True to skip parsing the service.
- 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.vand set the array to zero.evaluate(*args, **kwargs)Return all the indexes of this item.
get_idx()Return name in a list
parse(*args, **kwargs)update()Update the Parameter value.
Attributes