def compute_voltages(grid, configs_raw, potentials_raw):
    """Given a list of potential distribution and corresponding four-point
    spreads, compute the voltages

    Parameters
    ----------
    grid:
        crt_grid object the grid is used to infer electrode positions
    configs_raw: Nx4 array
        containing the measurement configs (1-indexed)
    potentials_raw: list with N entries
        corresponding to each measurement, containing the node potentials of
        each injection dipole.
    """
    # we operate on 0-indexed arrays, config holds 1-indexed values
    # configs = configs_raw - 1
    voltages = []
    for config, potentials in zip(configs_raw, potentials_raw):
        print('config', config)
        e3_node = grid.get_electrode_node(config[2])
        e4_node = grid.get_electrode_node(config[3])
        print(e3_node, e4_node)
        print('pot1', potentials[e3_node])
        print('pot2', potentials[e4_node])
        voltage = potentials[e3_node] - potentials[e4_node]
        voltages.append(voltage)
    return voltages