Parameter¶
-
class
qef.widgets.parameter.ParameterCallbacksMixin[source]¶ Bases:
objectImplement relationships between the different components of an ipywidget exposing all or some of the parameter attributes
The methods in this Mixin expects attribute
facade, a dictionary whose keys coincide with tuplewidget_namesand whose values are eitherNoneor references to ipywidgets. Attributefacadecan be created with functionadd_widget_facade().-
inf= inf¶ Representation of infinity value
-
max_value_change(change)[source]¶ Notify other widgets if
minchanges.- Reject change if
maxbecomes smaller thanmin - Uncheck
nomaxif new value is entered inmax
2. Update
value.valueif it becomes bigger thanmax.value- Reject change if
-
min_value_change(change)[source]¶ Notify other widgets if
minchanges.- Reject change if
minbecomes bigger thanmax - Uncheck
nominif new value is entered inmin - Update
value.valueif it becomes smaller thanmin.value
- Reject change if
-
validate_facade()[source]¶ Ascertain that keys of
facadeattribute are contained inwidget_names
-
value_value_change(change)[source]¶ Validate
valueis within bounds. Otherwise setvalueas the closest bound value
-
widget_names= ('nomin', 'min', 'value', 'nomax', 'max', 'vary', 'expr')¶
-
-
class
qef.widgets.parameter.ParameterWidget(show_header=True)[source]¶ Bases:
ipywidgets.widgets.widget_box.BoxOne possible representation of a fitting parameter. Inherits from ipywidgets.widgets.widget_box.Box
Parameters: show_header (Bool) – Hide or show names of the widget components min, value,…
-
class
qef.widgets.parameter.ParameterWithTraits(name=None, value=None, vary=True, min=-inf, max=inf, expr=None, brute_step=None, user_data=None)[source]¶ Bases:
lmfit.parameter.Parameter,traitlets.traitlets.HasTraitsWrapper of
ParameterwithTraitTypeallows synchronization with ipywidgetsSame signature for initialization as that of
Parameter.Parameters: - name (str, optional) – Name of the Parameter.
- value (float, optional) – Numerical Parameter value.
- vary (bool, optional) – Whether the Parameter is varied during a fit (default is True).
- min (float, optional) – Lower bound for value (default is -numpy.inf, no lower bound).
- max (float, optional) – Upper bound for value (default is numpy.inf, no upper bound).
- expr (str, optional) – Mathematical expression used to constrain the value during the fit.
- brute_step (float, optional) – Step size for grid points in the brute method.
- user_data (optional) – User-definable extra attribute used for a Parameter.
-
link_widget(widget, mapping=None)[source]¶ Link the value of a single ipywidget to one trait, or the values of the element widgets of a composite ipywidget to different traits. The specific traits can be specified with the
mappingargument.Parameters: - widget (ipywidgets.widgets.widget.Widget)
- mapping (str, dict, or None) – if str,
mappingdenotes the widget name to be associated with the widget. If dict, thenmappingvalues are attribute names of widget, referencing the simple ipywidgets to be associated to standardwidget_names. The widget names are the keys ofmapping. IfNone, an inspection of widget attributes will be performed, looking for names that coincide with standardwidget_names. If the inspection is unsuccessful, the widget will be associated with the standard widget name ‘value’ to represent the values taken by the fitting parameter.
-
trait_names= ('tvalue', 'tmin', 'tmax', 'tvary', 'texpr')¶
-
qef.widgets.parameter.add_widget_callbacks(widget, mapping=None)[source]¶ Extend the widget’s type with
ParameterCallbacksMixinParameters: - widget (ipywidgets.widgets.widget.Widget)
- mapping (str, dict, or None) – if str,
mappingdenotes the widget name to be associated with the widget. If dict, thenmappingvalues are attribute names of widget, referencing the simple ipywidgets to be associated to standardwidget_names. The widget names are the keys ofmapping. IfNone, an inspection of widget attributes will be performed, looking for names that coincide with standardwidget_names. If the inspection is unsuccessful, the widget will be associated with the standard widget name ‘value’ to represent the values taken by the fitting parameter.
-
qef.widgets.parameter.add_widget_facade(widget, mapping=None)[source]¶ Create
facadedictionary where keys are standardwidget_namesand whose values are simple ipywidgets that control the fitting parameter attributes denoted by the standardwidget_names. This dictionary is added to the input widget as an attribute.Parameters: - widget (ipywidgets.widgets.widget.Widget)
- mapping (str, dict, or None) – if str, mapping denotes the widget name to be associated with
the widget. If dict, then mapping values are attribute names
of widget, referencing the simple ipywidgets to be associated
to standard widget names. The widget names are the keys of mapping.
If
None, an inspection of widget attributes will be performed, looking for names that coincide with standard widget names. If the inspection is unsuccessful, the widget will be associated with the standard widget name ‘value’ to represent the values taken by the fitting parameter.
Returns: widget – Reference to input widget
Return type: Widget
-
qef.widgets.parameter.create_facade(widget, mapping=None)[source]¶ Create
facadedictionary where keys are standardwidget_namesand whose values are simple ipywidgets that control the fitting parameter attributes denoted by the standardwidget_names.Parameters: - widget (ipywidgets.widgets.widget.Widget)
- mapping (str, dict, or None) – if str, mapping denotes the widget name to be associated with
the widget. If dict, then mapping values are attribute names
of widget, referencing the simple ipywidgets to be associated
to standard widget names. The widget names are the keys of mapping.
If
None, an inspection of widget attributes will be performed, looking for names that coincide with standard widget names. If the inspection is unsuccessful, the widget will be associated with the standard widget name ‘value’ to represent the values taken by the fitting parameter.
Returns: facade
Return type: