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[ResolutionFunction]) – Resolution function, defaults to PercentageFhwm.

  • 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: ResolutionFunction#

Return the resolution function.

property interface#

Get the current interface of the object

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[str]]) – List of keys to skip, defaults to None.

Return type:

dict

classmethod from_dict(passed_dict)[source]#

Create a Model from a dictionary.

Parameters:

this_dict – dictionary of the Model

Return type:

Model

Returns:

Model