options - Command line options processor¶
Checks if the set of options is consistent for the fitter. |
|
Determines the default values for each setting of each fitter. |
|
Returns a dictionary of fit fields. |
|
Looks up a fitter by its ID. |
|
Represents a setting for a fitter. |
|
* DEPRECATED * |
|
* DEPRECATED * |
|
* DEPRECATED * |
Manage optimizer settings.
Each optimizer in bumps.fitters has its own settings attribute, giving the list of
settings available to the optimizer and the default value if the setting was not provided.
Settings for the same type of control should have the same value type and name, though the defaults can differ between the optimizers. This module defines the metadata for the various settings, each one having a setting name, a display label, an input type, and a long description. These are used to construct the command line help and UI interaction. If a fitter needs a completely new setting type it will have to be added here.
Each setting used by at least one active fitter adds a –name entry to the command line parser, with a list of fitters and default setting values for that fitter.
Various setting types are available:
float, int and str are simple types with no restrictions.
- bool defines a boolean setting, with an additional –no-name entry on the command line
to indicate false values. Boolean settings can default to True or False.
- The Range type restricts the setting to a valid setting range, with values clipped
to the range during
check_options()processing.
list settings define an enumerated set of available string values.
- bumps.options.FIT_CONFIG = <bumps.gui.old_options.FitConfig object>¶
* DEPRECATED *
- bumps.options.FIT_FIELDS = {'CR': ('Crossover ratio', <class 'float'>), 'F': ('Scale', <class 'float'>), 'Tmax': ('Max temperature', <class 'float'>), 'Tmin': ('Min temperature', <class 'float'>), 'alpha': ('Convergence', <class 'float'>), 'burn': ('Burn-in steps', <function parse_int>), 'ftol': ('f(x) tolerance', <class 'float'>), 'init': ('Initializer', <bumps.gui.old_options.ChoiceList object>), 'jump': ('Jump radius', <class 'float'>), 'nT': ('# Temperatures', <function parse_int>), 'outliers': ('Outliers', <bumps.gui.old_options.ChoiceList object>), 'pop': ('Population', <class 'float'>), 'radius': ('Simplex radius', <class 'float'>), 'samples': ('Samples', <function parse_int>), 'starts': ('Starts', <function parse_int>), 'steps': ('Steps', <function parse_int>), 'stop': ('Stopping criteria', <class 'str'>), 'thin': ('Thinning', <function parse_int>), 'trim': ('Burn-in trim', <function yesno>), 'xtol': ('x tolerance', <class 'float'>)}¶
* DEPRECATED *
- class bumps.options.Setting(name: str, label: str, stype: type, description: str)[source]¶
Bases:
objectRepresents a setting for a fitter.
- Attributes:
name (str): Name of the setting.
label (str): Label for the setting.
description (str): Description of the setting.
stype (Callable): Type of the setting.
- get_defaults(active_only=True)[source]¶
Retrieve the defaults for setting name for all fitters that use it.
If active_only, only include the active fitters, not anything experimental or deprecated.
- bumps.options.check_options(options: Dict[str, Any], fitter_id: str | None = None) Tuple[Dict[str, Any], List[str]][source]¶
Checks if the set of options is consistent for the fitter.
- Args:
options (Dict[str, Any]): Options to be checked.
fitter_id (Optional[str]): ID of the fitter (default=None).
- Returns:
Tuple[Dict[str, Any], List[str]]: A tuple containing the updated options dictionary and a list of warnings.
- bumps.options.get_fit_fields()[source]¶
Returns a dictionary of fit fields.
- Returns:
dict: Dictionary of fit fields where each key is a setting name and each value is a JSON-compatible Setting representation.
- bumps.options.get_fitter_defaults(active_only=True) dict[str, dict[str, Any]][source]¶
Determines the default values for each setting of each fitter.
This comes from the Fitter.settings attribute in the fitters defined by bumps.fitter, with an additional (“time”, 0.0) setting implicit to all fitters.
Returns {fitter_id: {setting: value, …}, …}