options - Command line options processor

check_options

Checks if the set of options is consistent for the fitter.

get_fitter_defaults

Determines the default values for each setting of each fitter.

get_fit_fields

Returns a dictionary of fit fields.

lookup_fitter

Looks up a fitter by its ID.

Setting

Represents a setting for a fitter.

FIT_CONFIG

* DEPRECATED *

FIT_FIELDS

* DEPRECATED *

ChoiceList

* 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:

class bumps.options.ChoiceList(*choices)[source]

Bases: object

* DEPRECATED *

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: object

Represents 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.

description: str
classmethod get(name)[source]

Retrieve the setting for name.

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.

help(active_only=True) str[source]

Help string for the –settings option in the argument parser, or SUPPRESS if the setting is only available for experimental or deprecated optimizers.

classmethod items()[source]

Iterate over the registered (name, Setting) pairs.

label: str
name: str
stype: Callable
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, …}, …}

bumps.options.lookup_fitter(fitter_id: str) FitBase[source]

Looks up a fitter by its ID.

Args:

fitter_id (str): ID of the fitter to look up.

Returns:

Fitter: The fitter instance corresponding to the given ID.

Raises:

ValueError: If the fitter ID is unknown.