.. _aggregationarg-py: ################# aggregationarg.py ################# ***************************** class AggregationArg(object): ***************************** Aggregation model argument container Attributes:: - operands: number of operands as integer - target_variable: target indice tuple (level, variable) - target_index: branch-object index that identifies the target objects - remove_targets: objects that were missing and should be removed - use_nan_funcs: True if operand values contain NaNs due to aggregation condition - values: operand values as list of numpy arrays - weights: weight values as list of numpy arrays - oper_target_index: operand target indices as a deque of numpy arrays - oper_data_level: operand data level indices in deque - success: model evaluation success as boolean - errors: list of error messages - results: results as numpy array def __init__(self, ind, tind, torem, scalar, deterministic=False): ================================================================== :: >>> from simo.simulation.model.aggregationarg import AggregationArg >>> import numpy >>> ind = (1,1) >>> tind = numpy.array([[0,0,0,0,0], ... [0,0,1,0,0], ... [0,0,2,0,0], ... [0,0,3,0,0], ... [0,0,4,0,0]], dtype=int) >>> torem = set([1]) >>> arg = AggregationArg(ind, tind, torem, True) >>> arg.target_variable (1, 1) def add_operand(self, datalevel, tind, rm_targets, values, weights, failed): ============================================================================ Add operand values and weights to argument container Add a single operand with weight:: >>> arg.add_operand(1, tind, set([]), [1,1,1,1,1], [2,2,2,2,2], []) >>> arg.operands 1 >>> arg.values deque([[1, 1, 1, 1, 1]]) >>> arg.weights deque([[2, 2, 2, 2, 2]]) Add second operand with weight:: >>> arg.add_operand(1, tind, set([3]), [1,1,1,1,1], [2,2,2,2,2], []) >>> arg.operands 2 >>> arg.values deque([[1, 1, 1, 1, 1], [1, 1, 1, 1, 1]]) >>> arg.weights deque([[2, 2, 2, 2, 2], [2, 2, 2, 2, 2]]) >>> arg.oper_target_index deque([array([[0, 0, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 2, 0, 0], [0, 0, 3, 0, 0], [0, 0, 4, 0, 0]]), array([[0, 0, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 2, 0, 0], [0, 0, 3, 0, 0], [0, 0, 4, 0, 0]])])