예제 #1
0
 def plotEzJz(self,*args,**kwargs):
     """
     NAME:
        plotEzJz
     PURPOSE:
        plot E_z(.)/sqrt(dens(R)) along the orbit
     INPUT:
        pot= Potential instance or list of instances in which the orbit was
              integrated
        d1= - plot Ez vs d1: e.g., 't', 'z', 'R', 'vR', 'vT', 'vz'      
        +bovy_plot.bovy_plot inputs
     OUTPUT:
        figure to output device
     HISTORY:
        2010-08-08 - Written - Bovy (NYU)
     """
     labeldict= {'t':r'$t$','R':r'$R$','vR':r'$v_R$','vT':r'$v_T$',
                 'z':r'$z$','vz':r'$v_z$','phi':r'$\phi$',
                 'x':r'$x$','y':r'$y$','vx':r'$v_x$','vy':r'$v_y$'}
     if not 'pot' in kwargs:
         try:
             pot= self._pot
         except AttributeError:
             raise AttributeError("Integrate orbit first or specify pot=")
     else:
         pot= kwargs.pop('pot')
     d1= kwargs.pop('d1','t')
     self.EzJz= [(evaluatePotentials(pot,self.orbit[ii,0],self.orbit[ii,3],
                                     t=self.t[ii],use_physical=False)-
                  evaluatePotentials(pot,self.orbit[ii,0],0.,
                                     phi= self.orbit[ii,5],t=self.t[ii],
                                     use_physical=False)+
                  self.orbit[ii,4]**2./2.)/\
                     nu.sqrt(evaluateDensities(pot,self.orbit[ii,0],0.,
                                               phi=self.orbit[ii,5],
                                               t=self.t[ii],
                                               use_physical=False))\
                     for ii in range(len(self.t))]
     if not 'xlabel' in kwargs:
         kwargs['xlabel']= labeldict[d1]
     if not 'ylabel' in kwargs:
         kwargs['ylabel']= r'$E_z/\sqrt{\rho}$'
     if d1 == 't':
         plot.bovy_plot(nu.array(self.t),nu.array(self.EzJz)/self.EzJz[0],
                        *args,**kwargs)
     elif d1 == 'z':
         plot.bovy_plot(self.orbit[:,3],nu.array(self.EzJz)/self.EzJz[0],
                        *args,**kwargs)
     elif d1 == 'R':
         plot.bovy_plot(self.orbit[:,0],nu.array(self.EzJz)/self.EzJz[0],
                        *args,**kwargs)
     elif d1 == 'vR':
         plot.bovy_plot(self.orbit[:,1],nu.array(self.EzJz)/self.EzJz[0],
                        *args,**kwargs)
     elif d1 == 'vT':
         plot.bovy_plot(self.orbit[:,2],nu.array(self.EzJz)/self.EzJz[0],
                        *args,**kwargs)
     elif d1 == 'vz':
         plot.bovy_plot(self.orbit[:,4],nu.array(self.EzJz)/self.EzJz[0],
                        *args,**kwargs)
예제 #2
0
 def plotEzJz(self,*args,**kwargs):
     """
     NAME:
        plotEzJz
     PURPOSE:
        plot E_z(.)/sqrt(dens(R)) along the orbit
     INPUT:
        pot= Potential instance or list of instances in which the orbit was
              integrated
        d1= - plot Ez vs d1: e.g., 't', 'z', 'R', 'vR', 'vT', 'vz'      
        +bovy_plot.bovy_plot inputs
     OUTPUT:
        figure to output device
     HISTORY:
        2010-08-08 - Written - Bovy (NYU)
     """
     labeldict= {'t':r'$t$','R':r'$R$','vR':r'$v_R$','vT':r'$v_T$',
                 'z':r'$z$','vz':r'$v_z$','phi':r'$\phi$',
                 'x':r'$x$','y':r'$y$','vx':r'$v_x$','vy':r'$v_y$'}
     if not 'pot' in kwargs:
         try:
             pot= self._pot
         except AttributeError:
             raise AttributeError("Integrate orbit first or specify pot=")
     else:
         pot= kwargs.pop('pot')
     d1= kwargs.pop('d1','t')
     self.EzJz= [(evaluatePotentials(pot,self.orbit[ii,0],self.orbit[ii,3],
                                     t=self.t[ii],use_physical=False)-
                  evaluatePotentials(pot,self.orbit[ii,0],0.,
                                     phi= self.orbit[ii,5],t=self.t[ii],
                                     use_physical=False)+
                  self.orbit[ii,4]**2./2.)/\
                     nu.sqrt(evaluateDensities(pot,self.orbit[ii,0],0.,
                                               phi=self.orbit[ii,5],
                                               t=self.t[ii],
                                               use_physical=False))\
                     for ii in range(len(self.t))]
     if not 'xlabel' in kwargs:
         kwargs['xlabel']= labeldict[d1]
     if not 'ylabel' in kwargs:
         kwargs['ylabel']= r'$E_z/\sqrt{\rho}$'
     if d1 == 't':
         plot.bovy_plot(nu.array(self.t),nu.array(self.EzJz)/self.EzJz[0],
                        *args,**kwargs)
     elif d1 == 'z':
         plot.bovy_plot(self.orbit[:,3],nu.array(self.EzJz)/self.EzJz[0],
                        *args,**kwargs)
     elif d1 == 'R':
         plot.bovy_plot(self.orbit[:,0],nu.array(self.EzJz)/self.EzJz[0],
                        *args,**kwargs)
     elif d1 == 'vR':
         plot.bovy_plot(self.orbit[:,1],nu.array(self.EzJz)/self.EzJz[0],
                        *args,**kwargs)
     elif d1 == 'vT':
         plot.bovy_plot(self.orbit[:,2],nu.array(self.EzJz)/self.EzJz[0],
                        *args,**kwargs)
     elif d1 == 'vz':
         plot.bovy_plot(self.orbit[:,4],nu.array(self.EzJz)/self.EzJz[0],
                        *args,**kwargs)