code: def Jacobi(self,*args,**kwargs):
          
          if not 'OmegaP' in kwargs or kwargs['OmegaP'] is None:
              OmegaP= 1.
              if not 'pot' in kwargs or kwargs['pot'] is None:
                  try:
                      pot= self._pot
                  except AttributeError:
                      raise AttributeError("Integrate orbit or specify pot=")
              else:
                  pot= kwargs['pot']
              if isinstance(pot,list):
                  for p in pot:
                      if hasattr(p,'OmegaP'):
                          OmegaP= p.OmegaP()
                          break
              else:
                  if hasattr(pot,'OmegaP'):
                      OmegaP= pot.OmegaP()
              kwargs.pop('OmegaP',None)
          else:
              OmegaP= kwargs.pop('OmegaP')
          #Make sure you are not using physical coordinates
          old_physical= kwargs.get('use_physical',None)
          kwargs['use_physical']= False
          if not isinstance(OmegaP,(int,float)) and len(OmegaP) == 3:
              if isinstance(OmegaP,list): thisOmegaP= nu.array(OmegaP)
              else: thisOmegaP= OmegaP
              out= self.E(*args,**kwargs)-nu.dot(thisOmegaP,
                                                   self.L(*args,**kwargs).T).T
          else:
              out= self.E(*args,**kwargs)-OmegaP*self.L(*args,**kwargs)[:,2]
          if not old_physical is None:
              kwargs['use_physical']= old_physical
          else:
              kwargs.pop('use_physical')
          return out
docs: NAME:
             Jacobi
          PURPOSE:
             calculate the Jacobi integral of the motion
          INPUT:
             Omega - pattern speed of rotating frame
             t= time
             pot= potential instance or list of such instances
          OUTPUT:
             Jacobi integral
          HISTORY:
             2011-04-18 - Written - Bovy (NYU)