Cli

Handle interaction with the doce module using the command line interface.

doce.cli.main(experiment=None, func=None, display_func=None)[source]

This method shall be called from the main script of the experiment to control the experiment using the command line.

This method provides a front-end for running a doce experiment. It should be called from the main script of the experiment. The main script must define the experiment object that will be called before processing and a func function that will be run for each setting.

Examples

Assuming that the file experiment_run.py contains:

>>> import doce
>>> if __name__ == "__main__":
...   doce.experiment.run() 
>>> def set(experiment, args=None):
...   experiment._plan.factor1=[1, 3]
...   experiment._plan.factor2=[2, 4]
...   return experiment
>>> def step(setting, experiment):
...   print(setting.identifier())

Executing this file with the –run option gives:

$ python experiment_run.py -r

factor1_1_factor2_2 factor1_1_factor2_4 factor1_3_factor2_2 factor1_3_factor2_4

Executing this file with the –help option gives:

$ python experiment_run.py -h