class easyreflectometry.experiment.model.Model[source]#

Bases: BaseObj

Model is the class that represents the experiment. It is used to store the information about the experiment and to perform the calculations.

sample: Sample#
scale: Parameter#
background: Parameter#
__init__(sample=None, scale=None, background=None, resolution_function=None, name='EasyModel', interface=None)[source]#

Constructor.

Parameters:
  • sample (Optional[Sample]) – The sample being modelled.

  • scale (Union[Parameter, Number, None]) – Scaling factor of profile.

  • background (Union[Parameter, Number, None]) – Linear background magnitude.

  • name (str) – Name of the model, defaults to ‘EasyModel’.

  • resolution_function (Optional[Callable[[array], float]]) – Resolution function, defaults to percentage_fhwm_resolution_function.

  • interface – Calculator interface, defaults to None.

add_item(*assemblies)[source]#

Add a layer or item to the model sample.

Parameters:

assemblies (list[BaseAssembly]) – Assemblies to add to model sample.

Return type:

None

duplicate_item(idx)[source]#

Duplicate a given item or layer in a sample.

Parameters:

idx (int) – Index of the item or layer to duplicate

Return type:

None

remove_item(idx)[source]#

Remove an item from the model.

Parameters:

idx (int) – Index of the item to remove.

Return type:

None

property resolution_function: Callable[[array], array]#

Return the resolution function.

property interface#

Get the current interface of the object

property uid: int#

Return a UID from the borg map.

user_data: dict#
as_dict(skip=None)[source]#

Produces a cleaned dict using a custom as_dict method to skip necessary things. The resulting dict matches the parameters in __init__

Parameters:

skip (Optional[list]) – List of keys to skip, defaults to None.

Return type:

dict

classmethod from_dict(data)[source]#

Create a Model from a dictionary.

Parameters:

data (dict) – dictionary of the Model

Return type:

Model

Returns:

Model