<commit_before># Class that implements isotropic spherical Hernquist DF
# computed using the Eddington formula
from .sphericaldf import sphericaldf
from .Eddingtondf import Eddingtondf

class isotropicHernquistdf(Eddingtondf):
    """Class that implements isotropic spherical Hernquist DF computed using the Eddington formula"""
    def __init__(self,ro=None,vo=None):
        # Initialize using sphericaldf rather than Eddingtondf, because
        # Eddingtondf will have code specific to computing the Eddington
        # integral, which is not necessary for Hernquist
        sphericaldf.__init__(self,ro=ro,vo=vo)

    def fE(self,E):
        # Stub for computing f(E)
        return None

    <commit_msg>Add __init__ and __call_internal__ for isotropicHernquistdf<commit_after># Class that implements isotropic spherical Hernquist DF
# computed using the Eddington formula
from .sphericaldf import sphericaldf
from .Eddingtondf import Eddingtondf

class isotropicHernquistdf(Eddingtondf):
    """Class that implements isotropic spherical Hernquist DF computed using the Eddington formula"""
    def __init__(self,pot=None,ro=None,vo=None):
        # Initialize using sphericaldf rather than Eddingtondf, because
        # Eddingtondf will have code specific to computing the Eddington
        # integral, which is not necessary for Hernquist
        sphericaldf.__init__(self,pot=pot,ro=ro,vo=vo)

    def __call_internal__(self,*args):
        """
        NAME:

            __call_internal__

        PURPOSE

            Calculate the distribution function for an isotropic Hernquist

        INPUT:

            E - The energy

        OUTPUT:

            fH - The distribution function

        HISTORY:

            2020-07 - Written

        """
        E = args[0]
        if _APY_LOADED and isinstance(E,units.quantity.Quantity):
            E.to(units.km**2/units.s**2).value/vo**2.
        # Scale energies
        phi0 = evaluatePotentials(self._pot,0,0)
        Erel = -E
        Etilde = Erel/phi0
        # Handle potential E out of bounds
        Etilde_out = numpy.where(Etilde<0|Etilde>1)[0]
        if len(Etilde_out)>0:
            # Set to dummy and 0 later, prevents functions throwing errors?
            Etilde[Etilde_out]=0.5
        _GMa = phi0*self._pot.a**2.
        fH = numpy.power((2**0.5)*((2*numpy.pi)**3) *((_GMa)**1.5),-1)\
            *(numpy.sqrt(Etilde)/numpy.power(1-Etilde,2))\
            *((1-2*Etilde)*(8*numpy.power(Etilde,2)-8*Etilde-3)\
            +((3*numpy.arcsin(numpy.sqrt(Etilde)))\
            /numpy.sqrt(Etilde*(1-Etilde))))
        # Fix out of bounds values
        if len(Etilde_out) > 0:
            fH[Etilde_out] = 0
        return fH
        
    
{'fraction_non_alphanumeric': 0.09315169366715759, 'fraction_numerical': 0.015832106038291605, 'mean_word_length': 2.603448275862069, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5194480', 'n_tokens_mistral': 878, 'n_tokens_neox': 800, 'n_words': 217}