cli - Command line interface¶
Run the bumps program with the command line interface. |
|
Replace symbols in |
|
Point the matplotlib config dir to %LOCALAPPDATA%{appdatadir}mplconfig. |
|
Setup matplotlib to use a particular backend. |
|
Load a model file. |
|
Show the problem plots and parameters. |
|
Reload individual parameter values from a saved .par file. |
|
Save the fit data, including parameter values, uncertainties and plots. |
|
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.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.install_plugin(p)[source]¶
Replace symbols in
bumps.plugin
with application specific methods.
- bumps.cli.load_best(problem, path)[source]¶
Reload individual parameter values from a saved .par file.
If the label does not exist in the file, use the value from the model as the default value. Ignore labels that do not exist in the model. In that way we can load parameters from an old fit with minimal fuss, even as we add, delete and move parameters in the model. If any parameters are missing, set problem.undefined to the a boolean index of the undefined parameters.
There is an interaction with –init=eps and the par file. If any parameters are missing from the par file they will be randomized across the entire parameter range using the equivalent of –init=lhs. That means you can drop a # at the beginning of the line in the .par file and that parameter will be shuffled on restart, with the remaining parameters starting near the initial value.
- 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.main()[source]¶
Run the bumps program with the command line interface.
Input parameters are taken from sys.argv.
- 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.options.BumpsOpts
object representing the command line parameters.