def __init__(self,amp=1.,pot=None,ro=None,vo=None,_init=None,**kwargs): """ NAME: __init__ PURPOSE: initialize a WrapperPotential, a super-class for wrapper potentials INPUT: amp - amplitude to be applied to the potential (default: 1.) pot - Potential instance or list thereof; the amplitude of this will be grown by this wrapper OUTPUT: (none) HISTORY: 2017-06-26 - Started - Bovy (UofT) """ if not _init: return None # Don't run __init__ at the end of setup Potential.__init__(self,amp=amp,ro=ro,vo=vo) self._pot= pot self.isNonAxi= _isNonAxi(self._pot)
def __init__(self,amp=1.,pot=None,ro=None,vo=None): """ NAME: __init__ PURPOSE: initialize a WrapperPotential, a super-class for wrapper potentials INPUT: amp - amplitude to be applied to the potential (default: 1.) pot - Potential instance or list thereof; the amplitude of this will be grown by this wrapper OUTPUT: (none) HISTORY: 2017-06-26 - Started - Bovy (UofT) """ Potential.__init__(self,amp=amp,ro=ro,vo=vo) self._pot= pot self.isNonAxi= _isNonAxi(self._pot)
def __init__(self, amp=1., alpha=1., normalize=False): """ NAME: __init__ PURPOSE: initialize a power-law-density potential INPUT: amp - amplitude to be applied to the potential (default: 1) alpha - inner power normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. OUTPUT: (none) HISTORY: 2010-07-10 - Written - Bovy (NYU) """ Potential.__init__(self, amp=amp) self.alpha = alpha if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): self.normalize(normalize) self.hasC = True self.hasC_dxdv = True
def __init__(self,amp=1.,alpha=1.,normalize=False): """ NAME: __init__ PURPOSE: initialize a power-law-density potential INPUT: amp - amplitude to be applied to the potential (default: 1) alpha - inner power normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. OUTPUT: (none) HISTORY: 2010-07-10 - Written - Bovy (NYU) """ Potential.__init__(self,amp=amp) self.alpha= alpha if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): self.normalize(normalize) self.hasC= True self.hasC_dxdv= True
def __init__(self, orbit, amp=1., GM=.06, ro=None, vo=None, softening=None, softening_model='plummer', softening_length=0.01): """ NAME: __init__ PURPOSE: initialize a MovingObjectPotential INPUT: orbit - the Orbit of the object (Orbit object) amp= - amplitude to be applied to the potential (default: 1); can be a Quantity with units of mass or Gxmass GM - 'mass' of the object (degenerate with amp, don't use both); can be a Quantity with units of mass or Gxmass Softening: either provide a) softening= with a ForceSoftening-type object b) softening_model= type of softening to use ('plummer') softening_length= (optional; can be Quantity) ro=, vo= distance and velocity scales for translation into internal units (default from configuration file) OUTPUT: (none) HISTORY: 2011-04-10 - Started - Bovy (NYU) """ Potential.__init__(self, amp=amp * GM, ro=ro, vo=vo, amp_units='mass') if _APY_LOADED and isinstance(softening_length, units.Quantity): softening_length = softening_length.to(units.kpc).value / self._ro # Make sure we aren't getting physical outputs self._orb = copy.deepcopy(orbit) self._orb.turn_physical_off() if softening is None: if softening_model.lower() == 'plummer': self._softening = PlummerSoftening( softening_length=softening_length) else: self._softening = softening self.isNonAxi = True return None
def __init__(self, amp=1., alpha=0.5, q=0.9, core=_CORE, normalize=False, r1=1., ro=None, vo=None): """ NAME: __init__ PURPOSE: initialize a flattened power-law potential INPUT: amp - amplitude to be applied to the potential (default: 1); can be a Quantity with units of velocity-squared alpha - power q - flattening core - core radius (can be Quantity) r1= (1.) reference radius for amplitude (can be Quantity) normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. ro=, vo= distance and velocity scales for translation into internal units (default from configuration file) OUTPUT: (none) HISTORY: 2013-01-09 - Written - Bovy (IAS) """ Potential.__init__(self, amp=amp, ro=ro, vo=vo, amp_units='velocity2') if _APY_LOADED and isinstance(core, units.Quantity): core = core.to(units.kpc).value / self._ro if _APY_LOADED and isinstance(r1, units.Quantity): r1 = r1.to(units.kpc).value / self._ro self.alpha = alpha self.q2 = q**2. self.core2 = core**2. # Back to old definition self._amp *= r1**self.alpha if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): #pragma: no cover self.normalize(normalize) self.hasC = True self.hasC_dxdv = True
def __init__(self, amp=1., core=_CORE, q=1., b=None, normalize=False, ro=None, vo=None): """ NAME: __init__ PURPOSE: initialize a logarithmic potential INPUT: amp - amplitude to be applied to the potential (default: 1); can be a Quantity with units of velocity-squared core - core radius at which the logarithm is cut (can be Quantity) q - potential flattening (z/q)**2. b= (None) if set, shape parameter in y-direction (y --> y/b; see definition) normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. ro=, vo= distance and velocity scales for translation into internal units (default from configuration file) OUTPUT: (none) HISTORY: 2010-04-02 - Started - Bovy (NYU) """ Potential.__init__(self, amp=amp, ro=ro, vo=vo, amp_units='velocity2') if _APY_LOADED and isinstance(core, units.Quantity): core = core.to(units.kpc).value / self._ro self.hasC = True self.hasC_dxdv = True self._core2 = core**2. self._q = q self._b = b if not self._b is None: self.isNonAxi = True self._1m1overb2 = 1. - 1. / self._b**2. if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): #pragma: no cover self.normalize(normalize) self._nemo_accname = 'LogPot' return None
def __init__(self, amp=1., alpha=1., rc=1., normalize=False, r1=1., ro=None, vo=None): """ NAME: __init__ PURPOSE: initialize a power-law-density potential INPUT: amp= amplitude to be applied to the potential (default: 1); can be a Quantity with units of mass density or Gxmass density alpha= inner power rc= cut-off radius (can be Quantity) r1= (1.) reference radius for amplitude (can be Quantity) normalize= if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. ro=, vo= distance and velocity scales for translation into internal units (default from configuration file) OUTPUT: (none) HISTORY: 2013-06-28 - Written - Bovy (IAS) """ Potential.__init__(self, amp=amp, ro=ro, vo=vo, amp_units='density') if _APY_LOADED and isinstance(r1, units.Quantity): r1 = r1.to(units.kpc).value / self._ro if _APY_LOADED and isinstance(rc, units.Quantity): rc = rc.to(units.kpc).value / self._ro self.alpha = alpha # Back to old definition self._amp *= r1**self.alpha self.rc = rc self._scale = self.rc if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): #pragma: no cover self.normalize(normalize) self.hasC = True self.hasC_dxdv = True self._nemo_accname = 'PowSphwCut'
def __init__(self,amp=1.,a=5.,alpha=1.5,beta=3.5,normalize=False, ro=None,vo=None): """ NAME: __init__ PURPOSE: initialize a two-power-density potential INPUT: amp - amplitude to be applied to the potential (default: 1); can be a Quantity with units of mass or Gxmass a - scale radius (can be Quantity) alpha - inner power beta - outer power normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. ro=, vo= distance and velocity scales for translation into internal units (default from configuration file) OUTPUT: (none) HISTORY: 2010-07-09 - Started - Bovy (NYU) """ if alpha == round(alpha) and beta == round(beta): Potential.__init__(self,amp=amp,ro=ro,vo=vo,amp_units='mass') integerSelf= TwoPowerIntegerSphericalPotential(amp=1.,a=a, alpha=int(alpha), beta=int(beta), normalize=False) self.integerSelf= integerSelf else: Potential.__init__(self,amp=amp,ro=ro,vo=vo,amp_units='mass') self.integerSelf= None if _APY_LOADED and isinstance(a,units.Quantity): a= a.to(units.kpc).value/self._ro self.a= a self._scale= self.a self.alpha= alpha self.beta= beta if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): #pragma: no cover self.normalize(normalize) return None
def __init__(self,orbit,amp=1.,GM=.06, ro=None,vo=None, softening=None, softening_model='plummer',softening_length=0.01): """ NAME: __init__ PURPOSE: initialize a MovingObjectPotential INPUT: orbit - the Orbit of the object (Orbit object) amp= - amplitude to be applied to the potential (default: 1); can be a Quantity with units of mass or Gxmass GM - 'mass' of the object (degenerate with amp, don't use both); can be a Quantity with units of mass or Gxmass Softening: either provide a) softening= with a ForceSoftening-type object b) softening_model= type of softening to use ('plummer') softening_length= (optional; can be Quantity) ro=, vo= distance and velocity scales for translation into internal units (default from configuration file) OUTPUT: (none) HISTORY: 2011-04-10 - Started - Bovy (NYU) """ Potential.__init__(self,amp=amp*GM,ro=ro,vo=vo,amp_units='mass') if _APY_LOADED and isinstance(softening_length,units.Quantity): softening_length= softening_length.to(units.kpc).value/self._ro # Make sure we aren't getting physical outputs self._orb= copy.deepcopy(orbit) self._orb.turn_physical_off() if softening is None: if softening_model.lower() == 'plummer': self._softening= PlummerSoftening(softening_length=softening_length) else: self._softening= softening self.isNonAxi= True return None
def __init__(self, amp=1., ro=1., hr=1. / 3., maxiter=_MAXITER, tol=0.001, normalize=False, new=True, glorder=100): """ NAME: __init__ PURPOSE: initialize a razor-thin-exponential disk potential INPUT: amp - amplitude to be applied to the potential (default: 1) hr - disk scale-length in terms of ro tol - relative accuracy of potential-evaluations maxiter - scipy.integrate keyword normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. OUTPUT: RazorThinExponentialDiskPotential object HISTORY: 2012-12-27 - Written - Bovy (IAS) """ Potential.__init__(self, amp=amp) self._new = new self._glorder = glorder self._ro = ro self._hr = hr self._scale = self._hr self._alpha = 1. / self._hr self._maxiter = maxiter self._tol = tol self._glx, self._glw = nu.polynomial.legendre.leggauss(self._glorder) if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): #pragma: no cover self.normalize(normalize)
def __init__(self,amp=1.,alpha=0.5,q=0.9,core=_CORE,normalize=False,r1=1., ro=None,vo=None): """ NAME: __init__ PURPOSE: initialize a flattened power-law potential INPUT: amp - amplitude to be applied to the potential (default: 1); can be a Quantity with units of velocity-squared alpha - power q - flattening core - core radius (can be Quantity) r1= (1.) reference radius for amplitude (can be Quantity) normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. ro=, vo= distance and velocity scales for translation into internal units (default from configuration file) OUTPUT: (none) HISTORY: 2013-01-09 - Written - Bovy (IAS) """ Potential.__init__(self,amp=amp,ro=ro,vo=vo,amp_units='velocity2') if _APY_LOADED and isinstance(core,units.Quantity): core= core.to(units.kpc).value/self._ro if _APY_LOADED and isinstance(r1,units.Quantity): r1= r1.to(units.kpc).value/self._ro self.alpha= alpha self.q2= q**2. self.core2= core**2. # Back to old definition self._amp*= r1**self.alpha if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): #pragma: no cover self.normalize(normalize) self.hasC= True self.hasC_dxdv= True
def __init__(self, orbit, amp=1., GM=.06, softening=None, softening_model='plummer', softening_length=0.01): """ NAME: __init__ PURPOSE: initialize a MovingObjectPotential INPUT: orbit - the Orbit of the object (Orbit object) amp= - amplitude to be applied to the potential (default: 1) GM - 'mass' of the object (degenerate with amp) Softening: either provide a) softening= with a ForceSoftening-type object b) softening_model= type of softening to use ('plummer') softening_length= (optional) OUTPUT: (none) HISTORY: 2011-04-10 - Started - Bovy (NYU) """ Potential.__init__(self, amp=amp) self._gm = GM self._orb = orbit if softening is None: if softening_model.lower() == 'plummer': self._softening = PlummerSoftening( softening_length=softening_length) else: self._softening = softening self.isNonAxi = True return None
def __init__(self, s, num_threads=None, nazimuths=4, ro=None, vo=None): """ NAME: __init__ PURPOSE: Initialize a SnapshotRZ potential object INPUT: s - a simulation snapshot loaded with pynbody num_threads= (4) number of threads to use for calculation nazimuths= (4) number of azimuths to average over ro=, vo= distance and velocity scales for translation into internal units (default from configuration file) OUTPUT: instance HISTORY: 2013 - Written - Rok Roskar (ETH) 2014-11-24 - Edited for merging into main galpy - Bovy (IAS) """ if not _PYNBODY_LOADED: raise ImportError( "The SnapShotRZPotential class is designed to work with pynbody snapshots, which cannot be loaded (probably because it is not installed) -- obtain from pynbody.github.io" ) Potential.__init__(self, amp=1.0, ro=ro, vo=vo) self._s = s self._point_hash = {} if num_threads is None: self._num_threads = pynbody.config['number_of_threads'] else: self._num_threads = num_threads # Set up azimuthal averaging self._naz = nazimuths self._cosaz= np.cos(np.arange(self._naz,dtype='float')\ /self._naz*2.*np.pi) self._sinaz= np.sin(np.arange(self._naz,dtype='float')\ /self._naz*2.*np.pi) self._zones = np.ones(self._naz) self._zzeros = np.zeros(self._naz) return None
def __init__(self,amp=1.,core=_CORE,q=1.,b=None,normalize=False, ro=None,vo=None): """ NAME: __init__ PURPOSE: initialize a logarithmic potential INPUT: amp - amplitude to be applied to the potential (default: 1); can be a Quantity with units of velocity-squared core - core radius at which the logarithm is cut (can be Quantity) q - potential flattening (z/q)**2. b= (None) if set, shape parameter in y-direction (y --> y/b; see definition) normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. ro=, vo= distance and velocity scales for translation into internal units (default from configuration file) OUTPUT: (none) HISTORY: 2010-04-02 - Started - Bovy (NYU) """ Potential.__init__(self,amp=amp,ro=ro,vo=vo,amp_units='velocity2') if _APY_LOADED and isinstance(core,units.Quantity): core= core.to(units.kpc).value/self._ro self.hasC= True self.hasC_dxdv= True self._core2= core**2. self._q= q self._b= b if not self._b is None: self.isNonAxi= True self._1m1overb2= 1.-1./self._b**2. if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): #pragma: no cover self.normalize(normalize) self._nemo_accname= 'LogPot' return None
def __init__(self,amp=1.,hr=1./3., maxiter=_MAXITER,tol=0.001,normalize=False, ro=None,vo=None, new=True,glorder=100): """ NAME: __init__ PURPOSE: initialize a razor-thin-exponential disk potential INPUT: amp - amplitude to be applied to the potential (default: 1); can be a Quantity with units of surface-mass or Gxsurface-mass hr - disk scale-length (can be Quantity) tol - relative accuracy of potential-evaluations maxiter - scipy.integrate keyword normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. ro=, vo= distance and velocity scales for translation into internal units (default from configuration file) OUTPUT: RazorThinExponentialDiskPotential object HISTORY: 2012-12-27 - Written - Bovy (IAS) """ Potential.__init__(self,amp=amp,ro=ro,vo=vo,amp_units='surfacedensity') if _APY_LOADED and isinstance(hr,units.Quantity): hr= hr.to(units.kpc).value/self._ro self._new= new self._glorder= glorder self._hr= hr self._scale= self._hr self._alpha= 1./self._hr self._maxiter= maxiter self._tol= tol self._glx, self._glw= nu.polynomial.legendre.leggauss(self._glorder) if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): #pragma: no cover self.normalize(normalize)
def __init__(self, amp=1., a=5., alpha=1.5, beta=3.5, normalize=False): """ NAME: __init__ PURPOSE: initialize a two-power-density potential INPUT: amp - amplitude to be applied to the potential (default: 1) a - "scale" (in terms of Ro) alpha - inner power beta - outer power normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. OUTPUT: (none) HISTORY: 2010-07-09 - Started - Bovy (NYU) """ self.a = a self._scale = self.a self.alpha = alpha self.beta = beta if alpha == round(alpha) and beta == round(beta): Potential.__init__(self, amp=amp) integerSelf = TwoPowerIntegerSphericalPotential(amp=1., a=a, alpha=int(alpha), beta=int(beta), normalize=False) self.integerSelf = integerSelf else: Potential.__init__(self, amp=amp) self.integerSelf = None if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): #pragma: no cover self.normalize(normalize) return None
def __init__(self,amp=1.,alpha=1.,rc=1.,normalize=False,r1=1., ro=None,vo=None): """ NAME: __init__ PURPOSE: initialize a power-law-density potential INPUT: amp= amplitude to be applied to the potential (default: 1); can be a Quantity with units of mass density or Gxmass density alpha= inner power rc= cut-off radius (can be Quantity) r1= (1.) reference radius for amplitude (can be Quantity) normalize= if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. ro=, vo= distance and velocity scales for translation into internal units (default from configuration file) OUTPUT: (none) HISTORY: 2013-06-28 - Written - Bovy (IAS) """ Potential.__init__(self,amp=amp,ro=ro,vo=vo,amp_units='density') if _APY_LOADED and isinstance(r1,units.Quantity): r1= r1.to(units.kpc).value/self._ro if _APY_LOADED and isinstance(rc,units.Quantity): rc= rc.to(units.kpc).value/self._ro self.alpha= alpha # Back to old definition self._amp*= r1**self.alpha self.rc= rc self._scale= self.rc if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): #pragma: no cover self.normalize(normalize) self.hasC= True self.hasC_dxdv= True self._nemo_accname= 'PowSphwCut'
def __init__(self, s, num_threads=None,nazimuths=4, ro=None,vo=None): """ NAME: __init__ PURPOSE: Initialize a SnapshotRZ potential object INPUT: s - a simulation snapshot loaded with pynbody num_threads= (4) number of threads to use for calculation nazimuths= (4) number of azimuths to average over ro=, vo= distance and velocity scales for translation into internal units (default from configuration file) OUTPUT: instance HISTORY: 2013 - Written - Rok Roskar (ETH) 2014-11-24 - Edited for merging into main galpy - Bovy (IAS) """ if not _PYNBODY_LOADED: raise ImportError("The SnapShotRZPotential class is designed to work with pynbody snapshots, which cannot be loaded (probably because it is not installed) -- obtain from pynbody.github.io") Potential.__init__(self,amp=1.0,ro=ro,vo=vo) self._s = s self._point_hash = {} if num_threads is None: self._num_threads= pynbody.config['number_of_threads'] else: self._num_threads = num_threads # Set up azimuthal averaging self._naz= nazimuths self._cosaz= np.cos(np.arange(self._naz,dtype='float')\ /self._naz*2.*np.pi) self._sinaz= np.sin(np.arange(self._naz,dtype='float')\ /self._naz*2.*np.pi) self._zones= np.ones(self._naz) self._zzeros= np.zeros(self._naz) return None
def __init__(self, amp=1., alpha=1., normalize=False, r1=1., ro=None, vo=None): """ NAME: __init__ PURPOSE: initialize a power-law-density potential INPUT: amp - amplitude to be applied to the potential (default: 1); can be a Quantity with units of mass density or Gxmass density alpha - inner power r1= (1.) reference radius for amplitude (can be Quantity) normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. ro=, vo= distance and velocity scales for translation into internal units (default from configuration file) OUTPUT: (none) HISTORY: 2010-07-10 - Written - Bovy (NYU) """ Potential.__init__(self, amp=amp, ro=ro, vo=vo, amp_units='mass') if _APY_LOADED and isinstance(r1, units.Quantity): r1 = r1.to(units.kpc).value / self._ro self.alpha = alpha # Back to old definition if self.alpha != 3.: self._amp *= r1**(self.alpha - 3.) * 4. * nu.pi / (3. - self.alpha) if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): self.normalize(normalize) self.hasC = True self.hasC_dxdv = True
def __init__(self,amp=1.,a=5.,alpha=1.5,beta=3.5,normalize=False): """ NAME: __init__ PURPOSE: initialize a two-power-density potential INPUT: amp - amplitude to be applied to the potential (default: 1) a - "scale" (in terms of Ro) alpha - inner power beta - outer power normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. OUTPUT: (none) HISTORY: 2010-07-09 - Started - Bovy (NYU) """ self.a= a self._scale= self.a self.alpha= alpha self.beta= beta if alpha == round(alpha) and beta == round(beta): Potential.__init__(self,amp=amp) integerSelf= TwoPowerIntegerSphericalPotential(amp=1.,a=a, alpha=int(alpha), beta=int(beta), normalize=False) self.integerSelf= integerSelf else: Potential.__init__(self,amp=amp) self.integerSelf= None if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): #pragma: no cover self.normalize(normalize) return None
def __init__(self, amp=1., ac=5., Delta=1., normalize=False, ro=None, vo=None): """ NAME: __init__ PURPOSE: initialize a Kuzmin-Kutuzov Staeckel potential INPUT: amp - amplitude to be applied to the potential (default: 1); can be a Quantity with units of mass density or Gxmass density ac - axis ratio of the coordinate surfaces; (a/c) = sqrt(-alpha) / sqrt(-gamma) (default: 5.) Delta - focal distance that defines the spheroidal coordinate system (default: 1.); Delta=sqrt(gamma-alpha) (can be Quantity) normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. ro=, vo= distance and velocity scales for translation into internal units (default from configuration file) OUTPUT: (none) HISTORY: 2015-02-15 - Written - Trick (MPIA) """ Potential.__init__(self, amp=amp, ro=ro, vo=vo, amp_units='mass') if _APY_LOADED and isinstance(Delta, units.Quantity): Delta = Delta.to(units.kpc).value / self._ro self._ac = ac self._Delta = Delta self._gamma = self._Delta**2 / (1. - self._ac**2) self._alpha = self._gamma - self._Delta**2 if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): self.normalize(normalize) self.hasC = True self.hasC_dxdv = True
def __init__(self,amp=1.,a=1.,b=0.1,normalize=False, ro=None,vo=None): """ NAME: __init__ PURPOSE: initialize a Miyamoto-Nagai potential INPUT: amp - amplitude to be applied to the potential (default: 1); can be a Quantity with units of mass or Gxmass a - scale length (can be Quantity) b - scale height (can be Quantity) normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. ro=, vo= distance and velocity scales for translation into internal units (default from configuration file) OUTPUT: (none) HISTORY: 2010-07-09 - Started - Bovy (NYU) """ Potential.__init__(self,amp=amp,ro=ro,vo=vo,amp_units='mass') if _APY_LOADED and isinstance(a,units.Quantity): a= a.to(units.kpc).value/self._ro if _APY_LOADED and isinstance(b,units.Quantity): b= b.to(units.kpc).value/self._ro self._a= a self._scale= self._a self._b= b self._b2= self._b**2. if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): self.normalize(normalize) self.hasC= True self.hasC_dxdv= True self._nemo_accname= 'MiyamotoNagai'
def __init__(self,amp=1.,ro=1.,hr=1./3., maxiter=_MAXITER,tol=0.001,normalize=False, new=True,glorder=100): """ NAME: __init__ PURPOSE: initialize a razor-thin-exponential disk potential INPUT: amp - amplitude to be applied to the potential (default: 1) hr - disk scale-length in terms of ro tol - relative accuracy of potential-evaluations maxiter - scipy.integrate keyword normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. OUTPUT: RazorThinExponentialDiskPotential object HISTORY: 2012-12-27 - Written - Bovy (IAS) """ Potential.__init__(self,amp=amp) self._new= new self._glorder= glorder self._ro= ro self._hr= hr self._scale= self._hr self._alpha= 1./self._hr self._maxiter= maxiter self._tol= tol self._glx, self._glw= nu.polynomial.legendre.leggauss(self._glorder) if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): #pragma: no cover self.normalize(normalize)
def __init__(self,orbit,amp=1.,GM=.06, softening=None, softening_model='plummer',softening_length=0.01): """ NAME: __init__ PURPOSE: initialize a MovingObjectPotential INPUT: orbit - the Orbit of the object (Orbit object) amp= - amplitude to be applied to the potential (default: 1) GM - 'mass' of the object (degenerate with amp) Softening: either provide a) softening= with a ForceSoftening-type object b) softening_model= type of softening to use ('plummer') softening_length= (optional) OUTPUT: (none) HISTORY: 2011-04-10 - Started - Bovy (NYU) """ Potential.__init__(self,amp=amp) self._gm= GM self._orb= orbit if softening is None: if softening_model.lower() == 'plummer': self._softening= PlummerSoftening(softening_length=softening_length) else: self._softening= softening self.isNonAxi= True return None
def __init__(self,amp=1.,ac=5.,Delta=1.,normalize=False, ro=None,vo=None): """ NAME: __init__ PURPOSE: initialize a Kuzmin-Kutuzov Staeckel potential INPUT: amp - amplitude to be applied to the potential (default: 1); can be a Quantity with units of mass density or Gxmass density ac - axis ratio of the coordinate surfaces; (a/c) = sqrt(-alpha) / sqrt(-gamma) (default: 5.) Delta - focal distance that defines the spheroidal coordinate system (default: 1.); Delta=sqrt(gamma-alpha) (can be Quantity) normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. ro=, vo= distance and velocity scales for translation into internal units (default from configuration file) OUTPUT: (none) HISTORY: 2015-02-15 - Written - Trick (MPIA) """ Potential.__init__(self,amp=amp,ro=ro,vo=vo,amp_units='mass') if _APY_LOADED and isinstance(Delta,units.Quantity): Delta= Delta.to(units.kpc).value/self._ro self._ac = ac self._Delta = Delta self._gamma = self._Delta**2 / (1.-self._ac**2) self._alpha = self._gamma - self._Delta**2 if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): self.normalize(normalize) self.hasC = True self.hasC_dxdv = True
def __init__(self,amp=1.,alpha=1.,normalize=False,r1=1., ro=None,vo=None): """ NAME: __init__ PURPOSE: initialize a power-law-density potential INPUT: amp - amplitude to be applied to the potential (default: 1); can be a Quantity with units of mass density or Gxmass density alpha - inner power r1= (1.) reference radius for amplitude (can be Quantity) normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. ro=, vo= distance and velocity scales for translation into internal units (default from configuration file) OUTPUT: (none) HISTORY: 2010-07-10 - Written - Bovy (NYU) """ Potential.__init__(self,amp=amp,ro=ro,vo=vo,amp_units='mass') if _APY_LOADED and isinstance(r1,units.Quantity): r1= r1.to(units.kpc).value/self._ro self.alpha= alpha # Back to old definition if self.alpha != 3.: self._amp*= r1**(self.alpha-3.)*4.*nu.pi/(3.-self.alpha) if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): self.normalize(normalize) self.hasC= True self.hasC_dxdv= True
def __init__(self,amp=1.,a=1.,normalize=False, ro=None,vo=None): """ NAME: __init__ PURPOSE: Initialize a Jaffe potential INPUT: amp - amplitude to be applied to the potential (default: 1); can be a Quantity with units of mass or Gxmass a - scale radius (can be Quantity) normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. ro=, vo= distance and velocity scales for translation into internal units (default from configuration file) OUTPUT: (none) HISTORY: 2010-07-09 - Written - Bovy (NYU) """ Potential.__init__(self,amp=amp,ro=ro,vo=vo,amp_units='mass') if _APY_LOADED and isinstance(a,units.Quantity): a= a.to(units.kpc).value/self._ro self.a= a self._scale= self.a self.alpha= 2 self.beta= 4 if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): #pragma: no cover self.normalize(normalize) self.hasC= True self.hasC_dxdv= True return None
def __init__(self, amp=1., a=1., normalize=False, ro=None, vo=None): """ NAME: __init__ PURPOSE: Initialize a Jaffe potential INPUT: amp - amplitude to be applied to the potential (default: 1); can be a Quantity with units of mass or Gxmass a - scale radius (can be Quantity) normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. ro=, vo= distance and velocity scales for translation into internal units (default from configuration file) OUTPUT: (none) HISTORY: 2010-07-09 - Written - Bovy (NYU) """ Potential.__init__(self, amp=amp, ro=ro, vo=vo, amp_units='mass') if _APY_LOADED and isinstance(a, units.Quantity): a = a.to(units.kpc).value / self._ro self.a = a self._scale = self.a self.alpha = 2 self.beta = 4 if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): #pragma: no cover self.normalize(normalize) self.hasC = True self.hasC_dxdv = True return None
def __init__(self,amp=1.,b=1.,normalize=False, ro=None,vo=None): """ NAME: __init__ PURPOSE: initialize an isochrone potential INPUT: amp= amplitude to be applied to the potential (default: 1); can be a Quantity with units of mass density or Gxmass density b= scale radius of the isochrone potential (can be Quantity) normalize= if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. ro=, vo= distance and velocity scales for translation into internal units (default from configuration file) OUTPUT: (none) HISTORY: 2013-09-08 - Written - Bovy (IAS) """ Potential.__init__(self,amp=amp,ro=ro,vo=vo,amp_units='mass') if _APY_LOADED and isinstance(b,units.Quantity): b= b.to(units.kpc).value/self._ro self.b= b self._scale= self.b self.b2= self.b**2. if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): #pragma: no cover self.normalize(normalize) self.hasC= True self.hasC_dxdv= True
def __init__(self, amp=1., a=1., alpha=1, beta=3, normalize=False): """ NAME: __init__ PURPOSE: initialize a two-power-density potential for integer powers INPUT: amp - amplitude to be applied to the potential (default: 1) a - "scale" (in terms of Ro) alpha - inner power (default: NFW) beta - outer power (default: NFW) normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. OUTPUT: (none) HISTORY: 2010-07-09 - Started - Bovy (NYU) """ self.alpha = alpha self.beta = beta self.a = a self._scale = self.a if alpha == 1 and beta == 4: Potential.__init__(self, amp=amp) HernquistSelf = HernquistPotential(amp=1., a=a, normalize=False) self.HernquistSelf = HernquistSelf self.JaffeSelf = None self.NFWSelf = None elif alpha == 2 and beta == 4: Potential.__init__(self, amp=amp) JaffeSelf = JaffePotential(amp=1., a=a, normalize=False) self.HernquistSelf = None self.JaffeSelf = JaffeSelf self.NFWSelf = None elif alpha == 1 and beta == 3: Potential.__init__(self, amp=amp) NFWSelf = NFWPotential(amp=1., a=a, normalize=False) self.HernquistSelf = None self.JaffeSelf = None self.NFWSelf = NFWSelf else: Potential.__init__(self, amp=amp) self.HernquistSelf = None self.JaffeSelf = None self.NFWSelf = None if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): #pragma: no cover self.normalize(normalize) return None
def __init__(self,amp=1.,a=1.,b=0.1,normalize=False): """ NAME: __init__ PURPOSE: initialize a Miyamoto-Nagai potential INPUT: amp - amplitude to be applied to the potential (default: 1) a - "disk scale" (in terms of Ro) b - "disk height" (in terms of Ro) normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. OUTPUT: (none) HISTORY: 2010-07-09 - Started - Bovy (NYU) """ Potential.__init__(self,amp=amp) self._a= a self._scale= self._a self._b= b self._b2= self._b**2. if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): self.normalize(normalize) self.hasC= True self.hasC_dxdv= True self._nemo_accname= 'MiyamotoNagai'
def __init__(self,amp=1.,alpha=0.5,q=0.9,core=_CORE,normalize=False): """ NAME: __init__ PURPOSE: initialize a flattened power-law potential INPUT: amp - amplitude to be applied to the potential (default: 1) alpha - power q - flattening core - core radius normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. OUTPUT: (none) HISTORY: 2013-01-09 - Written - Bovy (IAS) """ Potential.__init__(self,amp=amp) self.alpha= alpha self.q2= q**2. self.core2= core**2. if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): #pragma: no cover self.normalize(normalize) self.hasC= True self.hasC_dxdv= True
def __init__(self, amp=1., b=1., normalize=False, ro=None, vo=None): """ NAME: __init__ PURPOSE: initialize an isochrone potential INPUT: amp= amplitude to be applied to the potential (default: 1); can be a Quantity with units of mass density or Gxmass density b= scale radius of the isochrone potential (can be Quantity) normalize= if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. ro=, vo= distance and velocity scales for translation into internal units (default from configuration file) OUTPUT: (none) HISTORY: 2013-09-08 - Written - Bovy (IAS) """ Potential.__init__(self, amp=amp, ro=ro, vo=vo, amp_units='mass') if _APY_LOADED and isinstance(b, units.Quantity): b = b.to(units.kpc).value / self._ro self.b = b self._scale = self.b self.b2 = self.b**2. if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): #pragma: no cover self.normalize(normalize) self.hasC = True self.hasC_dxdv = True
def __init__(self,amp=1.,a=1.,alpha=1,beta=3,normalize=False): """ NAME: __init__ PURPOSE: initialize a two-power-density potential for integer powers INPUT: amp - amplitude to be applied to the potential (default: 1) a - "scale" (in terms of Ro) alpha - inner power (default: NFW) beta - outer power (default: NFW) normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. OUTPUT: (none) HISTORY: 2010-07-09 - Started - Bovy (NYU) """ self.alpha= alpha self.beta= beta self.a= a self._scale= self.a if alpha == 1 and beta == 4: Potential.__init__(self,amp=amp) HernquistSelf= HernquistPotential(amp=1.,a=a,normalize=False) self.HernquistSelf= HernquistSelf self.JaffeSelf= None self.NFWSelf= None elif alpha == 2 and beta == 4: Potential.__init__(self,amp=amp) JaffeSelf= JaffePotential(amp=1.,a=a,normalize=False) self.HernquistSelf= None self.JaffeSelf= JaffeSelf self.NFWSelf= None elif alpha == 1 and beta == 3: Potential.__init__(self,amp=amp) NFWSelf= NFWPotential(amp=1.,a=a,normalize=False) self.HernquistSelf= None self.JaffeSelf= None self.NFWSelf= NFWSelf else: Potential.__init__(self,amp=amp) self.HernquistSelf= None self.JaffeSelf= None self.NFWSelf= None if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): #pragma: no cover self.normalize(normalize) return None
def __init__(self, amp=1., alpha=0.5, q=0.9, core=_CORE, normalize=False): """ NAME: __init__ PURPOSE: initialize a flattened power-law potential INPUT: amp - amplitude to be applied to the potential (default: 1) alpha - power q - flattening core - core radius normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. OUTPUT: (none) HISTORY: 2013-01-09 - Written - Bovy (IAS) """ Potential.__init__(self, amp=amp) self.alpha = alpha self.q2 = q**2. self.core2 = core**2. if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): #pragma: no cover self.normalize(normalize) self.hasC = True self.hasC_dxdv = True
def __init__(self, amp=1., a=1., b=0.1, normalize=False): """ NAME: __init__ PURPOSE: initialize a Miyamoto-Nagai potential INPUT: amp - amplitude to be applied to the potential (default: 1) a - "disk scale" (in terms of Ro) b - "disk height" (in terms of Ro) normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. OUTPUT: (none) HISTORY: 2010-07-09 - Started - Bovy (NYU) """ Potential.__init__(self, amp=amp) self._a = a self._scale = self._a self._b = b self._b2 = self._b**2. if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): self.normalize(normalize) self.hasC = True self.hasC_dxdv = True self._nemo_accname = 'MiyamotoNagai'
def __init__(self,amp=1.,alpha=1.,rc=1.,normalize=False): """ NAME: __init__ PURPOSE: initialize a power-law-density potential INPUT: amp= amplitude to be applied to the potential (default: 1) alpha= inner power rc= cut-off radius normalize= if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. OUTPUT: (none) HISTORY: 2013-06-28 - Written - Bovy (IAS) """ Potential.__init__(self,amp=amp) self.alpha= alpha self.rc= rc self._scale= self.rc if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): #pragma: no cover self.normalize(normalize) self.hasC= True self.hasC_dxdv= True self._nemo_accname= 'PowSphwCut'
def __init__(self, amp=1., xo=1.49, yo=0.58, zo=0.40, q=0.6, rhoo=1, ro=None, vo=None, normalize=False): #####rozdelane, dokumentace okopirovana """ NAME: __init__ PURPOSE: initialize Milky Way potential presented in http://adsabs.harvard.edu/abs/2012MNRAS.427.1429W INPUT: ######## needs corrections!!!!!!!!!!!!!!!!!!!!!!! #amp - amplitude to be applied to the potential (default: 1); can be a Quantity with units of mass or Gxmass xo, yo, zo - principal axes of the bar (xo = 1.49, yo = 0.58, zo = 0.40 in kpc) q - bulge axis ratio rhoo - central density; determined by normalising the total mass of the bar, M_{bar} = 2.0*10^10 M_{sun} normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. ro=, vo= distance and velocity scales for translation into internal units (default from configuration file) OUTPUT: (none) HISTORY: 2016-06-20 - Started - Bovy (NYU) """ Potential.__init__(self,amp=amp,ro=ro,vo=vo,amp_units='mass') if _APY_LOADED and isinstance(xo,units.Quantity): xo = xo.to(units.kpc).value/self._ro if _APY_LOADED and isinstance(yo,units.Quantity): yo = yo.to(units.kpc).value/self._ro if _APY_LOADED and isinstance(zo,units.Quantity): zo = zo.to(units.kpc).value/self._ro #### what to do with rhoo units??? self._xo = xo self._yo = yo self._zo = zo self._q = q self._rhoo = rhoo if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): self.normalize(normalize) self.hasC = False self.hasC_dxdv = False self._nemo_accname = 'MWBar'
def __init__(self,amp=1.,ac=5.,Delta=1.,normalize=False): """ NAME: __init__ PURPOSE: initialize a Kuzmin-Kutuzov Staeckel potential INPUT: amp - amplitude to be applied to the potential (default: 1) ac - axis ratio of the coordinate surfaces; (a/c) = sqrt(-alpha) / sqrt(-gamma) (default: 5.) Delta - focal distance that defines the spheroidal coordinate system (default: 1.); Delta=sqrt(gamma-alpha) normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. OUTPUT: (none) HISTORY: 2015-02-15 - Written - Trick (MPIA) """ Potential.__init__(self,amp=amp) self._ac = ac self._Delta = Delta self._gamma = self._Delta**2 / (1.-self._ac**2) self._alpha = self._gamma - self._Delta**2 if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): self.normalize(normalize) self.hasC = True self.hasC_dxdv = True
def __init__(self,amp=1.,core=_CORE,q=1.,normalize=False): """ NAME: __init__ PURPOSE: initialize a Logarithmic Halo potential INPUT: amp - amplitude to be applied to the potential (default: 1) core - core radius at which the logarithm is cut q - potential flattening (z/q)**2. normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. OUTPUT: (none) HISTORY: 2010-04-02 - Started - Bovy (NYU) """ Potential.__init__(self,amp=amp) self.hasC= True self.hasC_dxdv= True self._core2= core**2. self._q= q if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): #pragma: no cover self.normalize(normalize) self._nemo_accname= 'LogPot' return None
def __init__(self, amp=1., a=1. ,normalize=False, ro=None,vo=None): """ NAME: __init__ PURPOSE: initialize a Kuzmin disk Potential INPUT: amp - amplitude to be applied to the potential (default: 1); can be a Quantity with units of mass density or Gxmass density a - scale length (can be Quantity) normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. ro=, vo= distance and velocity scales for translation into internal units (default from configuration file) OUTPUT: KuzminDiskPotential object HISTORY: 2016-05-09 - Written - Aladdin """ Potential.__init__(self,amp=amp,ro=ro,vo=vo,amp_units='mass') if _APY_LOADED and isinstance(a,units.Quantity): a= a.to(units.kpc).value/self._ro self._a = a ## a must be greater or equal to 0. if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): self.normalize(normalize) self.hasC = True self.hasC_dxdv= True return None
def __init__(self, amp=1., a=1., normalize=False, ro=None, vo=None): """ NAME: __init__ PURPOSE: initialize a Kuzmin disk Potential INPUT: amp - amplitude to be applied to the potential (default: 1); can be a Quantity with units of mass density or Gxmass density a - scale length (can be Quantity) normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. ro=, vo= distance and velocity scales for translation into internal units (default from configuration file) OUTPUT: KuzminDiskPotential object HISTORY: 2016-05-09 - Written - Aladdin """ Potential.__init__(self, amp=amp, ro=ro, vo=vo, amp_units='mass') if _APY_LOADED and isinstance(a, units.Quantity): a = a.to(units.kpc).value / self._ro self._a = a ## a must be greater or equal to 0. if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): self.normalize(normalize) self.hasC = True self.hasC_dxdv = True return None
def __init__(self, amp=1., alpha=1., rc=1., normalize=False): """ NAME: __init__ PURPOSE: initialize a power-law-density potential INPUT: amp= amplitude to be applied to the potential (default: 1) alpha= inner power rc= cut-off radius normalize= if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. OUTPUT: (none) HISTORY: 2013-06-28 - Written - Bovy (IAS) """ Potential.__init__(self, amp=amp) self.alpha = alpha self.rc = rc self._scale = self.rc if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): #pragma: no cover self.normalize(normalize) self.hasC = True self.hasC_dxdv = True self._nemo_accname = 'PowSphwCut'
def __init__(self,amp=1.,a=1.,normalize=False): """ NAME: __init__ PURPOSE: Initialize a Jaffe potential INPUT: amp - amplitude to be applied to the potential a - "scale" (in terms of Ro) normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. OUTPUT: (none) HISTORY: 2010-07-09 - Written - Bovy (NYU) """ Potential.__init__(self,amp=amp) self.a= a self._scale= self.a self.alpha= 2 self.beta= 4 if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): #pragma: no cover self.normalize(normalize) self.hasC= True self.hasC_dxdv= True return None
def __init__(self, amp=1., a=1., normalize=False): """ NAME: __init__ PURPOSE: Initialize a Jaffe potential INPUT: amp - amplitude to be applied to the potential a - "scale" (in terms of Ro) normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. OUTPUT: (none) HISTORY: 2010-07-09 - Written - Bovy (NYU) """ Potential.__init__(self, amp=amp) self.a = a self._scale = self.a self.alpha = 2 self.beta = 4 if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): #pragma: no cover self.normalize(normalize) self.hasC = True self.hasC_dxdv = True return None
def __init__(self, amp=1., a=1., normalize=False): """ NAME: __init__ PURPOSE: initialize a pseudo-isothermal potential INPUT: amp - amplitude to be applied to the potential (default: 1) a -core radius normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. OUTPUT: (none) HISTORY: 2015-12-04 - Started - Bovy (UofT) """ Potential.__init__(self, amp=amp) self.hasC = True self.hasC_dxdv = True self._a = a self._a2 = a**2. self._a3 = a**3. if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): #pragma: no cover self.normalize(normalize) return None
def __init__(self, amp=1., b=0.8, normalize=False): """ NAME: __init__ PURPOSE: initialize a Plummer potential INPUT: amp - amplitude to be applied to the potential (default: 1) b - scale parameter normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. OUTPUT: (none) HISTORY: 2015-06-15 - Written - Bovy (IAS) """ Potential.__init__(self, amp=amp) self._b = b self._scale = self._b self._b2 = self._b**2. if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): self.normalize(normalize) self.hasC = True self.hasC_dxdv = True self._nemo_accname = 'Plummer'
def __init__(self,amp=1.,b=0.8,normalize=False): """ NAME: __init__ PURPOSE: initialize a Plummer potential INPUT: amp - amplitude to be applied to the potential (default: 1) b - scale parameter normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. OUTPUT: (none) HISTORY: 2015-06-15 - Written - Bovy (IAS) """ Potential.__init__(self,amp=amp) self._b= b self._scale= self._b self._b2= self._b**2. if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): self.normalize(normalize) self.hasC= True self.hasC_dxdv= True self._nemo_accname= 'Plummer'
def __init__(self,amp=1.,a=1.,normalize=False): """ NAME: __init__ PURPOSE: initialize a pseudo-isothermal potential INPUT: amp - amplitude to be applied to the potential (default: 1) a -core radius normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. OUTPUT: (none) HISTORY: 2015-12-04 - Started - Bovy (UofT) """ Potential.__init__(self,amp=amp) self.hasC= True self.hasC_dxdv= True self._a= a self._a2= a**2. self._a3= a**3. if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): #pragma: no cover self.normalize(normalize) return None
def __init__(self, amp=1., b=1., normalize=False): """ NAME: __init__ PURPOSE: initialize an isochrone potential INPUT: amp= amplitude to be applied to the potential (default: 1) b= scale radius of the isochrone potential normalize= if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. OUTPUT: (none) HISTORY: 2013-09-08 - Written - Bovy (IAS) """ Potential.__init__(self, amp=amp) self.b = b self._scale = self.b self.b2 = self.b**2. if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): #pragma: no cover self.normalize(normalize) self.hasC = True self.hasC_dxdv = True
def __init__(self, Mh=69725.0, ah=200, normalize=False): """ NAME: __init__ PURPOSE: initialize the Wilkinson and Evans (1999) halo potential INPUT: Mh - amplitude to be applied to the potential - M_h (default: 1) ah - "scale length" (in terms of Ro) normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. OUTPUT: (none) HISTORY: 2015-12-26 - Written - Igoshev A.P. (RU) """ Potential.__init__(self, amp=1.0) self._Mh = Mh self._ah = ah if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): self.normalize(normalize) self.hasC = True self.hasC_dxdv = False self._nemo_accname = 'WilkinsonEvans'
def __init__(self, amp=1., a=2., normalize=False): """ NAME: __init__ PURPOSE: initialize a Burkert-density potential INPUT: amp - amplitude to be applied to the potential (default: 1) a = scale radius normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. OUTPUT: (none) HISTORY: 2013-04-10 - Written - Bovy (IAS) """ Potential.__init__(self, amp=amp) self.a = a self._scale = self.a if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): #pragma: no cover self.normalize(normalize) self.hasC = False
def __init__(self,amp=1.,a=2.,normalize=False): """ NAME: __init__ PURPOSE: initialize a Burkert-density potential INPUT: amp - amplitude to be applied to the potential (default: 1) a = scale radius normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. OUTPUT: (none) HISTORY: 2013-04-10 - Written - Bovy (IAS) """ Potential.__init__(self,amp=amp) self.a=a self._scale= self.a if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): #pragma: no cover self.normalize(normalize) self.hasC= False
def __init__(self,amp=1.,b=1.,normalize=False): """ NAME: __init__ PURPOSE: initialize an isochrone potential INPUT: amp= amplitude to be applied to the potential (default: 1) b= scale radius of the isochrone potential normalize= if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. OUTPUT: (none) HISTORY: 2013-09-08 - Written - Bovy (IAS) """ Potential.__init__(self,amp=amp) self.b= b self._scale= self.b self.b2= self.b**2. if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): #pragma: no cover self.normalize(normalize) self.hasC= True self.hasC_dxdv= True
def __init__(self, amp=1., hr=1. / 3., maxiter=_MAXITER, tol=0.001, normalize=False, ro=None, vo=None, new=True, glorder=100): """ NAME: __init__ PURPOSE: initialize a razor-thin-exponential disk potential INPUT: amp - amplitude to be applied to the potential (default: 1); can be a Quantity with units of surface-mass or Gxsurface-mass hr - disk scale-length (can be Quantity) tol - relative accuracy of potential-evaluations maxiter - scipy.integrate keyword normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that the force is this fraction of the force necessary to make vc(1.,0.)=1. ro=, vo= distance and velocity scales for translation into internal units (default from configuration file) OUTPUT: RazorThinExponentialDiskPotential object HISTORY: 2012-12-27 - Written - Bovy (IAS) """ Potential.__init__(self, amp=amp, ro=ro, vo=vo, amp_units='surfacedensity') if _APY_LOADED and isinstance(hr, units.Quantity): hr = hr.to(units.kpc).value / self._ro self._new = new self._glorder = glorder self._hr = hr self._scale = self._hr self._alpha = 1. / self._hr self._maxiter = maxiter self._tol = tol self._glx, self._glw = nu.polynomial.legendre.leggauss(self._glorder) if normalize or \ (isinstance(normalize,(int,float)) \ and not isinstance(normalize,bool)): #pragma: no cover self.normalize(normalize)
def __init__(self, amp=1, ro=None, vo=None, amp_units='density', N=2, alpha=0.2, r_ref=1, phi_ref=0, Rs=0.3, H=0.125, omega=0, Cs=[1]): """ NAME: __init__ PURPOSE: initialize a spiral arms potential INPUT: :amp: amplitude to be applied to the potential (default: 1); can be a Quantity with units of density. (:math:`amp = 4 \\pi G \\rho_0`) :ro: distance scales for translation into internal units (default from configuration file) :vo: velocity scales for translation into internal units (default from configuration file) :N: number of spiral arms :alpha: pitch angle of the logarithmic spiral arms in radians (can be Quantity) :r_ref: fiducial radius where :math:`\\rho = \\rho_0` (:math:`r_0` in the paper by Cox and Gomez) (can be Quantity) :phi_ref: reference angle (:math:`\\phi_p(r_0)` in the paper by Cox and Gomez) (can be Quantity) :Rs: radial scale length of the drop-off in density amplitude of the arms (can be Quantity) :H: scale height of the stellar arm perturbation (can be Quantity) :Cs: list of constants multiplying the :math:`\cos(n \\gamma)` terms :omega: rotational pattern speed of the spiral arms (can be Quantity) OUTPUT: (none) HISTORY: Started - 2017-05-12 Jack Hong (UBC) Completed - 2017-07-04 Jack Hong (UBC) """ Potential.__init__(self, amp=amp, ro=ro, vo=vo, amp_units=amp_units) if _APY_LOADED: if isinstance(alpha, units.Quantity): alpha = alpha.to(units.rad).value if isinstance(r_ref, units.Quantity): r_ref = r_ref.to(units.kpc).value / self._ro if isinstance(phi_ref, units.Quantity): phi_ref = phi_ref.to(units.rad).value if isinstance(Rs, units.Quantity): Rs = Rs.to(units.kpc).value / self._ro if isinstance(H, units.Quantity): H = H.to(units.kpc).value / self._ro if isinstance(omega, units.Quantity): omega = omega.to(units.km / units.s / units.kpc).value \ / bovy_conversion.freq_in_kmskpc(self._vo, self._ro) self._N = -N # trick to flip to left handed coordinate system; flips sign for phi and phi_ref, but also alpha. self._alpha = -alpha # we don't want sign for alpha to change, so flip alpha. (see eqn. 3 in the paper) self._sin_alpha = np.sin(-alpha) self._tan_alpha = np.tan(-alpha) self._r_ref = r_ref self._phi_ref = phi_ref self._Rs = Rs self._H = H self._Cs = np.array(Cs) self._ns = np.arange(1, len(Cs) + 1) self._omega = omega self._rho0 = 1 / (4 * np.pi) self._HNn = self._H * self._N * self._ns self.isNonAxi = True # Potential is not axisymmetric self.hasC = True # Potential has C implementation to speed up orbit integrations self.hasC_dxdv = True # Potential has C implementation of second derivatives