For the last bits I would write function which is called here like:

`chan_info['coil_trans'] =get_transform(pos[idx], r[idx])`

Where pos could be a list or an array of the preprocessed x, y, z shperical coordinates and r would be the corresponding translation