cli - Command line interface

main Run the bumps program with the command line interface.
install_plugin Replace symbols in bumps.plugin with application specific methods.
set_mplconfig Point the matplotlib config dir to %LOCALAPPDATA%{appdatadir}mplconfig.
config_matplotlib Setup matplotlib to use a particular backend.
load_model Load a model file.
preview Show the problem plots and parameters.
load_best Load parameter values from a file.
save_best Save the fit data, including parameter values, uncertainties and plots.
resynth Generate maximum likelihood fits to resynthesized data sets.

Bumps command line interface.

The functions in this module are used by the bumps command to implement the command line interface. Bumps plugin models can use them to create stand alone applications with a similar interface. For example, the Refl1D application uses the following:

from . import fitplugin
import bumps.cli
bumps.cli.set_mplconfig(appdatadir='Refl1D')
bumps.cli.install_plugin(fitplugin)
bumps.cli.main()

After completing a set of fits on related systems, a post-analysis script can use load_model() to load the problem definition and load_best() to load the best value found in the fit. This can be used for example in experiment design, where you look at the expected parameter uncertainty when fitting simulated data from a range of experimental systems.

bumps.cli.main()[source]

Run the bumps program with the command line interface.

Input parameters are taken from sys.argv.

bumps.cli.install_plugin(p)[source]

Replace symbols in bumps.plugin with application specific methods.

bumps.cli.set_mplconfig(appdatadir)[source]

Point the matplotlib config dir to %LOCALAPPDATA%{appdatadir}mplconfig.

bumps.cli.config_matplotlib(backend=None)[source]

Setup matplotlib to use a particular backend.

The backend should be ‘WXAgg’ for interactive use, or ‘Agg’ for batch. This distinction allows us to run in environments such as cluster computers which do not have wx installed on the compute nodes.

This function must be called before any imports to pylab. To allow this, modules should not import pylab at the module level, but instead import it for each function/method that uses it. Exceptions can be made for modules which are completely dedicated to plotting, but these modules should never be imported at the module level.

bumps.cli.load_model(path, model_options=None)[source]

Load a model file.

path contains the path to the model file.

model_options are any additional arguments to the model. The sys.argv variable will be set such that sys.argv[1:] == model_options.

bumps.cli.preview(problem, view=None)[source]

Show the problem plots and parameters.

bumps.cli.load_best(problem, path)[source]

Load parameter values from a file.

bumps.cli.save_best(fitdriver, problem, best, view=None)[source]

Save the fit data, including parameter values, uncertainties and plots.

fitdriver is the fitter that was used to drive the fit.

problem is a FitProblem instance.

best is the parameter set to save.

bumps.cli.resynth(fitdriver, problem, mapper, opts)[source]

Generate maximum likelihood fits to resynthesized data sets.

fitdriver is a bumps.fitters.FitDriver object with a fitter already chosen.

problem is a bumps.fitproblem.FitProblem() object. It should be initialized with optimal values for the parameters.

mapper is one of the available bumps.mapper classes.

opts is a bumps.cli.BumpsOpts object representing the command line parameters.