예제 #1
0
def _createparams(np, params, bounds):
    '''Create a Parameters list with bounds, popping off items from both input lists
    np     -- number of parameters
    params -- list of initial values
    bounds -- list of tuples of bounds
    '''

    if np > len(params):
        raise ValueError("Number of parameters supplied is less than that required")

    pl = [ _param(params.pop(0)) for _i in range(np) ]

    nbound = len(bounds)
    if nbound > np:
        nbound = np

    for i in range(nbound):
        b = bounds.pop(0)
        pli = pl[i]
        if b is not None:
            b = _asIterable(b)
            if b[0] is not None:
                pli.lowerLimit = b[0]
            if len(b) > 1:
                if b[1] is not None:
                    pli.upperLimit = b[1]
#    print [(p.value, p.lowerLimit, p.upperLimit) for p in pl]
    return pl
예제 #2
0
def _createparams(np, params, bounds):
    '''Create a Parameters list with bounds, popping off items from both input lists
    np     -- number of parameters
    params -- list of initial values
    bounds -- list of tuples of bounds
    '''

    if np > len(params):
        raise ValueError, "Number of parameters supplied is less than that required"

    pl = [_param(params.pop(0)) for _i in range(np)]

    nbound = len(bounds)
    if nbound > np:
        nbound = np

    for i in range(nbound):
        b = bounds.pop(0)
        if b is not None:
            b = _asIterable(b)
            if b[0] is not None:
                pl[i].lowerLimit = b[0]
            if len(b) > 1:
                if b[1] is not None:
                    pl[i].upperLimit = b[1]


#    print [(p.value, p.lowerLimit, p.upperLimit) for p in pl]
    return pl
예제 #3
0
def _createparams(np, params, bounds):
    '''Create a Parameters list with bounds, popping off items from both input lists
    np     -- number of parameters
    params -- list of initial values
    bounds -- list of tuples of bounds
    '''
    params = list(params)
    pl = [ _param(params.pop(0)) for i in range(np) ]

    bounds = list(bounds)
    nbound = len(bounds)
    if nbound > np:
        nbound = np
 
    for i in range(nbound):
        b = bounds.pop(0)
        if b is not None:
            b = _asIterable(b)
            if b[0] is not None:
                pl[i].lowerLimit = b[0]
            if len(b) > 1:
                if b[1] is not None:
                    pl[i].upperLimit = b[1]
#    print [(p.value, p.lowerLimit, p.upperLimit) for p in pl]
    return pl