def valid(circuit, param):
    """ checks validity of parameters

    Parameters
    ----------
    circuit : string
        string defining the circuit

    param : list
        list of parameter values

    Returns
    -------
    valid : boolean

    Notes
    -----
    All parameters are considered valid if they are greater than zero --
    except for E2 (the exponent of CPE) which also must be less than one.

    """

    p_string = [x for x in circuit if x not in 'ps(),-/']

    for i, (a, b) in enumerate(zip(p_string[::2], p_string[1::2])):
        if str(a + b) == "E2":
            if param[i] <= 0 or param[i] >= 1:
                return False
        else:
            if param[i] <= 0:
                return False

    return True