code: def _refine_sensor_orientation(chanin):
      """Improve orientation matrices based on multiaxis measures.
  
      The ex and ey elements from _convert_channel_info were oriented not
      based on the physical orientation of the sensor.
      It doesn't have to be this way, we can use (if available) the orientation
      information from mulit-axis recordings to refine these elements.
      """
      logger.info("Refining sensor orientations...")
      chanout = deepcopy(chanin)
      tmpname = list()
      for ii in range(len(chanin)):
          tmpname.append(chanin[ii]["ch_name"])
  
      for ii in range(len(chanin)):
          tmploc = deepcopy(chanin[ii]["loc"])
          tmploc = tmploc.reshape(3, 4, order="F")
          if np.isnan(tmploc.sum()) is False:
              target, flipFlag = _guess_other_chan_axis(tmpname, ii)
              if np.isnan(target) is False:
                  targetloc = deepcopy(chanin[target]["loc"])
                  if np.isnan(targetloc.sum()) is False:
                      targetloc = targetloc.reshape(3, 4, order="F")
                      tmploc[:, 2] = targetloc[:, 3]
                      tmploc[:, 1] = flipFlag * np.cross(
                          tmploc[:, 2], tmploc[:, 3]
                      )
                      chanout[ii]["loc"] = tmploc.reshape(12, order="F")
      logger.info("[done]")
      return chanout
  
imports: from copy import deepcopy
  import numpy
  from ...utils import logger
label_desc: Use image node_id 1 for calling a global function with example usage: _refine_sensor_orientation(chanin) and returns: chanout