def init(self, projectname=None, description=None, **kwargs):
        """
        Initialize a new experiment

        Parameters
        ----------
        projectname: str
            The name of the project that shall be used. If None, the last one
            created will be used
        description: str
            A short summary of the experiment
        ``**kwargs``
            Keyword arguments passed to the :meth:`app_main` method

        Notes
        -----
        If the experiment is None, a new experiment will be created
        """
        self.app_main(**kwargs)
        experiments = self.config.experiments
        experiment = self._experiment
        if experiment is None and not experiments:
            experiment = self.name + '_exp0'
        elif experiment is None:
            try:
                experiment = utils.get_next_name(self.experiment)
            except ValueError:
                raise ValueError(
                    "Could not estimate an experiment id! Please use the "
                    "experiment argument to provide an id.")
        self.experiment = experiment
        if self.is_archived(experiment):
            raise ValueError(
                "The specified experiment has already been archived! Run "
                "``%s -id %s unarchive`` first" % (self.name, experiment))
        if projectname is None:
            projectname = self.projectname
        else:
            self.projectname = projectname
        self.logger.info("Initializing experiment %s of project %s",
                         experiment, projectname)
        exp_dict = experiments.setdefault(experiment, OrderedDict())
        if description is not None:
            exp_dict['description'] = description
        exp_dict['project'] = projectname
        exp_dict['expdir'] = exp_dir = osp.join('experiments', experiment)
        exp_dir = osp.join(self.config.projects[projectname]['root'], exp_dir)
        exp_dict['timestamps'] = OrderedDict()

        if not os.path.exists(exp_dir):
            self.logger.debug("    Creating experiment directory %s", exp_dir)
            os.makedirs(exp_dir)
        self.fix_paths(exp_dict)
        return exp_dict
def init ( self , projectname = None , description = None , ** kwargs ) : self . app_main ( ** kwargs ) experiments = self . config . experiments experiment = self . _experiment if experiment is None and not experiments : experiment = self . name + '_exp0' elif experiment is None : try : experiment = utils . get_next_name ( self . experiment ) except ValueError : raise ValueError ( "Could not estimate an experiment id! Please use the " "experiment argument to provide an id." ) self . experiment = experiment if self . is_archived ( experiment ) : raise ValueError ( "The specified experiment has already been archived! Run " "``%s -id %s unarchive`` first" % ( self . name , experiment ) ) if projectname is None : projectname = self . projectname else : self . projectname = projectname self . logger . info ( "Initializing experiment %s of project %s" , experiment , projectname ) exp_dict = experiments . setdefault ( experiment , OrderedDict ( ) ) if description is not None : exp_dict [ 'description' ] = description exp_dict [ 'project' ] = projectname exp_dict [ 'expdir' ] = exp_dir = osp . join ( 'experiments' , experiment ) exp_dir = osp . join ( self . config . projects [ projectname ] [ 'root' ] , exp_dir ) exp_dict [ 'timestamps' ] = OrderedDict ( ) if not os . path . exists ( exp_dir ) : self . logger . debug ( "    Creating experiment directory %s" , exp_dir ) os . makedirs ( exp_dir ) self . fix_paths ( exp_dict ) return exp_dict
Initialize a new experiment

        Parameters
        ----------
        projectname: str
            The name of the project that shall be used. If None, the last one
            created will be used
        description: str
            A short summary of the experiment
        ``**kwargs``
            Keyword arguments passed to the :meth:`app_main` method

        Notes
        -----
        If the experiment is None, a new experiment will be created