Todo
Improve autoapi module
circadapt.components
Components for easy input/output of the CircAdapt model.
The component is a general class. It holds parameters that will be called using the Parameter object and signals that are called using the Signals object.
Package Contents
Classes
General functions to communicate with c++ objects. |
|
Basic functions used for Parameter and Signal classes. |
|
General functions to retreive signals from the c++ object. |
|
General functions to retreive signals from the c++ object. |
|
General functions to retreive signals from the c++ object. |
|
Component object with no locations. |
|
Any component that automatically detects the parameters from the c++ class. |
Submodules
Objects
- class circadapt.components.Component(component_type, model, objects=None)[source]
General functions to communicate with c++ objects.
Parameters
- model: ctypes object
C++ model
- locs: string
Locations of objects in the c++ model that can be altered along this component
- parameters = []
- signals = []
- parameter_on_set
- __getitem__(arg: any) any[source]
Get data.
This function is called when self[arg].
Parameters
- arg: slice or string
If slice, return a components object with locs obtained from slice. If str, return the parameter or signal for all locs
- class circadapt.components.ParSig(model, par, locs)[source]
Basic functions used for Parameter and Signal classes.
- class circadapt.components.Parameter(model, par, locs, parameter_on_set=None)[source]
Bases:
ParSigGeneral functions to retreive signals from the c++ object.
Parameters
- model: ctypes object
C++ model
- par: str
Parameter name that will be obtained from each loc.
- locs: string
Locations of objects in the c++ model that can be altered along this component.
- __setitem__(arg, value)[source]
Set data.
Set data of the parameter for locs given in arg. Only parameter names can be used.
Parameters
- arg: slice
Locations to be changed.
- val: float/int/bool
Value will automatically be translated to type of the parameter.
- build()
- __repr__()
Object representation in string format.
- __add__(val)
Handle the + operator.
- __radd__(val)
Handle the + operator as right hand element.
- __sub__(val)
Handle the - operator.
- __rsub__(val)
Handle the - operator as right hand element.
- __mul__(val)
Handle the * operator.
- __rmul__(val)
Handle the * operator as right hand element.
- __truediv__(val)
Handle the / operator.
- __rtruediv__(val)
Handle the / operator as right hand element.
- __floordiv__(val)
Handle the // operator.
- __rfloordiv__(val)
Handle the // operator.
- __mod__(val)
Handle the % operator.
- __rmod__(val)
Handle the % operator.
- __pow__(val)
Handle the ** operator.
- __rpow__(val)
Handle the ** operator as right hand element.
- __neg__()
Handle -self.
- __lt__(val)
Handle the < operator.
- __le__(val)
Handle the <= operator.
- __gt__(val)
Handle the > operator.
- __ge__(val)
Handle the >= operator.
- __eq__(val)
Handle the == operator.
- __ne__(val)
Handle the != operator.
- class circadapt.components.ParameterVectorXd(*arg, **kwarg)[source]
Bases:
ParameterGeneral functions to retreive signals from the c++ object.
Parameters
- model: ctypes object
C++ model
- par: str
Parameter name that will be obtained from each loc.
- locs: string
Locations of objects in the c++ model that can be altered along this component.
- __setitem__(arg, value)[source]
Set data.
Set data of the parameter for locs given in arg. Only parameter names can be used.
Parameters
- arg: slice
Locations to be changed.
- val: float/int/bool
Value will automatically be translated to type of the parameter.
- build()
- __repr__()
Object representation in string format.
- __add__(val)
Handle the + operator.
- __radd__(val)
Handle the + operator as right hand element.
- __sub__(val)
Handle the - operator.
- __rsub__(val)
Handle the - operator as right hand element.
- __mul__(val)
Handle the * operator.
- __rmul__(val)
Handle the * operator as right hand element.
- __truediv__(val)
Handle the / operator.
- __rtruediv__(val)
Handle the / operator as right hand element.
- __floordiv__(val)
Handle the // operator.
- __rfloordiv__(val)
Handle the // operator.
- __mod__(val)
Handle the % operator.
- __rmod__(val)
Handle the % operator.
- __pow__(val)
Handle the ** operator.
- __rpow__(val)
Handle the ** operator as right hand element.
- __neg__()
Handle -self.
- __lt__(val)
Handle the < operator.
- __le__(val)
Handle the <= operator.
- __gt__(val)
Handle the > operator.
- __ge__(val)
Handle the >= operator.
- __eq__(val)
Handle the == operator.
- __ne__(val)
Handle the != operator.
- class circadapt.components.Signal(model, par, locs)[source]
Bases:
ParSigGeneral functions to retreive signals from the c++ object.
Parameters
- model: ctypes object
C++ model
- par: str
Parameter name that will be obtained from each loc.
- locs: string
Locations of objects in the c++ model that can be altered along this component
- __setitem__(arg: any, value) any[source]
Set data.
Function is called when use self[arg].
Raises
Always raise error, signals can not be changed.
- __getitem__(arg: any) any[source]
Get data.
This function is called when self[arg].
Parameters
- arg: slice or string
If slice, return a components object with locs obtained from slice. If str, return the parameter or signal for all locs
- store(_export: bool | numpy.ndarray)[source]
Configure storage for export signals for all objects in this container.
This method sets whether each object in the container should have its corresponding export signal stored in the model. The input _export determines which objects are marked for storage.
Parameters
- _exportbool or numpy.ndarray of bool
If a single bool is provided, the same value applies to all objects.
If a numpy array of booleans is provided, its length must match
the number of objects in this container. Each element indicates whether to store the export signal for the corresponding object.
Raises
- ValueError
If _export is a numpy array with a length that does not match the number of objects, or if the signal type is not supported.
- TypeError
If _export is neither a bool nor a numpy array of booleans.
- build()
- __repr__()
Object representation in string format.
- __add__(val)
Handle the + operator.
- __radd__(val)
Handle the + operator as right hand element.
- __sub__(val)
Handle the - operator.
- __rsub__(val)
Handle the - operator as right hand element.
- __mul__(val)
Handle the * operator.
- __rmul__(val)
Handle the * operator as right hand element.
- __truediv__(val)
Handle the / operator.
- __rtruediv__(val)
Handle the / operator as right hand element.
- __floordiv__(val)
Handle the // operator.
- __rfloordiv__(val)
Handle the // operator.
- __mod__(val)
Handle the % operator.
- __rmod__(val)
Handle the % operator.
- __pow__(val)
Handle the ** operator.
- __rpow__(val)
Handle the ** operator as right hand element.
- __neg__()
Handle -self.
- __lt__(val)
Handle the < operator.
- __le__(val)
Handle the <= operator.
- __gt__(val)
Handle the > operator.
- __ge__(val)
Handle the >= operator.
- __eq__(val)
Handle the == operator.
- __ne__(val)
Handle the != operator.
- class circadapt.components.General(model)[source]
Bases:
ComponentComponent object with no locations.
- parameters
- signals
- parameter_on_set
- __getitem__(arg: any) any[source]
Get data.
This function is called when self[arg].
Parameters
- arg: slice or string
If slice, return a components object with locs obtained from slice. If str, return the parameter or signal for all locs
- __setitem__(arg, value)[source]
Set data.
Set data of the parameter for locs given in arg. Only parameter names can be used.
Parameters
- arg: slice
Locations to be changed.
- val: float/int/bool
Value will automatically be translated to type of the parameter.
- build()
- add_object(o)
- add(name)
- class circadapt.components.AutoComponent(component_type, model, objects=None)[source]
Bases:
ComponentAny component that automatically detects the parameters from the c++ class.
This type of component is especially for plugins. No special functions are given to this type of component.
- parameters = []
- signals = []
- parameter_on_set
- build()
- __repr__()
Object representation in string format.
- __getitem__(arg: any) any
Get data.
This function is called when self[arg].
Parameters
- arg: slice or string
If slice, return a components object with locs obtained from slice. If str, return the parameter or signal for all locs
- __setitem__(arg: str, val: any) any
Set data.
Set data of the parameter given in arg. Only parameter names can be used.
Parameters
- arg: str
Parameter name
- val: float/int/bool
Value will automatically be translated to type to
- __iter__()
Iterate over object, used for dict(self).
- add(name)