def adapt_proj(proj, params: dict, param_map: dict):
    """Changes the parametrization of a circuit.

    Parameters
    ----------
    proj
        ANNarchy projection instance.
    params
        Key-value pairs of the parameters that should be changed.
    param_map
        Map between the keys in params and the circuit variables.

    Returns
    -------
    Projection
        Updated projection instance.

    """
    for key in params.keys():
        val = params[key]
        for op, var in param_map[key]['var']:
            edges = param_map[key]['edges'] if 'edges' in param_map[key] else [
                ]
            for source, target, edge in edges:
                if (source in proj.name and target in proj.name and edge in
                    proj.name):
                    try:
                        proj.set({var: float(val)})
                    except TypeError:
                        proj.set({var: val})
                    except [ValueError, KeyError]:
                        pass
    return proj
