def _set_user_params(params, name: str, index: int, value: float):
    """Adjust a custom user-supplied parameter, held in
       Parameters.user_params[name]. Set a user parameter
       called 'name' via 'user.name' or '.name'.
    """
    if name.startswith('user.'):
        name = name[5:]
    elif name.startswith('.'):
        name = name[1:]
    if params.user_params is None:
        params.user_params = {}
    if index is None:
        params.user_params[name] = value
    else:
        if name not in params.user_params:
            params.user_params[name] = []
        while len(params.user_params[name]) <= index:
            params.user_params[name].append(None)
        params.user_params[name][index] = value
