For OPM MEG, raw.info[‘chs’][‘num’][‘loc’][3:12] give the OPM sensor direction,called rotation matrix. But if the normal direction of meg sensor is know (n1,n2,n3) only,How can we get the rotation matrix (e11,e12,e13;e21,e22,e23;e31,e32,e33)?
I had the same problem, I had to calculate the rotation matrix which transforms the unit vector (0,0,1) to normal direction of meg sensor (n1,n2,n3). You can try this function create_rot_matrix(v1, v2) which can be found in my package megtools inside vector_functions.py (see megtools/vector_functions.py at master · UrbanM/megtools · GitHub)
I used this as following, where holders[i,0:6] is my array of sensor locations and directions.