possumLib.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:DW-POSSUM 作者: marksgraham 项目源码 文件源码
def get_motion_level(directory,translation_threshold=2.5,rotation_threshold=2.5):
  '''Roughly classify the amount of motion per slice for calculating likelihood of signal dropouts - 1 = severe motion, 2 = moderate motion'''
  motion_path = os.path.join(directory,'motion')
  motion = np.loadtxt(motion_path)
  max_motion = np.max(motion[:,1:],axis=0)
  min_motion = np.min(motion[:,1:],axis=0)
  diff_motion = np.abs(max_motion-min_motion)
  diff_motion[:3] = diff_motion[:3]*1000
  diff_motion[3:] = np.rad2deg(diff_motion[3:])

  if np.any( diff_motion[:3] > translation_threshold):
      return 1    
  elif np.any(diff_motion[3:] > rotation_threshold):
      return 1
  elif np.any( diff_motion[:3] > 1):
      return 2    
  elif np.any(diff_motion[3:] > 1):
      return 2
  else:
      return 0
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号