コード例 #1
0
 def __init__(self,*args,**kwargs):
     """
     NAME:
        __init__
     PURPOSE:
        initialize a potential from parameters provided in an INI file
        or as named arguments to the constructor (see below).
     INPUT:
        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.
     HISTORY:
        2014-12-05 EV
     """
     Potential.__init__(self,amp=1.)
     normalize=False
     for key, value in kwargs.items():
         if key=="normalize":
             normalize=value
             del kwargs[key]
     self._pot = agama.Potential(*args,**kwargs)
     if normalize or \
             (isinstance(normalize,(int,float)) \
                 and not isinstance(normalize,bool)):
         self.normalize(normalize)
     self.hasC= False
     self.hasC_dxdv=False
コード例 #2
0
ファイル: pygama.py プロジェクト: flatironinstitute/Agama
 def __init__(self, *args, **kwargs):
     '''
     Initialize a potential from parameters provided in an INI file
     or as named arguments to the constructor.
     Arguments are the same as for regular agama.Potential (see below);
     an extra keyword 'normalize=...' has the same meaning as in Galpy:
     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.
     '''
     # importing galpy takes a lot of time (when first called in a script), so we only perform this
     # when the constructor of this class is called, and add the inheritance from
     # galpy.potential.Potential at runtime.
     from galpy.potential import Potential
     GalpyPotential.__bases__ = (Potential, _agama.Potential)
     Potential.__init__(self, amp=1.)
     normalize = False
     for key, value in kwargs.items():
         if key == 'normalize':
             normalize = value
             del kwargs[key]
     _agama.Potential.__init__(
         self, *args, **kwargs)  # construct a regular Agama potential
     if normalize or (isinstance(normalize, (int, float))
                      and not isinstance(normalize, bool)):
         self.normalize(normalize)
     self.hasC = False
     self.hasC_dxdv = False
コード例 #3
0
 def __init__(self,pot1,pot2,dt=100.,tform=50.):
     """pot1= potential for t < tform, pot2= potential for t > tform+dt, dt: time over which to turn on pot2, tform: time at which the interpolation is switched on"""
     Potential.__init__(self,amp=1.)
     self._pot1= pot1
     self._pot2= pot2
     self._tform= tform
     self._dt= dt
     return None
コード例 #4
0
ファイル: test_galpypaper.py プロジェクト: morganb-phys/galpy
 def __init__(self, pot1, pot2, dt=100., tform=50.):
     """pot1= potential for t < tform, pot2= potential for t > tform+dt, dt: time over which to turn on pot2,
     tform: time at which the interpolation is switched on"""
     Potential.__init__(self, amp=1.)
     self._pot1 = pot1
     self._pot2 = pot2
     self._tform = tform
     self._dt = dt
     return None
コード例 #5
0
ファイル: test_streamgapdf.py プロジェクト: NatalieP-J/galpy
 def __init__(self):
     Potential.__init__(self,amp=1.)
     self.hasC= False
     return None
コード例 #6
0
 def __init__(self):
     Potential.__init__(self,amp=1.)
     self.hasC= False
     return None