code: def angact_ho(x,omega):
      
      action = (x[3:]**2+(omega*x[:3])**2)/(2.*omega)
      angle = np.array([np.arctan(-x[3+i]/omega[i]/x[i]) if x[i]!=0. else -np.sign(x[3+i])*np.pi/2. for i in range(3)])
      for i in range(3):
          if(x[i]<0):
              angle[i]+=np.pi
      return np.concatenate((action,angle % (2.*np.pi)))
docs: Calculate angle and action variable in sho potential with
      parameter omega