models
Modules:
| Name | Description |
|---|---|
polynomial |
|
Classes
Modules
polynomial
Classes:
| Name | Description |
|---|---|
Polynomial |
A polynomial model. |
Classes
Polynomial(name='polynomial', coefficients=None)
A polynomial model.
Attributes:
| Name | Type | Description |
|---|---|---|
coefficients |
ClassVar[CollectionBase]
|
Coefficients of the polynomial. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the model. |
'polynomial'
|
coefficients
|
Optional[Union[Iterable[Union[float, Parameter]], CollectionBase]]
|
Coefficients used to populate |
None
|
Raises:
| Type | Description |
|---|---|
TypeError
|
If |
Methods:
| Name | Description |
|---|---|
encode |
Use an encoder to covert an EasyScience object into another |
decode |
Re-create an EasyScience object from the output of an encoder. |
as_dict |
Convert an object into a full dictionary using |
from_dict |
Re-create an EasyScience object from a full encoded dictionary. |
__reduce__ |
Make the class picklable. |
generate_bindings |
Generate or re-generate bindings to an interface (if exists). |
switch_interface |
Switch or create a new interface. |
get_parameters |
Get all parameter objects as a list. |
get_fit_parameters |
Get all objects which can be fitted (and are not fixed) as a |
__copy__ |
Return a copy of the object. |
Attributes
interface
property
writable
Get the current interface of the object.
unique_name
property
writable
Get the unique name of the object.
name
property
writable
Get the common name of the object.
Returns:
| Type | Description |
|---|---|
str
|
Common name of the object. |
Functions
encode(skip=None, encoder=None, **kwargs)
Use an encoder to covert an EasyScience object into another
format. Default is to a dictionary using SerializerDict.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
skip
|
Optional[List[str]]
|
List of field names as strings to skip when forming the encoded object. By default, None. |
None
|
encoder
|
Optional[SerializerBase]
|
The encoder to be used for encoding the data. By default, None. |
None
|
**kwargs
|
Any additional key word arguments to be passed to the encoder. |
{}
|
Returns:
| Type | Description |
|---|---|
Any
|
Encoded object containing all information to reform an EasyScience object. |
decode(obj, decoder=None)
classmethod
Re-create an EasyScience object from the output of an encoder.
The default decoder is SerializerDict.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
Any
|
Encoded EasyScience object. |
required |
decoder
|
Optional[SerializerBase]
|
Decoder to be used to reform the EasyScience object. By default, None. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
Reformed EasyScience object. |
as_dict(skip=None)
Convert an object into a full dictionary using
SerializerDict. This is a shortcut for
obj.encode(encoder=SerializerDict)
Parameters
skip : Optional[List[str]], default=None List of field names as strings to skip when forming the dictionary. By default, None.
Returns
Dict[str, Any] Encoded object containing all information to reform an EasyScience object.
from_dict(obj_dict)
classmethod
Re-create an EasyScience object from a full encoded dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj_dict
|
Dict[str, Any]
|
Dictionary containing the serialized contents (from
|
required |
Returns:
| Type | Description |
|---|---|
Any
|
Reformed EasyScience object. |
__reduce__()
Make the class picklable.
Due to the nature of the dynamic class definitions special measures need to be taken.
Returns:
| Type | Description |
|---|---|
tuple
|
Tuple consisting of how to make the object. |
generate_bindings()
Generate or re-generate bindings to an interface (if exists).
Raises:
| Type | Description |
|---|---|
AttributeError
|
If |
switch_interface(new_interface_name)
Switch or create a new interface.
get_parameters()
Get all parameter objects as a list.
Returns:
| Type | Description |
|---|---|
List[Parameter]
|
List of |
get_fit_parameters()
Get all objects which can be fitted (and are not fixed) as a list.
Returns:
| Type | Description |
|---|---|
List[Parameter]
|
List of |
__copy__()
Return a copy of the object.