Itemizer

class decida.Itemizer.Itemizer(*iterables, **kwargs)

Bases: future.types.newobject.newobject

synopsis:

Cross-product iterator with tag.

Each Itemizer iteration produces a list of elements, one from each contributing list of iterators.

At each iteration, the tag() method produces a string for naming or reporting.

constructor arguments:

*iterators (iterables)

variable arguments are each an iterator

tag (str, default=None)

format string for the tag. If None, then tag is “%s. ... %s” (number of iterators)

results:

  • the Itemizer instance iterates over the cross-product of all of the specified iterators.
  • each iteration produces a list of elements, one from each iterator.
  • the tag() method produces a string for naming or reporting.

example (from test_Itemizer):

>>> from decida.Itemizer import Itemizer
>>> procs = ["TT", "SS", "FF"]
>>> vdds  = [0.9, 1.0, 1.1]
>>> temps = [0, 25, 100]
>>> ix = Itemizer(procs, vdds, temps, tag="%s.V_%s.T_%s")
>>> for proc, vdd, temp in ix :
>>>    tag = ix.tag()
>>>    print tag, proc, vdd, temp
TT.V_0.9.T_0 TT 0.9 0
TT.V_0.9.T_25 TT 0.9 25
TT.V_0.9.T_100 TT 0.9 100
TT.V_1.0.T_0 TT 1.0 0
TT.V_1.0.T_25 TT 1.0 25
TT.V_1.0.T_100 TT 1.0 100
TT.V_1.1.T_0 TT 1.1 0
TT.V_1.1.T_25 TT 1.1 25
TT.V_1.1.T_100 TT 1.1 100
SS.V_0.9.T_0 SS 0.9 0
SS.V_0.9.T_25 SS 0.9 25
SS.V_0.9.T_100 SS 0.9 100
SS.V_1.0.T_0 SS 1.0 0
SS.V_1.0.T_25 SS 1.0 25
SS.V_1.0.T_100 SS 1.0 100
SS.V_1.1.T_0 SS 1.1 0
SS.V_1.1.T_25 SS 1.1 25
SS.V_1.1.T_100 SS 1.1 100
FF.V_0.9.T_0 FF 0.9 0
FF.V_0.9.T_25 FF 0.9 25
FF.V_0.9.T_100 FF 0.9 100
FF.V_1.0.T_0 FF 1.0 0
FF.V_1.0.T_25 FF 1.0 25
FF.V_1.0.T_100 FF 1.0 100
FF.V_1.1.T_0 FF 1.1 0
FF.V_1.1.T_25 FF 1.1 25
FF.V_1.1.T_100 FF 1.1 100

public methods:

tag()

generate string based on specified tag format and element values