Utils¶
Exploration Functions¶
Created on 24.05.2013
- pypet.utils.explore.cartesian_product(parameter_dict, combined_parameters=())¶
Generates a Cartesian product of the input parameter dictionary.
For example: >>> print cartesian_product({‘param1’:[1,2,3], ‘param2’:[42.0, 52.5]}) {‘param1’:[1,1,2,2,3,3],’param2’: [42.0,52.5,42.0,52.5,42.0,52.5]}
Parameters: - param_dict – Dictionary containing parameter names as keys and iterables of data to explore.
- combined_parameter_list –
Tuple of tuples. Defines the order of the parameters and parameters that are linked together. If an inner tuple contains only a single item, you can space the inner tuple brackets.
For example: >>> print cartesian_product( {‘param1’: [42.0, 52.5], ‘param2’:[‘a’, ‘b’], ‘param3’ : [1,2,3]}, ((‘param3’,),(‘param1’, ‘param2’))) {param3’:[1,1,2,2,3,3],’param1’ : [42.0,52.5,42.0,52.5,42.0,52.5], ‘param2’:[‘a’,’b’,’a’,’b’,’a’,’b’]}
Returns: Dictionary with cartesian product lists.