The Trajectory, Single Runs and Group Nodes

Trajectory

class pypet.trajectory.Trajectory(name='my_trajectory', add_time=True, comment='', dynamically_imported_classes=None, filename=None, file_title=None)

The trajectory manages results and parameters.

The trajectory is the container to interact with before and during a simulation. You can add four types of data to the trajectory:

  • Config:

    These are special parameters specifying modalities of how to run your simulations. Changing a config parameter should NOT have any influence on the results you obtain from your simulations.

    They specify runtime environment parameters like how many CPUs you use for multiprocessing etc.

    In fact, if you use the default runtime environment of this project, the environment will add some config parameters to your trajectory.

    The method to add these is f_add_config()

  • Parameters:

    These are your primary ammunition in numerical simulations. They specify how your simulation works. They can only be added before the actual running of the simulation exploring the parameter space. They can be added via f_add_parameter() and be explored using f_explore(). Or to expand an existing trajectory use f_expand().

    Your parameters should encompass all values that completely define your simulation, I recommend also storing random number generator seeds as parameters to guarantee that a simulation can be exactly repeated.

  • Derived Parameters:

    They are not much different from parameters except that they can be added anytime.

    Conceptually this encompasses stuff that is intermediately computed from the original parameters. For instance, as your original parameters you have a random number seed and some other parameters. From these you compute a connection matrix for a neural network. This connection matrix could be stored as a derived parameter.

    Derived parameters are added via f_add_derived_parameter()

  • Results:

    Result are added via the f_add_result()

There are several ways to access the parameters and results, to learn about these, fast access, and natural naming see Natural Naming.

Parameters:
  • name – Name of the trajectory, if add_time=True the current time is added as a string to the parameter name.
  • add_time – Boolean whether to add the current time to the trajectory name.
  • comment – A useful comment describing the trajectory.
  • dynamicly_imported_classes

    If the user has a custom parameter that needs to be loaded dynamically during runtime, the module containing the class needs to be specified here as a list of classes or strings naming classes and there module paths. For example: dynamically_imported_classes = [‘pypet.parameter.PickleParameter’,MyCustomParameter]

    If you only have a single class to import, you do not need the list brackets: dynamically_imported_classes = ‘pypet.parameter.PickleParameter’

  • filename – If you want to use the default HDF5StorageService, you can specify the filename of the HDF5 file. If you specify the filename, the trajectory will automatically create the corresponding service object.
  • file_title – HDF5 also let’s you specify the title of the file.
Raises:

AttributeError: If the name of the trajectory contains invalid characters.

TypeError: If the dynamically imported classes are not classes or strings.

Example usage:

>>> traj = Trajectory('ExampleTrajectory',dynamically_imported_classes=['Some.custom.class'],    comment = 'I am a neat example!', filename='experiment.hdf5', file_title='Experiments')
f_add_to_dynamic_imports(dynamically_imported_classes)

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

Parameters:dynamically_imported_classes

If the user has a custom parameter or result that needs to be loaded dynamically during runtime, the module containing the class needs to be specified here as a list of classes or strings naming classes and there module paths. For example: dynamically_imported_classes = [‘pypet.parameter.PickleParameter’,MyCustomParameter]

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

f_as_run(name_or_idx)

Can make the trajectory behave like a single run, for easy data analysis.

Has the following effects:
  • v_idx and v_as_run are set to the approriate index and run name

  • All explored parameters are set to the corresponding value in the exploration array, i.e. when you call f_get() (or fast access) on them you will get in return the value at the corresponding v_idx position in the exploration array.

  • If you perform a search (via Natural Naming) in the trajectory tree it will only search the run subtree under results and derived_parameters with the corresponding index. For instance, if you use f_as_run(‘run_00000007’) or f_as_run(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.

    Note that this functionality also effects the iterator functions f_iter_nodes() and f_iter_leaves().

    Also the shortcuts cr, current_run and, currentrun will map to the selected runname, i.e. traj.derived_parameters.cr with the settings from above mapped to traj.derived_parameters.run_00000007.

f_backup(backup_filename)

Backs up the trajectory with the given storage service.

Parameters:backup_filename – Name of file where to store the backup.
f_expand(build_dict)

Similar to f_explore(), but can be used to enlarge already completed trajectories.

f_explore(build_dict)

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 array as values.

All iterables need to have the same length.

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

f_find_idx(name_list, predicate)

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

Parameters:
  • name_list – A list of parameter names the predicate applies to
  • predicate – A lambda predicate for filtering that evaluates to either true or false.
Returns:

a generator returning the matching single run idx

Example:

>>> predicate = lambda param1,param2: param1.get()==4 and param2.get() in [1,2]
>>> iterator = traj.f_find_idx(['groupA.param1','groupA.param2'], predicate)
>>> [x for x in iterator]
[0,2,17,36]
f_get_run_information(name_or_idx=None, copy=True)

Returns a dictionary containing information about a single run.

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
  • 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 than a list of all dictionaries is returned.

Parameters:
  • name_or_idx – str or int
  • 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.
Returns:

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

f_get_run_names(sort=True)

Returns a list of run names.

Parameters:sort – Whether to get them sorted, will only require O(N) [and not O(N*log N)] since we use (sort of) bucket sort. Yet, will still be slower than sort=False because list comprehension is used
f_idx_to_run(name_or_idx)

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

Parameters:name_or_idx – Name of a single run of an integer index
Returns:The corresponding idx or name of the single run
f_is_completed(name_or_id=None)

Whether or not a given run is completed.

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

Parameters:name_or_id – Nam or id of a run to check
Returns:True or False
f_is_empty()

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

f_load(name=None, index=None, as_new=False, load_parameters=None, load_derived_parameters=None, load_results=None, force=False)

Loads a trajectory via the storage service.

Parameters:
  • name – Name of the trajectory to be loaded. If no name or index is specified the current name of the trajectory is used.
  • index – If you don’t specify a name you can also specify an index. The corresponding trajectory in the hdf5 file at the index position is loaded.
  • 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 and derived 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.
  • load_parameters – How parameters and config items are loaded
  • load_derived_parameters – How derived parameters are loaded
  • load_results

    How results are loaded

    You can specify how to load the parameters and config/derived_parameters/results.

    pypet.pypetconstants.LOAD_NOTHING: (0)
    Nothing is loaded

    pypet.pypetconstants.LOAD_SKELETON: (1)

    The skeleton including annotations are loaded, i.e. the items are empty. Note that if the items already exist in your trajectory an Attribute Error is thrown. If this is the case use -1 instead.

    pypet.pypetconstants.LOAD_DATA: (2)

    The whole data is loaded. Note that if the items already exist in your trajectory an Attribute Error is thrown. If this is the case use -2 instead.

    pypet.pypetconstants.UPDATE_SKELETON: (-1)

    The skeleton and annotations are updated, i.e. only items that are not currently part of your trajectory are loaded empty

    pypet.pypetconstants.UPDATE_DATA: (-2) Like (2)

    Only items that are currently not in your trajectory are loaded with data.
  • force – Pypet will refuse to load trajectories that have been created via pypet with a different version number. To load a trajectory from a previous version simply put force = True.
Raises:

Attribute Error:

If options 1 and 2 (load skeleton and load data) are applied but the objects already exist in your trajectory. This prevents implicitly overriding data in RAM. Use -1 and -2 instead to load only items that are currently not in your trajectory in RAM. Or remove the items you want to ‘reload’ first.

f_load_item(item, *args, **kwargs)

Loads a single item, see also f_load_items()

f_load_items(iterator, *args, **kwargs)

Loads parameters specified in iterator. You can directly list the Parameter objects or their names.

If names are given the ~pypet.trajectory.Trajectory.f_get method is applied to find the parameters or results in the trajectory. If kwargs f_contains the keyword >>only_empties=True<<, only empty parameters or results are passed to the storage service to get loaded.

This function is useful if you called f_update_skeleton() before and now you want to load the data of individual results one by one.

Parameters:
  • iterator – A list with parameters or results to be loaded.
  • args – Additional arguments directly passed to the storage service
  • kwargs

    Additional keyword arguments directly passed to the storage service (except the kwarg only_empties)

    If you use the standard hdf5 storage service, you can pass the following additional keyword argument:

    param load_only:
     If you load a result, you can partially load it and ignore the rest. Just specify the name of the data you want to load. You can also provide a list, for example load_only=’spikes’, load_only=[‘spikes’,’membrane_potential’]

    Throws a ValueError if data cannot be found.

f_lock_derived_parameters()

Locks all derived parameters

f_lock_parameters()

Locks all parameters

f_merge(other_trajectory, trial_parameter=None, remove_duplicates=False, ignore_trajectory_derived_parameters=False, ignore_trajectory_results=False, backup_filename=None, move_nodes=False, delete_other_trajectory=False, merge_config=True, keep_other_trajectory_info=True)

Merges another trajectory into the current trajectory.

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

Parameters:
  • other_trajectory – Other trajectory instance to merge into the current one.
  • trial_parameter – If you have a particular parameter that specifies only the trial number, i.e. an integer parameter running form 0 to N1 and 0 to N2, the parameter is modified that after merging it will cover the range 0 to N1+N2.
  • remove_duplicates – Whether you want to remove duplicate parameter points. Requires N1 * N2 (quadratic complexity in single runs).
  • ignore_trajectory_derived_parameters – Whether you want to ignore or merge derived parameters kept under .derived_parameters.trajectory
  • ignore_trajectory_results – As above but with results. If you have trajectory results with the same name in both trajectories, the result in the current trajectory is kept and the other one is not merged into the current trajectory.
  • backup_filename – If specified, backs up both trajectories into the given filename. You could also say backup_filename = True, than the trajectories are backed up into a file in your data folder and a name is automatically chosen.
  • move_nodes – If you use the HDF5 storage service and both trajectories are stored in the same file, merging is achieved fast directly within the file. You can choose if you want to copy nodes 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.
  • delete_other_trajectory – If you want to delete the other trajectory after merging
  • 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.
  • keep_other_trajectory_info – Whether to keep information like length, name, etc. of the other trajectory.

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.

f_preset_config(config_name, *args, **kwargs)

Similar to func:~pypet.trajectory.Trajectory.f_preset_parameter.

f_preset_parameter(param_name, *args, **kwargs)

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).

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

Parameters:param_name – The full name of the parameter that is to be changed after its creation.

Example:

>>> traj.f_preset_parameter('groupA.param1', data=44)
>>> traj.f_add_parameter('groupA.param1', data=11)
>>> traj.parameters.groupA.param1.get()
44
f_remove_item(item, *args, **kwargs)

Removes a single item, see remove_items()

f_remove_items(iterable, *args, **kwargs)

Removes parameters, results or groups from the trajectory.

This function can also be used to erase data from disk via the storage service.

Parameters:
  • iterable – A sequence of items you want to remove. Either the instances themselves or strings with the names of the item.
  • remove_from_storage – Boolean whether you want to also delete the item from your storage.
  • remove_empty_groups – If your deletion of the instance leads to empty groups, these will be deleted, too.
  • args – Additional arguments passed to the storage service
  • kwargs – Additional keyword arguments passed to the storage service

Note if you use the standard hdf5 storage service, there are no additional arguments or keyword arguments to pass!

f_restore_default()

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

f_shrink()

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

Raises:TypeError if the trajectory was stored before.
f_store()

Stores the trajectory to disk.

If you use the HDF5 Storage Service only novel data is stored to disk.

If you have results that have been stored to disk before only new items are added and already present data is NOT overwritten.

Overwriting existing data with the HDF5 storage service is currently not supported.

f_update_skeleton()

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.

v_as_run

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

You can turn the trajectory to behave like a single run object if you set v_as_run 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_idx you can call pypet.trajectory.Trajectory.f_as_run:(). See it’s documentation for a description of making the trajectory behave like a single run.

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

v_comment

Should be a nice descriptive comment

v_full_copy

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

v_idx

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

You can turn the trajectory to behave like a single run object 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 pypet.trajectory.Trajectory.f_as_run:(). See it’s documentation for a description of making the trajectory behave like a single run.

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

v_storage_service

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

Default is the HDF5StorageService.

v_version

The version of pypet that was used to create the trajectory

SingleRun

class pypet.trajectory.SingleRun(name, idx, parent_trajectory)

Constitutes one specific parameter combination in the whole trajectory.

A SingleRun instance is accessed during the actual run phase of a trajectory. There exists a SingleRun object for each point in the parameter space.

Parameters can no longer be added, the parameter set is supposed to be complete before a the actual running of the experiment. However, derived parameters can still be added.

The instance of a SingleRun is never instantiated by the user but by the parent trajectory.

f_get_config(fast_access=False, copy=True)
Returns a dictionary containing the full config names as keys and the config parameters
or the config parameter values.
Parameters:
  • fast_access – Determines whether the parameter objects or their values are returned in the dictionary.
  • copy – Whether the original dictionary or a shallow copy is returned. If you want the real dictionary please do not modify it at all! Not Copying and fast access do not work at the same time! Raises TypeError if fast access is true and copy false.
Returns:

Dictionary containing the config data

Raises:

TypeError

f_get_derived_parameters(fast_access=False, copy=True)
Returns a dictionary containing the full parameter names as keys and the parameters

or the parameter values.

param fast_access:
 Determines whether the parameter objects or their values are returned in the dictionary. .
Parameters:copy – Whether the original dictionary or a shallow copy is returned. If you want the real dictionary please do not modify it at all! Not Copying and fast access do not work at the same time! Raises TypeError if fast access is true and copy false.
Returns:Dictionary containing the parameters.
Raises:TypeError
f_get_explored_parameters(fast_access=False, copy=True)
Returns a dictionary containing the full parameter names as keys and the parameters
or the parameter values.
Parameters:
  • fast_access – Determines whether the parameter objects or their values are returned in the dictionary..
  • copy – Whether the original dictionary or a shallow copy is returned. If you want the real dictionary please do not modify it at all! Not Copying and fast access do not work at the same time! Raises TypeError if fast access is true and copy false.
Returns:

Dictionary containing the parameters.

Raises:

TypeError

f_get_parameters(fast_access=False, copy=True)
Returns a dictionary containing the full parameter names as keys and the parameters
or the parameter values.
Parameters:
  • fast_access – Determines whether the parameter objects or their values are returned in the dictionary.
  • copy – Whether the original dictionary or a shallow copy is returned. If you want the real dictionary please do not modify it at all! Not Copying and fast access do not work at the same time! Raises TypeError if fast access is true and copy false.
Returns:

Dictionary containing the parameters.

Raises:

TypeError

f_get_results(fast_access=False, copy=True)

Returns a dictionary containing the full result names as keys and the corresponding result objects.

Parameters:
  • fast_access – Determines whether the result objects or their values are returned in the dictionary. Works only for results if they contain a single item with the name of the result.
  • copy – Whether the original dictionary or a shallow copy is returned. If you want the real dictionary please do not modify it at all! Not Copying and fast access do not work at the same time! Raises TypeError if fast access is true and copy false.
Returns:

Dictionary containing the results.

f_store(*args, **kwargs)

Stores the single run to disk

f_store_item(item, *args, **kwargs)

Stores a single item, see also f_store_items().

f_store_items(iterator, *args, **kwargs)

Stores individual items to disk.

This function is useful if you calculated very large results (or large derived parameters) during runtime and you want to write these to disk immediately and empty them afterwards to free some memory.

Parameters:
  • iterator – An iterable containing the parameters or results to store, either their names or the instances.
  • non_empties – Will only store the subset of provided items that are not empty.
  • args – Additional arguments passed to the storage service
  • kwargs – Additional keyword arguments passed to the storage service
Raises:

TypeError:

If the (parent) trajectory has never been stored to disk. In this case use :func:’pypet.trajectory.f_store` first.

ValueError: If no item could be found to be stored.

Note if you use the standard hdf5 storage service, there are no additional arguments or keyword arguments to pass!

f_to_dict(fast_access=False, short_names=False, copy=True)

Returns a dictionary with pairings of (full) names as keys and instances/values.

Parameters:
  • fast_access – If True, parameter values are returned instead of the instances. Works also for results if they contain a single item with the name of the result.
  • short_names – If true, keys are not full names but only the names. Raises a Value Error if the names are not unique.
  • copy – If fast_access=False and short_names=False you can access the original data dictionary if you set copy=False. If you do that, please do not modify anything! Raises Value Error if copy=False and fast_access=True or short_names=True.
Returns:

dictionary

Raises:

ValueError

v_check_uniqueness

Whether natural naming should check if naming is unambiguous.

Default is False. If True, searching a parameter or result via :func’~pypet.naturalnaming.NNGroupNode.f_get` will take O(N), because all nodes have to be visited!

v_environment_hexsha

If used with an environment this returns the current SHA-1 code of the environment.

v_fast_access

Whether parameter instances (False) or their values (True) are returned via natural naming.

Works also for results if they contain a single item with the name of the result.

Default is True.

v_idx

Index of the single run

v_search_strategy

Search strategy for lookup of items in the trajectory tree.

Default is breadth first search (BFS), you could also choose depth first search (DFS), but not recommended!

v_standard_parameter

The standard parameter used for parameter creation

v_standard_result

The standard result class used for result creation

v_stored

Whether or not the trajectory or run has been stored to disk before.

v_time

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

v_timestamp

Float timestamp of creation time

v_trajectory_name

Name of the parent trajectory

v_trajectory_time

Time trajectory was created

v_trajectory_timestamp

Timestamp when trajectory was created

NNGroupNode

class pypet.naturalnaming.NNGroupNode(nn_interface=None, full_name='', root=False)

A group node hanging somewhere under the trajectory or single run root node.

You can add other groups or parameters/results to it.

f_ann_to_string()

Returns annotations as string.

Equivalent to v_annotations.f_ann_to_str()

f_children()

Returns the number of children of the group.

f_contains(item, recursive=True)

Checks if the node contains a specific parameter or result.

It is checked if the item can be found via the “~pypet.naturalnaming.NNGroupNode.f_get” method.

Parameters:

item

Parameter/Result name or instance.

If a parameter or result instance is supplied it is also checked if the provided item and the found item are exactly the same instance, i.e. id(item)==id(found_item)

Param:

recursive:

Whether the whole sub tree under the group should be checked or only its immediate children. Default is the whole sub tree. If recursive=False you must only specify the name not the full name.

Returns:

True or False

f_get(name, fast_access=False, check_uniqueness=False, search_strategy='BFS')

Searches for an item (parameter/result/group node) with the given name.

Parameters:
  • name – Name of the item (full name or parts of the full name)
  • fast_access – If the result is a parameter, whether fast access should be applied.
  • check_uniqueness – Whether it should be checked if the name unambiguously yields a single result.
  • search_strategy – The search strategy (default and recommended is BFS)
Returns:

The found instance (result/parameter/group node) or if fast access is True and you found a parameter, the parameter’s value is returned.

f_get_annotations(*args)

Returns annotations

Equivalent to v_annotations.f_get(*args)

f_get_children(copy=True)

Returns a children dictionary.

Parameters:copy – Whether the group’s original dictionary or a shallow copy is returned. If you want the real dictionary please do not modify it at all!
Returns:Dictionary of nodes
f_get_class_name()

Returns the class name of the parameter or result or group, equivalent to return self.__class__.__name__

f_has_children()

Checks if node has children or not

f_is_root()

Returns whether the group is root (True for the trajectory and a single run object)

f_iter_leaves()

Iterates (recursively) over all leaves hanging below the current group.

f_iter_nodes(recursive=False, search_strategy='BFS')

Iterates over nodes hanging below this group.

Parameters:
  • recursive – Whether to iterate the whole sub tree or only immediate children.
  • search_strategy – Either BFS or DFS (BFS recommended)
Returns:

Iterator over nodes

f_load_child(name, recursive=False, load_data=-2)

Loads a child or recursively a subtree from disk.

For how to choose ‘load_data’ see :ref:’more-on-loading’.

f_remove_child(name, recursive=False)

Removes a child of the group.

Note that groups and leaves are only removed from the current trajectory in RAM. If the trajectory is stored to disk, this data is not affected. Thus, remove can be used only to free RAM memory!

If you want to free memory on disk via your storage service, use f_remove_items() of your trajectory.

Parameters:
  • name – Name of child
  • recursive – Must be true if child is a group that has children. Will remove the whole subtree in this case. Otherwise a Type Error is thrown.
Raises:

TypeError

f_set_annotations(*args, **kwargs)

Sets Annotations

Equivalent to calling v_annotations.f_set(*args,**kwargs)

f_store_child(name, recursive=False)

Stores a child or recursively a subtree to disk.

f_to_dict(fast_access=False, short_names=False)

Returns a dictionary with pairings of (full) names as keys and instances as values.

Parameters:
  • fast_access – If True, parameter values are returned instead of the instances.
  • short_names – If true, keys are not full names but only the names. Raises a Value Error if the names are not unique.
Returns:

dictionary

Raises:

ValueError

v_annotations

Annotation feature of a trajectory node.

Store some short additional information about your nodes here. If you use the standard HDF5 storage service, they will be stored as hdf5 node attributes.

v_creator_name

The name of the creator of the node, either the name of a single run (e.g. ‘run_00000009’) or ‘trajectory’.

Returns:String
v_depth

Depth of the node in the trajectory tree.

v_full_name

The full name, relative to the root node.

The full name of a trajectory or single run is the empty string since it is root.

v_leaf

Whether node is a leaf or not (i.e. it is a group node)

v_location

Location relative to the root node.

The location of a trajectory or single run is the empty string since it is root.

v_name

Name of the node

ParameterGroup

class pypet.naturalnaming.ParameterGroup(nn_interface=None, full_name='', root=False)

Group node in your trajectory, hanging below traj.parameters (or the parameters group itself).

You can add other groups or parameters to it.

f_add_parameter(*args, **kwargs)

Adds a parameter under the current node.

There are two ways to add a new parameter either by adding a parameter instance, directly:

>>> new_parameter = Parameter('group1.group2.myparam', data=42, comment='Example!')
>>> traj.f_add_parameter(new_parameter)

Or by passing the values directly to the function, with the name being the first (non-keyword!) argument:

>>> traj.f_add_parameter('group1.group2.myparam', data=42, comment='Example!')

If you want to create a different parameter than the standard parameter, you can give the constructor as the first (non-keyword!) argument followed by the name (non-keyword!):

>>> traj.f_add_parameter(PickleParameter,'group1.group2.myparam', data=42, comment='Example!')

The full name of the current node is added as a prefix to the given parameter name. If the current node is the trajectory the prefix ‘parameters’ is added to the name.

f_add_parameter_group(name)

Adds an empty parameter group under the current node.

Adds the full name of the current node as prefix to the name of the group. If current node is the trajectory or single run (root), the prefix ‘parameters’ is added to the full name.

The name can also contain subgroups separated via colons, for example: name=subgroup1.subgroup2.subgroup3. These other parent groups will be automatically be created.

ConfigGroup

class pypet.naturalnaming.ConfigGroup(nn_interface=None, full_name='', root=False)

Group node in your trajectory, hanging below traj.config.

You can add other groups or parameters to it.

f_add_config(*args, **kwargs)

Adds config under the current group.

Similar to f_add_parameter().

If current group is the trajectory the prefix ‘config’ is added to the name.

f_add_config_group(name)

Adds an empty config group under the current node.

Adds the full name of the current node as prefix to the name of the group. If current node is the trajectory or single run (root), the prefix ‘config’ is added to the full name.

The name can also contain subgroups separated via colons, for example: name=subgroup1.subgroup2.subgroup3. These other parent groups will be automatically be created.

DerivedParameterGroup

class pypet.naturalnaming.DerivedParameterGroup(nn_interface=None, full_name='', root=False)

Group node in your trajectory, hanging below traj.derived_parameters.

You can add other groups or parameters to it.

f_add_derived_parameter(*args, **kwargs)

Adds a derived parameter under the current group.

Similar to f_add_parameter().

Naming prefixes are added as in f_add_derived_parameter_group()

f_add_derived_parameter_group(name)

Adds an empty derived parameter group under the current node.

Adds the full name of the current node as prefix to the name of the group. If current node is the trajectory (root) adds the prefix ‘derived_parameters.trajectory’ to the full name. If current node is a single run (root) adds the prefix ‘derived_parameters.run_08%d%’ to the full name where ‘08%d’ is replaced by the index of the current run.

The name can also contain subgroups separated via colons, for example: name=subgroup1.subgroup2.subgroup3. These other parent groups will be automatically be created.

ResultGroup

class pypet.naturalnaming.ResultGroup(nn_interface=None, full_name='', root=False)

Group node in your trajectory, hanging below traj.results.

You can add other groups or results to it.

f_add_result(*args, **kwargs)

Adds a result under the current node.

There are two ways to add a new result either by adding a result instance, directly:

>>> new_result = Result('group1.group2.myresult', 1666, x=3, y=4, comment='Example!')
>>> traj.f_add_result(new_result)

Or by passing the values directly to the function, with the name being the first (non-keyword!) argument:

>>> traj.f_add_result('group1.group2.myresult', 1666, x=3, y=3,comment='Example!')

If you want to create a different result than the standard result, you can give the constructor as the first (non-keyword!) argument followed by the name (non-keyword!):

>>> traj.f_add_result(PickleResult,'group1.group2.myresult', 1666, x=3, y=3, comment='Example!')

Additional arguments (here 1666) or keyword arguments (here x=3, y=3) are passed onto the constructor of the result.

Adds the full name of the current node as prefix to the name of the result. If current node is the trajectory (root) adds the prefix ‘results.trajectory’ to the full name. If current node is a single run (root) adds the prefix ‘results.run_08%d%’ to the full name where ‘08%d’ is replaced by the index of the current run.

f_add_result_group(name)

Adds an empty result group under the current node.

Adds the full name of the current node as prefix to the name of the group. If current node is the trajectory (root) adds the prefix ‘results.trajectory’ to the full name. If current node is a single run (root) adds the prefix ‘results.run_08%d%’ to the full name where ‘08%d’ is replaced by the index of the current run.

The name can also contain subgroups separated via colons, for example: name=subgroup1.subgroup2.subgroup3. These other parent groups will be automatically be created.