Simulation control

Trajectory

class l2l.utils.trajectory.Trajectory(**keyword_args)[source]

Bases: object

The trajectory is a class which holds the history of the parameter space exploration, defines the current parameters to be explored and holds the results from each execution. Based on the pypet trajectory concept: https://github.com/SmokinCaterpillar/pypet

f_add_parameter_group(name, comment='')[source]

Adds a new parameter group :param name: name of the new parameter group :param comment: ignored for the moment. Kept to match pypet interface.

f_add_parameter_to_group(group_name, key, val)[source]

Adds a parameter to an already existing group.

Parameters:
  • group_name – Name of the group where the parameter should be added
  • key – Name of the parameter to be added
  • val – Value of the parameter

Throws an exception if the group does not exist

f_add_result(key, val, comment='')[source]

Adds a result to the trajectory :param key: it identifies either a generation params result group or another result :param val: The value to be added to the results TODO: verify where is the generation_params call performed

f_add_parameter(key, val, comment='')[source]

Adds a parameter to the trajectory :param key: Name of the parameter :param val: Value of the parameter :param comment

f_add_derived_parameter(key, val, comment='')[source]

Adds a derived parameter to the trajectory. Match the previous pypet interface. :param key: Name of the parameter :param val: Value of the parameter :param comment:

f_expand(build_dict, fail_safe=True)[source]

The expand function takes care of adding a new generation and individuals to the trajectory This is a critical function to allow the addition of a new generation, called by the optimizer from the postprocessing function :param build_dict: The dictionary containing the new generation id and its individuals :param fail_safe: Currently ignored

Individual

class l2l.utils.individual.Individual(generation=0, ind_idx=0, params=[])[source]

Bases: l2l.utils.groups.ParameterGroup

This class represents individuals in the parameter search. It derives from a Parameter group. The main elements which make an individual are the ID of its generation, its individual ID and the params specific for its run.

ParamterGroup

class l2l.utils.groups.ParameterGroup[source]

Bases: object

This class is a Dictionary which can be used to store parameters. It is used to fit the pypet already existing interface with the trajectory

f_add_parameter(key, val, comment='')[source]

Adds parameter with name key and value val. The comment is ignored for the moment but kept for compatibility with the pypet groups :param key: Name of the parameter :param val: Value of the parameter :param comment: Ignores for the moment