How to use the galpy.potential.Potential.__init__ function in galpy

To help you get started, we’ve selected a few galpy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GalacticDynamics-Oxford / Agama / pytests / galpy_agama.py View on Github external
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
    __init__.__doc__ += agama.Potential.__doc__
github GalacticDynamics-Oxford / Agama / py / pygama.py View on Github external
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