Skip to content

base_classes

Modules:

Name Description
easydynamics_base
easydynamics_list
easydynamics_modelbase
name_mixin

Classes:

Name Description
EasyDynamicsBase

Base class for all EasyDynamics classes.

EasyDynamicsModelBase

Base class for all EasyDynamics models.

Classes

EasyDynamicsBase(*args, name='MyEasyDynamicsModel', display_name=None, unique_name=None, **kwargs)

Base class for all EasyDynamics classes.

Parameters:

Name Type Description Default
*args object

Positional arguments to pass to the parent class.

()
name str

Name of the model.

'MyEasyDynamicsModel'
display_name str | None

Display name of the model. If None, the name will be used.

None
unique_name str | None

Unique name of the model. If None, a unique name will be generated.

None
**kwargs object

Additional keyword arguments to pass to the parent class.

{}

Raises:

Type Description
TypeError

If name is not a string.

Methods:

Name Description
to_dict

Convert an EasyScience object into a full dictionary using

from_dict

Re-create an EasyScience object from a full encoded

__dir__

This creates auto-completion and helps out in iPython

__copy__

Return a copy of the object.

Attributes:

Name Type Description
unique_name str

Get the unique name of the object.

display_name str

Get a pretty display name.

name str

Get the name of the model.

Attributes

unique_name property writable

Get the unique name of the object.

display_name property writable

Get a pretty display name.

:return: The pretty display name.

name property writable

Get the name of the model.

Returns:

Type Description
str

The name of the model.

Functions

to_dict(skip=None)

Convert an EasyScience object into a full dictionary using SerializerBases generic convert_to_dict method.

:param skip: List of field names as strings to skip when forming the dictionary :return: 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.

:param obj_dict: dictionary containing the serialized contents (from SerializerDict) of an EasyScience object :return: Reformed EasyScience object

__dir__()

This creates auto-completion and helps out in iPython notebooks.

:return: list of function and parameter names for auto- completion

__copy__()

Return a copy of the object.

EasyDynamicsModelBase(*args, unit='meV', name='MyEasyDynamicsModel', display_name=None, unique_name=None, **kwargs)

Base class for all EasyDynamics models.

Parameters:

Name Type Description Default
*args object

Positional arguments to pass to the parent class.

()
unit str | sc.Unit

Unit of the model.

'meV'
name str

Name of the model.

'MyEasyDynamicsModel'
display_name str | None

Display name of the model. If None, the name will be used.

None
unique_name str | None

Unique name of the model. If None, a unique name will be generated.

None
**kwargs object

Additional keyword arguments to pass to the parent class.

{}

Raises:

Type Description
TypeError

If name is not a string.

Methods:

Name Description
to_dict

Convert an EasyScience object into a full dictionary using

from_dict

Re-create an EasyScience object with DescriptorNumber

__dir__

This creates auto-completion and helps out in iPython

__copy__

Return a copy of the object.

get_all_variables

Get all Descriptor and Parameter objects as a list.

get_all_parameters

Get all Parameter objects as a list.

get_fittable_parameters

Get all parameters which can be fitted as a list.

get_free_parameters

Get all parameters which are currently free to be fitted as a

get_fit_parameters

This is an alias for get_free_parameters.

Attributes:

Name Type Description
unique_name str

Get the unique name of the object.

display_name str

Get a pretty display name.

name str

Get the name of the model.

unit str | sc.Unit | None

Get the unit of the model.

Attributes

unique_name property writable

Get the unique name of the object.

display_name property writable

Get a pretty display name.

:return: The pretty display name.

name property writable

Get the name of the model.

Returns:

Type Description
str

The name of the model.

unit property writable

Get the unit of the model.

Returns:

Type Description
str | sc.Unit | None

The unit of the model.

Functions

to_dict(skip=None)

Convert an EasyScience object into a full dictionary using SerializerBases generic convert_to_dict method.

:param skip: List of field names as strings to skip when forming the dictionary :return: encoded object containing all information to reform an EasyScience object.

from_dict(obj_dict) classmethod

Re-create an EasyScience object with DescriptorNumber attributes from a full encoded dictionary.

:param obj_dict: dictionary containing the serialized contents (from SerializerDict) of an EasyScience object :return: Reformed EasyScience object

__dir__()

This creates auto-completion and helps out in iPython notebooks.

:return: list of function and parameter names for auto- completion

__copy__()

Return a copy of the object.

get_all_variables()

Get all Descriptor and Parameter objects as a list.

:return: List of Descriptor and Parameter objects.

get_all_parameters()

Get all Parameter objects as a list.

:return: List of Parameter objects.

get_fittable_parameters()

Get all parameters which can be fitted as a list.

:return: List of Parameter objects.

get_free_parameters()

Get all parameters which are currently free to be fitted as a list.

:return: List of Parameter objects.

get_fit_parameters()

This is an alias for get_free_parameters.

To be removed when fully moved to new base classes and minimizer can be changed.

Modules

easydynamics_base

Classes:

Name Description
EasyDynamicsBase

Base class for all EasyDynamics classes.

Classes

EasyDynamicsBase(*args, name='MyEasyDynamicsModel', display_name=None, unique_name=None, **kwargs)

Base class for all EasyDynamics classes.

Parameters:

Name Type Description Default
*args object

Positional arguments to pass to the parent class.

()
name str

Name of the model.

'MyEasyDynamicsModel'
display_name str | None

Display name of the model. If None, the name will be used.

None
unique_name str | None

Unique name of the model. If None, a unique name will be generated.

None
**kwargs object

Additional keyword arguments to pass to the parent class.

{}

Raises:

Type Description
TypeError

If name is not a string.

Methods:

Name Description
to_dict

Convert an EasyScience object into a full dictionary using

from_dict

Re-create an EasyScience object from a full encoded

__dir__

This creates auto-completion and helps out in iPython

__copy__

Return a copy of the object.

Attributes:

Name Type Description
unique_name str

Get the unique name of the object.

display_name str

Get a pretty display name.

name str

Get the name of the model.

Attributes
unique_name property writable

Get the unique name of the object.

display_name property writable

Get a pretty display name.

:return: The pretty display name.

name property writable

Get the name of the model.

Returns:

Type Description
str

The name of the model.

Functions
to_dict(skip=None)

Convert an EasyScience object into a full dictionary using SerializerBases generic convert_to_dict method.

:param skip: List of field names as strings to skip when forming the dictionary :return: 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.

:param obj_dict: dictionary containing the serialized contents (from SerializerDict) of an EasyScience object :return: Reformed EasyScience object

__dir__()

This creates auto-completion and helps out in iPython notebooks.

:return: list of function and parameter names for auto- completion

__copy__()

Return a copy of the object.

easydynamics_list

Classes:

Name Description
EasyDynamicsList

Base class for all EasyDynamics lists.

Classes

EasyDynamicsList(*args, protected_types=None, display_name=None, unique_name=None, **kwargs)

Base class for all EasyDynamics lists.

Parameters:

Name Type Description Default
*args ProtectedType_ | list[ProtectedType_]

Initial items to add to the list. Can be a single item or a list of items. Each item must be an instance of one of the protected types.

()
protected_types list[type[ProtectedType_]] | type[ProtectedType_] | None

Types that are allowed in the list. Can be a single EasyDynamicsBase or EasyDynamicsModelBase subclass or a list of them. If None, defaults to [EasyDynamicsBase].

None
display_name str | None

Display name of the list. If None, the name will be used.

None
unique_name str | None

Unique name of the list. If None, a unique name will be generated.

None
**kwargs object

Additional keyword arguments to pass to the EasyList constructor.

{}

Methods:

Name Description
insert

Insert an item into the list at a specific index.

append

Append an item to the end of the list.

pop

Remove and return an item at a specific index or name.

get_names

Get a list of the names of all items in the list.

get_duplicate_names

Get a list of duplicate names in the list.

__getitem__

Get an item by index, slice, or unique_name.

to_dict

Convert the EasyList to a dictionary for serialization.

from_dict

Re-create an EasyScience object from a full encoded

__dir__

This creates auto-completion and helps out in iPython

__copy__

Return a copy of the object.

__setitem__

Set an item at an index.

__delitem__

Delete an item by index, slice, or name.

__len__

Return the number of items in the collection.

sort

Sort the collection according to the given key function.

Attributes:

Name Type Description
unique_name str

Get the unique name of the object.

display_name str

Get a pretty display name.

Attributes
unique_name property writable

Get the unique name of the object.

display_name property writable

Get a pretty display name.

:return: The pretty display name.

Functions
insert(index, value)

Insert an item into the list at a specific index.

Parameters:

Name Type Description Default
index int

The index at which to insert the item.

required
value ProtectedType_

The item to insert. Must be an instance of one of the protected types.

required
append(value)

Append an item to the end of the list.

Parameters:

Name Type Description Default
value ProtectedType_

The item to append. Must be an instance of one of the protected types.

required
pop(index=-1)

Remove and return an item at a specific index or name.

Parameters:

Name Type Description Default
index int | str

The index or name at which to pop the item.

-1

Returns:

Type Description
ProtectedType_

The item that was popped.

Raises:

Type Description
TypeError

If index is not an int or str.

KeyError

If index is a str and no item with that name is found.

get_names()

Get a list of the names of all items in the list.

Returns:

Type Description
list[str]

A list of the names of all items in the list.

get_duplicate_names()

Get a list of duplicate names in the list.

Returns:

Type Description
list[str]

A list of duplicate names in the list.

__getitem__(idx)

Get an item by index, slice, or unique_name.

Parameters:

Name Type Description Default
idx int | slice | str
Index, slice, or name of the item to get.
required

Returns:

Type Description
ProtectedType_ | EasyDynamicsList[ProtectedType_]

The item at the specified index or name, or a new EasyDynamicsList if a slice is provided.

Raises:

Type Description
TypeError

If idx is not an int, slice, or str.

KeyError

If idx is a str and no item with that name is found.

AmbiguousNameError

If idx is a str and multiple items with that name are found.

to_dict()

Convert the EasyList to a dictionary for serialization.

:return: Dictionary representation of the EasyList

from_dict(obj_dict) classmethod

Re-create an EasyScience object from a full encoded dictionary.

:param obj_dict: dictionary containing the serialized contents (from SerializerDict) of an EasyScience object :return: Reformed EasyScience object

__dir__()

This creates auto-completion and helps out in iPython notebooks.

:return: list of function and parameter names for auto- completion

__copy__()

Return a copy of the object.

__setitem__(idx, value)
__setitem__(idx: int, value: ProtectedType_) -> None
__setitem__(
    idx: slice, value: Iterable[ProtectedType_]
) -> None

Set an item at an index.

:param idx: Index to set :param value: New value

__delitem__(idx)

Delete an item by index, slice, or name.

:param idx: Index, slice, or name of item to delete

__len__()

Return the number of items in the collection.

sort(key=None, reverse=False)

Sort the collection according to the given key function.

:param key: Mapping function to sort by :param reverse: Whether to reverse the sort

easydynamics_modelbase

Classes:

Name Description
EasyDynamicsModelBase

Base class for all EasyDynamics models.

Classes

EasyDynamicsModelBase(*args, unit='meV', name='MyEasyDynamicsModel', display_name=None, unique_name=None, **kwargs)

Base class for all EasyDynamics models.

Parameters:

Name Type Description Default
*args object

Positional arguments to pass to the parent class.

()
unit str | sc.Unit

Unit of the model.

'meV'
name str

Name of the model.

'MyEasyDynamicsModel'
display_name str | None

Display name of the model. If None, the name will be used.

None
unique_name str | None

Unique name of the model. If None, a unique name will be generated.

None
**kwargs object

Additional keyword arguments to pass to the parent class.

{}

Raises:

Type Description
TypeError

If name is not a string.

Methods:

Name Description
to_dict

Convert an EasyScience object into a full dictionary using

from_dict

Re-create an EasyScience object with DescriptorNumber

__dir__

This creates auto-completion and helps out in iPython

__copy__

Return a copy of the object.

get_all_variables

Get all Descriptor and Parameter objects as a list.

get_all_parameters

Get all Parameter objects as a list.

get_fittable_parameters

Get all parameters which can be fitted as a list.

get_free_parameters

Get all parameters which are currently free to be fitted as a

get_fit_parameters

This is an alias for get_free_parameters.

Attributes:

Name Type Description
unit str | sc.Unit | None

Get the unit of the model.

unique_name str

Get the unique name of the object.

display_name str

Get a pretty display name.

name str

Get the name of the model.

Attributes
unit property writable

Get the unit of the model.

Returns:

Type Description
str | sc.Unit | None

The unit of the model.

unique_name property writable

Get the unique name of the object.

display_name property writable

Get a pretty display name.

:return: The pretty display name.

name property writable

Get the name of the model.

Returns:

Type Description
str

The name of the model.

Functions
to_dict(skip=None)

Convert an EasyScience object into a full dictionary using SerializerBases generic convert_to_dict method.

:param skip: List of field names as strings to skip when forming the dictionary :return: encoded object containing all information to reform an EasyScience object.

from_dict(obj_dict) classmethod

Re-create an EasyScience object with DescriptorNumber attributes from a full encoded dictionary.

:param obj_dict: dictionary containing the serialized contents (from SerializerDict) of an EasyScience object :return: Reformed EasyScience object

__dir__()

This creates auto-completion and helps out in iPython notebooks.

:return: list of function and parameter names for auto- completion

__copy__()

Return a copy of the object.

get_all_variables()

Get all Descriptor and Parameter objects as a list.

:return: List of Descriptor and Parameter objects.

get_all_parameters()

Get all Parameter objects as a list.

:return: List of Parameter objects.

get_fittable_parameters()

Get all parameters which can be fitted as a list.

:return: List of Parameter objects.

get_free_parameters()

Get all parameters which are currently free to be fitted as a list.

:return: List of Parameter objects.

get_fit_parameters()

This is an alias for get_free_parameters.

To be removed when fully moved to new base classes and minimizer can be changed.

name_mixin

Classes:

Name Description
NameMixin

Mixin class to add name functionality to EasyDynamics classes.

Classes

NameMixin(*args, name='MyEasyDynamicsModel', **kwargs)

Mixin class to add name functionality to EasyDynamics classes.

Parameters:

Name Type Description Default
*args object

Positional arguments to pass to the parent class.

()
name str

Name of the model.

'MyEasyDynamicsModel'
**kwargs object

Keyword arguments to pass to the parent class.

{}

Raises:

Type Description
TypeError

If name is not a string.

Attributes:

Name Type Description
name str

Get the name of the model.

Attributes
name property writable

Get the name of the model.

Returns:

Type Description
str

The name of the model.

Functions