How to use the galpy.potential.Potential 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 / 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