if self.report_progress:<EOL><INDENT>if self.report_progress is True:<EOL><INDENT>self.report_progress = (<NUM_LIT:5>, '<STR_LIT>', logging.INFO)<EOL><DEDENT>elif isinstance(self.report_progress, (int, float)):<EOL><INDENT>self.report_progress = (self.report_progress, '<STR_LIT>', logging.INFO)<EOL><DEDENT>elif isinstance(self.report_progress, str):<EOL><INDENT>self.report_progress = (<NUM_LIT:5>, self.report_progress, logging.INFO)<EOL><DEDENT>elif len(self.report_progress) == <NUM_LIT:2>:<EOL><INDENT>self.report_progress = (self.report_progress[<NUM_LIT:0>], self.report_progress[<NUM_LIT:1>],<EOL>logging.INFO)<EOL><DEDENT><DEDENT>if self.log_config:<EOL><INDENT>if self.log_config == pypetconstants.DEFAULT_LOGGING:<EOL><INDENT>pypet_path = os.path.abspath(os.path.dirname(__file__))<EOL>init_path = os.path.join(pypet_path, '<STR_LIT>')<EOL>self.log_config = os.path.join(init_path, '<STR_LIT>')<EOL><DEDENT>if isinstance(self.log_config, str):<EOL><INDENT>if not os.path.isfile(self.log_config):<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>'<STR_LIT>' % self.log_config)<EOL><DEDENT>parser = NoInterpolationParser()<EOL>parser.read(self.log_config)<EOL><DEDENT>elif isinstance(self.log_config, cp.RawConfigParser):<EOL><INDENT>parser = self.log_config<EOL><DEDENT>else:<EOL><INDENT>parser = None<EOL><DEDENT>if parser is not None:<EOL><INDENT>self._sp_config = self._parser_to_string_io(parser)<EOL>self._mp_config = self._find_multiproc_options(parser)<EOL>if self._mp_config is not None:<EOL><INDENT>self._mp_config = self._parser_to_string_io(self._mp_config)<EOL><DEDENT><DEDENT>elif isinstance(self.log_config, dict):<EOL><INDENT>self._sp_config = self.log_config<EOL>self._mp_config = self._find_multiproc_dict(self._sp_config)<EOL><DEDENT><DEDENT>if self.log_stdout:<EOL><INDENT>if self.log_stdout is True:<EOL><INDENT>self.log_stdout = ('<STR_LIT>', logging.INFO)<EOL><DEDENT>if isinstance(self.log_stdout, str):<EOL><INDENT>self.log_stdout = (self.log_stdout, logging.INFO)<EOL><DEDENT>if isinstance(self.log_stdout, int):<EOL><INDENT>self.log_stdout = ('<STR_LIT>', self.log_stdout)<EOL><DEDENT><DEDENT>

Checks and converts all settings if necessary passed to the Manager.

        Searches for multiprocessing options as well.


parser = NoInterpolationParser()<EOL>parser.readfp(log_config)<EOL>rename_func = lambda string: rename_log_file(string,<EOL>env_name=self.env_name,<EOL>traj_name=self.traj_name,<EOL>set_name=self.set_name,<EOL>run_name=self.run_name)<EOL>sections = parser.sections()<EOL>for section in sections:<EOL><INDENT>options = parser.options(section)<EOL>for option in options:<EOL><INDENT>if option == '<STR_LIT:args>':<EOL><INDENT>self._check_and_replace_parser_args(parser, section, option,<EOL>rename_func=rename_func)<EOL><DEDENT><DEDENT><DEDENT>return parser<EOL>

Checks for filenames within a config file and translates them.

        Moreover, directories for the files are created as well.

        :param log_config: Config file as a stream (like StringIO)


new_dict = dict()<EOL>for key in log_config.keys():<EOL><INDENT>if key == '<STR_LIT:filename>':<EOL><INDENT>filename = log_config[key]<EOL>filename = rename_log_file(filename,<EOL>env_name=self.env_name,<EOL>traj_name=self.traj_name,<EOL>set_name=self.set_name,<EOL>run_name=self.run_name)<EOL>new_dict[key] = filename<EOL>try_make_dirs(filename)<EOL><DEDENT>elif isinstance(log_config[key], dict):<EOL><INDENT>inner_dict = self._handle_dict_config(log_config[key])<EOL>new_dict[key] = inner_dict<EOL><DEDENT>else:<EOL><INDENT>new_dict[key] = log_config[key]<EOL><DEDENT><DEDENT>return new_dict<EOL>

Recursively walks and copies the `log_config` dict and searches for filenames.

        Translates filenames and creates directories if necessary.


log_stdout = self.log_stdout<EOL>if sys.stdout is self._stdout_to_logger:<EOL><INDENT>log_stdout = False<EOL><DEDENT>if self.log_config:<EOL><INDENT>if multiproc:<EOL><INDENT>proc_log_config = self._mp_config<EOL><DEDENT>else:<EOL><INDENT>proc_log_config = self._sp_config<EOL><DEDENT>if proc_log_config:<EOL><INDENT>if isinstance(proc_log_config, dict):<EOL><INDENT>new_dict = self._handle_dict_config(proc_log_config)<EOL>dictConfig(new_dict)<EOL><DEDENT>else:<EOL><INDENT>parser = self._handle_config_parsing(proc_log_config)<EOL>memory_file = self._parser_to_string_io(parser)<EOL>fileConfig(memory_file, disable_existing_loggers=False)<EOL><DEDENT><DEDENT><DEDENT>if log_stdout:<EOL><INDENT>std_name, std_level = self.log_stdout<EOL>stdout = StdoutToLogger(std_name, log_level=std_level)<EOL>stdout.start()<EOL>self._tools.append(stdout)<EOL><DEDENT>

Creates logging handlers and redirects stdout.


for tool in self._tools:<EOL><INDENT>tool.finalize()<EOL><DEDENT>self._tools = []<EOL>self._stdout_to_logger = None<EOL>for config in (self._sp_config, self._mp_config):<EOL><INDENT>if hasattr(config, '<STR_LIT>'):<EOL><INDENT>config.close()<EOL><DEDENT><DEDENT>self._sp_config = None<EOL>self._mp_config = None<EOL>if remove_all_handlers:<EOL><INDENT>self.tabula_rasa()<EOL><DEDENT>

Finalizes the manager, closes and removes all handlers if desired.


if sys.stdout is not self:<EOL><INDENT>self._original_steam = sys.stdout<EOL>sys.stdout = self<EOL>self._redirection = True<EOL><DEDENT>if self._redirection:<EOL><INDENT>print('<STR_LIT>')<EOL><DEDENT>


if not self._recursion:<EOL><INDENT>self._recursion = True<EOL>try:<EOL><INDENT>for line in buf.rstrip().splitlines():<EOL><INDENT>self._logger.log(self._log_level, line.rstrip())<EOL><DEDENT><DEDENT>finally:<EOL><INDENT>self._recursion = False<EOL><DEDENT><DEDENT>else:<EOL><INDENT>sys.__stderr__.write('<STR_LIT>')<EOL><DEDENT>


pass<EOL>


if self._original_steam is not None and self._redirection:<EOL><INDENT>sys.stdout = self._original_steam<EOL>print('<STR_LIT>')<EOL>self._redirection = False<EOL>self._original_steam = None<EOL><DEDENT>


if name is None and index is None:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>elif name is not None and index is not None:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>traj = Trajectory(name=new_name, add_time=add_time, dynamic_imports=dynamic_imports,<EOL>wildcard_functions=wildcard_functions)<EOL>traj.f_load(name=name, index=index, as_new=as_new, load_parameters=load_parameters,<EOL>load_derived_parameters=load_derived_parameters, load_results=load_results,<EOL>load_other_data=load_other_data, recursive=recursive, load_data=load_data,<EOL>max_depth=max_depth, force=force, with_run_information=with_run_information,<EOL>storage_service=storage_service, **kwargs)<EOL>return traj<EOL>

Helper function that creates a novel trajectory and loads it from disk.

    For the parameters see :func:`~pypet.trajectory.Trajectory.f_load`.

    ``new_name`` and ``add_time`` are only used in case ``as_new`` is ``True``.
    Accordingly, they determine the new name of trajectory.


if idx >= <NUM_LIT:0>:<EOL><INDENT>return pypetconstants.FORMATTED_RUN_NAME % idx<EOL><DEDENT>else:<EOL><INDENT>return pypetconstants.RUN_NAME_DUMMY<EOL><DEDENT>


GROUPSIZE = <NUM_LIT:1000><EOL>set_idx = idx // GROUPSIZE<EOL>if set_idx >= <NUM_LIT:0>:<EOL><INDENT>return pypetconstants.FORMATTED_SET_NAME % set_idx<EOL><DEDENT>else:<EOL><INDENT>return pypetconstants.SET_NAME_DUMMY<EOL><DEDENT>


return list(self._wildcard_keys.keys())<EOL>


return wildcard in self._wildcard_keys<EOL>

Checks if a given `wildcard` is really a wildcard.


for wildcards, function in func_dict.items():<EOL><INDENT>if not isinstance(wildcards, tuple):<EOL><INDENT>wildcards = (wildcards,)<EOL><DEDENT>for wildcard in wildcards:<EOL><INDENT>if wildcard in self._wildcard_keys:<EOL><INDENT>raise ValueError('<STR_LIT>' % wildcard)<EOL><DEDENT>self._wildcard_keys[wildcard] = wildcards<EOL><DEDENT>self._wildcard_functions[wildcards] = function<EOL>self._logger.debug('<STR_LIT>' % str(wildcards))<EOL><DEDENT>


def f_wildcard(self, wildcard='<STR_LIT:$>', run_idx=None):

if run_idx is None:<EOL><INDENT>run_idx = self.v_idx<EOL><DEDENT>wildcards = self._wildcard_keys[wildcard]<EOL>try:<EOL><INDENT>return self._wildcard_cache[(wildcards, run_idx)]<EOL><DEDENT>except KeyError:<EOL><INDENT>translation = self._wildcard_functions[wildcards](run_idx)<EOL>self._wildcard_cache[(wildcards, run_idx)] = translation<EOL>return translation<EOL><DEDENT>


return self._version<EOL>

The version of *pypet* that was used to create the trajectory


return self._python<EOL>

The version of python as a string that was used to create the trajectory


return self._comment<EOL>


comment = str(comment)<EOL>self._comment = comment<EOL>


return self._storage_service<EOL>

The service that can store the trajectory to disk or wherever.

        Default is None or if a filename was provided on construction
        the :class:`~pypet.storageservice.HDF5StorageService`.


self._storage_service = service<EOL>


return self._is_run<EOL>

``True`` mak if trajectory is used during a single run initiated by an environment.

        Accordingly, the functionality of the trajectory is reduced.


return self._idx<EOL>

Index if you want to access the trajectory as during a single run.

        You can turn the trajectory to behave as if during the execution of your runs if you set
        `v_idx` to a particular index. Note that only integer values are appropriate here,
        not names of runs.

        Alternatively instead of directly setting `v_idx` you can call
        :func:`~pypet.trajectory.Trajectory.f_set_crun:`.

        Set to `-1` to make the trajectory turn everything back to default.


Changes the index to make the trajectory behave as a single run


return self.v_crun if self.v_crun is not None else self.f_wildcard('<STR_LIT:$>', -<NUM_LIT:1>)<EOL>

Similar to ``v_crun`` but returns ``'run_ALL'`` if ``v_crun`` is ``None``.


return self._crun<EOL>

Run name if you want to access the trajectory as a single run.

        You can turn the trajectory to behave as during a single run if you set
        `v_crun` to a particular run name. Note that only string values are appropriate here,
        not indices. Check the `v_idx` property if you want to provide an index.

        Alternatively instead of directly setting `v_crun` you can call
        :func:`~pypet.trajectory.Trajectory.f_set_crun:`.

        Set to `None` to make the trajectory to turn everything back to default.


Changes the run name to make the trajectory behave as during a single run


return self._full_copy<EOL>

Whether trajectory is copied fully during pickling or only the current
        parameter space point.

        Note if the trajectory is copied as a whole, also during a single run
        you can access the full parameter space.

        Changing `v_full_copy` will also change `v_full_copy` of all explored parameters!


self._full_copy = bool(val)<EOL>for param in self._explored_parameters.values():<EOL><INDENT>if param is not None:<EOL><INDENT>param.v_full_copy = bool(val)<EOL><DEDENT><DEDENT>

Sets full copy mode of trajectory and (!) ALL explored parameters!


return self._with_links<EOL>

Whether links should be considered in case using natural naming
        or squared bracket indexing


self._with_links = bool(val)<EOL>


for name in kwargs:<EOL><INDENT>val = kwargs[name]<EOL>if not name.startswith('<STR_LIT>'):<EOL><INDENT>name = '<STR_LIT>' + name<EOL><DEDENT>if not name in self._nn_interface._not_admissible_names:<EOL><INDENT>raise AttributeError('<STR_LIT>' % name)<EOL><DEDENT>else:<EOL><INDENT>setattr(self, name, val)<EOL><DEDENT><DEDENT>

Sets properties like ``v_fast_access``.

        For example: ``traj.f_set_properties(v_fast_access=True, v_auto_load=False)``


if not isinstance(dynamic_imports, (list, tuple)):<EOL><INDENT>dynamic_imports = [dynamic_imports]<EOL><DEDENT>for item in dynamic_imports:<EOL><INDENT>if not (isinstance(item, str) or inspect.isclass(item)):<EOL><INDENT>raise TypeError('<STR_LIT>' %<EOL>str(item))<EOL><DEDENT><DEDENT>self._dynamic_imports.extend(dynamic_imports)<EOL>

Adds classes or paths to classes to the trajectory to create custom parameters.

        :param dynamic_imports:

            If you've written custom parameter that needs to be loaded dynamically during runtime,
            this needs to be specified here as a list of classes or strings naming classes
            and there module paths. For example:
            `dynamic_imports = ['pypet.parameter.PickleParameter',MyCustomParameter]`

            If you only have a single class to import, you do not need the list brackets:
            `dynamic_imports = 'pypet.parameter.PickleParameter'`


if (name_or_idx is None or name_or_idx == self.f_wildcard('<STR_LIT:$>', -<NUM_LIT:1>) or<EOL>name_or_idx == -<NUM_LIT:1>):<EOL><INDENT>self.f_restore_default()<EOL><DEDENT>else:<EOL><INDENT>if isinstance(name_or_idx, str):<EOL><INDENT>self._idx = self.f_idx_to_run(name_or_idx)<EOL>self._crun = name_or_idx<EOL><DEDENT>else:<EOL><INDENT>self._crun = self.f_idx_to_run(name_or_idx)<EOL>self._idx = name_or_idx<EOL><DEDENT>self._set_explored_parameters_to_idx(self.v_idx)<EOL><DEDENT>

Can make the trajectory behave as during a particular single run.

        It allows easier data analysis.

         Has the following effects:

        *
            `v_idx` and `v_crun` are set to the appropriate index and run name

        *
            All explored parameters are set to the corresponding value in the exploration
            ranges, i.e. when you call :func:`~pypet.parameter.Parameter.f_get` (or fast access)
            on them you will get in return the value at the corresponding `v_idx` position
            in the exploration range.

        *
            If you perform a search in the trajectory tree, the trajectory will
            only search the run subtree under *results* and *derived_parameters* with the
            corresponding index.
            For instance, if you use `f_set_crun('run_00000007')` or `f_set_crun(7)`
            and search for `traj.results.z` this will search for `z` only in the subtree
            `traj.results.run_00000007`. Yet, you can still explicitly name other subtrees,
            i.e. `traj.results.run_00000004.z` will still work.


@not_in_run<EOL><INDENT>def f_iter_runs(self, start=<NUM_LIT:0>, stop=None, step=<NUM_LIT:1>, yields='<STR_LIT:name>'):<DEDENT>

if stop is None:<EOL><INDENT>stop =len(self)<EOL><DEDENT>elif stop > len(self):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>yields = yields.lower()<EOL>if yields == '<STR_LIT:name>':<EOL><INDENT>yield_func = lambda x: self.f_idx_to_run(x)<EOL><DEDENT>elif yields == '<STR_LIT>':<EOL><INDENT>yield_func = lambda x: x<EOL><DEDENT>elif yields == '<STR_LIT>':<EOL><INDENT>yield_func = lambda x: self<EOL><DEDENT>elif yields == '<STR_LIT>':<EOL><INDENT>yield_func = lambda x: self.__copy__()<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>for idx in range(start, stop, step):<EOL><INDENT>self.f_set_crun(idx)<EOL>yield yield_func(idx)<EOL><DEDENT>self.f_set_crun(None)<EOL>

Makes the trajectory iterate over all runs.

        :param start: Start index of run

        :param stop: Stop index, leave ``None`` for length of trajectory

        :param step: Stepsize

        :param yields:

            What should be yielded: ``'name'`` of run, ``idx`` of run
            or ``'self'`` to simply return the trajectory container.

            You can also pick ``'copy'`` to get **shallow** copies (ie the tree is copied but
            no leave nodes except explored ones.) of your trajectory,
            might lead to some of overhead.

        Note that after a full iteration, the trajectory is set back to normal.

        Thus, the following code snippet

        ::

            for run_name in traj.f_iter_runs():

                 # Do some stuff here...

        is equivalent to

        ::

            for run_name in traj.f_get_run_names(sort=True):
                traj.f_set_crun(run_name)

                # Do some stuff here...

            traj.f_set_crun(None)

        :return:

            Iterator over runs. The iterator itself will return the run names but modify
            the trajectory in each iteration and set it back do normal in the end.


if self._stored and not force:<EOL><INDENT>raise TypeError('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>for param in self._explored_parameters.values():<EOL><INDENT>param.f_unlock()<EOL>try:<EOL><INDENT>param._shrink()<EOL><DEDENT>except Exception as exc:<EOL><INDENT>self._logger.error('<STR_LIT>' %<EOL>(param.v_full_name, repr(exc)))<EOL><DEDENT><DEDENT>self._explored_parameters = {}<EOL>self._run_information = {}<EOL>self._single_run_ids = {}<EOL>self._add_run_info(<NUM_LIT:0>)<EOL>self._test_run_addition(<NUM_LIT:1>)<EOL>

Shrinks the trajectory and removes all exploration ranges from the parameters.
        Only possible if the trajectory has not been stored to disk before or was loaded as new.

        :param force:

            Usually you cannot shrink the trajectory if it has been stored to disk,
            because there's no guarantee that it is actually shrunk if there
            still exist explored parameters on disk. In case you are certain that
            you did not store explored parameters to disk set or you deleted all
            of them from disk set `force=True`.

        :raises: TypeError if the trajectory was stored before.


if self.f_contains(name, shortcuts=False):<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>'<STR_LIT>' % name)<EOL><DEDENT>else:<EOL><INDENT>self._changed_default_parameters[name] = (args, kwargs)<EOL><DEDENT>

Generic preset function, marks a parameter or config for presetting.


@not_in_run<EOL><INDENT>def f_preset_config(self, config_name, *args, **kwargs):<DEDENT>

if not config_name.startswith('<STR_LIT>'):<EOL><INDENT>config_name = '<STR_LIT>' + config_name<EOL><DEDENT>self._preset(config_name, args, kwargs)<EOL>


@not_in_run<EOL><INDENT>def f_preset_parameter(self, param_name, *args, **kwargs):<DEDENT>

if not param_name.startswith('<STR_LIT>'):<EOL><INDENT>param_name = '<STR_LIT>' + param_name<EOL><DEDENT>self._preset(param_name, args, kwargs)<EOL>

Presets parameter value before a parameter is added.

        Can be called before parameters are added to the Trajectory in order to change the
        values that are stored into the parameter on creation.

        After creation of a parameter, the instance of the parameter is called
        with `param.f_set(*args,**kwargs)` with `*args`, and `**kwargs` provided by the user
        with `f_preset_parameter`.

        Before an experiment is carried out it is checked if all parameters that were
        marked were also preset.

        :param param_name:

            The full name (!) of the parameter that is to be changed after its creation.

        :param args:

            Arguments that will be used for changing the parameter's data

        :param kwargs:

            Keyword arguments that will be used for changing the parameter's data

        Example:

        >>> traj.f_preset_parameter('groupA.param1', data=44)
        >>> traj.f_add_parameter('groupA.param1', data=11)
        >>> traj.parameters.groupA.param1
        44


Called by the environment to make some initial configurations before performing the
        individual runs.

        Checks if all parameters marked for presetting were preset. If not raises a
        DefaultReplacementError.

        Locks all parameters.

        Removal of potential results of previous runs in case the trajectory was expanded to avoid
        mixing up undesired shortcuts in natural naming.


@not_in_run<EOL><INDENT>@kwargs_api_change('<STR_LIT>')<EOL>@kwargs_api_change('<STR_LIT>')<EOL>def f_get_from_runs(self, name, include_default_run=True, use_indices=False,<EOL>fast_access=False, with_links = True,<EOL>shortcuts=True, max_depth=None, auto_load=False):<DEDENT>

result_dict = OrderedDict()<EOL>old_crun = self.v_crun<EOL>try:<EOL><INDENT>if len(self._run_parent_groups) > <NUM_LIT:0>:<EOL><INDENT>for run_name in self.f_iter_runs():<EOL><INDENT>value = None<EOL>already_found = False<EOL>for run_parent_group in self._run_parent_groups.values():<EOL><INDENT>if run_name not in run_parent_group._children:<EOL><INDENT>continue<EOL><DEDENT>try:<EOL><INDENT>value = run_parent_group.f_get(run_name + '<STR_LIT:.>' + name,<EOL>fast_access=False,<EOL>with_links=with_links,<EOL>shortcuts=shortcuts,<EOL>max_depth=max_depth,<EOL>auto_load=auto_load)<EOL>if already_found:<EOL><INDENT>raise pex.NotUniqueNodeError('<STR_LIT>'<EOL>'<STR_LIT>' % name)<EOL><DEDENT>else:<EOL><INDENT>already_found = True<EOL><DEDENT><DEDENT>except (AttributeError, pex.DataNotInStorageError):<EOL><INDENT>pass<EOL><DEDENT><DEDENT>if value is None and include_default_run:<EOL><INDENT>for run_parent_group in self._run_parent_groups.values():<EOL><INDENT>try:<EOL><INDENT>value = run_parent_group.f_get(self.f_wildcard('<STR_LIT:$>', -<NUM_LIT:1>) +<EOL>'<STR_LIT:.>' + name,<EOL>fast_access=False,<EOL>with_links=with_links,<EOL>shortcuts=shortcuts,<EOL>max_depth=max_depth,<EOL>auto_load=auto_load)<EOL>if already_found:<EOL><INDENT>raise pex.NotUniqueNodeError('<STR_LIT>'<EOL>'<STR_LIT>' % name)<EOL><DEDENT>else:<EOL><INDENT>already_found = True<EOL><DEDENT><DEDENT>except (AttributeError, pex.DataNotInStorageError):<EOL><INDENT>pass<EOL><DEDENT><DEDENT><DEDENT>if value is not None:<EOL><INDENT>if value.v_is_leaf:<EOL><INDENT>value = self._nn_interface._apply_fast_access(value, fast_access)<EOL><DEDENT>if use_indices:<EOL><INDENT>key = self.f_idx_to_run(run_name)<EOL><DEDENT>else:<EOL><INDENT>key = run_name<EOL><DEDENT>result_dict[key] = value<EOL><DEDENT><DEDENT><DEDENT>return result_dict<EOL><DEDENT>finally:<EOL><INDENT>self.v_crun = old_crun<EOL><DEDENT>

Searches for all occurrences of `name` in each run.

        Generates an ordered dictionary with the run names or indices as keys and
        found items as values.

        Example:

        >>> traj.f_get_from_runs(self, 'deep.universal_answer', use_indices=True, fast_access=True)
        OrderedDict([(0, 42), (1, 42), (2, 'fortytwo), (3, 43)])

        :param name:

            String description of the item(s) to find.
            Cannot be full names but the part of the names that are below
            a `run_XXXXXXXXX` group.

        :param include_default_run:

            If results found under ``run_ALL`` should be accounted for every run or simply be
            ignored.

        :param use_indices:

            If `True` the keys of the resulting dictionary are the run indices
            (e.g. 0,1,2,3), otherwise the keys are run names (e.g. `run_00000000`,
            `run_000000001`)

        :param fast_access:

            Whether to return parameter or result instances or the values handled by these.

        :param with_links:

            If links should be considered

        :param shortcuts:

            If shortcuts are allowed and the trajectory can *hop* over nodes in the
            path.

        :param max_depth:

            Maximum depth (relative to start node) how search should progress in tree.
            `None` means no depth limit.  Only relevant if `shortcuts` are allowed.

        :param auto_load:

            If data should be loaded from the storage service if it cannot be found in the
            current trajectory tree. Auto-loading will load group and leaf nodes currently
            not in memory and it will load data into empty leaves. Be aware that auto-loading
            does not work with shortcuts.

        :return:

            Ordered dictionary with run names or indices as keys and found items as values.
            Will only include runs where an item was actually found.


return self._length<EOL>

Length of trajectory, minimum length is 1


return self._is_completed(name_or_id)<EOL>

Whether or not a given run is completed.

        If no run is specified it is checked whether all runs were completed.

        :param name_or_id: Nam or id of a run to check

        :return: True or False


if name_or_id is None:<EOL><INDENT>return all(<EOL>(runinfo['<STR_LIT>'] for runinfo in self._run_information.values()))<EOL><DEDENT>else:<EOL><INDENT>return self.f_get_run_information(name_or_id, copy=False)['<STR_LIT>']<EOL><DEDENT>

Private function such that it can still be called by the environment during
        a single run


@not_in_run<EOL><INDENT>def f_expand(self, build_dict, fail_safe=True):<DEDENT>

if len(self._explored_parameters) == <NUM_LIT:0>:<EOL><INDENT>self._logger.info('<STR_LIT>'<EOL>'<STR_LIT>')<EOL>return self.f_explore(build_dict)<EOL><DEDENT>enlarge_set = set([self.f_get(key).v_full_name<EOL>for key in build_dict.keys()])<EOL>if not set(self._explored_parameters.keys()) == enlarge_set:<EOL><INDENT>raise TypeError('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>' %<EOL>(str(set(self._explored_parameters.keys())),<EOL>str(set(build_dict.keys()))))<EOL><DEDENT>if any(x is None for x in self._explored_parameters.values()):<EOL><INDENT>raise TypeError('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>old_ranges = None<EOL>if fail_safe:<EOL><INDENT>old_ranges = {}<EOL>for param_name in self._explored_parameters:<EOL><INDENT>old_ranges[param_name] = self._explored_parameters[param_name].f_get_range()<EOL><DEDENT>try:<EOL><INDENT>old_ranges = cp.deepcopy(old_ranges)<EOL><DEDENT>except Exception:<EOL><INDENT>self._logger.error('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>')<EOL>old_ranges = None<EOL><DEDENT><DEDENT>try:<EOL><INDENT>count = <NUM_LIT:0><EOL>length = None<EOL>for key, builditerable in build_dict.items():<EOL><INDENT>act_param = self.f_get(key)<EOL>act_param.f_unlock()<EOL>act_param._expand(builditerable)<EOL>name = act_param.v_full_name<EOL>self._explored_parameters[name] = act_param<EOL>if count == <NUM_LIT:0>:<EOL><INDENT>length = act_param.f_get_range_length()<EOL><DEDENT>elif not length == act_param.f_get_range_length():<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>count += <NUM_LIT:1><EOL><DEDENT>original_length = len(self)<EOL>for irun in range(original_length, length):<EOL><INDENT>self._add_run_info(irun)<EOL><DEDENT>self._test_run_addition(length)<EOL>self._remove_exploration()<EOL><DEDENT>except Exception:<EOL><INDENT>if old_ranges is not None:<EOL><INDENT>for param_name in old_ranges:<EOL><INDENT>param_range = old_ranges[param_name]<EOL>param = self._explored_parameters[param_name]<EOL>param.f_unlock()<EOL>try:<EOL><INDENT>param._shrink()<EOL><DEDENT>except Exception as exc:<EOL><INDENT>self._logger.error('<STR_LIT>'<EOL>'<STR_LIT>' % (param_name, repr(exc)))<EOL><DEDENT>param._explore(param_range)<EOL>param._explored = True<EOL><DEDENT><DEDENT>raise<EOL><DEDENT>

Similar to :func:`~pypet.trajectory.Trajectory.f_explore`, but can be used to enlarge
        already completed trajectories.

        Please ensure before usage, that all explored parameters are loaded!

        :param build_dict:

            Dictionary containing the expansion

        :param fail_safe:

            If old ranges should be **deep-copied** in order to allow to restore
            the original exploration if something fails during expansion.
            Set to `False` if deep-copying your parameter ranges causes errors.

        :raises:

            TypeError: If not all explored parameters are enlarged

            AttributeError: If keys of dictionary cannot be found in the trajectory

            NotUniqueNodeError:

                If dictionary keys do not unambiguously map to single parameters

            ValueError: If not all explored parameter ranges are of the same length


for param in self._explored_parameters.values():<EOL><INDENT>if param._stored:<EOL><INDENT>try:<EOL><INDENT>self.f_delete_item(param)<EOL><DEDENT>except Exception:<EOL><INDENT>self._logger.exception('<STR_LIT>'<EOL>'<STR_LIT>' % param.v_full_name)<EOL><DEDENT><DEDENT><DEDENT>

Called if trajectory is expanded, deletes all explored parameters from disk


return self.f_copy(copy_leaves=True,<EOL>with_links=True)<EOL>


new_traj = Trajectory(_copy_traj=True)<EOL>new_traj._length = self._length<EOL>new_traj._name = self._name<EOL>new_traj._timestamp = self._timestamp<EOL>new_traj._time = self._time<EOL>new_traj._single_run_ids = self._single_run_ids<EOL>new_traj._run_information = self._run_information<EOL>new_traj._updated_run_information = self._updated_run_information<EOL>new_traj._fast_access = self._fast_access<EOL>new_traj._shortcuts = self._shortcuts<EOL>new_traj._iter_recursive = self._iter_recursive<EOL>new_traj._max_depth = self._max_depth<EOL>new_traj._auto_load = self._auto_load<EOL>new_traj._with_links = self._with_links<EOL>new_traj._environment_hexsha = self._environment_hexsha<EOL>new_traj._environment_name = self._environment_name<EOL>new_traj._idx = self._idx<EOL>new_traj._crun = self._crun<EOL>new_traj._standard_parameter = self._standard_parameter<EOL>new_traj._standard_result = self._standard_result<EOL>new_traj._standard_leaf = self._standard_leaf<EOL>new_traj._auto_run_prepend = self._auto_run_prepend<EOL>new_traj._no_clobber = self._no_clobber<EOL>new_traj._run_started = self._run_started <EOL>new_traj._run_by_environment = self._run_by_environment  <EOL>new_traj._full_copy = self._full_copy<EOL>new_traj._dynamic_imports = self._dynamic_imports<EOL>new_traj._wildcard_functions = self._wildcard_functions<EOL>new_traj._wildcard_keys = self._wildcard_keys<EOL>new_traj._reversed_wildcards = self._reversed_wildcards<EOL>new_traj._wildcard_cache = self._wildcard_cache<EOL>new_traj._comment = self._comment<EOL>new_traj._stored = self._stored<EOL>new_traj._storage_service = self._storage_service<EOL>new_traj._is_run = self._is_run<EOL>new_traj._copy_from(self, copy_leaves=copy_leaves,<EOL>with_links=with_links)<EOL>for my_dict, new_dict in ((self._new_nodes, new_traj._new_nodes),<EOL>(self._new_links, new_traj._new_links)):<EOL><INDENT>for key in my_dict:<EOL><INDENT>value = my_dict[key]<EOL>parent, child = value<EOL>if parent is self:<EOL><INDENT>new_parent = new_traj<EOL><DEDENT>else:<EOL><INDENT>new_parent = new_traj.f_get(parent.v_full_name,<EOL>shortcuts=False,<EOL>with_links=False,<EOL>auto_load=False)<EOL><DEDENT>new_child = new_parent._children[key[<NUM_LIT:1>]]<EOL>new_dict[key] = (new_parent, new_child)<EOL><DEDENT><DEDENT>return new_traj<EOL>

Returns a *shallow* copy of a trajectory.

        :param copy_leaves:

            If leaves should be **shallow** copied or simply referred to by both trees.
            **Shallow** copying is established using the copy module.

            Accepts the setting ``'explored'`` to only copy explored parameters.
            Note that ``v_full_copy`` determines how these will be copied.

        :param with_links: If links should be ignored or followed and copied as well

        :return: A shallow copy


def _copy_skeleton(node_in, node_out):<EOL><INDENT>"""<STR_LIT>"""<EOL>new_annotations = node_out.v_annotations<EOL>node_in._annotations = new_annotations<EOL>node_in.v_comment = node_out.v_comment<EOL><DEDENT>def _add_leaf(leaf):<EOL><INDENT>"""<STR_LIT>"""<EOL>leaf_full_name = leaf.v_full_name<EOL>try:<EOL><INDENT>found_leaf = self.f_get(leaf_full_name,<EOL>with_links=False,<EOL>shortcuts=False,<EOL>auto_load=False)<EOL>if overwrite:<EOL><INDENT>found_leaf.__setstate__(leaf.__getstate__())<EOL><DEDENT>return found_leaf<EOL><DEDENT>except AttributeError:<EOL><INDENT>pass<EOL><DEDENT>if copy_leaves is True or (copy_leaves == '<STR_LIT>' and<EOL>leaf.v_is_parameter and leaf.v_explored):<EOL><INDENT>new_leaf = self.f_add_leaf(cp.copy(leaf))<EOL><DEDENT>else:<EOL><INDENT>new_leaf = self.f_add_leaf(leaf)<EOL><DEDENT>if new_leaf.v_is_parameter and new_leaf.v_explored:<EOL><INDENT>self._explored_parameters[new_leaf.v_full_name] = new_leaf<EOL><DEDENT>return new_leaf<EOL><DEDENT>def _add_group(group):<EOL><INDENT>"""<STR_LIT>"""<EOL>group_full_name = group.v_full_name<EOL>try:<EOL><INDENT>found_group = self.f_get(group_full_name,<EOL>with_links=False,<EOL>shortcuts=False,<EOL>auto_load=False)<EOL>if overwrite:<EOL><INDENT>_copy_skeleton(found_group, group)<EOL><DEDENT>return found_group<EOL><DEDENT>except AttributeError:<EOL><INDENT>pass<EOL><DEDENT>new_group = self.f_add_group(group_full_name)<EOL>_copy_skeleton(new_group, group)<EOL>return new_group<EOL><DEDENT>is_run = self._is_run<EOL>self._is_run = False  <EOL>try:<EOL><INDENT>if node.v_is_leaf:<EOL><INDENT>return _add_leaf(node)<EOL><DEDENT>elif node.v_is_group:<EOL><INDENT>other_root = node.v_root<EOL>if other_root is self:<EOL><INDENT>raise RuntimeError('<STR_LIT>')<EOL><DEDENT>result = _add_group(node)<EOL>nodes_iterator = node.f_iter_nodes(recursive=True, with_links=with_links)<EOL>has_links = []<EOL>if node._links:<EOL><INDENT>has_links.append(node)<EOL><DEDENT>for child in nodes_iterator:<EOL><INDENT>if child.v_is_leaf:<EOL><INDENT>_add_leaf(child)<EOL><DEDENT>else:<EOL><INDENT>_add_group(child)<EOL>if child._links:<EOL><INDENT>has_links.append(child)<EOL><DEDENT><DEDENT><DEDENT>if with_links:<EOL><INDENT>for current in has_links:<EOL><INDENT>mine = self.f_get(current.v_full_name, with_links=False,<EOL>shortcuts=False, auto_load=False)<EOL>my_link_set = set(mine._links.keys())<EOL>other_link_set = set(current._links.keys())<EOL>new_links = other_link_set - my_link_set<EOL>for link in new_links:<EOL><INDENT>where_full_name = current._links[link].v_full_name<EOL>mine.f_add_link(link, where_full_name)<EOL><DEDENT><DEDENT><DEDENT>return result<EOL><DEDENT>else:<EOL><INDENT>raise RuntimeError('<STR_LIT>')<EOL><DEDENT><DEDENT>except Exception:<EOL><INDENT>self._is_run = is_run<EOL><DEDENT>

Pass a ``node`` to insert the full tree to the trajectory.

        Considers all links in the given node!
        Ignored nodes already found in the current trajectory.

        :param node: The node to insert

        :param copy_leaves:

            If leaves should be **shallow** copied or simply referred to by both trees.
            **Shallow** copying is established using the copy module.

            Accepts the setting ``'explored'`` to only copy explored parameters.
            Note that ``v_full_copy`` determines how these will be copied.

        :param overwrite:

            If existing elemenst should be overwritten. Requries ``__getstate__`` and
            ``__setstate__`` being implemented in the leaves.

        :param with_links: If links should be ignored or followed and copied as well

        :return: The corresponding (new) node in the tree.


for run_idx in range(len(self)):<EOL><INDENT>if self.f_is_completed(run_idx):<EOL><INDENT>raise TypeError('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT><DEDENT>added_explored_parameters = []<EOL>try:<EOL><INDENT>length = len(self)<EOL>for key, builditerable in build_dict.items():<EOL><INDENT>act_param = self.f_get(key)<EOL>if not act_param.v_is_leaf or not act_param.v_is_parameter:<EOL><INDENT>raise ValueError('<STR_LIT>' % key)<EOL><DEDENT>act_param.f_unlock()<EOL>act_param._explore(builditerable)<EOL>added_explored_parameters.append(act_param)<EOL>full_name = act_param.v_full_name<EOL>self._explored_parameters[full_name] = act_param<EOL>act_param._explored = True<EOL>if len(self._explored_parameters) == <NUM_LIT:1>:<EOL><INDENT>length = act_param.f_get_range_length()<EOL><DEDENT>elif not length == act_param.f_get_range_length():<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT><DEDENT>for irun in range(length):<EOL><INDENT>self._add_run_info(irun)<EOL><DEDENT>self._test_run_addition(length)<EOL><DEDENT>except Exception:<EOL><INDENT>for param in added_explored_parameters:<EOL><INDENT>param.f_unlock()<EOL>param._shrink()<EOL>param._explored = False<EOL>full_name = param.v_full_name<EOL>del self._explored_parameters[full_name]<EOL><DEDENT>if len(self._explored_parameters) == <NUM_LIT:0>:<EOL><INDENT>self.f_shrink(force=True)<EOL><DEDENT>raise<EOL><DEDENT>

Prepares the trajectory to explore the parameter space.

        To explore the parameter space you need to provide a dictionary with the names of the
        parameters to explore as keys and iterables specifying the exploration ranges as values.

        All iterables need to have the same length otherwise a ValueError is raised.
        A ValueError is also raised if the names from the dictionary map to groups or results
        and not parameters.

        If your trajectory is already explored but not stored yet and your parameters are
        not locked you can add new explored parameters to the current ones if their
        iterables match the current length of the trajectory.

        Raises an AttributeError if the names from the dictionary are not found at all in
        the trajectory and NotUniqueNodeError if the keys not unambiguously map
        to single parameters.

        Raises a TypeError if the trajectory has been stored already, please use
        :func:`~pypet.trajectory.Trajectory.f_expand` then instead.

        Example usage:

        >>> traj.f_explore({'groupA.param1' : [1,2,3,4,5], 'groupA.param2':['a','b','c','d','e']})

        Could also be called consecutively:

        >>> traj.f_explore({'groupA.param1' : [1,2,3,4,5]})
        >>> traj.f_explore({'groupA.param2':['a','b','c','d','e']})

        NOTE:

        Since parameters are very conservative regarding the data they accept
        (see :ref:`type_conservation`), you sometimes won't be able to use Numpy arrays
        for exploration as iterables.

        For instance, the following code snippet won't work:

        ::

            import numpy a np
            from pypet.trajectory import Trajectory
            traj = Trajectory()
            traj.f_add_parameter('my_float_parameter', 42.4,
                                 comment='My value is a standard python float')

            traj.f_explore( { 'my_float_parameter': np.arange(42.0, 44.876, 0.23) } )

        This will result in a `TypeError` because your exploration iterable
        `np.arange(42.0, 44.876, 0.23)` contains `numpy.float64` values
        whereas you parameter is supposed to use standard python floats.

        Yet, you can use Numpys `tolist()` function to overcome this problem:

        ::

            traj.f_explore( { 'my_float_parameter': np.arange(42.0, 44.876, 0.23).tolist() } )

        Or you could specify your parameter directly as a numpy float:

        ::

            traj.f_add_parameter('my_float_parameter', np.float64(42.4),
                                   comment='My value is a numpy 64 bit float')


idx = run_information_dict['<STR_LIT>']<EOL>name = run_information_dict['<STR_LIT:name>']<EOL>self._run_information[name] = run_information_dict<EOL>self._updated_run_information.add(idx)<EOL>

Overwrites the run information of a particular run


def _add_run_info(self, idx, name='<STR_LIT>', timestamp=<NUM_LIT>, finish_timestamp=<NUM_LIT>,<EOL>runtime='<STR_LIT>', time='<STR_LIT>',<EOL>completed=<NUM_LIT:0>, parameter_summary='<STR_LIT>',<EOL>short_environment_hexsha='<STR_LIT>'):

if idx in self._single_run_ids:<EOL><INDENT>old_name = self._single_run_ids[idx]<EOL>del self._single_run_ids[old_name]<EOL>del self._single_run_ids[idx]<EOL>del self._run_information[old_name]<EOL><DEDENT>if name == '<STR_LIT>':<EOL><INDENT>name = self.f_wildcard('<STR_LIT:$>', idx)<EOL><DEDENT>self._single_run_ids[name] = idx<EOL>self._single_run_ids[idx] = name<EOL>info_dict = {'<STR_LIT>': idx,<EOL>'<STR_LIT>': timestamp,<EOL>'<STR_LIT>': finish_timestamp,<EOL>'<STR_LIT>': runtime,<EOL>'<STR_LIT:time>': time,<EOL>'<STR_LIT>': completed,<EOL>'<STR_LIT:name>': name,<EOL>'<STR_LIT>': parameter_summary,<EOL>'<STR_LIT>': short_environment_hexsha}<EOL>self._run_information[name] = info_dict<EOL>self._length = len(self._run_information)<EOL>

Adds a new run to the `_run_information` dict.


for par in self._parameters.values():<EOL><INDENT>if not par.f_is_empty():<EOL><INDENT>par.f_lock()<EOL><DEDENT><DEDENT>


for par in self._derived_parameters.values():<EOL><INDENT>if not par.f_is_empty():<EOL><INDENT>par.f_lock()<EOL><DEDENT><DEDENT>


self._is_run = False<EOL>self.f_set_crun(None)<EOL>if store_meta_data:<EOL><INDENT>self.f_store(only_init=True)<EOL><DEDENT>

Final rollback initiated by the environment

        Restores the trajectory as root of the tree, and stores meta data to disk.
        This updates the trajectory's information about single runs, i.e. if they've been
        completed, when they were started, etc.


Loads the full skeleton from the storage service.

        This needs to be done after a successful exploration in order to update the
        trajectory tree with all results and derived parameters from the individual single runs.
        This will only add empty results and derived parameters (i.e. the skeleton)
        and load annotations.


<EOL>if name is None and index is None:<EOL><INDENT>name = self.v_name<EOL><DEDENT>if as_new:<EOL><INDENT>load_parameters = pypetconstants.LOAD_DATA<EOL>load_derived_parameters = pypetconstants.LOAD_NOTHING<EOL>load_results = pypetconstants.LOAD_NOTHING<EOL>load_other_data = pypetconstants.LOAD_NOTHING<EOL><DEDENT>unused_kwargs = set(kwargs.keys())<EOL>if self.v_storage_service is None or storage_service is not None or len(kwargs) > <NUM_LIT:0>:<EOL><INDENT>self._storage_service, unused_kwargs = storage_factory(storage_service=storage_service,<EOL>trajectory=self, **kwargs)<EOL><DEDENT>if len(unused_kwargs) > <NUM_LIT:0>:<EOL><INDENT>raise ValueError('<STR_LIT>' %<EOL>str(unused_kwargs))<EOL><DEDENT>if dynamic_imports is not None:<EOL><INDENT>self.f_add_to_dynamic_imports(dynamic_imports)<EOL><DEDENT>if load_data is not None:<EOL><INDENT>load_parameters = load_data<EOL>load_derived_parameters = load_data<EOL>load_results = load_data<EOL>load_other_data = load_data<EOL><DEDENT>self._storage_service.load(pypetconstants.TRAJECTORY, self, trajectory_name=name,<EOL>trajectory_index=index,<EOL>as_new=as_new, load_parameters=load_parameters,<EOL>load_derived_parameters=load_derived_parameters,<EOL>load_results=load_results,<EOL>load_other_data=load_other_data,<EOL>recursive=recursive,<EOL>max_depth=max_depth,<EOL>with_run_information=with_run_information,<EOL>with_meta_data=with_meta_data,<EOL>force=force)<EOL>if as_new:<EOL><INDENT>for param in self._parameters.values():<EOL><INDENT>param.f_unlock()<EOL><DEDENT><DEDENT>

Loads a trajectory via the storage service.

        If you want to load individual results or parameters manually, you can take
        a look at :func:`~pypet.trajectory.Trajectory.f_load_items`.
        To only load subtrees check out :func:`~pypet.naturalnaming.NNGroupNode.f_load_child`.

        For `f_load` you can pass the following arguments:

        :param name:

            Name of the trajectory to be loaded. If no name or index is specified
            the current name of the trajectory is used.

        :param index:

            If you don't specify a name you can specify an integer index instead.
            The corresponding trajectory in the hdf5 file at the index
            position is loaded (counting starts with 0). Negative indices are also allowed
            counting in reverse order. For instance, `-1` refers to the last trajectory in
            the file, `-2` to the second last, and so on.

        :param as_new:

            Whether you want to rerun the experiments. So the trajectory is loaded only
            with parameters. The current trajectory name is kept in this case, which should be
            different from the trajectory name specified in the input parameter `name`.
            If you load `as_new=True` all parameters are unlocked.
            If you load `as_new=False` the current trajectory is replaced by the one on disk,
            i.e. name, timestamp, formatted time etc. are all taken from disk.

        :param load_parameters: How parameters and config items are loaded

        :param load_derived_parameters: How derived parameters are loaded

        :param load_results: How results are loaded

            You can specify how to load the parameters, derived parameters and results
            as follows:

                * :const:`pypet.pypetconstants.LOAD_NOTHING`: (0)

                    Nothing is loaded.

                * :const:`pypet.pypetconstants.LOAD_SKELETON`: (1)

                    The skeleton is loaded including annotations (See :ref:`more-on-annotations`).
                    This means that only empty
                    *parameter* and *result* objects will
                    be created  and you can manually load the data into them afterwards.
                    Note that :class:`pypet.annotations.Annotations` do not count as data and they
                    will be loaded because they are assumed to be small.

                * :const:`pypet.pypetconstants.LOAD_DATA`: (2)

                    The whole data is loaded. Note in case you have non-empty leaves
                    already in RAM, these are left untouched.

                * :const:`pypet.pypetconstants.OVERWRITE_DATA`: (3)

                    As before, but non-empty nodes are emptied and reloaded.

                Note that in all cases except :const:`pypet.pypetconstants.LOAD_NOTHING`,
                annotations will be reloaded if the corresponding instance
                is created or the annotations of an existing instance were emptied before.

        :param recursive:

            If data should be loaded recursively. If set to `None`, this is equivalent to
            set all data loading to `:const:`pypet.pypetconstants.LOAD_NOTHING`.

        :param load_data:

            As the above, per default set to `None`. If not `None` the setting of `load_data`
            will overwrite the settings of `load_parameters`, `load_derived_parameters`,
            `load_results`, and `load_other_data`. This is more or less or shortcut if all
            types should be loaded the same.

        :param max_depth:

            Maximum depth to load nodes (inclusive).

        :param force:

            *pypet* will refuse to load trajectories that have been created using *pypet* with a
            different version number or a different python version.
            To force the load of a trajectory from a previous version
            simply set ``force = True``. Note that it is not checked if other versions of packages
            differ from previous experiments, i.e. numpy, scipy, etc. But you can check
            for this manually. The versions of other packages can be found under
            ``'config.environment.name_of_environment.versions.package_name'``.

        :param dynamic_imports:

            If you've written a custom parameter that needs to be loaded dynamically
            during runtime, this needs to be specified here as a list of classes or
            strings naming classes and there module paths. For example:
            `dynamic_imports = ['pypet.parameter.PickleParameter',MyCustomParameter]`

            If you only have a single class to import, you do not need the list brackets:
            `dynamic_imports = 'pypet.parameter.PickleParameter'`

            The classes passed here are added for good and will be kept by the trajectory.
            Please add your dynamically imported classes only once.

        :param with_run_information:

            If information about the individual runs should be loaded. If you have many
            runs, like 1,000,000 or more you can spare time by setting
            `with_run_information=False`.
            Note that `f_get_run_information` and `f_idx_to_run` do not work in such a case.
            Moreover, setting `v_idx` does not work either. If you load the trajectory
            without this information, be careful, this is not recommended.

        :param wiht_meta_data:

            If meta data should be loaded.

        :param storage_service:

            Pass a storage service used by the trajectory. Alternatively pass a constructor
            and other ``**kwargs`` are passed onto the constructor. Leave `None` in combination
            with using no other kwargs, if you don't want to change the service
            the trajectory is currently using.

        :param kwargs:

            Other arguments passed to the storage service constructor. Don't pass any
            other kwargs and ``storage_service=None``,
            if you don't want to change the current service.


def _check_if_both_have_same_parameters(self, other_trajectory,<EOL>ignore_data, consecutive_merge):

if not isinstance(other_trajectory, Trajectory):<EOL><INDENT>raise TypeError('<STR_LIT>'<EOL>'<STR_LIT>' % str(type(other_trajectory)))<EOL><DEDENT>if self._stored and not consecutive_merge:<EOL><INDENT>self.f_load_skeleton()<EOL><DEDENT>if other_trajectory._stored:<EOL><INDENT>other_trajectory.f_load_skeleton()<EOL><DEDENT>other_wildcard_set = set(x[<NUM_LIT:1>] for x in other_trajectory._wildcard_functions.keys())<EOL>wildcard_set = set(x[<NUM_LIT:1>] for x in self._wildcard_functions.keys())<EOL>diff = wildcard_set.symmetric_difference(other_wildcard_set)<EOL>if diff:<EOL><INDENT>raise TypeError('<STR_LIT>' %<EOL>(str(wildcard_set), str(other_wildcard_set)))<EOL><DEDENT>if self._stored:<EOL><INDENT>with self._nn_interface._disable_logging:<EOL><INDENT>self.f_load_items(self._parameters.keys(), only_empties=True)<EOL><DEDENT><DEDENT>if other_trajectory._stored:<EOL><INDENT>with self._nn_interface._disable_logging:<EOL><INDENT>other_trajectory.f_load_items(other_trajectory._parameters.keys(),<EOL>only_empties=True)<EOL><DEDENT><DEDENT>self.f_restore_default()<EOL>other_trajectory.f_restore_default()<EOL>allmyparams = self._parameters.copy()<EOL>allotherparams = other_trajectory._parameters.copy()<EOL>if '<STR_LIT>' in self:<EOL><INDENT>my_traj_dpars = self._derived_parameters<EOL>if self._stored:<EOL><INDENT>with self._nn_interface._disable_logging:<EOL><INDENT>self.f_load_items(my_traj_dpars.keys(), only_empties=True)<EOL><DEDENT><DEDENT>allmyparams.update(my_traj_dpars)<EOL>other_traj_dpars = other_trajectory._derived_parameters<EOL>if other_trajectory._stored:<EOL><INDENT>with self._nn_interface._disable_logging:<EOL><INDENT>other_trajectory.f_load_items(other_traj_dpars.keys(), only_empties=True)<EOL><DEDENT><DEDENT>allotherparams.update(other_traj_dpars)<EOL><DEDENT>my_keyset = set(allmyparams.keys())<EOL>other_keyset = set(allotherparams.keys())<EOL>diff = my_keyset.symmetric_difference(other_keyset) - ignore_data<EOL>run_dummys = (self.f_wildcard('<STR_LIT:$>', -<NUM_LIT:1>), other_trajectory.f_wildcard('<STR_LIT:$>', -<NUM_LIT:1>))<EOL>if diff:<EOL><INDENT>run_difference_can_be_resolved = True<EOL>for full_name in diff:<EOL><INDENT>split_name = full_name.split('<STR_LIT:.>')<EOL>if not any(x in self._run_information or<EOL>x in other_trajectory._run_information or<EOL>x in run_dummys<EOL>for x in split_name):<EOL><INDENT>run_difference_can_be_resolved = False<EOL>break<EOL><DEDENT>elif full_name in allotherparams:<EOL><INDENT>del allotherparams[full_name]<EOL><DEDENT><DEDENT>if not run_difference_can_be_resolved:<EOL><INDENT>raise TypeError('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>' % str(diff))<EOL><DEDENT><DEDENT>for key, other_param in allotherparams.items():<EOL><INDENT>if key in ignore_data:<EOL><INDENT>continue<EOL><DEDENT>my_param = self.f_get(key)<EOL>split_key = key.split('<STR_LIT:.>')<EOL>if any(x in self._run_information or<EOL>x in other_trajectory._run_information<EOL>for x in split_key):<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>if not my_param._values_of_same_type(my_param.f_get(), other_param.f_get()):<EOL><INDENT>raise TypeError('<STR_LIT>'<EOL>'<STR_LIT>' %<EOL>(key, str(type(my_param.f_get())),<EOL>str(type(other_param.f_get()))))<EOL><DEDENT><DEDENT><DEDENT>

Checks if two trajectories live in the same space and can be merged.


self._storage_service.store(pypetconstants.BACKUP, self, trajectory_name=self.v_name,<EOL>**kwargs)<EOL>

Backs up the trajectory with the given storage service.

        Arguments of ``kwargs`` are directly passed to the storage service,
        for the HDF5StorageService you can provide the following argument:

        :param backup_filename:

            Name of file where to store the backup.

            In case you use the standard HDF5 storage service and `backup_filename=None`,
            the file will be chosen automatically.
            The backup file will be in the same folder as your hdf5 file and
            named 'backup_XXXXX.hdf5' where 'XXXXX' is the name of your current trajectory.


if len(self._reversed_wildcards) > <NUM_LIT:0>:<EOL><INDENT>start = old_length<EOL><DEDENT>else:<EOL><INDENT>start = -<NUM_LIT:1><EOL><DEDENT>for wildcards, func in self._wildcard_functions.items():<EOL><INDENT>for irun in range(start, len(self)):<EOL><INDENT>translated_name = func(irun)<EOL>if not translated_name in self._reversed_wildcards:<EOL><INDENT>self._reversed_wildcards[translated_name] = ([], wildcards)<EOL><DEDENT>self._reversed_wildcards[translated_name][<NUM_LIT:0>].append(irun)<EOL><DEDENT><DEDENT>

Creates a full mapping from all wildcard translations to the corresponding wildcards


other_length = len(other_trajectories)<EOL>self._logger.info('<STR_LIT>' % other_length)<EOL>self.f_load_skeleton()<EOL>if backup:<EOL><INDENT>self.f_backup()<EOL><DEDENT>for idx, other in enumerate(other_trajectories):<EOL><INDENT>self.f_merge(other, ignore_data=ignore_data,<EOL>move_data=move_data,<EOL>delete_other_trajectory=delete_other_trajectory,<EOL>keep_info=keep_info,<EOL>keep_other_trajectory_info=keep_other_trajectory_info,<EOL>merge_config=merge_config,<EOL>backup=False,<EOL>consecutive_merge=True)<EOL>self._logger.log(<NUM_LIT>,'<STR_LIT>' % (idx + <NUM_LIT:1>, other_length))<EOL><DEDENT>self._logger.info('<STR_LIT>')<EOL>self._reversed_wildcards = {}<EOL>self.f_store()<EOL>self._logger.info('<STR_LIT>')<EOL>

Can be used to merge several `other_trajectories` into your current one.

        IMPORTANT `backup=True` only backs up the current trajectory not any of
        the `other_trajectories`. If you need a backup of these, do it manually.

        Parameters as for :func:`~pypet.trajectory.Trajectory.f_merge`.


if consecutive_merge and trial_parameter is not None:<EOL><INDENT>self._logger.warning('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>if consecutive_merge and backup:<EOL><INDENT>self._logger.warning('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>timestamp = time.time()<EOL>original_ignore_data = set(ignore_data)<EOL>ignore_data = original_ignore_data.copy()<EOL>old_len = len(self)<EOL>self._check_if_both_have_same_parameters(other_trajectory, ignore_data, consecutive_merge)<EOL>self._make_reversed_wildcards(old_length=old_len)<EOL>other_trajectory._make_reversed_wildcards()<EOL>if backup:<EOL><INDENT>other_trajectory.f_backup()<EOL>self.f_backup()<EOL><DEDENT>self._logger.info('<STR_LIT>')<EOL>used_runs, changed_parameters = self._merge_parameters(<EOL>other_trajectory,<EOL>remove_duplicates,<EOL>trial_parameter,<EOL>ignore_data)<EOL>ignore_data.update(set(changed_parameters))<EOL>if len(used_runs) == <NUM_LIT:0>:<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>rename_dict = {}<EOL>self._logger.info('<STR_LIT>')<EOL>allowed_translations = set([translation for translation, pair in<EOL>other_trajectory._reversed_wildcards.items() if<EOL>any(x in used_runs for x in pair[<NUM_LIT:0>])])<EOL>self._merge_single_runs(other_trajectory, used_runs)<EOL>self._logger.info('<STR_LIT>')<EOL>self._merge_derived_parameters(other_trajectory=other_trajectory,<EOL>used_runs=used_runs,<EOL>rename_dict=rename_dict,<EOL>allowed_translations=allowed_translations,<EOL>ignore_data=ignore_data)<EOL>self._merge_results(other_trajectory=other_trajectory,<EOL>used_runs=used_runs,<EOL>rename_dict=rename_dict,<EOL>allowed_translations=allowed_translations,<EOL>ignore_data=ignore_data)<EOL>self._logger.info('<STR_LIT>')<EOL>self._logger.info('<STR_LIT>')<EOL>self._storage_service.store(pypetconstants.PREPARE_MERGE, self,<EOL>trajectory_name=self.v_name,<EOL>changed_parameters=changed_parameters,<EOL>old_length=old_len)<EOL>if not slow_merge:<EOL><INDENT>try:<EOL><INDENT>try:<EOL><INDENT>other_filename = other_trajectory.v_storage_service.filename<EOL><DEDENT>except AttributeError:<EOL><INDENT>self._logger.warning('<STR_LIT>'<EOL>'<STR_LIT>')<EOL>other_filename = None<EOL><DEDENT>self._storage_service.store(pypetconstants.MERGE, '<STR_LIT>', trajectory_name=self.v_name,<EOL>other_trajectory_name=other_trajectory.v_name,<EOL>rename_dict=rename_dict, move_nodes=move_data,<EOL>delete_trajectory=delete_other_trajectory,<EOL>other_filename=other_filename)<EOL><DEDENT>except pex.NoSuchServiceError as exc:<EOL><INDENT>self._logger.exception('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>')<EOL>slow_merge = True<EOL><DEDENT>except ValueError as exc:<EOL><INDENT>self._logger.exception('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>')<EOL>slow_merge = True<EOL><DEDENT><DEDENT>if slow_merge:<EOL><INDENT>self._merge_slowly(other_trajectory, rename_dict)<EOL><DEDENT>if merge_config:<EOL><INDENT>self._merge_config(other_trajectory)<EOL><DEDENT>self._merge_links(other_trajectory=other_trajectory,<EOL>used_runs=used_runs,<EOL>allowed_translations=allowed_translations,<EOL>ignore_data=original_ignore_data)<EOL>self._logger.info('<STR_LIT>')<EOL>formatted_time = datetime.datetime.fromtimestamp(timestamp).strftime('<STR_LIT>')<EOL>hexsha = hashlib.sha1((self.v_name +<EOL>str(self.v_timestamp) +<EOL>other_trajectory.v_name +<EOL>str(other_trajectory.v_timestamp) +<EOL>VERSION).encode('<STR_LIT:utf-8>')).hexdigest()<EOL>short_hexsha = hexsha[<NUM_LIT:0>:<NUM_LIT:7>]<EOL>if keep_info:<EOL><INDENT>merge_name = '<STR_LIT>' % (short_hexsha, formatted_time)<EOL>config_name = '<STR_LIT>' % merge_name<EOL>self.f_add_config(config_name, len(used_runs),<EOL>comment='<STR_LIT>')<EOL>config_name = '<STR_LIT>' % merge_name<EOL>self.f_add_config(config_name, timestamp,<EOL>comment='<STR_LIT>')<EOL>config_name = '<STR_LIT>' % merge_name<EOL>self.f_add_config(config_name, hexsha,<EOL>comment='<STR_LIT>')<EOL>config_name = '<STR_LIT>' % merge_name<EOL>self.f_add_config(config_name, remove_duplicates,<EOL>comment='<STR_LIT>')<EOL>if original_ignore_data:<EOL><INDENT>config_name = '<STR_LIT>' % merge_name<EOL>self.f_add_config(config_name, tuple(original_ignore_data),<EOL>comment='<STR_LIT>')<EOL><DEDENT>config_name = '<STR_LIT>' % merge_name<EOL>self.f_add_config(config_name, len(self),<EOL>comment='<STR_LIT>')<EOL>self.config.merge.v_comment = '<STR_LIT>'<EOL>if self.v_version != VERSION:<EOL><INDENT>config_name = '<STR_LIT>' % merge_name<EOL>self.f_add_config(config_name, self.v_version,<EOL>comment='<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>if trial_parameter is not None:<EOL><INDENT>config_name = '<STR_LIT>' % merge_name<EOL>self.f_add_config(config_name, len(other_trajectory),<EOL>comment='<STR_LIT>')<EOL><DEDENT>if keep_other_trajectory_info:<EOL><INDENT>if other_trajectory.v_version != self.v_version:<EOL><INDENT>config_name = '<STR_LIT>' % merge_name<EOL>self.f_add_config(config_name, other_trajectory.v_version,<EOL>comment='<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>config_name = '<STR_LIT>' % merge_name<EOL>self.f_add_config(config_name, other_trajectory.v_name,<EOL>comment='<STR_LIT>')<EOL>config_name = '<STR_LIT>' % merge_name<EOL>self.f_add_config(config_name, other_trajectory.v_timestamp,<EOL>comment='<STR_LIT>'<EOL>'<STR_LIT>')<EOL>config_name = '<STR_LIT>' % merge_name<EOL>self.f_add_config(config_name, len(other_trajectory),<EOL>comment='<STR_LIT>')<EOL>if other_trajectory.v_comment:<EOL><INDENT>config_name = '<STR_LIT>' % merge_name<EOL>self.f_add_config(config_name, other_trajectory.v_comment,<EOL>comment='<STR_LIT>')<EOL><DEDENT><DEDENT><DEDENT>if not consecutive_merge:<EOL><INDENT>self._logger.info('<STR_LIT>')<EOL>self.f_store(store_data=pypetconstants.STORE_DATA)<EOL>self._reversed_wildcards = {}<EOL><DEDENT>other_trajectory._reversed_wildcards = {}<EOL>self._logger.info('<STR_LIT>')<EOL>

Merges another trajectory into the current trajectory.

        Both trajectories must live in the same space. This means both need to have the same
        parameters with similar types of values.

        Note that links are also merged. There are exceptions: Links found under
        a generic run group called `run_ALL` or links linking to a node under such a
        group are NOT merged and simply skipped, because there is no straightforward
        way to resolve the link.

        :param other_trajectory: Other trajectory instance to merge into the current one.

        :param trial_parameter:

            If you have a particular parameter that specifies only the trial
            number, i.e. an integer parameter running form 0 to T1 and
            0 to T2, the parameter is modified such that after merging it will
            cover the range 0 to T1+T2+1. T1 is the number of individual trials in the current
            trajectory and T2 number of trials in the other trajectory.

        :param remove_duplicates:

            Whether you want to remove duplicate parameter points.
            Requires N1 * N2 (quadratic complexity in single runs).
            A ValueError is raised if no runs would be merged.

        :param ignore_data:

            List of full names of data that should be ignored and not merged.

        :param backup:

            If ``True``, backs up both trajectories into files chosen automatically
            by the storage services. If you want to customize your backup use
            the `f_backup` function instead.

        :param move_data:

           Tells the storage service to move data from one trajectory to the other
           instead of copying it.

           If you use the HDF5 storage service and both trajectories are
           stored in the same file, merging is performed fast directly within
           the file. You can choose if you want to copy nodes ('move_nodes=False`)
           from the other trajectory to the current one, or if you want to move them.
           Accordingly, the stored data is no longer accessible in the other trajectory.

        :param delete_other_trajectory:

            If you want to delete the other trajectory after merging.

        :param keep_info:

            If `True`, information about the merge is added to the trajectory `config` tree under
            `config.merge`.

        :param merge_config:

            Whether or not to merge all config parameters under `.config.git`,
            `.config.environment`, and `.config.merge` of the other trajectory
            into the current one.

        :param keep_other_trajectory_info:

            Whether to keep information like length, name, etc. of the other trajectory
            in case you want to keep all the information. Setting of `keep_other_trajectory_info`
            is irrelevant in case `keep_info=False`.

        :param consecutive_merge:
            Can be set to `True` if you are about to merge several trajectories into the current
            one within a loop to avoid quadratic complexity.
            But remember to store your trajectory manually after
            all merges. Also make sure that all parameters and derived parameters are available
            in your current trajectory and load them before the consecutive merging.
            Also avoid specifying a `trial_parameter` and set `backup=False`
            to avoid quadratic complexity in case of consecutive merges.

        :param slow_merge:
            Enforces a slow merging. This means all data is loaded one after the other to
            memory and stored to disk. Otherwise it is tried to directly copy the data
            from one file into another without explicitly loading the data.

        If you cannot directly merge trajectories within one HDF5 file, a slow merging process
        is used. Results are loaded, stored, and emptied again one after the other. Might take
        some time!

        Annotations of parameters and derived parameters under `.derived_parameters.trajectory`
        are NOT merged. If you wish to extract the annotations of these parameters you have to
        do that manually before merging. Note that annotations of results and derived parameters
        of single runs are copied, so you don't have to worry about these.


def _merge_single_runs(self, other_trajectory, used_runs):

count = len(self)  <EOL>run_indices = range(len(other_trajectory))<EOL>run_name_dict = OrderedDict()<EOL>to_store_groups_with_annotations = []<EOL>for idx in run_indices:<EOL><INDENT>if idx in used_runs:<EOL><INDENT>other_info_dict = other_trajectory.f_get_run_information(idx)<EOL>time_ = other_info_dict['<STR_LIT:time>']<EOL>timestamp = other_info_dict['<STR_LIT>']<EOL>completed = other_info_dict['<STR_LIT>']<EOL>short_environment_hexsha = other_info_dict['<STR_LIT>']<EOL>finish_timestamp = other_info_dict['<STR_LIT>']<EOL>runtime = other_info_dict['<STR_LIT>']<EOL>new_idx = used_runs[idx]<EOL>new_runname = self.f_wildcard('<STR_LIT:$>', new_idx)<EOL>run_name_dict[idx] = new_runname<EOL>info_dict = dict(<EOL>idx=new_idx,<EOL>time=time_,<EOL>timestamp=timestamp,<EOL>completed=completed,<EOL>short_environment_hexsha=short_environment_hexsha,<EOL>finish_timestamp=finish_timestamp,<EOL>runtime=runtime)<EOL>self._add_run_info(**info_dict)<EOL><DEDENT><DEDENT>

Updates the `run_information` of the current trajectory.


def _rename_full_name(self, full_name, other_trajectory, used_runs=None, new_run_idx=None):

split_name = full_name.split('<STR_LIT:.>')<EOL>for idx, name in enumerate(split_name):<EOL><INDENT>if name in other_trajectory._reversed_wildcards:<EOL><INDENT>run_indices, wildcards = other_trajectory._reversed_wildcards[name]<EOL>if new_run_idx is None:<EOL><INDENT>run_idx = None<EOL>for run_jdx in run_indices:<EOL><INDENT>if run_jdx in used_runs:<EOL><INDENT>run_idx = used_runs[run_jdx]<EOL>break<EOL><DEDENT>elif run_jdx == -<NUM_LIT:1>:<EOL><INDENT>run_idx = -<NUM_LIT:1><EOL>break<EOL><DEDENT><DEDENT>if run_idx is None:<EOL><INDENT>raise RuntimeError('<STR_LIT>')<EOL><DEDENT><DEDENT>else:<EOL><INDENT>run_idx = new_run_idx<EOL><DEDENT>new_name = self.f_wildcard(wildcards[<NUM_LIT:0>], run_idx)<EOL>split_name[idx] = new_name<EOL><DEDENT><DEDENT>full_name = '<STR_LIT:.>'.join(split_name)<EOL>return full_name<EOL>

Renames a full name based on the wildcards and a particular run


other_derived_parameters = other_trajectory._derived_parameters.copy()<EOL>new_first_run_idx = min(used_runs.values())<EOL>run_name_dummy = other_trajectory.f_wildcard('<STR_LIT:$>', -<NUM_LIT:1>)<EOL>for param_name in other_derived_parameters:<EOL><INDENT>if param_name in ignore_data:<EOL><INDENT>continue<EOL><DEDENT>split_name = param_name.split('<STR_LIT:.>')<EOL>if not any(x in run_name_dummy for x in split_name):<EOL><INDENT>continue<EOL><DEDENT>ignore_data.add(param_name)<EOL>param = other_derived_parameters[param_name]<EOL>new_param_name = self._rename_full_name(param_name, other_trajectory,<EOL>used_runs=used_runs)<EOL>if new_param_name in self:<EOL><INDENT>my_param = self.f_get(new_param_name, fast_access=False)<EOL>if (my_param._equal_values(my_param.f_get(), param.f_get()) and<EOL>not (my_param.f_has_range() or param.f_has_range())):<EOL><INDENT>continue<EOL><DEDENT><DEDENT>first_new_param_name = self._rename_full_name(param_name,<EOL>other_trajectory,<EOL>new_run_idx=new_first_run_idx)<EOL>rename_dict[param_name] = first_new_param_name<EOL>comment = param.v_comment<EOL>param_type = param.f_get_class_name()<EOL>param_type = self._create_class(param_type)<EOL>first_param = self.f_add_leaf(param_type,<EOL>first_new_param_name,<EOL>comment=comment)<EOL>for run_idx in used_runs.values():<EOL><INDENT>if run_idx == new_first_run_idx:<EOL><INDENT>continue<EOL><DEDENT>next_name = self._rename_full_name(param_name, other_trajectory,<EOL>new_run_idx=run_idx)<EOL>split_name = next_name.split('<STR_LIT:.>')<EOL>link_name = split_name.pop()<EOL>location_name = '<STR_LIT:.>'.join(split_name)<EOL>if not self.f_contains(location_name, shortcuts=False):<EOL><INDENT>the_group = self.f_add_group(location_name)<EOL><DEDENT>else:<EOL><INDENT>the_group = self.f_get(location_name)<EOL><DEDENT>the_group.f_add_link(link_name, first_param)<EOL><DEDENT><DEDENT>for param_name in other_derived_parameters:<EOL><INDENT>if param_name in ignore_data:<EOL><INDENT>continue<EOL><DEDENT>split_name = param_name.split('<STR_LIT:.>')<EOL>ignore_data.add(param_name)<EOL>if any(x in other_trajectory._reversed_wildcards and x not in allowed_translations<EOL>for x in split_name):<EOL><INDENT>continue<EOL><DEDENT>new_name = self._rename_full_name(param_name, other_trajectory,<EOL>used_runs=used_runs)<EOL>if self.f_contains(new_name):<EOL><INDENT>my_param = self.f_get(new_name, fast_access=False)<EOL>param = other_derived_parameters[param_name]<EOL>if (my_param._equal_values(my_param.f_get(), param.f_get()) and<EOL>not (my_param.f_has_range() or param.f_has_range())):<EOL><INDENT>continue<EOL><DEDENT>else:<EOL><INDENT>self._logger.error('<STR_LIT>'<EOL>'<STR_LIT>' % new_name)<EOL><DEDENT><DEDENT>rename_dict[param_name] = new_name<EOL><DEDENT>

Merges derived parameters that have the `run_ALL` in a name.

        Creates a new parameter with the name of the first new run and links to this
        parameter to avoid copying in all other runs.


def _merge_links(self, other_trajectory, used_runs, allowed_translations, ignore_data):

linked_items = other_trajectory._linked_by<EOL>run_name_dummys = set([f(-<NUM_LIT:1>) for f in other_trajectory._wildcard_functions.values()])<EOL>if len(linked_items) > <NUM_LIT:0>:<EOL><INDENT>self._logger.info('<STR_LIT>')<EOL>for old_linked_name in other_trajectory._linked_by:<EOL><INDENT>if old_linked_name in ignore_data:<EOL><INDENT>continue<EOL><DEDENT>split_name = old_linked_name.split('<STR_LIT:.>')<EOL>if any(x in run_name_dummys for x in split_name):<EOL><INDENT>self._logger.warning('<STR_LIT>'<EOL>'<STR_LIT>' %<EOL>(old_linked_name, str(run_name_dummys)))<EOL>continue<EOL><DEDENT>old_link_dict = other_trajectory._linked_by[old_linked_name]<EOL>split_name = old_linked_name.split('<STR_LIT:.>')<EOL>if all(x in allowed_translations for x in split_name):<EOL><INDENT>new_linked_full_name = self._rename_full_name(old_linked_name,<EOL>other_trajectory,<EOL>used_runs=used_runs)<EOL><DEDENT>else:<EOL><INDENT>new_linked_full_name = old_linked_name<EOL><DEDENT>for linking_node, link_set in old_link_dict.values():<EOL><INDENT>linking_full_name = linking_node.v_full_name<EOL>split_name = linking_full_name .split('<STR_LIT:.>')<EOL>if any(x in run_name_dummys for x in split_name):<EOL><INDENT>self._logger.warning('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>' %<EOL>(linking_full_name, str(run_name_dummys)))<EOL><DEDENT>split_name = linking_full_name .split('<STR_LIT:.>')<EOL>if any(x in allowed_translations for x in split_name):<EOL><INDENT>new_linking_full_name = self._rename_full_name(linking_full_name,<EOL>other_trajectory,<EOL>used_runs=used_runs)<EOL><DEDENT>else:<EOL><INDENT>new_linking_full_name = linking_full_name<EOL><DEDENT>for link in link_set:<EOL><INDENT>if (linking_full_name + '<STR_LIT:.>' + link) in ignore_data:<EOL><INDENT>continue<EOL><DEDENT>if link in run_name_dummys:<EOL><INDENT>self._logger.warning('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>' %<EOL>(link,<EOL>linking_full_name,<EOL>str(run_name_dummys)))<EOL>continue<EOL><DEDENT>try:<EOL><INDENT>new_linked_item = self.f_get(new_linked_full_name,<EOL>shortcuts=False)<EOL>if self.f_contains(new_linking_full_name):<EOL><INDENT>new_linking_item = self.f_get(new_linking_full_name,<EOL>shortcuts=False)<EOL><DEDENT>else:<EOL><INDENT>new_linking_item =  self.f_add_group(new_linking_full_name)<EOL><DEDENT>if link in allowed_translations:<EOL><INDENT>run_indices, wildcards = other_trajectory._reversed_wildcards[link]<EOL>link = self.f_wildcard(wildcards[<NUM_LIT:0>], used_runs[run_indices[<NUM_LIT:0>]])<EOL><DEDENT>if not link in new_linking_item._links:<EOL><INDENT>new_linking_item.f_add_link(link, new_linked_item)<EOL><DEDENT>else:<EOL><INDENT>self._logger.debug('<STR_LIT>' %<EOL>(link, new_linked_item.v_full_name))<EOL><DEDENT><DEDENT>except (AttributeError, ValueError) as exc:<EOL><INDENT>self._logger.error('<STR_LIT>'<EOL>'<STR_LIT>' %<EOL>(link, linking_full_name, old_linked_name,<EOL>repr(exc)))<EOL><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT>


self._logger.info('<STR_LIT>')<EOL>if '<STR_LIT>' in other_trajectory:<EOL><INDENT>self._logger.info('<STR_LIT>')<EOL>git_node = other_trajectory.f_get('<STR_LIT>')<EOL>param_list = []<EOL>for param in git_node.f_iter_leaves(with_links=False):<EOL><INDENT>if not self.f_contains(param.v_full_name, shortcuts=False):<EOL><INDENT>param_list.append(self.f_add_config(param))<EOL><DEDENT><DEDENT>if param_list:<EOL><INDENT>self.f_store_items(param_list)<EOL><DEDENT>self._logger.info('<STR_LIT>')<EOL><DEDENT>if '<STR_LIT>' in other_trajectory:<EOL><INDENT>self._logger.info('<STR_LIT>')<EOL>env_node = other_trajectory.f_get('<STR_LIT>')<EOL>param_list = []<EOL>for param in env_node.f_iter_leaves(with_links=False):<EOL><INDENT>if not self.f_contains(param.v_full_name, shortcuts=False):<EOL><INDENT>param_list.append(self.f_add_config(param))<EOL><DEDENT><DEDENT>if param_list:<EOL><INDENT>self.f_store_items(param_list)<EOL><DEDENT>self._logger.info('<STR_LIT>')<EOL><DEDENT>if '<STR_LIT>' in other_trajectory:<EOL><INDENT>self._logger.info('<STR_LIT>')<EOL>merge_node = other_trajectory.f_get('<STR_LIT>')<EOL>param_list = []<EOL>for param in merge_node.f_iter_leaves(with_links=False):<EOL><INDENT>if not self.f_contains(param.v_full_name, shortcuts=False):<EOL><INDENT>param_list.append(self.f_add_config(param))<EOL><DEDENT><DEDENT>if param_list:<EOL><INDENT>self.f_store_items(param_list)<EOL><DEDENT>self._logger.info('<STR_LIT>')<EOL><DEDENT>

Merges meta data about previous merges, git commits, and environment settings
        of the other trajectory into the current one.


def _merge_slowly(self, other_trajectory, rename_dict):

for other_key in rename_dict:<EOL><INDENT>new_key = rename_dict[other_key]<EOL>other_instance = other_trajectory.f_get(other_key)<EOL>if other_instance.f_is_empty():<EOL><INDENT>with self._nn_interface._disable_logging:<EOL><INDENT>other_trajectory.f_load_item(other_instance)<EOL><DEDENT><DEDENT>if not self.f_contains(new_key):<EOL><INDENT>class_name = other_instance.f_get_class_name()<EOL>class_ = self._create_class(class_name)<EOL>my_instance = self.f_add_leaf(class_, new_key)<EOL><DEDENT>else:<EOL><INDENT>my_instance = self.f_get(new_key, shortcuts=False)<EOL><DEDENT>if not my_instance.f_is_empty():<EOL><INDENT>raise RuntimeError('<STR_LIT>' % new_key)<EOL><DEDENT>load_dict = other_instance._store()<EOL>my_instance._load(load_dict)<EOL>my_instance.f_set_annotations(**other_instance.v_annotations.f_to_dict(copy=False))<EOL>my_instance.v_comment = other_instance.v_comment<EOL>self.f_store_item(my_instance)<EOL>if other_instance.v_is_parameter:<EOL><INDENT>other_instance.f_unlock()<EOL>my_instance.f_unlock()<EOL><DEDENT>other_instance.f_empty()<EOL>my_instance.f_empty()<EOL><DEDENT>

Merges trajectories by loading iteratively items of the other trajectory and
        store it into the current trajectory.

        :param rename_dict:

            Dictionary containing mappings from the old result names in the `other_trajectory`
            to the new names in the current trajectory.


def _merge_results(self, other_trajectory, rename_dict, used_runs, allowed_translations,<EOL>ignore_data):

other_results = other_trajectory._results.copy()<EOL>for result_name in other_results:<EOL><INDENT>if result_name in ignore_data:<EOL><INDENT>continue<EOL><DEDENT>split_name = result_name.split('<STR_LIT:.>')<EOL>ignore_data.add(result_name)<EOL>if any(x in other_trajectory._reversed_wildcards and x not in allowed_translations<EOL>for x in split_name):<EOL><INDENT>continue<EOL><DEDENT>new_name = self._rename_full_name(result_name, other_trajectory,<EOL>used_runs=used_runs)<EOL>if self.f_contains(new_name):<EOL><INDENT>self._logger.warning('<STR_LIT>' % new_name)<EOL>continue<EOL><DEDENT>rename_dict[result_name] = new_name<EOL><DEDENT>

Merges all results.

        :param rename_dict:

            Dictionary that is filled with the names of results in the `other_trajectory`
            as keys and the corresponding new names in the current trajectory as values.
            Note for results kept under trajectory run branch there is actually no need to
            change the names. So we will simply keep the original name.


if trial_parameter_name:<EOL><INDENT>if remove_duplicates:<EOL><INDENT>self._logger.warning('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>')<EOL>remove_duplicates = False<EOL><DEDENT><DEDENT>params_to_change = {}<EOL>if trial_parameter_name:<EOL><INDENT>my_trial_parameter = self.f_get(trial_parameter_name)<EOL>other_trial_parameter = other_trajectory.f_get(trial_parameter_name)<EOL>if not isinstance(my_trial_parameter, BaseParameter):<EOL><INDENT>raise TypeError('<STR_LIT>'<EOL>'<STR_LIT>' % trial_parameter_name)<EOL><DEDENT>if my_trial_parameter.f_has_range():<EOL><INDENT>my_trial_list = my_trial_parameter.f_get_range(copy=False)<EOL><DEDENT>else:<EOL><INDENT>my_trial_list = [my_trial_parameter.f_get()]<EOL><DEDENT>if other_trial_parameter.f_has_range():<EOL><INDENT>other_trial_list = other_trial_parameter.f_get_range(copy=False)<EOL><DEDENT>else:<EOL><INDENT>other_trial_list = [other_trial_parameter.f_get()]<EOL><DEDENT>mytrialset = set(my_trial_list)<EOL>mymaxtrial_T1 = max(mytrialset)  <EOL>if mytrialset != set(range(mymaxtrial_T1 + <NUM_LIT:1>)):<EOL><INDENT>raise TypeError('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>' % (mymaxtrial_T1, str(mytrialset)))<EOL><DEDENT>othertrialset = set(other_trial_list)<EOL>othermaxtrial_T2 = max(othertrialset)  <EOL>if othertrialset != set(range(othermaxtrial_T2 + <NUM_LIT:1>)):<EOL><INDENT>raise TypeError('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>' %<EOL>(othermaxtrial_T2, str(othertrialset)))<EOL><DEDENT>trial_parameter_name = my_trial_parameter.v_full_name<EOL>if not trial_parameter_name in self._explored_parameters:<EOL><INDENT>self._explored_parameters[trial_parameter_name] = my_trial_parameter<EOL><DEDENT>params_to_change[trial_parameter_name] = (my_trial_parameter, other_trial_parameter)<EOL><DEDENT>params_to_merge = other_trajectory._parameters.copy()<EOL>params_to_merge.update(other_trajectory._derived_parameters)<EOL>for ignore in ignore_data:<EOL><INDENT>if ignore in params_to_merge:<EOL><INDENT>del params_to_merge[ignore]<EOL><DEDENT><DEDENT>run_name_dummys = set([f(-<NUM_LIT:1>) for f in other_trajectory._wildcard_functions.values()])<EOL>for key in params_to_merge:<EOL><INDENT>other_param = params_to_merge[key]<EOL>split_key = key.split('<STR_LIT:.>')<EOL>if any(x in other_trajectory._reversed_wildcards for x in split_key):<EOL><INDENT>continue<EOL><DEDENT>my_param = self.f_get(key)<EOL>if not my_param._values_of_same_type(my_param.f_get(), other_param.f_get()):<EOL><INDENT>raise TypeError('<STR_LIT>'<EOL>'<STR_LIT>' % key)<EOL><DEDENT>if my_param.v_full_name == trial_parameter_name:<EOL><INDENT>continue<EOL><DEDENT>if (my_param.f_has_range() or<EOL>other_param.f_has_range() or<EOL>not my_param._equal_values(my_param.f_get(), other_param.f_get())):<EOL><INDENT>params_to_change[key] = (my_param, other_param)<EOL>if not my_param.f_has_range() and not other_param.f_has_range():<EOL><INDENT>remove_duplicates = False<EOL><DEDENT><DEDENT><DEDENT>used_runs = {}<EOL>for idx in range(len(other_trajectory)):<EOL><INDENT>used_runs[idx] = idx<EOL><DEDENT>if remove_duplicates:<EOL><INDENT>for irun in range(len(other_trajectory)):<EOL><INDENT>for jrun in range(len(self)):<EOL><INDENT>change = True<EOL>for my_param, other_param in params_to_change.values():<EOL><INDENT>if other_param.f_has_range():<EOL><INDENT>other_param._set_parameter_access(irun)<EOL><DEDENT>if my_param.f_has_range():<EOL><INDENT>my_param._set_parameter_access(jrun)<EOL><DEDENT>val1 = my_param.f_get()<EOL>val2 = other_param.f_get()<EOL>if not my_param._equal_values(val1, val2):<EOL><INDENT>change = False<EOL>break<EOL><DEDENT><DEDENT>if change:<EOL><INDENT>del used_runs[irun]<EOL>break<EOL><DEDENT><DEDENT><DEDENT>for my_param, other_param in params_to_change.values():<EOL><INDENT>other_param._restore_default()<EOL>my_param._restore_default()<EOL><DEDENT><DEDENT>adding_length = len(used_runs)<EOL>starting_length = len(self)<EOL>if adding_length == <NUM_LIT:0>:<EOL><INDENT>return used_runs, []<EOL><DEDENT>count = <NUM_LIT:0><EOL>for key in sorted(used_runs.keys()):<EOL><INDENT>used_runs[key] = starting_length + count<EOL>count += <NUM_LIT:1><EOL><DEDENT>for my_param, other_param in params_to_change.values():<EOL><INDENT>fullname = my_param.v_full_name<EOL>if fullname == trial_parameter_name:<EOL><INDENT>other_range = [x + mymaxtrial_T1 + <NUM_LIT:1> for x in other_trial_list]<EOL><DEDENT>else:<EOL><INDENT>if other_param.f_has_range():<EOL><INDENT>other_range = (x for jdx, x in enumerate(other_param.f_get_range(copy=False))<EOL>if jdx in used_runs)<EOL><DEDENT>else:<EOL><INDENT>other_range = (other_param.f_get() for _ in range(adding_length))<EOL><DEDENT><DEDENT>if not my_param.f_has_range():<EOL><INDENT>my_param.f_unlock()<EOL>my_param._explore((my_param.f_get() for _ in  range(len(self))))<EOL><DEDENT>my_param.f_unlock()<EOL>my_param._expand(other_range)<EOL>if not fullname in self._explored_parameters:<EOL><INDENT>self._explored_parameters[fullname] = my_param<EOL><DEDENT><DEDENT>return used_runs, list(params_to_change.keys())<EOL>

Merges parameters from the other trajectory into the current one.

        The explored parameters in the current trajectory are directly enlarged (in RAM),
        no storage service is needed here. Later on in `f_merge` the storage service
        will be requested to store the enlarge parameters to disk.

        Note explored parameters are always enlarged. Unexplored parameters might become
        new explored parameters if they differ in their default values
        in the current and the other trajectory, respectively.

        :return: A tuple with two elements:

            1.

                Dictionary of run index mappings from old trajectroy to the new one.

            2.

                List of names of parameters that were altered.


@not_in_run<EOL><INDENT>def f_migrate(self, new_name=None, in_store=False,<EOL>new_storage_service=None, **kwargs):<DEDENT>

if new_name is not None:<EOL><INDENT>self._name = new_name<EOL><DEDENT>unused_kwargs = set(kwargs.keys())<EOL>if new_storage_service is not None or len(kwargs) > <NUM_LIT:0>:<EOL><INDENT>self._storage_service, unused_kwargs = storage_factory(<EOL>storage_service=new_storage_service,<EOL>trajectory=self, **kwargs)<EOL><DEDENT>if len(unused_kwargs) > <NUM_LIT:0>:<EOL><INDENT>raise ValueError('<STR_LIT>' %<EOL>str(unused_kwargs))<EOL><DEDENT>self._stored = in_store<EOL>

Can be called to rename and relocate the trajectory.

        :param new_name: New name of the trajectory, None if you do not want to change the name.

        :param in_store:

            Set this to True if the trajectory has been stored with the new name at the new
            file before  and you just want to "switch back" to the location.
            If you migrate to a store used before and you do not set `in_store=True`,
            the storage service will throw a RuntimeError in case you store the Trajectory
            because it will assume that you try to store a new trajectory that accidentally has
            the very same name as another trajectory. If set to `True` and trajectory is not found
            in the file, the trajectory is simply stored to the file.

        :param new_storage_service:

            New service where you want to migrate to. Leave none if you want to keep the olde one.

        :param kwargs:

            Additional keyword arguments passed to the service.
            For instance, to change the file of the trajectory use ``filename='my_new_file.hdf5``.


@kwargs_api_change('<STR_LIT>')<EOL><INDENT>@kwargs_api_change('<STR_LIT>')<EOL>@kwargs_mutual_exclusive('<STR_LIT>', '<STR_LIT>', lambda x: not x)<EOL>def f_store(self, only_init=False, store_data=pypetconstants.STORE_DATA,<EOL>max_depth=None):<DEDENT>

if self._is_run:<EOL><INDENT>if self._new_nodes or self._new_links:<EOL><INDENT>self._storage_service.store(pypetconstants.SINGLE_RUN, self,<EOL>trajectory_name=self.v_name,<EOL>recursive=not only_init,<EOL>store_data=store_data,<EOL>max_depth=max_depth)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>self._storage_service.store(pypetconstants.TRAJECTORY, self,<EOL>trajectory_name=self.v_name,<EOL>only_init=only_init,<EOL>store_data=store_data,<EOL>max_depth=max_depth)<EOL>self._stored = True<EOL><DEDENT>

Stores the trajectory to disk and recursively all data in the tree.

        :param only_init:

            If you just want to initialise the store. If yes, only meta information about
            the trajectory is stored and none of the groups/leaves within the trajectory.
            Alternatively, you can pass `recursive=False`.

        :param store_data:

            Only considered if ``only_init=False``. Choose of the following:

                * :const:`pypet.pypetconstants.STORE_NOTHING`: (0)

                    Nothing is store.

                * :const:`pypet.pypetconstants.STORE_DATA_SKIPPING`: (1)

                    Speedy version of normal ``STORE_DATA`` will entirely skip groups
                    (but not their children) and leaves if they have been stored before.
                    No new data is added in this case.

                * :const:`pypet.pypetconstants.STORE_DATA`: (2)

                    Stores every group and leave node. If they contain data that is not yet stored
                    to disk it is added.

                * :const:`pypet.pypetconstants.OVERWRITE_DATA`: (3)

                    Stores all groups and leave nodes and will delete all data on disk
                    and overwrite it with the current data in RAM.

                    **NOT RECOMMENDED**! Overwriting data on disk fragments the HDF5 file and
                    yields badly compressed large files. Better stick to the concept
                    write once and read many!

        If you use the HDF5 Storage Service usually (STORE_DATA (2)) only novel data
        is stored to disk.
        If you have results that have been stored to disk before only new data items are added and
        already present data is NOT overwritten.

        Overwriting (OVERWRITE_DATA (3)) existing data with the HDF5 storage service
        is not recommended due to fragmentation of the HDF5 file. Better stick to the concept
        write once, but read often.

        If you want to store individual parameters or results, you might want to
        take a look at :func:`~pypet.Trajectory.f_store_items`.
        To store whole subtrees of your trajectory check out
        :func:`~pypet.naturalnaming.NNGroupNode.f_store_child`.
        Note both functions require that your trajectory was stored to disk with `f_store`
        at least once before.

        **ATTENTION**: Calling `f_store` during a single run the behavior is different.

        To avoid re-storing the full trajectory in every single run, which is redundant,
        only sub-trees of the trajectory are really stored.

        The storage serivce looks for new data that is added below groups called `run_XXXXXXXXXX`
        and stores it where `XXXXXXXXX` is the index of this run. The `only_init` parameter is
        ignored in this case. You can avoid this behavior by using the argument from below.

        :param max_depth:

            Maximum depth to store tree (inclusive). During single runs `max_depth` is also counted
            from root.


return (len(self._parameters) == <NUM_LIT:0> and<EOL>len(self._derived_parameters) == <NUM_LIT:0> and<EOL>len(self._results) == <NUM_LIT:0> and<EOL>len(self._other_leaves) == <NUM_LIT:0>)<EOL>

Whether no results nor parameters have been added yet to the trajectory
        (ignores config).


self._idx = -<NUM_LIT:1><EOL>self._crun = None<EOL>for param in self._explored_parameters.values():<EOL><INDENT>if param is not None:<EOL><INDENT>param._restore_default()<EOL><DEDENT><DEDENT>

Restores the default value in all explored parameters and sets the
        v_idx property back to -1 and v_crun to None.


for param in self._explored_parameters.values():<EOL><INDENT>if param is not None:<EOL><INDENT>param._set_parameter_access(idx)<EOL><DEDENT><DEDENT>

Notifies the explored parameters what current point in the parameter space
        they should represent.


self._is_run = False <EOL>self._new_nodes = OrderedDict()<EOL>self._new_links = OrderedDict()<EOL>self._is_run = True<EOL>return self<EOL>

Modifies the trajectory for single runs executed by the environment


if sort:<EOL><INDENT>return [self.f_idx_to_run(idx) for idx in range(len(self))]<EOL><DEDENT>else:<EOL><INDENT>return list(self._run_information.keys())<EOL><DEDENT>

Returns a list of run names.

        ONLY useful for a single run during multiprocessing if ``v_full_copy` was set to ``True``.
        Otherwise only the current run is available.

        :param sort:

            Whether to get them sorted, will only require O(N) [and not O(N*log N)] since we
            use (sort of) bucket sort.


def f_get_run_information(self, name_or_idx=None, copy=True):

if name_or_idx is None:<EOL><INDENT>if copy:<EOL><INDENT>return cp.deepcopy(self._run_information)<EOL><DEDENT>else:<EOL><INDENT>return self._run_information<EOL><DEDENT><DEDENT>try:<EOL><INDENT>if copy:<EOL><INDENT>return self._run_information[name_or_idx].copy()<EOL><DEDENT>else:<EOL><INDENT>return self._run_information[name_or_idx]<EOL><DEDENT><DEDENT>except KeyError:<EOL><INDENT>name_or_idx = self.f_idx_to_run(name_or_idx)<EOL>if copy:<EOL><INDENT>return self._run_information[name_or_idx].copy()<EOL><DEDENT>else:<EOL><INDENT>return self._run_information[name_or_idx]<EOL><DEDENT><DEDENT>

Returns a dictionary containing information about a single run.

        ONLY useful during a single run if ``v_full_copy` was set to ``True``.
        Otherwise only the current run is available.

        The information dictionaries have the following key, value pairings:

            * completed: Boolean, whether a run was completed

            * idx: Index of a run

            * timestamp: Timestamp of the run as a float

            * time: Formatted time string

            * finish_timestamp: Timestamp of the finishing of the run

            * runtime: Total runtime of the run in human readable format

            * name: Name of the run

            * parameter_summary:

                A string summary of the explored parameter settings for the particular run

            * short_environment_hexsha: The short version of the environment SHA-1 code

        If no name or idx is given then a nested dictionary with keys as run names and
        info dictionaries as values is returned.

        :param name_or_idx: str or int

        :param copy:

            Whether you want the dictionary used by the trajectory or a copy. Note if
            you want the real thing, please do not modify it, i.e. popping or adding stuff. This
            could mess up your whole trajectory.

        :return:

            A run information dictionary or a nested dictionary of information dictionaries
            with the run names as keys.


def f_find_idx(self, name_list, predicate):

if self._is_run and not self.v_full_copy:<EOL><INDENT>raise TypeError('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>if isinstance(name_list, str):<EOL><INDENT>name_list = [name_list]<EOL><DEDENT>iter_list = []<EOL>for name in name_list:<EOL><INDENT>param = self.f_get(name)<EOL>if not param.v_is_parameter:<EOL><INDENT>raise TypeError('<STR_LIT>' %<EOL>(name, str(type(param))))<EOL><DEDENT>if param.f_has_range():<EOL><INDENT>iter_list.append(iter(param.f_get_range(copy=False)))<EOL><DEDENT>else:<EOL><INDENT>iter_list.append(itools.repeat(param.f_get(), len(self)))<EOL><DEDENT><DEDENT>logic_iter = map(predicate, *iter_list)<EOL>for idx, item in enumerate(logic_iter):<EOL><INDENT>if item:<EOL><INDENT>yield idx<EOL><DEDENT><DEDENT>

Finds a single run index given a particular condition on parameters.

        ONLY useful for a single run if ``v_full_copy` was set to ``True``.
        Otherwise a TypeError is thrown.

        :param name_list:

            A list of parameter names the predicate applies to, if you have only a single
            parameter name you can omit the list brackets.

        :param predicate:

            A lambda predicate for filtering that evaluates to either ``True`` or  ``False``

        :return: A generator yielding the matching single run indices

        Example:

        >>> predicate = lambda param1, param2: param1==4 and param2 in [1.0, 2.0]
        >>> iterator = traj.f_find_idx(['groupA.param1', 'groupA.param2'], predicate)
        >>> [x for x in iterator]
        [0, 2, 17, 36]


return self._single_run_ids[name_or_idx]<EOL>

Converts an integer idx to the corresponding single run name and vice versa.

        Note during a single run ONLY useful if ``v_full_copy`` was set to True.

        :param name_or_idx: Name of a single run or an integer index

        :return: The corresponding idx or name of the single run

        Example usage:

        >>> traj.f_idx_to_run(4)
        'run_00000004'
        >>> traj.f_idx_to_run('run_00000000')
        0


def f_start_run(self, run_name_or_idx=None, turn_into_run=True):

if self._run_started:<EOL><INDENT>return self<EOL><DEDENT>if run_name_or_idx is None:<EOL><INDENT>if self.v_idx == -<NUM_LIT:1>:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT><DEDENT>else:<EOL><INDENT>self.f_set_crun(run_name_or_idx)<EOL><DEDENT>self._run_started = True<EOL>if turn_into_run:<EOL><INDENT>self._make_single_run()<EOL><DEDENT>self._set_start()<EOL>return self<EOL>

Can be used to manually allow running of an experiment without using an environment.

        :param run_name_or_idx:

            Can manually set a trajectory to a particular run. If `None` the current run
            the trajectory is set to is used.

        :param turn_into_run:

            Turns the trajectory into a run, i.e. reduces functionality but makes storing
            more efficient.


def f_finalize_run(self, store_meta_data=True, clean_up=True):

if not self._run_started:<EOL><INDENT>return self<EOL><DEDENT>self._set_finish()<EOL>if clean_up and self._is_run:<EOL><INDENT>self._finalize_run()<EOL><DEDENT>self._is_run = False<EOL>self._run_started = False<EOL>self._updated_run_information.add(self.v_idx)<EOL>if store_meta_data:<EOL><INDENT>self.f_store(only_init=True)<EOL><DEDENT>return self<EOL>

Can be called to finish a run if manually started.

        Does NOT reset the index of the run,
        i.e. ``f_restore_default`` should be called manually if desired.

        Does NOT store any data (except meta data) so you have to call
        ``f_store`` manually before to avoid data loss.

        :param store_meta_data:

            If meta data like the runtime should be stored

        :param clean_up:

            If data added during the run should be cleaned up.
            Only works if ``turn_into_run`` was set to ``True``.


init_time = time.time()<EOL>formatted_time = datetime.datetime.fromtimestamp(init_time).strftime('<STR_LIT>')<EOL>run_info_dict = self._run_information[self.v_crun]<EOL>run_info_dict['<STR_LIT>'] = init_time<EOL>run_info_dict['<STR_LIT:time>'] = formatted_time<EOL>if self._environment_hexsha is not None:<EOL><INDENT>run_info_dict['<STR_LIT>'] = self._environment_hexsha[<NUM_LIT:0>:<NUM_LIT:7>]<EOL><DEDENT>

Sets the start timestamp and formatted time to the current time.


runsummary = '<STR_LIT>'<EOL>for idx, expparam in enumerate(self._explored_parameters.values()):<EOL><INDENT>if idx > <NUM_LIT:0>:<EOL><INDENT>runsummary += '<STR_LIT:U+002CU+0020>'<EOL><DEDENT>valstr = expparam.f_val_to_str()<EOL>if len(valstr) >= pypetconstants.HDF5_STRCOL_MAX_COMMENT_LENGTH:<EOL><INDENT>valstr = valstr[<NUM_LIT:0>:pypetconstants.HDF5_STRCOL_MAX_COMMENT_LENGTH - <NUM_LIT:3>]<EOL>valstr += '<STR_LIT>'<EOL><DEDENT>if expparam.v_name in runsummary:<EOL><INDENT>param_name = expparam.v_full_name<EOL><DEDENT>else:<EOL><INDENT>param_name = expparam.v_name<EOL><DEDENT>runsummary = runsummary + param_name + '<STR_LIT>' + valstr<EOL><DEDENT>return runsummary<EOL>

Summarizes the parameter settings.

        :param run_name: Name of the single run

        :param paramlist: List of explored parameters

        :param add_table: Whether to add the overview table

        :param create_run_group:

            If a group with the particular name should be created if it does not exist.
            Might be necessary when trajectories are merged.


run_info_dict = self._run_information[self.v_crun]<EOL>timestamp_run = run_info_dict['<STR_LIT>']<EOL>run_summary = self._summarize_explored_parameters()<EOL>finish_timestamp_run = time.time()<EOL>findatetime = datetime.datetime.fromtimestamp(finish_timestamp_run)<EOL>startdatetime = datetime.datetime.fromtimestamp(timestamp_run)<EOL>runtime_run = str(findatetime - startdatetime)<EOL>run_info_dict['<STR_LIT>'] = run_summary<EOL>run_info_dict['<STR_LIT>'] = <NUM_LIT:1><EOL>run_info_dict['<STR_LIT>'] = finish_timestamp_run<EOL>run_info_dict['<STR_LIT>'] = runtime_run<EOL>

Sets the finish time and computes the runtime in human readable format


def _construct_instance(self, constructor, full_name, *args, **kwargs):

if getattr(constructor, '<STR_LIT>', False):<EOL><INDENT>return constructor(full_name, self, *args, **kwargs)<EOL><DEDENT>else:<EOL><INDENT>return constructor(full_name, *args, **kwargs)<EOL><DEDENT>

Creates a new node. Checks if the new node needs to know the trajectory.

        :param constructor:  The constructor to use
        :param full_name: Full name of node
        :param args: Arguments passed to constructor
        :param kwargs: Keyword arguments passed to the constructor
        :return:


return dynamicimports.create_class(class_name, self._dynamic_imports)<EOL>

Dynamically creates a class.

        It is tried if the class can be created by the already given imports.
        If not the list of the dynamically loaded classes is used.


return self._shortcuts<EOL>

Whether shortcuts are allowed if accessing data via natural naming or
        squared bracket indexing.


return self._max_depth<EOL>

The maximum depth the tree should be searched if shortcuts are allowed.

        Set to `None` if there should be no depth limit.


return self._iter_recursive<EOL>

Whether using `__iter__` should iterate only immediate children or
        recursively all nodes.


return self._auto_load<EOL>

Whether the trajectory should attempt to load data on the fly.


return self._timestamp<EOL>


return self._time<EOL>

Formatted time string of the time the trajectory or run was created.


return self._standard_parameter<EOL>

The standard parameter used for parameter creation


self._standard_parameter = parameter<EOL>


return self._standard_result<EOL>

The standard result class used for result creation


self._standard_result = result<EOL>


return self._standard_leaf<EOL>

The standard constructor used if you add a generic leaf.

        The constructor is only used if you do not add items under the usual four subtrees
        (`parameters`, `derived_parameters`, `config`, `results`).


self._standard_leaf = leaf<EOL>