Table of Contents

Module: multipleloop py4cs/multipleloop.py

Generate combination of multiple-valued parameters.

The purpose of this module is to set up parameter studies based on a certain input format for variables where multiple values of each parameter can be given.

Imported modules   
import operator
import py4cs.funcs
import re
Functions   
_outer
_test1
_test2
combine
dump
input2values
options
remove
varied_parameters
  _outer 
_outer ( a,  b )

Return the outer product/combination of two lists. a multi- or one-dimensional list or scalar b one-dimensional list or scalar (new parameter) Return: outer combination all. The function is to be called repeatedly: all = _outer(all, p)

Exceptions   
TypeError, 'a must be a list'
TypeError, 'a must be list of list'
  _test1 
_test1 ()

  _test2 
_test2 ()

  combine 
combine ( prm_values )

prm_values may be a nested list: prm_values[i] contains (parameter_name, list_of_parameter_values) for parameter no. i. prm_values may instead be a dictionary prm_values[parameter_name] = list_of_parameter_values

Three lists are returned: all all combinations (experiments) all[i] is the list of parameter values in experiment no i names list of all parameter names varied list of parameter names that are varied

  dump 
dump (
        all,
        names,
        varied,
        )

  input2values 
input2values ( s )

Translate a string s with multiple loop syntax into a list of single values (for the corresponding parameter).

Multiple loop syntax: -1 & -3.4 & 20 & 70 & [0:10,1.3] & [0:10] & 11.76

  options 
options (
        all,
        names,
        prefix='--',
        )

Return a list of command-line options. Input: all[i] list of parameter values in experiment no i names[i] name of parameter no. i Return: cmd[i] -name value pairs of all parameters in experiment no. i

  remove 
remove (
        condition,
        all,
        names,
        )

Remove experiments that fulfill a boolean condition. Example: all = remove(w < 1.0 and p = 1.2) or (q in (1,2,3) and f < 0.1, all, names) (names of the parametes must be used)

  varied_parameters 
varied_parameters (
        parameters,
        varied,
        names,
        )

Extract a subset of parameters corresponding to the names listed in the varied list. All names are in the list names. The parameters list corresponds to names. >>> parameters = [1,5,3] >>> names = [a,b,'c'] >>> varied = [a,'c'] >>> varied_parameteres(parameters, varied, names) [1,3]

Classes   

MultipleLoop

High-level, simplified interface to the functionality in

ReportHTML


Table of Contents

This document was automatically generated on Sun Mar 14 15:31:01 2004 by HappyDoc version 2.1