diffpy.srfit.interface package

Usability interface for SrFit.

The classes and functions in this package are designed to unobtrusively mix with base SrFit objects and provide them with interface enhancements for scripting.

Submodules

diffpy.srfit.interface.interface module

Interface enhancements for Parameter-type classes.

Most interface additions can thought of by considering the classes in SrFit to be sets of parameters. += adds a new parameter, when that makes sense. |= is the ‘union’ of these sets, and in general is used to combine different objects. See individual interface classes for specifics.

class diffpy.srfit.interface.interface.FitRecipeInterface[source]

Bases: object

Mix-in class for enhancing the FitRecipe interface.

__iadd__(args)[source]

Add a variable with +=.

Think of + as addition of a variable. This accepts a single argument or an iterable of single arguments or argument tuples.

Parameters:

args – The arguments to pass to add_variable or create_new_variable.

Returns:

Return self after adding the variable.

Return type:

FitRecipeInterface

__ior__(args)[source]

Add a contribution with |=.

Think of | as the union of components. This accepts a single argument.

Parameters:

args (FitContribution) – The contribution to add.

Returns:

Return self after adding the contribution.

Return type:

FitRecipeInterface

class diffpy.srfit.interface.interface.ParameterInterface[source]

Bases: object

Mix-in class for enhancing the Parameter interface.

__lshift__(v)[source]

Set the value with <<.

Think of << as injecting a value.

Parameters:

v (float or ArgumentABC) – The value, or Argument derivative, to assign.

Returns:

Return self after the value has been set.

Return type:

ParameterInterface

class diffpy.srfit.interface.interface.RecipeOrganizerInterface[source]

Bases: object

Mix-in class for enhancing the RecipeOrganizer interface.

__iadd__(args)[source]

Add a parameter with +=.

Think of + as addition of a Parameter. This accepts arguments for a single call to _new_parameter or _add_parameter.

Parameters:

args (tuple) – The arguments to pass to _new_parameter or _add_parameter.

Returns:

Return self after adding the parameter.

Return type:

RecipeOrganizerInterface

__imod__(args)[source]

Restrain with %=.

Think of % as a loose rope. This accepts arguments for a single restraint.

Parameters:

args (tuple) – The arguments to pass to add_soft_bounds.

Returns:

Return self after applying the restraint.

Return type:

RecipeOrganizerInterface

__imul__(args)[source]

Constrain with *=.

Think of * as a push-pin. This accepts arguments for a single constraint.

Parameters:

args (tuple) – The arguments to pass to add_constraint.

Returns:

Return self after applying the constraint.

Return type:

RecipeOrganizerInterface